vue.esm-browser.js 212 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346
  1. /**
  2. * vue v3.4.21
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. function makeMap(str, expectsLowerCase) {
  7. const set = new Set(str.split(","));
  8. return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
  9. }
  10. const EMPTY_OBJ = Object.freeze({}) ;
  11. const EMPTY_ARR = Object.freeze([]) ;
  12. const NOOP = () => {
  13. };
  14. const NO = () => false;
  15. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  16. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  17. const isModelListener = (key) => key.startsWith("onUpdate:");
  18. const extend = Object.assign;
  19. const remove = (arr, el) => {
  20. const i = arr.indexOf(el);
  21. if (i > -1) {
  22. arr.splice(i, 1);
  23. }
  24. };
  25. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  26. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  27. const isArray = Array.isArray;
  28. const isMap = (val) => toTypeString(val) === "[object Map]";
  29. const isSet = (val) => toTypeString(val) === "[object Set]";
  30. const isDate = (val) => toTypeString(val) === "[object Date]";
  31. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  32. const isFunction = (val) => typeof val === "function";
  33. const isString = (val) => typeof val === "string";
  34. const isSymbol = (val) => typeof val === "symbol";
  35. const isObject = (val) => val !== null && typeof val === "object";
  36. const isPromise = (val) => {
  37. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  38. };
  39. const objectToString = Object.prototype.toString;
  40. const toTypeString = (value) => objectToString.call(value);
  41. const toRawType = (value) => {
  42. return toTypeString(value).slice(8, -1);
  43. };
  44. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  45. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  46. const isReservedProp = /* @__PURE__ */ makeMap(
  47. // the leading comma is intentional so empty string "" is also included
  48. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  49. );
  50. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  51. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  52. );
  53. const cacheStringFunction = (fn) => {
  54. const cache = /* @__PURE__ */ Object.create(null);
  55. return (str) => {
  56. const hit = cache[str];
  57. return hit || (cache[str] = fn(str));
  58. };
  59. };
  60. const camelizeRE = /-(\w)/g;
  61. const camelize = cacheStringFunction((str) => {
  62. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  63. });
  64. const hyphenateRE = /\B([A-Z])/g;
  65. const hyphenate = cacheStringFunction(
  66. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  67. );
  68. const capitalize = cacheStringFunction((str) => {
  69. return str.charAt(0).toUpperCase() + str.slice(1);
  70. });
  71. const toHandlerKey = cacheStringFunction((str) => {
  72. const s = str ? `on${capitalize(str)}` : ``;
  73. return s;
  74. });
  75. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  76. const invokeArrayFns = (fns, arg) => {
  77. for (let i = 0; i < fns.length; i++) {
  78. fns[i](arg);
  79. }
  80. };
  81. const def = (obj, key, value) => {
  82. Object.defineProperty(obj, key, {
  83. configurable: true,
  84. enumerable: false,
  85. value
  86. });
  87. };
  88. const looseToNumber = (val) => {
  89. const n = parseFloat(val);
  90. return isNaN(n) ? val : n;
  91. };
  92. const toNumber = (val) => {
  93. const n = isString(val) ? Number(val) : NaN;
  94. return isNaN(n) ? val : n;
  95. };
  96. let _globalThis;
  97. const getGlobalThis = () => {
  98. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  99. };
  100. const PatchFlagNames = {
  101. [1]: `TEXT`,
  102. [2]: `CLASS`,
  103. [4]: `STYLE`,
  104. [8]: `PROPS`,
  105. [16]: `FULL_PROPS`,
  106. [32]: `NEED_HYDRATION`,
  107. [64]: `STABLE_FRAGMENT`,
  108. [128]: `KEYED_FRAGMENT`,
  109. [256]: `UNKEYED_FRAGMENT`,
  110. [512]: `NEED_PATCH`,
  111. [1024]: `DYNAMIC_SLOTS`,
  112. [2048]: `DEV_ROOT_FRAGMENT`,
  113. [-1]: `HOISTED`,
  114. [-2]: `BAIL`
  115. };
  116. const slotFlagsText = {
  117. [1]: "STABLE",
  118. [2]: "DYNAMIC",
  119. [3]: "FORWARDED"
  120. };
  121. const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
  122. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  123. const range = 2;
  124. function generateCodeFrame(source, start = 0, end = source.length) {
  125. let lines = source.split(/(\r?\n)/);
  126. const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
  127. lines = lines.filter((_, idx) => idx % 2 === 0);
  128. let count = 0;
  129. const res = [];
  130. for (let i = 0; i < lines.length; i++) {
  131. count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
  132. if (count >= start) {
  133. for (let j = i - range; j <= i + range || end > count; j++) {
  134. if (j < 0 || j >= lines.length)
  135. continue;
  136. const line = j + 1;
  137. res.push(
  138. `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
  139. );
  140. const lineLength = lines[j].length;
  141. const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
  142. if (j === i) {
  143. const pad = start - (count - (lineLength + newLineSeqLength));
  144. const length = Math.max(
  145. 1,
  146. end > count ? lineLength - pad : end - start
  147. );
  148. res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
  149. } else if (j > i) {
  150. if (end > count) {
  151. const length = Math.max(Math.min(end - count, lineLength), 1);
  152. res.push(` | ` + "^".repeat(length));
  153. }
  154. count += lineLength + newLineSeqLength;
  155. }
  156. }
  157. break;
  158. }
  159. }
  160. return res.join("\n");
  161. }
  162. function normalizeStyle(value) {
  163. if (isArray(value)) {
  164. const res = {};
  165. for (let i = 0; i < value.length; i++) {
  166. const item = value[i];
  167. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  168. if (normalized) {
  169. for (const key in normalized) {
  170. res[key] = normalized[key];
  171. }
  172. }
  173. }
  174. return res;
  175. } else if (isString(value) || isObject(value)) {
  176. return value;
  177. }
  178. }
  179. const listDelimiterRE = /;(?![^(]*\))/g;
  180. const propertyDelimiterRE = /:([^]+)/;
  181. const styleCommentRE = /\/\*[^]*?\*\//g;
  182. function parseStringStyle(cssText) {
  183. const ret = {};
  184. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  185. if (item) {
  186. const tmp = item.split(propertyDelimiterRE);
  187. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  188. }
  189. });
  190. return ret;
  191. }
  192. function stringifyStyle(styles) {
  193. let ret = "";
  194. if (!styles || isString(styles)) {
  195. return ret;
  196. }
  197. for (const key in styles) {
  198. const value = styles[key];
  199. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  200. if (isString(value) || typeof value === "number") {
  201. ret += `${normalizedKey}:${value};`;
  202. }
  203. }
  204. return ret;
  205. }
  206. function normalizeClass(value) {
  207. let res = "";
  208. if (isString(value)) {
  209. res = value;
  210. } else if (isArray(value)) {
  211. for (let i = 0; i < value.length; i++) {
  212. const normalized = normalizeClass(value[i]);
  213. if (normalized) {
  214. res += normalized + " ";
  215. }
  216. }
  217. } else if (isObject(value)) {
  218. for (const name in value) {
  219. if (value[name]) {
  220. res += name + " ";
  221. }
  222. }
  223. }
  224. return res.trim();
  225. }
  226. function normalizeProps(props) {
  227. if (!props)
  228. return null;
  229. let { class: klass, style } = props;
  230. if (klass && !isString(klass)) {
  231. props.class = normalizeClass(klass);
  232. }
  233. if (style) {
  234. props.style = normalizeStyle(style);
  235. }
  236. return props;
  237. }
  238. const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
  239. const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
  240. const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
  241. const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
  242. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  243. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  244. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  245. const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
  246. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  247. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  248. const isBooleanAttr = /* @__PURE__ */ makeMap(
  249. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  250. );
  251. function includeBooleanAttr(value) {
  252. return !!value || value === "";
  253. }
  254. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  255. `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
  256. );
  257. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  258. `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
  259. );
  260. function isRenderableAttrValue(value) {
  261. if (value == null) {
  262. return false;
  263. }
  264. const type = typeof value;
  265. return type === "string" || type === "number" || type === "boolean";
  266. }
  267. function looseCompareArrays(a, b) {
  268. if (a.length !== b.length)
  269. return false;
  270. let equal = true;
  271. for (let i = 0; equal && i < a.length; i++) {
  272. equal = looseEqual(a[i], b[i]);
  273. }
  274. return equal;
  275. }
  276. function looseEqual(a, b) {
  277. if (a === b)
  278. return true;
  279. let aValidType = isDate(a);
  280. let bValidType = isDate(b);
  281. if (aValidType || bValidType) {
  282. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  283. }
  284. aValidType = isSymbol(a);
  285. bValidType = isSymbol(b);
  286. if (aValidType || bValidType) {
  287. return a === b;
  288. }
  289. aValidType = isArray(a);
  290. bValidType = isArray(b);
  291. if (aValidType || bValidType) {
  292. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  293. }
  294. aValidType = isObject(a);
  295. bValidType = isObject(b);
  296. if (aValidType || bValidType) {
  297. if (!aValidType || !bValidType) {
  298. return false;
  299. }
  300. const aKeysCount = Object.keys(a).length;
  301. const bKeysCount = Object.keys(b).length;
  302. if (aKeysCount !== bKeysCount) {
  303. return false;
  304. }
  305. for (const key in a) {
  306. const aHasKey = a.hasOwnProperty(key);
  307. const bHasKey = b.hasOwnProperty(key);
  308. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  309. return false;
  310. }
  311. }
  312. }
  313. return String(a) === String(b);
  314. }
  315. function looseIndexOf(arr, val) {
  316. return arr.findIndex((item) => looseEqual(item, val));
  317. }
  318. const toDisplayString = (val) => {
  319. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  320. };
  321. const replacer = (_key, val) => {
  322. if (val && val.__v_isRef) {
  323. return replacer(_key, val.value);
  324. } else if (isMap(val)) {
  325. return {
  326. [`Map(${val.size})`]: [...val.entries()].reduce(
  327. (entries, [key, val2], i) => {
  328. entries[stringifySymbol(key, i) + " =>"] = val2;
  329. return entries;
  330. },
  331. {}
  332. )
  333. };
  334. } else if (isSet(val)) {
  335. return {
  336. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  337. };
  338. } else if (isSymbol(val)) {
  339. return stringifySymbol(val);
  340. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  341. return String(val);
  342. }
  343. return val;
  344. };
  345. const stringifySymbol = (v, i = "") => {
  346. var _a;
  347. return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
  348. };
  349. function warn$2(msg, ...args) {
  350. console.warn(`[Vue warn] ${msg}`, ...args);
  351. }
  352. let activeEffectScope;
  353. class EffectScope {
  354. constructor(detached = false) {
  355. this.detached = detached;
  356. /**
  357. * @internal
  358. */
  359. this._active = true;
  360. /**
  361. * @internal
  362. */
  363. this.effects = [];
  364. /**
  365. * @internal
  366. */
  367. this.cleanups = [];
  368. this.parent = activeEffectScope;
  369. if (!detached && activeEffectScope) {
  370. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  371. this
  372. ) - 1;
  373. }
  374. }
  375. get active() {
  376. return this._active;
  377. }
  378. run(fn) {
  379. if (this._active) {
  380. const currentEffectScope = activeEffectScope;
  381. try {
  382. activeEffectScope = this;
  383. return fn();
  384. } finally {
  385. activeEffectScope = currentEffectScope;
  386. }
  387. } else {
  388. warn$2(`cannot run an inactive effect scope.`);
  389. }
  390. }
  391. /**
  392. * This should only be called on non-detached scopes
  393. * @internal
  394. */
  395. on() {
  396. activeEffectScope = this;
  397. }
  398. /**
  399. * This should only be called on non-detached scopes
  400. * @internal
  401. */
  402. off() {
  403. activeEffectScope = this.parent;
  404. }
  405. stop(fromParent) {
  406. if (this._active) {
  407. let i, l;
  408. for (i = 0, l = this.effects.length; i < l; i++) {
  409. this.effects[i].stop();
  410. }
  411. for (i = 0, l = this.cleanups.length; i < l; i++) {
  412. this.cleanups[i]();
  413. }
  414. if (this.scopes) {
  415. for (i = 0, l = this.scopes.length; i < l; i++) {
  416. this.scopes[i].stop(true);
  417. }
  418. }
  419. if (!this.detached && this.parent && !fromParent) {
  420. const last = this.parent.scopes.pop();
  421. if (last && last !== this) {
  422. this.parent.scopes[this.index] = last;
  423. last.index = this.index;
  424. }
  425. }
  426. this.parent = void 0;
  427. this._active = false;
  428. }
  429. }
  430. }
  431. function effectScope(detached) {
  432. return new EffectScope(detached);
  433. }
  434. function recordEffectScope(effect, scope = activeEffectScope) {
  435. if (scope && scope.active) {
  436. scope.effects.push(effect);
  437. }
  438. }
  439. function getCurrentScope() {
  440. return activeEffectScope;
  441. }
  442. function onScopeDispose(fn) {
  443. if (activeEffectScope) {
  444. activeEffectScope.cleanups.push(fn);
  445. } else {
  446. warn$2(
  447. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  448. );
  449. }
  450. }
  451. let activeEffect;
  452. class ReactiveEffect {
  453. constructor(fn, trigger, scheduler, scope) {
  454. this.fn = fn;
  455. this.trigger = trigger;
  456. this.scheduler = scheduler;
  457. this.active = true;
  458. this.deps = [];
  459. /**
  460. * @internal
  461. */
  462. this._dirtyLevel = 4;
  463. /**
  464. * @internal
  465. */
  466. this._trackId = 0;
  467. /**
  468. * @internal
  469. */
  470. this._runnings = 0;
  471. /**
  472. * @internal
  473. */
  474. this._shouldSchedule = false;
  475. /**
  476. * @internal
  477. */
  478. this._depsLength = 0;
  479. recordEffectScope(this, scope);
  480. }
  481. get dirty() {
  482. if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
  483. this._dirtyLevel = 1;
  484. pauseTracking();
  485. for (let i = 0; i < this._depsLength; i++) {
  486. const dep = this.deps[i];
  487. if (dep.computed) {
  488. triggerComputed(dep.computed);
  489. if (this._dirtyLevel >= 4) {
  490. break;
  491. }
  492. }
  493. }
  494. if (this._dirtyLevel === 1) {
  495. this._dirtyLevel = 0;
  496. }
  497. resetTracking();
  498. }
  499. return this._dirtyLevel >= 4;
  500. }
  501. set dirty(v) {
  502. this._dirtyLevel = v ? 4 : 0;
  503. }
  504. run() {
  505. this._dirtyLevel = 0;
  506. if (!this.active) {
  507. return this.fn();
  508. }
  509. let lastShouldTrack = shouldTrack;
  510. let lastEffect = activeEffect;
  511. try {
  512. shouldTrack = true;
  513. activeEffect = this;
  514. this._runnings++;
  515. preCleanupEffect(this);
  516. return this.fn();
  517. } finally {
  518. postCleanupEffect(this);
  519. this._runnings--;
  520. activeEffect = lastEffect;
  521. shouldTrack = lastShouldTrack;
  522. }
  523. }
  524. stop() {
  525. var _a;
  526. if (this.active) {
  527. preCleanupEffect(this);
  528. postCleanupEffect(this);
  529. (_a = this.onStop) == null ? void 0 : _a.call(this);
  530. this.active = false;
  531. }
  532. }
  533. }
  534. function triggerComputed(computed) {
  535. return computed.value;
  536. }
  537. function preCleanupEffect(effect2) {
  538. effect2._trackId++;
  539. effect2._depsLength = 0;
  540. }
  541. function postCleanupEffect(effect2) {
  542. if (effect2.deps.length > effect2._depsLength) {
  543. for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
  544. cleanupDepEffect(effect2.deps[i], effect2);
  545. }
  546. effect2.deps.length = effect2._depsLength;
  547. }
  548. }
  549. function cleanupDepEffect(dep, effect2) {
  550. const trackId = dep.get(effect2);
  551. if (trackId !== void 0 && effect2._trackId !== trackId) {
  552. dep.delete(effect2);
  553. if (dep.size === 0) {
  554. dep.cleanup();
  555. }
  556. }
  557. }
  558. function effect(fn, options) {
  559. if (fn.effect instanceof ReactiveEffect) {
  560. fn = fn.effect.fn;
  561. }
  562. const _effect = new ReactiveEffect(fn, NOOP, () => {
  563. if (_effect.dirty) {
  564. _effect.run();
  565. }
  566. });
  567. if (options) {
  568. extend(_effect, options);
  569. if (options.scope)
  570. recordEffectScope(_effect, options.scope);
  571. }
  572. if (!options || !options.lazy) {
  573. _effect.run();
  574. }
  575. const runner = _effect.run.bind(_effect);
  576. runner.effect = _effect;
  577. return runner;
  578. }
  579. function stop(runner) {
  580. runner.effect.stop();
  581. }
  582. let shouldTrack = true;
  583. let pauseScheduleStack = 0;
  584. const trackStack = [];
  585. function pauseTracking() {
  586. trackStack.push(shouldTrack);
  587. shouldTrack = false;
  588. }
  589. function resetTracking() {
  590. const last = trackStack.pop();
  591. shouldTrack = last === void 0 ? true : last;
  592. }
  593. function pauseScheduling() {
  594. pauseScheduleStack++;
  595. }
  596. function resetScheduling() {
  597. pauseScheduleStack--;
  598. while (!pauseScheduleStack && queueEffectSchedulers.length) {
  599. queueEffectSchedulers.shift()();
  600. }
  601. }
  602. function trackEffect(effect2, dep, debuggerEventExtraInfo) {
  603. var _a;
  604. if (dep.get(effect2) !== effect2._trackId) {
  605. dep.set(effect2, effect2._trackId);
  606. const oldDep = effect2.deps[effect2._depsLength];
  607. if (oldDep !== dep) {
  608. if (oldDep) {
  609. cleanupDepEffect(oldDep, effect2);
  610. }
  611. effect2.deps[effect2._depsLength++] = dep;
  612. } else {
  613. effect2._depsLength++;
  614. }
  615. {
  616. (_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  617. }
  618. }
  619. }
  620. const queueEffectSchedulers = [];
  621. function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
  622. var _a;
  623. pauseScheduling();
  624. for (const effect2 of dep.keys()) {
  625. let tracking;
  626. if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  627. effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
  628. effect2._dirtyLevel = dirtyLevel;
  629. }
  630. if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
  631. {
  632. (_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
  633. }
  634. effect2.trigger();
  635. if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
  636. effect2._shouldSchedule = false;
  637. if (effect2.scheduler) {
  638. queueEffectSchedulers.push(effect2.scheduler);
  639. }
  640. }
  641. }
  642. }
  643. resetScheduling();
  644. }
  645. const createDep = (cleanup, computed) => {
  646. const dep = /* @__PURE__ */ new Map();
  647. dep.cleanup = cleanup;
  648. dep.computed = computed;
  649. return dep;
  650. };
  651. const targetMap = /* @__PURE__ */ new WeakMap();
  652. const ITERATE_KEY = Symbol("iterate" );
  653. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  654. function track(target, type, key) {
  655. if (shouldTrack && activeEffect) {
  656. let depsMap = targetMap.get(target);
  657. if (!depsMap) {
  658. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  659. }
  660. let dep = depsMap.get(key);
  661. if (!dep) {
  662. depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
  663. }
  664. trackEffect(
  665. activeEffect,
  666. dep,
  667. {
  668. target,
  669. type,
  670. key
  671. }
  672. );
  673. }
  674. }
  675. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  676. const depsMap = targetMap.get(target);
  677. if (!depsMap) {
  678. return;
  679. }
  680. let deps = [];
  681. if (type === "clear") {
  682. deps = [...depsMap.values()];
  683. } else if (key === "length" && isArray(target)) {
  684. const newLength = Number(newValue);
  685. depsMap.forEach((dep, key2) => {
  686. if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
  687. deps.push(dep);
  688. }
  689. });
  690. } else {
  691. if (key !== void 0) {
  692. deps.push(depsMap.get(key));
  693. }
  694. switch (type) {
  695. case "add":
  696. if (!isArray(target)) {
  697. deps.push(depsMap.get(ITERATE_KEY));
  698. if (isMap(target)) {
  699. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  700. }
  701. } else if (isIntegerKey(key)) {
  702. deps.push(depsMap.get("length"));
  703. }
  704. break;
  705. case "delete":
  706. if (!isArray(target)) {
  707. deps.push(depsMap.get(ITERATE_KEY));
  708. if (isMap(target)) {
  709. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  710. }
  711. }
  712. break;
  713. case "set":
  714. if (isMap(target)) {
  715. deps.push(depsMap.get(ITERATE_KEY));
  716. }
  717. break;
  718. }
  719. }
  720. pauseScheduling();
  721. for (const dep of deps) {
  722. if (dep) {
  723. triggerEffects(
  724. dep,
  725. 4,
  726. {
  727. target,
  728. type,
  729. key,
  730. newValue,
  731. oldValue,
  732. oldTarget
  733. }
  734. );
  735. }
  736. }
  737. resetScheduling();
  738. }
  739. function getDepFromReactive(object, key) {
  740. var _a;
  741. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  742. }
  743. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  744. const builtInSymbols = new Set(
  745. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  746. );
  747. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  748. function createArrayInstrumentations() {
  749. const instrumentations = {};
  750. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  751. instrumentations[key] = function(...args) {
  752. const arr = toRaw(this);
  753. for (let i = 0, l = this.length; i < l; i++) {
  754. track(arr, "get", i + "");
  755. }
  756. const res = arr[key](...args);
  757. if (res === -1 || res === false) {
  758. return arr[key](...args.map(toRaw));
  759. } else {
  760. return res;
  761. }
  762. };
  763. });
  764. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  765. instrumentations[key] = function(...args) {
  766. pauseTracking();
  767. pauseScheduling();
  768. const res = toRaw(this)[key].apply(this, args);
  769. resetScheduling();
  770. resetTracking();
  771. return res;
  772. };
  773. });
  774. return instrumentations;
  775. }
  776. function hasOwnProperty(key) {
  777. const obj = toRaw(this);
  778. track(obj, "has", key);
  779. return obj.hasOwnProperty(key);
  780. }
  781. class BaseReactiveHandler {
  782. constructor(_isReadonly = false, _isShallow = false) {
  783. this._isReadonly = _isReadonly;
  784. this._isShallow = _isShallow;
  785. }
  786. get(target, key, receiver) {
  787. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  788. if (key === "__v_isReactive") {
  789. return !isReadonly2;
  790. } else if (key === "__v_isReadonly") {
  791. return isReadonly2;
  792. } else if (key === "__v_isShallow") {
  793. return isShallow2;
  794. } else if (key === "__v_raw") {
  795. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  796. // this means the reciever is a user proxy of the reactive proxy
  797. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  798. return target;
  799. }
  800. return;
  801. }
  802. const targetIsArray = isArray(target);
  803. if (!isReadonly2) {
  804. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  805. return Reflect.get(arrayInstrumentations, key, receiver);
  806. }
  807. if (key === "hasOwnProperty") {
  808. return hasOwnProperty;
  809. }
  810. }
  811. const res = Reflect.get(target, key, receiver);
  812. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  813. return res;
  814. }
  815. if (!isReadonly2) {
  816. track(target, "get", key);
  817. }
  818. if (isShallow2) {
  819. return res;
  820. }
  821. if (isRef(res)) {
  822. return targetIsArray && isIntegerKey(key) ? res : res.value;
  823. }
  824. if (isObject(res)) {
  825. return isReadonly2 ? readonly(res) : reactive(res);
  826. }
  827. return res;
  828. }
  829. }
  830. class MutableReactiveHandler extends BaseReactiveHandler {
  831. constructor(isShallow2 = false) {
  832. super(false, isShallow2);
  833. }
  834. set(target, key, value, receiver) {
  835. let oldValue = target[key];
  836. if (!this._isShallow) {
  837. const isOldValueReadonly = isReadonly(oldValue);
  838. if (!isShallow(value) && !isReadonly(value)) {
  839. oldValue = toRaw(oldValue);
  840. value = toRaw(value);
  841. }
  842. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  843. if (isOldValueReadonly) {
  844. return false;
  845. } else {
  846. oldValue.value = value;
  847. return true;
  848. }
  849. }
  850. }
  851. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  852. const result = Reflect.set(target, key, value, receiver);
  853. if (target === toRaw(receiver)) {
  854. if (!hadKey) {
  855. trigger(target, "add", key, value);
  856. } else if (hasChanged(value, oldValue)) {
  857. trigger(target, "set", key, value, oldValue);
  858. }
  859. }
  860. return result;
  861. }
  862. deleteProperty(target, key) {
  863. const hadKey = hasOwn(target, key);
  864. const oldValue = target[key];
  865. const result = Reflect.deleteProperty(target, key);
  866. if (result && hadKey) {
  867. trigger(target, "delete", key, void 0, oldValue);
  868. }
  869. return result;
  870. }
  871. has(target, key) {
  872. const result = Reflect.has(target, key);
  873. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  874. track(target, "has", key);
  875. }
  876. return result;
  877. }
  878. ownKeys(target) {
  879. track(
  880. target,
  881. "iterate",
  882. isArray(target) ? "length" : ITERATE_KEY
  883. );
  884. return Reflect.ownKeys(target);
  885. }
  886. }
  887. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  888. constructor(isShallow2 = false) {
  889. super(true, isShallow2);
  890. }
  891. set(target, key) {
  892. {
  893. warn$2(
  894. `Set operation on key "${String(key)}" failed: target is readonly.`,
  895. target
  896. );
  897. }
  898. return true;
  899. }
  900. deleteProperty(target, key) {
  901. {
  902. warn$2(
  903. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  904. target
  905. );
  906. }
  907. return true;
  908. }
  909. }
  910. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  911. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  912. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  913. true
  914. );
  915. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  916. const toShallow = (value) => value;
  917. const getProto = (v) => Reflect.getPrototypeOf(v);
  918. function get(target, key, isReadonly = false, isShallow = false) {
  919. target = target["__v_raw"];
  920. const rawTarget = toRaw(target);
  921. const rawKey = toRaw(key);
  922. if (!isReadonly) {
  923. if (hasChanged(key, rawKey)) {
  924. track(rawTarget, "get", key);
  925. }
  926. track(rawTarget, "get", rawKey);
  927. }
  928. const { has: has2 } = getProto(rawTarget);
  929. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  930. if (has2.call(rawTarget, key)) {
  931. return wrap(target.get(key));
  932. } else if (has2.call(rawTarget, rawKey)) {
  933. return wrap(target.get(rawKey));
  934. } else if (target !== rawTarget) {
  935. target.get(key);
  936. }
  937. }
  938. function has(key, isReadonly = false) {
  939. const target = this["__v_raw"];
  940. const rawTarget = toRaw(target);
  941. const rawKey = toRaw(key);
  942. if (!isReadonly) {
  943. if (hasChanged(key, rawKey)) {
  944. track(rawTarget, "has", key);
  945. }
  946. track(rawTarget, "has", rawKey);
  947. }
  948. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  949. }
  950. function size(target, isReadonly = false) {
  951. target = target["__v_raw"];
  952. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  953. return Reflect.get(target, "size", target);
  954. }
  955. function add(value) {
  956. value = toRaw(value);
  957. const target = toRaw(this);
  958. const proto = getProto(target);
  959. const hadKey = proto.has.call(target, value);
  960. if (!hadKey) {
  961. target.add(value);
  962. trigger(target, "add", value, value);
  963. }
  964. return this;
  965. }
  966. function set(key, value) {
  967. value = toRaw(value);
  968. const target = toRaw(this);
  969. const { has: has2, get: get2 } = getProto(target);
  970. let hadKey = has2.call(target, key);
  971. if (!hadKey) {
  972. key = toRaw(key);
  973. hadKey = has2.call(target, key);
  974. } else {
  975. checkIdentityKeys(target, has2, key);
  976. }
  977. const oldValue = get2.call(target, key);
  978. target.set(key, value);
  979. if (!hadKey) {
  980. trigger(target, "add", key, value);
  981. } else if (hasChanged(value, oldValue)) {
  982. trigger(target, "set", key, value, oldValue);
  983. }
  984. return this;
  985. }
  986. function deleteEntry(key) {
  987. const target = toRaw(this);
  988. const { has: has2, get: get2 } = getProto(target);
  989. let hadKey = has2.call(target, key);
  990. if (!hadKey) {
  991. key = toRaw(key);
  992. hadKey = has2.call(target, key);
  993. } else {
  994. checkIdentityKeys(target, has2, key);
  995. }
  996. const oldValue = get2 ? get2.call(target, key) : void 0;
  997. const result = target.delete(key);
  998. if (hadKey) {
  999. trigger(target, "delete", key, void 0, oldValue);
  1000. }
  1001. return result;
  1002. }
  1003. function clear() {
  1004. const target = toRaw(this);
  1005. const hadItems = target.size !== 0;
  1006. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1007. const result = target.clear();
  1008. if (hadItems) {
  1009. trigger(target, "clear", void 0, void 0, oldTarget);
  1010. }
  1011. return result;
  1012. }
  1013. function createForEach(isReadonly, isShallow) {
  1014. return function forEach(callback, thisArg) {
  1015. const observed = this;
  1016. const target = observed["__v_raw"];
  1017. const rawTarget = toRaw(target);
  1018. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  1019. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  1020. return target.forEach((value, key) => {
  1021. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1022. });
  1023. };
  1024. }
  1025. function createIterableMethod(method, isReadonly, isShallow) {
  1026. return function(...args) {
  1027. const target = this["__v_raw"];
  1028. const rawTarget = toRaw(target);
  1029. const targetIsMap = isMap(rawTarget);
  1030. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1031. const isKeyOnly = method === "keys" && targetIsMap;
  1032. const innerIterator = target[method](...args);
  1033. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  1034. !isReadonly && track(
  1035. rawTarget,
  1036. "iterate",
  1037. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1038. );
  1039. return {
  1040. // iterator protocol
  1041. next() {
  1042. const { value, done } = innerIterator.next();
  1043. return done ? { value, done } : {
  1044. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1045. done
  1046. };
  1047. },
  1048. // iterable protocol
  1049. [Symbol.iterator]() {
  1050. return this;
  1051. }
  1052. };
  1053. };
  1054. }
  1055. function createReadonlyMethod(type) {
  1056. return function(...args) {
  1057. {
  1058. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1059. warn$2(
  1060. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1061. toRaw(this)
  1062. );
  1063. }
  1064. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1065. };
  1066. }
  1067. function createInstrumentations() {
  1068. const mutableInstrumentations2 = {
  1069. get(key) {
  1070. return get(this, key);
  1071. },
  1072. get size() {
  1073. return size(this);
  1074. },
  1075. has,
  1076. add,
  1077. set,
  1078. delete: deleteEntry,
  1079. clear,
  1080. forEach: createForEach(false, false)
  1081. };
  1082. const shallowInstrumentations2 = {
  1083. get(key) {
  1084. return get(this, key, false, true);
  1085. },
  1086. get size() {
  1087. return size(this);
  1088. },
  1089. has,
  1090. add,
  1091. set,
  1092. delete: deleteEntry,
  1093. clear,
  1094. forEach: createForEach(false, true)
  1095. };
  1096. const readonlyInstrumentations2 = {
  1097. get(key) {
  1098. return get(this, key, true);
  1099. },
  1100. get size() {
  1101. return size(this, true);
  1102. },
  1103. has(key) {
  1104. return has.call(this, key, true);
  1105. },
  1106. add: createReadonlyMethod("add"),
  1107. set: createReadonlyMethod("set"),
  1108. delete: createReadonlyMethod("delete"),
  1109. clear: createReadonlyMethod("clear"),
  1110. forEach: createForEach(true, false)
  1111. };
  1112. const shallowReadonlyInstrumentations2 = {
  1113. get(key) {
  1114. return get(this, key, true, true);
  1115. },
  1116. get size() {
  1117. return size(this, true);
  1118. },
  1119. has(key) {
  1120. return has.call(this, key, true);
  1121. },
  1122. add: createReadonlyMethod("add"),
  1123. set: createReadonlyMethod("set"),
  1124. delete: createReadonlyMethod("delete"),
  1125. clear: createReadonlyMethod("clear"),
  1126. forEach: createForEach(true, true)
  1127. };
  1128. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  1129. iteratorMethods.forEach((method) => {
  1130. mutableInstrumentations2[method] = createIterableMethod(
  1131. method,
  1132. false,
  1133. false
  1134. );
  1135. readonlyInstrumentations2[method] = createIterableMethod(
  1136. method,
  1137. true,
  1138. false
  1139. );
  1140. shallowInstrumentations2[method] = createIterableMethod(
  1141. method,
  1142. false,
  1143. true
  1144. );
  1145. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1146. method,
  1147. true,
  1148. true
  1149. );
  1150. });
  1151. return [
  1152. mutableInstrumentations2,
  1153. readonlyInstrumentations2,
  1154. shallowInstrumentations2,
  1155. shallowReadonlyInstrumentations2
  1156. ];
  1157. }
  1158. const [
  1159. mutableInstrumentations,
  1160. readonlyInstrumentations,
  1161. shallowInstrumentations,
  1162. shallowReadonlyInstrumentations
  1163. ] = /* @__PURE__ */ createInstrumentations();
  1164. function createInstrumentationGetter(isReadonly, shallow) {
  1165. const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  1166. return (target, key, receiver) => {
  1167. if (key === "__v_isReactive") {
  1168. return !isReadonly;
  1169. } else if (key === "__v_isReadonly") {
  1170. return isReadonly;
  1171. } else if (key === "__v_raw") {
  1172. return target;
  1173. }
  1174. return Reflect.get(
  1175. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1176. key,
  1177. receiver
  1178. );
  1179. };
  1180. }
  1181. const mutableCollectionHandlers = {
  1182. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1183. };
  1184. const shallowCollectionHandlers = {
  1185. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1186. };
  1187. const readonlyCollectionHandlers = {
  1188. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1189. };
  1190. const shallowReadonlyCollectionHandlers = {
  1191. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1192. };
  1193. function checkIdentityKeys(target, has2, key) {
  1194. const rawKey = toRaw(key);
  1195. if (rawKey !== key && has2.call(target, rawKey)) {
  1196. const type = toRawType(target);
  1197. warn$2(
  1198. `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
  1199. );
  1200. }
  1201. }
  1202. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1203. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1204. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1205. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1206. function targetTypeMap(rawType) {
  1207. switch (rawType) {
  1208. case "Object":
  1209. case "Array":
  1210. return 1 /* COMMON */;
  1211. case "Map":
  1212. case "Set":
  1213. case "WeakMap":
  1214. case "WeakSet":
  1215. return 2 /* COLLECTION */;
  1216. default:
  1217. return 0 /* INVALID */;
  1218. }
  1219. }
  1220. function getTargetType(value) {
  1221. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1222. }
  1223. function reactive(target) {
  1224. if (isReadonly(target)) {
  1225. return target;
  1226. }
  1227. return createReactiveObject(
  1228. target,
  1229. false,
  1230. mutableHandlers,
  1231. mutableCollectionHandlers,
  1232. reactiveMap
  1233. );
  1234. }
  1235. function shallowReactive(target) {
  1236. return createReactiveObject(
  1237. target,
  1238. false,
  1239. shallowReactiveHandlers,
  1240. shallowCollectionHandlers,
  1241. shallowReactiveMap
  1242. );
  1243. }
  1244. function readonly(target) {
  1245. return createReactiveObject(
  1246. target,
  1247. true,
  1248. readonlyHandlers,
  1249. readonlyCollectionHandlers,
  1250. readonlyMap
  1251. );
  1252. }
  1253. function shallowReadonly(target) {
  1254. return createReactiveObject(
  1255. target,
  1256. true,
  1257. shallowReadonlyHandlers,
  1258. shallowReadonlyCollectionHandlers,
  1259. shallowReadonlyMap
  1260. );
  1261. }
  1262. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1263. if (!isObject(target)) {
  1264. {
  1265. warn$2(`value cannot be made reactive: ${String(target)}`);
  1266. }
  1267. return target;
  1268. }
  1269. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1270. return target;
  1271. }
  1272. const existingProxy = proxyMap.get(target);
  1273. if (existingProxy) {
  1274. return existingProxy;
  1275. }
  1276. const targetType = getTargetType(target);
  1277. if (targetType === 0 /* INVALID */) {
  1278. return target;
  1279. }
  1280. const proxy = new Proxy(
  1281. target,
  1282. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1283. );
  1284. proxyMap.set(target, proxy);
  1285. return proxy;
  1286. }
  1287. function isReactive(value) {
  1288. if (isReadonly(value)) {
  1289. return isReactive(value["__v_raw"]);
  1290. }
  1291. return !!(value && value["__v_isReactive"]);
  1292. }
  1293. function isReadonly(value) {
  1294. return !!(value && value["__v_isReadonly"]);
  1295. }
  1296. function isShallow(value) {
  1297. return !!(value && value["__v_isShallow"]);
  1298. }
  1299. function isProxy(value) {
  1300. return isReactive(value) || isReadonly(value);
  1301. }
  1302. function toRaw(observed) {
  1303. const raw = observed && observed["__v_raw"];
  1304. return raw ? toRaw(raw) : observed;
  1305. }
  1306. function markRaw(value) {
  1307. if (Object.isExtensible(value)) {
  1308. def(value, "__v_skip", true);
  1309. }
  1310. return value;
  1311. }
  1312. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1313. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1314. const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
  1315. class ComputedRefImpl {
  1316. constructor(getter, _setter, isReadonly, isSSR) {
  1317. this.getter = getter;
  1318. this._setter = _setter;
  1319. this.dep = void 0;
  1320. this.__v_isRef = true;
  1321. this["__v_isReadonly"] = false;
  1322. this.effect = new ReactiveEffect(
  1323. () => getter(this._value),
  1324. () => triggerRefValue(
  1325. this,
  1326. this.effect._dirtyLevel === 2 ? 2 : 3
  1327. )
  1328. );
  1329. this.effect.computed = this;
  1330. this.effect.active = this._cacheable = !isSSR;
  1331. this["__v_isReadonly"] = isReadonly;
  1332. }
  1333. get value() {
  1334. const self = toRaw(this);
  1335. if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
  1336. triggerRefValue(self, 4);
  1337. }
  1338. trackRefValue(self);
  1339. if (self.effect._dirtyLevel >= 2) {
  1340. if (this._warnRecursive) {
  1341. warn$2(COMPUTED_SIDE_EFFECT_WARN, `
  1342. getter: `, this.getter);
  1343. }
  1344. triggerRefValue(self, 2);
  1345. }
  1346. return self._value;
  1347. }
  1348. set value(newValue) {
  1349. this._setter(newValue);
  1350. }
  1351. // #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
  1352. get _dirty() {
  1353. return this.effect.dirty;
  1354. }
  1355. set _dirty(v) {
  1356. this.effect.dirty = v;
  1357. }
  1358. // #endregion
  1359. }
  1360. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1361. let getter;
  1362. let setter;
  1363. const onlyGetter = isFunction(getterOrOptions);
  1364. if (onlyGetter) {
  1365. getter = getterOrOptions;
  1366. setter = () => {
  1367. warn$2("Write operation failed: computed value is readonly");
  1368. } ;
  1369. } else {
  1370. getter = getterOrOptions.get;
  1371. setter = getterOrOptions.set;
  1372. }
  1373. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1374. if (debugOptions && !isSSR) {
  1375. cRef.effect.onTrack = debugOptions.onTrack;
  1376. cRef.effect.onTrigger = debugOptions.onTrigger;
  1377. }
  1378. return cRef;
  1379. }
  1380. function trackRefValue(ref2) {
  1381. var _a;
  1382. if (shouldTrack && activeEffect) {
  1383. ref2 = toRaw(ref2);
  1384. trackEffect(
  1385. activeEffect,
  1386. (_a = ref2.dep) != null ? _a : ref2.dep = createDep(
  1387. () => ref2.dep = void 0,
  1388. ref2 instanceof ComputedRefImpl ? ref2 : void 0
  1389. ),
  1390. {
  1391. target: ref2,
  1392. type: "get",
  1393. key: "value"
  1394. }
  1395. );
  1396. }
  1397. }
  1398. function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
  1399. ref2 = toRaw(ref2);
  1400. const dep = ref2.dep;
  1401. if (dep) {
  1402. triggerEffects(
  1403. dep,
  1404. dirtyLevel,
  1405. {
  1406. target: ref2,
  1407. type: "set",
  1408. key: "value",
  1409. newValue: newVal
  1410. }
  1411. );
  1412. }
  1413. }
  1414. function isRef(r) {
  1415. return !!(r && r.__v_isRef === true);
  1416. }
  1417. function ref(value) {
  1418. return createRef(value, false);
  1419. }
  1420. function shallowRef(value) {
  1421. return createRef(value, true);
  1422. }
  1423. function createRef(rawValue, shallow) {
  1424. if (isRef(rawValue)) {
  1425. return rawValue;
  1426. }
  1427. return new RefImpl(rawValue, shallow);
  1428. }
  1429. class RefImpl {
  1430. constructor(value, __v_isShallow) {
  1431. this.__v_isShallow = __v_isShallow;
  1432. this.dep = void 0;
  1433. this.__v_isRef = true;
  1434. this._rawValue = __v_isShallow ? value : toRaw(value);
  1435. this._value = __v_isShallow ? value : toReactive(value);
  1436. }
  1437. get value() {
  1438. trackRefValue(this);
  1439. return this._value;
  1440. }
  1441. set value(newVal) {
  1442. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1443. newVal = useDirectValue ? newVal : toRaw(newVal);
  1444. if (hasChanged(newVal, this._rawValue)) {
  1445. this._rawValue = newVal;
  1446. this._value = useDirectValue ? newVal : toReactive(newVal);
  1447. triggerRefValue(this, 4, newVal);
  1448. }
  1449. }
  1450. }
  1451. function triggerRef(ref2) {
  1452. triggerRefValue(ref2, 4, ref2.value );
  1453. }
  1454. function unref(ref2) {
  1455. return isRef(ref2) ? ref2.value : ref2;
  1456. }
  1457. function toValue(source) {
  1458. return isFunction(source) ? source() : unref(source);
  1459. }
  1460. const shallowUnwrapHandlers = {
  1461. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1462. set: (target, key, value, receiver) => {
  1463. const oldValue = target[key];
  1464. if (isRef(oldValue) && !isRef(value)) {
  1465. oldValue.value = value;
  1466. return true;
  1467. } else {
  1468. return Reflect.set(target, key, value, receiver);
  1469. }
  1470. }
  1471. };
  1472. function proxyRefs(objectWithRefs) {
  1473. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1474. }
  1475. class CustomRefImpl {
  1476. constructor(factory) {
  1477. this.dep = void 0;
  1478. this.__v_isRef = true;
  1479. const { get, set } = factory(
  1480. () => trackRefValue(this),
  1481. () => triggerRefValue(this)
  1482. );
  1483. this._get = get;
  1484. this._set = set;
  1485. }
  1486. get value() {
  1487. return this._get();
  1488. }
  1489. set value(newVal) {
  1490. this._set(newVal);
  1491. }
  1492. }
  1493. function customRef(factory) {
  1494. return new CustomRefImpl(factory);
  1495. }
  1496. function toRefs(object) {
  1497. if (!isProxy(object)) {
  1498. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1499. }
  1500. const ret = isArray(object) ? new Array(object.length) : {};
  1501. for (const key in object) {
  1502. ret[key] = propertyToRef(object, key);
  1503. }
  1504. return ret;
  1505. }
  1506. class ObjectRefImpl {
  1507. constructor(_object, _key, _defaultValue) {
  1508. this._object = _object;
  1509. this._key = _key;
  1510. this._defaultValue = _defaultValue;
  1511. this.__v_isRef = true;
  1512. }
  1513. get value() {
  1514. const val = this._object[this._key];
  1515. return val === void 0 ? this._defaultValue : val;
  1516. }
  1517. set value(newVal) {
  1518. this._object[this._key] = newVal;
  1519. }
  1520. get dep() {
  1521. return getDepFromReactive(toRaw(this._object), this._key);
  1522. }
  1523. }
  1524. class GetterRefImpl {
  1525. constructor(_getter) {
  1526. this._getter = _getter;
  1527. this.__v_isRef = true;
  1528. this.__v_isReadonly = true;
  1529. }
  1530. get value() {
  1531. return this._getter();
  1532. }
  1533. }
  1534. function toRef(source, key, defaultValue) {
  1535. if (isRef(source)) {
  1536. return source;
  1537. } else if (isFunction(source)) {
  1538. return new GetterRefImpl(source);
  1539. } else if (isObject(source) && arguments.length > 1) {
  1540. return propertyToRef(source, key, defaultValue);
  1541. } else {
  1542. return ref(source);
  1543. }
  1544. }
  1545. function propertyToRef(source, key, defaultValue) {
  1546. const val = source[key];
  1547. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1548. }
  1549. const TrackOpTypes = {
  1550. "GET": "get",
  1551. "HAS": "has",
  1552. "ITERATE": "iterate"
  1553. };
  1554. const TriggerOpTypes = {
  1555. "SET": "set",
  1556. "ADD": "add",
  1557. "DELETE": "delete",
  1558. "CLEAR": "clear"
  1559. };
  1560. const stack$1 = [];
  1561. function pushWarningContext(vnode) {
  1562. stack$1.push(vnode);
  1563. }
  1564. function popWarningContext() {
  1565. stack$1.pop();
  1566. }
  1567. function warn$1(msg, ...args) {
  1568. pauseTracking();
  1569. const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
  1570. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1571. const trace = getComponentTrace();
  1572. if (appWarnHandler) {
  1573. callWithErrorHandling(
  1574. appWarnHandler,
  1575. instance,
  1576. 11,
  1577. [
  1578. msg + args.map((a) => {
  1579. var _a, _b;
  1580. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  1581. }).join(""),
  1582. instance && instance.proxy,
  1583. trace.map(
  1584. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1585. ).join("\n"),
  1586. trace
  1587. ]
  1588. );
  1589. } else {
  1590. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1591. if (trace.length && // avoid spamming console during tests
  1592. true) {
  1593. warnArgs.push(`
  1594. `, ...formatTrace(trace));
  1595. }
  1596. console.warn(...warnArgs);
  1597. }
  1598. resetTracking();
  1599. }
  1600. function getComponentTrace() {
  1601. let currentVNode = stack$1[stack$1.length - 1];
  1602. if (!currentVNode) {
  1603. return [];
  1604. }
  1605. const normalizedStack = [];
  1606. while (currentVNode) {
  1607. const last = normalizedStack[0];
  1608. if (last && last.vnode === currentVNode) {
  1609. last.recurseCount++;
  1610. } else {
  1611. normalizedStack.push({
  1612. vnode: currentVNode,
  1613. recurseCount: 0
  1614. });
  1615. }
  1616. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1617. currentVNode = parentInstance && parentInstance.vnode;
  1618. }
  1619. return normalizedStack;
  1620. }
  1621. function formatTrace(trace) {
  1622. const logs = [];
  1623. trace.forEach((entry, i) => {
  1624. logs.push(...i === 0 ? [] : [`
  1625. `], ...formatTraceEntry(entry));
  1626. });
  1627. return logs;
  1628. }
  1629. function formatTraceEntry({ vnode, recurseCount }) {
  1630. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1631. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1632. const open = ` at <${formatComponentName(
  1633. vnode.component,
  1634. vnode.type,
  1635. isRoot
  1636. )}`;
  1637. const close = `>` + postfix;
  1638. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1639. }
  1640. function formatProps(props) {
  1641. const res = [];
  1642. const keys = Object.keys(props);
  1643. keys.slice(0, 3).forEach((key) => {
  1644. res.push(...formatProp(key, props[key]));
  1645. });
  1646. if (keys.length > 3) {
  1647. res.push(` ...`);
  1648. }
  1649. return res;
  1650. }
  1651. function formatProp(key, value, raw) {
  1652. if (isString(value)) {
  1653. value = JSON.stringify(value);
  1654. return raw ? value : [`${key}=${value}`];
  1655. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1656. return raw ? value : [`${key}=${value}`];
  1657. } else if (isRef(value)) {
  1658. value = formatProp(key, toRaw(value.value), true);
  1659. return raw ? value : [`${key}=Ref<`, value, `>`];
  1660. } else if (isFunction(value)) {
  1661. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1662. } else {
  1663. value = toRaw(value);
  1664. return raw ? value : [`${key}=`, value];
  1665. }
  1666. }
  1667. function assertNumber(val, type) {
  1668. if (val === void 0) {
  1669. return;
  1670. } else if (typeof val !== "number") {
  1671. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1672. } else if (isNaN(val)) {
  1673. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  1674. }
  1675. }
  1676. const ErrorCodes = {
  1677. "SETUP_FUNCTION": 0,
  1678. "0": "SETUP_FUNCTION",
  1679. "RENDER_FUNCTION": 1,
  1680. "1": "RENDER_FUNCTION",
  1681. "WATCH_GETTER": 2,
  1682. "2": "WATCH_GETTER",
  1683. "WATCH_CALLBACK": 3,
  1684. "3": "WATCH_CALLBACK",
  1685. "WATCH_CLEANUP": 4,
  1686. "4": "WATCH_CLEANUP",
  1687. "NATIVE_EVENT_HANDLER": 5,
  1688. "5": "NATIVE_EVENT_HANDLER",
  1689. "COMPONENT_EVENT_HANDLER": 6,
  1690. "6": "COMPONENT_EVENT_HANDLER",
  1691. "VNODE_HOOK": 7,
  1692. "7": "VNODE_HOOK",
  1693. "DIRECTIVE_HOOK": 8,
  1694. "8": "DIRECTIVE_HOOK",
  1695. "TRANSITION_HOOK": 9,
  1696. "9": "TRANSITION_HOOK",
  1697. "APP_ERROR_HANDLER": 10,
  1698. "10": "APP_ERROR_HANDLER",
  1699. "APP_WARN_HANDLER": 11,
  1700. "11": "APP_WARN_HANDLER",
  1701. "FUNCTION_REF": 12,
  1702. "12": "FUNCTION_REF",
  1703. "ASYNC_COMPONENT_LOADER": 13,
  1704. "13": "ASYNC_COMPONENT_LOADER",
  1705. "SCHEDULER": 14,
  1706. "14": "SCHEDULER"
  1707. };
  1708. const ErrorTypeStrings$1 = {
  1709. ["sp"]: "serverPrefetch hook",
  1710. ["bc"]: "beforeCreate hook",
  1711. ["c"]: "created hook",
  1712. ["bm"]: "beforeMount hook",
  1713. ["m"]: "mounted hook",
  1714. ["bu"]: "beforeUpdate hook",
  1715. ["u"]: "updated",
  1716. ["bum"]: "beforeUnmount hook",
  1717. ["um"]: "unmounted hook",
  1718. ["a"]: "activated hook",
  1719. ["da"]: "deactivated hook",
  1720. ["ec"]: "errorCaptured hook",
  1721. ["rtc"]: "renderTracked hook",
  1722. ["rtg"]: "renderTriggered hook",
  1723. [0]: "setup function",
  1724. [1]: "render function",
  1725. [2]: "watcher getter",
  1726. [3]: "watcher callback",
  1727. [4]: "watcher cleanup function",
  1728. [5]: "native event handler",
  1729. [6]: "component event handler",
  1730. [7]: "vnode hook",
  1731. [8]: "directive hook",
  1732. [9]: "transition hook",
  1733. [10]: "app errorHandler",
  1734. [11]: "app warnHandler",
  1735. [12]: "ref function",
  1736. [13]: "async component loader",
  1737. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
  1738. };
  1739. function callWithErrorHandling(fn, instance, type, args) {
  1740. try {
  1741. return args ? fn(...args) : fn();
  1742. } catch (err) {
  1743. handleError(err, instance, type);
  1744. }
  1745. }
  1746. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1747. if (isFunction(fn)) {
  1748. const res = callWithErrorHandling(fn, instance, type, args);
  1749. if (res && isPromise(res)) {
  1750. res.catch((err) => {
  1751. handleError(err, instance, type);
  1752. });
  1753. }
  1754. return res;
  1755. }
  1756. const values = [];
  1757. for (let i = 0; i < fn.length; i++) {
  1758. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1759. }
  1760. return values;
  1761. }
  1762. function handleError(err, instance, type, throwInDev = true) {
  1763. const contextVNode = instance ? instance.vnode : null;
  1764. if (instance) {
  1765. let cur = instance.parent;
  1766. const exposedInstance = instance.proxy;
  1767. const errorInfo = ErrorTypeStrings$1[type] ;
  1768. while (cur) {
  1769. const errorCapturedHooks = cur.ec;
  1770. if (errorCapturedHooks) {
  1771. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1772. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1773. return;
  1774. }
  1775. }
  1776. }
  1777. cur = cur.parent;
  1778. }
  1779. const appErrorHandler = instance.appContext.config.errorHandler;
  1780. if (appErrorHandler) {
  1781. callWithErrorHandling(
  1782. appErrorHandler,
  1783. null,
  1784. 10,
  1785. [err, exposedInstance, errorInfo]
  1786. );
  1787. return;
  1788. }
  1789. }
  1790. logError(err, type, contextVNode, throwInDev);
  1791. }
  1792. function logError(err, type, contextVNode, throwInDev = true) {
  1793. {
  1794. const info = ErrorTypeStrings$1[type];
  1795. if (contextVNode) {
  1796. pushWarningContext(contextVNode);
  1797. }
  1798. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1799. if (contextVNode) {
  1800. popWarningContext();
  1801. }
  1802. if (throwInDev) {
  1803. throw err;
  1804. } else {
  1805. console.error(err);
  1806. }
  1807. }
  1808. }
  1809. let isFlushing = false;
  1810. let isFlushPending = false;
  1811. const queue = [];
  1812. let flushIndex = 0;
  1813. const pendingPostFlushCbs = [];
  1814. let activePostFlushCbs = null;
  1815. let postFlushIndex = 0;
  1816. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1817. let currentFlushPromise = null;
  1818. const RECURSION_LIMIT = 100;
  1819. function nextTick(fn) {
  1820. const p = currentFlushPromise || resolvedPromise;
  1821. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1822. }
  1823. function findInsertionIndex(id) {
  1824. let start = flushIndex + 1;
  1825. let end = queue.length;
  1826. while (start < end) {
  1827. const middle = start + end >>> 1;
  1828. const middleJob = queue[middle];
  1829. const middleJobId = getId(middleJob);
  1830. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1831. start = middle + 1;
  1832. } else {
  1833. end = middle;
  1834. }
  1835. }
  1836. return start;
  1837. }
  1838. function queueJob(job) {
  1839. if (!queue.length || !queue.includes(
  1840. job,
  1841. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1842. )) {
  1843. if (job.id == null) {
  1844. queue.push(job);
  1845. } else {
  1846. queue.splice(findInsertionIndex(job.id), 0, job);
  1847. }
  1848. queueFlush();
  1849. }
  1850. }
  1851. function queueFlush() {
  1852. if (!isFlushing && !isFlushPending) {
  1853. isFlushPending = true;
  1854. currentFlushPromise = resolvedPromise.then(flushJobs);
  1855. }
  1856. }
  1857. function invalidateJob(job) {
  1858. const i = queue.indexOf(job);
  1859. if (i > flushIndex) {
  1860. queue.splice(i, 1);
  1861. }
  1862. }
  1863. function queuePostFlushCb(cb) {
  1864. if (!isArray(cb)) {
  1865. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1866. cb,
  1867. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1868. )) {
  1869. pendingPostFlushCbs.push(cb);
  1870. }
  1871. } else {
  1872. pendingPostFlushCbs.push(...cb);
  1873. }
  1874. queueFlush();
  1875. }
  1876. function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
  1877. {
  1878. seen = seen || /* @__PURE__ */ new Map();
  1879. }
  1880. for (; i < queue.length; i++) {
  1881. const cb = queue[i];
  1882. if (cb && cb.pre) {
  1883. if (instance && cb.id !== instance.uid) {
  1884. continue;
  1885. }
  1886. if (checkRecursiveUpdates(seen, cb)) {
  1887. continue;
  1888. }
  1889. queue.splice(i, 1);
  1890. i--;
  1891. cb();
  1892. }
  1893. }
  1894. }
  1895. function flushPostFlushCbs(seen) {
  1896. if (pendingPostFlushCbs.length) {
  1897. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  1898. (a, b) => getId(a) - getId(b)
  1899. );
  1900. pendingPostFlushCbs.length = 0;
  1901. if (activePostFlushCbs) {
  1902. activePostFlushCbs.push(...deduped);
  1903. return;
  1904. }
  1905. activePostFlushCbs = deduped;
  1906. {
  1907. seen = seen || /* @__PURE__ */ new Map();
  1908. }
  1909. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1910. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1911. continue;
  1912. }
  1913. activePostFlushCbs[postFlushIndex]();
  1914. }
  1915. activePostFlushCbs = null;
  1916. postFlushIndex = 0;
  1917. }
  1918. }
  1919. const getId = (job) => job.id == null ? Infinity : job.id;
  1920. const comparator = (a, b) => {
  1921. const diff = getId(a) - getId(b);
  1922. if (diff === 0) {
  1923. if (a.pre && !b.pre)
  1924. return -1;
  1925. if (b.pre && !a.pre)
  1926. return 1;
  1927. }
  1928. return diff;
  1929. };
  1930. function flushJobs(seen) {
  1931. isFlushPending = false;
  1932. isFlushing = true;
  1933. {
  1934. seen = seen || /* @__PURE__ */ new Map();
  1935. }
  1936. queue.sort(comparator);
  1937. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1938. try {
  1939. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1940. const job = queue[flushIndex];
  1941. if (job && job.active !== false) {
  1942. if (check(job)) {
  1943. continue;
  1944. }
  1945. callWithErrorHandling(job, null, 14);
  1946. }
  1947. }
  1948. } finally {
  1949. flushIndex = 0;
  1950. queue.length = 0;
  1951. flushPostFlushCbs(seen);
  1952. isFlushing = false;
  1953. currentFlushPromise = null;
  1954. if (queue.length || pendingPostFlushCbs.length) {
  1955. flushJobs(seen);
  1956. }
  1957. }
  1958. }
  1959. function checkRecursiveUpdates(seen, fn) {
  1960. if (!seen.has(fn)) {
  1961. seen.set(fn, 1);
  1962. } else {
  1963. const count = seen.get(fn);
  1964. if (count > RECURSION_LIMIT) {
  1965. const instance = fn.ownerInstance;
  1966. const componentName = instance && getComponentName(instance.type);
  1967. handleError(
  1968. `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
  1969. null,
  1970. 10
  1971. );
  1972. return true;
  1973. } else {
  1974. seen.set(fn, count + 1);
  1975. }
  1976. }
  1977. }
  1978. let isHmrUpdating = false;
  1979. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  1980. {
  1981. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1982. createRecord: tryWrap(createRecord),
  1983. rerender: tryWrap(rerender),
  1984. reload: tryWrap(reload)
  1985. };
  1986. }
  1987. const map = /* @__PURE__ */ new Map();
  1988. function registerHMR(instance) {
  1989. const id = instance.type.__hmrId;
  1990. let record = map.get(id);
  1991. if (!record) {
  1992. createRecord(id, instance.type);
  1993. record = map.get(id);
  1994. }
  1995. record.instances.add(instance);
  1996. }
  1997. function unregisterHMR(instance) {
  1998. map.get(instance.type.__hmrId).instances.delete(instance);
  1999. }
  2000. function createRecord(id, initialDef) {
  2001. if (map.has(id)) {
  2002. return false;
  2003. }
  2004. map.set(id, {
  2005. initialDef: normalizeClassComponent(initialDef),
  2006. instances: /* @__PURE__ */ new Set()
  2007. });
  2008. return true;
  2009. }
  2010. function normalizeClassComponent(component) {
  2011. return isClassComponent(component) ? component.__vccOpts : component;
  2012. }
  2013. function rerender(id, newRender) {
  2014. const record = map.get(id);
  2015. if (!record) {
  2016. return;
  2017. }
  2018. record.initialDef.render = newRender;
  2019. [...record.instances].forEach((instance) => {
  2020. if (newRender) {
  2021. instance.render = newRender;
  2022. normalizeClassComponent(instance.type).render = newRender;
  2023. }
  2024. instance.renderCache = [];
  2025. isHmrUpdating = true;
  2026. instance.effect.dirty = true;
  2027. instance.update();
  2028. isHmrUpdating = false;
  2029. });
  2030. }
  2031. function reload(id, newComp) {
  2032. const record = map.get(id);
  2033. if (!record)
  2034. return;
  2035. newComp = normalizeClassComponent(newComp);
  2036. updateComponentDef(record.initialDef, newComp);
  2037. const instances = [...record.instances];
  2038. for (const instance of instances) {
  2039. const oldComp = normalizeClassComponent(instance.type);
  2040. if (!hmrDirtyComponents.has(oldComp)) {
  2041. if (oldComp !== record.initialDef) {
  2042. updateComponentDef(oldComp, newComp);
  2043. }
  2044. hmrDirtyComponents.add(oldComp);
  2045. }
  2046. instance.appContext.propsCache.delete(instance.type);
  2047. instance.appContext.emitsCache.delete(instance.type);
  2048. instance.appContext.optionsCache.delete(instance.type);
  2049. if (instance.ceReload) {
  2050. hmrDirtyComponents.add(oldComp);
  2051. instance.ceReload(newComp.styles);
  2052. hmrDirtyComponents.delete(oldComp);
  2053. } else if (instance.parent) {
  2054. instance.parent.effect.dirty = true;
  2055. queueJob(instance.parent.update);
  2056. } else if (instance.appContext.reload) {
  2057. instance.appContext.reload();
  2058. } else if (typeof window !== "undefined") {
  2059. window.location.reload();
  2060. } else {
  2061. console.warn(
  2062. "[HMR] Root or manually mounted instance modified. Full reload required."
  2063. );
  2064. }
  2065. }
  2066. queuePostFlushCb(() => {
  2067. for (const instance of instances) {
  2068. hmrDirtyComponents.delete(
  2069. normalizeClassComponent(instance.type)
  2070. );
  2071. }
  2072. });
  2073. }
  2074. function updateComponentDef(oldComp, newComp) {
  2075. extend(oldComp, newComp);
  2076. for (const key in oldComp) {
  2077. if (key !== "__file" && !(key in newComp)) {
  2078. delete oldComp[key];
  2079. }
  2080. }
  2081. }
  2082. function tryWrap(fn) {
  2083. return (id, arg) => {
  2084. try {
  2085. return fn(id, arg);
  2086. } catch (e) {
  2087. console.error(e);
  2088. console.warn(
  2089. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2090. );
  2091. }
  2092. };
  2093. }
  2094. let devtools$1;
  2095. let buffer = [];
  2096. let devtoolsNotInstalled = false;
  2097. function emit$1(event, ...args) {
  2098. if (devtools$1) {
  2099. devtools$1.emit(event, ...args);
  2100. } else if (!devtoolsNotInstalled) {
  2101. buffer.push({ event, args });
  2102. }
  2103. }
  2104. function setDevtoolsHook$1(hook, target) {
  2105. var _a, _b;
  2106. devtools$1 = hook;
  2107. if (devtools$1) {
  2108. devtools$1.enabled = true;
  2109. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2110. buffer = [];
  2111. } else if (
  2112. // handle late devtools injection - only do this if we are in an actual
  2113. // browser environment to avoid the timer handle stalling test runner exit
  2114. // (#4815)
  2115. typeof window !== "undefined" && // some envs mock window but not fully
  2116. window.HTMLElement && // also exclude jsdom
  2117. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2118. ) {
  2119. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2120. replay.push((newHook) => {
  2121. setDevtoolsHook$1(newHook, target);
  2122. });
  2123. setTimeout(() => {
  2124. if (!devtools$1) {
  2125. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2126. devtoolsNotInstalled = true;
  2127. buffer = [];
  2128. }
  2129. }, 3e3);
  2130. } else {
  2131. devtoolsNotInstalled = true;
  2132. buffer = [];
  2133. }
  2134. }
  2135. function devtoolsInitApp(app, version) {
  2136. emit$1("app:init" /* APP_INIT */, app, version, {
  2137. Fragment,
  2138. Text,
  2139. Comment,
  2140. Static
  2141. });
  2142. }
  2143. function devtoolsUnmountApp(app) {
  2144. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2145. }
  2146. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  2147. "component:added" /* COMPONENT_ADDED */
  2148. );
  2149. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2150. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2151. "component:removed" /* COMPONENT_REMOVED */
  2152. );
  2153. const devtoolsComponentRemoved = (component) => {
  2154. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2155. !devtools$1.cleanupBuffer(component)) {
  2156. _devtoolsComponentRemoved(component);
  2157. }
  2158. };
  2159. function createDevtoolsComponentHook(hook) {
  2160. return (component) => {
  2161. emit$1(
  2162. hook,
  2163. component.appContext.app,
  2164. component.uid,
  2165. component.parent ? component.parent.uid : void 0,
  2166. component
  2167. );
  2168. };
  2169. }
  2170. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2171. "perf:start" /* PERFORMANCE_START */
  2172. );
  2173. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  2174. "perf:end" /* PERFORMANCE_END */
  2175. );
  2176. function createDevtoolsPerformanceHook(hook) {
  2177. return (component, type, time) => {
  2178. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2179. };
  2180. }
  2181. function devtoolsComponentEmit(component, event, params) {
  2182. emit$1(
  2183. "component:emit" /* COMPONENT_EMIT */,
  2184. component.appContext.app,
  2185. component,
  2186. event,
  2187. params
  2188. );
  2189. }
  2190. function emit(instance, event, ...rawArgs) {
  2191. if (instance.isUnmounted)
  2192. return;
  2193. const props = instance.vnode.props || EMPTY_OBJ;
  2194. {
  2195. const {
  2196. emitsOptions,
  2197. propsOptions: [propsOptions]
  2198. } = instance;
  2199. if (emitsOptions) {
  2200. if (!(event in emitsOptions) && true) {
  2201. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  2202. warn$1(
  2203. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  2204. );
  2205. }
  2206. } else {
  2207. const validator = emitsOptions[event];
  2208. if (isFunction(validator)) {
  2209. const isValid = validator(...rawArgs);
  2210. if (!isValid) {
  2211. warn$1(
  2212. `Invalid event arguments: event validation failed for event "${event}".`
  2213. );
  2214. }
  2215. }
  2216. }
  2217. }
  2218. }
  2219. let args = rawArgs;
  2220. const isModelListener = event.startsWith("update:");
  2221. const modelArg = isModelListener && event.slice(7);
  2222. if (modelArg && modelArg in props) {
  2223. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  2224. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  2225. if (trim) {
  2226. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  2227. }
  2228. if (number) {
  2229. args = rawArgs.map(looseToNumber);
  2230. }
  2231. }
  2232. {
  2233. devtoolsComponentEmit(instance, event, args);
  2234. }
  2235. {
  2236. const lowerCaseEvent = event.toLowerCase();
  2237. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2238. warn$1(
  2239. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2240. instance,
  2241. instance.type
  2242. )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
  2243. event
  2244. )}" instead of "${event}".`
  2245. );
  2246. }
  2247. }
  2248. let handlerName;
  2249. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2250. props[handlerName = toHandlerKey(camelize(event))];
  2251. if (!handler && isModelListener) {
  2252. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2253. }
  2254. if (handler) {
  2255. callWithAsyncErrorHandling(
  2256. handler,
  2257. instance,
  2258. 6,
  2259. args
  2260. );
  2261. }
  2262. const onceHandler = props[handlerName + `Once`];
  2263. if (onceHandler) {
  2264. if (!instance.emitted) {
  2265. instance.emitted = {};
  2266. } else if (instance.emitted[handlerName]) {
  2267. return;
  2268. }
  2269. instance.emitted[handlerName] = true;
  2270. callWithAsyncErrorHandling(
  2271. onceHandler,
  2272. instance,
  2273. 6,
  2274. args
  2275. );
  2276. }
  2277. }
  2278. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2279. const cache = appContext.emitsCache;
  2280. const cached = cache.get(comp);
  2281. if (cached !== void 0) {
  2282. return cached;
  2283. }
  2284. const raw = comp.emits;
  2285. let normalized = {};
  2286. let hasExtends = false;
  2287. if (!isFunction(comp)) {
  2288. const extendEmits = (raw2) => {
  2289. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2290. if (normalizedFromExtend) {
  2291. hasExtends = true;
  2292. extend(normalized, normalizedFromExtend);
  2293. }
  2294. };
  2295. if (!asMixin && appContext.mixins.length) {
  2296. appContext.mixins.forEach(extendEmits);
  2297. }
  2298. if (comp.extends) {
  2299. extendEmits(comp.extends);
  2300. }
  2301. if (comp.mixins) {
  2302. comp.mixins.forEach(extendEmits);
  2303. }
  2304. }
  2305. if (!raw && !hasExtends) {
  2306. if (isObject(comp)) {
  2307. cache.set(comp, null);
  2308. }
  2309. return null;
  2310. }
  2311. if (isArray(raw)) {
  2312. raw.forEach((key) => normalized[key] = null);
  2313. } else {
  2314. extend(normalized, raw);
  2315. }
  2316. if (isObject(comp)) {
  2317. cache.set(comp, normalized);
  2318. }
  2319. return normalized;
  2320. }
  2321. function isEmitListener(options, key) {
  2322. if (!options || !isOn(key)) {
  2323. return false;
  2324. }
  2325. key = key.slice(2).replace(/Once$/, "");
  2326. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2327. }
  2328. let currentRenderingInstance = null;
  2329. let currentScopeId = null;
  2330. function setCurrentRenderingInstance(instance) {
  2331. const prev = currentRenderingInstance;
  2332. currentRenderingInstance = instance;
  2333. currentScopeId = instance && instance.type.__scopeId || null;
  2334. return prev;
  2335. }
  2336. function pushScopeId(id) {
  2337. currentScopeId = id;
  2338. }
  2339. function popScopeId() {
  2340. currentScopeId = null;
  2341. }
  2342. const withScopeId = (_id) => withCtx;
  2343. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2344. if (!ctx)
  2345. return fn;
  2346. if (fn._n) {
  2347. return fn;
  2348. }
  2349. const renderFnWithContext = (...args) => {
  2350. if (renderFnWithContext._d) {
  2351. setBlockTracking(-1);
  2352. }
  2353. const prevInstance = setCurrentRenderingInstance(ctx);
  2354. let res;
  2355. try {
  2356. res = fn(...args);
  2357. } finally {
  2358. setCurrentRenderingInstance(prevInstance);
  2359. if (renderFnWithContext._d) {
  2360. setBlockTracking(1);
  2361. }
  2362. }
  2363. {
  2364. devtoolsComponentUpdated(ctx);
  2365. }
  2366. return res;
  2367. };
  2368. renderFnWithContext._n = true;
  2369. renderFnWithContext._c = true;
  2370. renderFnWithContext._d = true;
  2371. return renderFnWithContext;
  2372. }
  2373. let accessedAttrs = false;
  2374. function markAttrsAccessed() {
  2375. accessedAttrs = true;
  2376. }
  2377. function renderComponentRoot(instance) {
  2378. const {
  2379. type: Component,
  2380. vnode,
  2381. proxy,
  2382. withProxy,
  2383. props,
  2384. propsOptions: [propsOptions],
  2385. slots,
  2386. attrs,
  2387. emit,
  2388. render,
  2389. renderCache,
  2390. data,
  2391. setupState,
  2392. ctx,
  2393. inheritAttrs
  2394. } = instance;
  2395. let result;
  2396. let fallthroughAttrs;
  2397. const prev = setCurrentRenderingInstance(instance);
  2398. {
  2399. accessedAttrs = false;
  2400. }
  2401. try {
  2402. if (vnode.shapeFlag & 4) {
  2403. const proxyToUse = withProxy || proxy;
  2404. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  2405. get(target, key, receiver) {
  2406. warn$1(
  2407. `Property '${String(
  2408. key
  2409. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  2410. );
  2411. return Reflect.get(target, key, receiver);
  2412. }
  2413. }) : proxyToUse;
  2414. result = normalizeVNode(
  2415. render.call(
  2416. thisProxy,
  2417. proxyToUse,
  2418. renderCache,
  2419. props,
  2420. setupState,
  2421. data,
  2422. ctx
  2423. )
  2424. );
  2425. fallthroughAttrs = attrs;
  2426. } else {
  2427. const render2 = Component;
  2428. if (attrs === props) {
  2429. markAttrsAccessed();
  2430. }
  2431. result = normalizeVNode(
  2432. render2.length > 1 ? render2(
  2433. props,
  2434. true ? {
  2435. get attrs() {
  2436. markAttrsAccessed();
  2437. return attrs;
  2438. },
  2439. slots,
  2440. emit
  2441. } : { attrs, slots, emit }
  2442. ) : render2(
  2443. props,
  2444. null
  2445. /* we know it doesn't need it */
  2446. )
  2447. );
  2448. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2449. }
  2450. } catch (err) {
  2451. blockStack.length = 0;
  2452. handleError(err, instance, 1);
  2453. result = createVNode(Comment);
  2454. }
  2455. let root = result;
  2456. let setRoot = void 0;
  2457. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  2458. [root, setRoot] = getChildRoot(result);
  2459. }
  2460. if (fallthroughAttrs && inheritAttrs !== false) {
  2461. const keys = Object.keys(fallthroughAttrs);
  2462. const { shapeFlag } = root;
  2463. if (keys.length) {
  2464. if (shapeFlag & (1 | 6)) {
  2465. if (propsOptions && keys.some(isModelListener)) {
  2466. fallthroughAttrs = filterModelListeners(
  2467. fallthroughAttrs,
  2468. propsOptions
  2469. );
  2470. }
  2471. root = cloneVNode(root, fallthroughAttrs);
  2472. } else if (!accessedAttrs && root.type !== Comment) {
  2473. const allAttrs = Object.keys(attrs);
  2474. const eventAttrs = [];
  2475. const extraAttrs = [];
  2476. for (let i = 0, l = allAttrs.length; i < l; i++) {
  2477. const key = allAttrs[i];
  2478. if (isOn(key)) {
  2479. if (!isModelListener(key)) {
  2480. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2481. }
  2482. } else {
  2483. extraAttrs.push(key);
  2484. }
  2485. }
  2486. if (extraAttrs.length) {
  2487. warn$1(
  2488. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  2489. );
  2490. }
  2491. if (eventAttrs.length) {
  2492. warn$1(
  2493. `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
  2494. );
  2495. }
  2496. }
  2497. }
  2498. }
  2499. if (vnode.dirs) {
  2500. if (!isElementRoot(root)) {
  2501. warn$1(
  2502. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  2503. );
  2504. }
  2505. root = cloneVNode(root);
  2506. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2507. }
  2508. if (vnode.transition) {
  2509. if (!isElementRoot(root)) {
  2510. warn$1(
  2511. `Component inside <Transition> renders non-element root node that cannot be animated.`
  2512. );
  2513. }
  2514. root.transition = vnode.transition;
  2515. }
  2516. if (setRoot) {
  2517. setRoot(root);
  2518. } else {
  2519. result = root;
  2520. }
  2521. setCurrentRenderingInstance(prev);
  2522. return result;
  2523. }
  2524. const getChildRoot = (vnode) => {
  2525. const rawChildren = vnode.children;
  2526. const dynamicChildren = vnode.dynamicChildren;
  2527. const childRoot = filterSingleRoot(rawChildren, false);
  2528. if (!childRoot) {
  2529. return [vnode, void 0];
  2530. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  2531. return getChildRoot(childRoot);
  2532. }
  2533. const index = rawChildren.indexOf(childRoot);
  2534. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2535. const setRoot = (updatedRoot) => {
  2536. rawChildren[index] = updatedRoot;
  2537. if (dynamicChildren) {
  2538. if (dynamicIndex > -1) {
  2539. dynamicChildren[dynamicIndex] = updatedRoot;
  2540. } else if (updatedRoot.patchFlag > 0) {
  2541. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2542. }
  2543. }
  2544. };
  2545. return [normalizeVNode(childRoot), setRoot];
  2546. };
  2547. function filterSingleRoot(children, recurse = true) {
  2548. let singleRoot;
  2549. for (let i = 0; i < children.length; i++) {
  2550. const child = children[i];
  2551. if (isVNode(child)) {
  2552. if (child.type !== Comment || child.children === "v-if") {
  2553. if (singleRoot) {
  2554. return;
  2555. } else {
  2556. singleRoot = child;
  2557. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  2558. return filterSingleRoot(singleRoot.children);
  2559. }
  2560. }
  2561. }
  2562. } else {
  2563. return;
  2564. }
  2565. }
  2566. return singleRoot;
  2567. }
  2568. const getFunctionalFallthrough = (attrs) => {
  2569. let res;
  2570. for (const key in attrs) {
  2571. if (key === "class" || key === "style" || isOn(key)) {
  2572. (res || (res = {}))[key] = attrs[key];
  2573. }
  2574. }
  2575. return res;
  2576. };
  2577. const filterModelListeners = (attrs, props) => {
  2578. const res = {};
  2579. for (const key in attrs) {
  2580. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2581. res[key] = attrs[key];
  2582. }
  2583. }
  2584. return res;
  2585. };
  2586. const isElementRoot = (vnode) => {
  2587. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  2588. };
  2589. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2590. const { props: prevProps, children: prevChildren, component } = prevVNode;
  2591. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  2592. const emits = component.emitsOptions;
  2593. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2594. return true;
  2595. }
  2596. if (nextVNode.dirs || nextVNode.transition) {
  2597. return true;
  2598. }
  2599. if (optimized && patchFlag >= 0) {
  2600. if (patchFlag & 1024) {
  2601. return true;
  2602. }
  2603. if (patchFlag & 16) {
  2604. if (!prevProps) {
  2605. return !!nextProps;
  2606. }
  2607. return hasPropsChanged(prevProps, nextProps, emits);
  2608. } else if (patchFlag & 8) {
  2609. const dynamicProps = nextVNode.dynamicProps;
  2610. for (let i = 0; i < dynamicProps.length; i++) {
  2611. const key = dynamicProps[i];
  2612. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2613. return true;
  2614. }
  2615. }
  2616. }
  2617. } else {
  2618. if (prevChildren || nextChildren) {
  2619. if (!nextChildren || !nextChildren.$stable) {
  2620. return true;
  2621. }
  2622. }
  2623. if (prevProps === nextProps) {
  2624. return false;
  2625. }
  2626. if (!prevProps) {
  2627. return !!nextProps;
  2628. }
  2629. if (!nextProps) {
  2630. return true;
  2631. }
  2632. return hasPropsChanged(prevProps, nextProps, emits);
  2633. }
  2634. return false;
  2635. }
  2636. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2637. const nextKeys = Object.keys(nextProps);
  2638. if (nextKeys.length !== Object.keys(prevProps).length) {
  2639. return true;
  2640. }
  2641. for (let i = 0; i < nextKeys.length; i++) {
  2642. const key = nextKeys[i];
  2643. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2644. return true;
  2645. }
  2646. }
  2647. return false;
  2648. }
  2649. function updateHOCHostEl({ vnode, parent }, el) {
  2650. while (parent) {
  2651. const root = parent.subTree;
  2652. if (root.suspense && root.suspense.activeBranch === vnode) {
  2653. root.el = vnode.el;
  2654. }
  2655. if (root === vnode) {
  2656. (vnode = parent.vnode).el = el;
  2657. parent = parent.parent;
  2658. } else {
  2659. break;
  2660. }
  2661. }
  2662. }
  2663. const COMPONENTS = "components";
  2664. const DIRECTIVES = "directives";
  2665. function resolveComponent(name, maybeSelfReference) {
  2666. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  2667. }
  2668. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  2669. function resolveDynamicComponent(component) {
  2670. if (isString(component)) {
  2671. return resolveAsset(COMPONENTS, component, false) || component;
  2672. } else {
  2673. return component || NULL_DYNAMIC_COMPONENT;
  2674. }
  2675. }
  2676. function resolveDirective(name) {
  2677. return resolveAsset(DIRECTIVES, name);
  2678. }
  2679. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  2680. const instance = currentRenderingInstance || currentInstance;
  2681. if (instance) {
  2682. const Component = instance.type;
  2683. if (type === COMPONENTS) {
  2684. const selfName = getComponentName(
  2685. Component,
  2686. false
  2687. );
  2688. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  2689. return Component;
  2690. }
  2691. }
  2692. const res = (
  2693. // local registration
  2694. // check instance[type] first which is resolved for options API
  2695. resolve(instance[type] || Component[type], name) || // global registration
  2696. resolve(instance.appContext[type], name)
  2697. );
  2698. if (!res && maybeSelfReference) {
  2699. return Component;
  2700. }
  2701. if (warnMissing && !res) {
  2702. const extra = type === COMPONENTS ? `
  2703. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  2704. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  2705. }
  2706. return res;
  2707. } else {
  2708. warn$1(
  2709. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  2710. );
  2711. }
  2712. }
  2713. function resolve(registry, name) {
  2714. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  2715. }
  2716. const isSuspense = (type) => type.__isSuspense;
  2717. let suspenseId = 0;
  2718. const SuspenseImpl = {
  2719. name: "Suspense",
  2720. // In order to make Suspense tree-shakable, we need to avoid importing it
  2721. // directly in the renderer. The renderer checks for the __isSuspense flag
  2722. // on a vnode's type and calls the `process` method, passing in renderer
  2723. // internals.
  2724. __isSuspense: true,
  2725. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  2726. if (n1 == null) {
  2727. mountSuspense(
  2728. n2,
  2729. container,
  2730. anchor,
  2731. parentComponent,
  2732. parentSuspense,
  2733. namespace,
  2734. slotScopeIds,
  2735. optimized,
  2736. rendererInternals
  2737. );
  2738. } else {
  2739. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  2740. n2.suspense = n1.suspense;
  2741. n2.suspense.vnode = n2;
  2742. n2.el = n1.el;
  2743. return;
  2744. }
  2745. patchSuspense(
  2746. n1,
  2747. n2,
  2748. container,
  2749. anchor,
  2750. parentComponent,
  2751. namespace,
  2752. slotScopeIds,
  2753. optimized,
  2754. rendererInternals
  2755. );
  2756. }
  2757. },
  2758. hydrate: hydrateSuspense,
  2759. create: createSuspenseBoundary,
  2760. normalize: normalizeSuspenseChildren
  2761. };
  2762. const Suspense = SuspenseImpl ;
  2763. function triggerEvent(vnode, name) {
  2764. const eventListener = vnode.props && vnode.props[name];
  2765. if (isFunction(eventListener)) {
  2766. eventListener();
  2767. }
  2768. }
  2769. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  2770. const {
  2771. p: patch,
  2772. o: { createElement }
  2773. } = rendererInternals;
  2774. const hiddenContainer = createElement("div");
  2775. const suspense = vnode.suspense = createSuspenseBoundary(
  2776. vnode,
  2777. parentSuspense,
  2778. parentComponent,
  2779. container,
  2780. hiddenContainer,
  2781. anchor,
  2782. namespace,
  2783. slotScopeIds,
  2784. optimized,
  2785. rendererInternals
  2786. );
  2787. patch(
  2788. null,
  2789. suspense.pendingBranch = vnode.ssContent,
  2790. hiddenContainer,
  2791. null,
  2792. parentComponent,
  2793. suspense,
  2794. namespace,
  2795. slotScopeIds
  2796. );
  2797. if (suspense.deps > 0) {
  2798. triggerEvent(vnode, "onPending");
  2799. triggerEvent(vnode, "onFallback");
  2800. patch(
  2801. null,
  2802. vnode.ssFallback,
  2803. container,
  2804. anchor,
  2805. parentComponent,
  2806. null,
  2807. // fallback tree will not have suspense context
  2808. namespace,
  2809. slotScopeIds
  2810. );
  2811. setActiveBranch(suspense, vnode.ssFallback);
  2812. } else {
  2813. suspense.resolve(false, true);
  2814. }
  2815. }
  2816. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  2817. const suspense = n2.suspense = n1.suspense;
  2818. suspense.vnode = n2;
  2819. n2.el = n1.el;
  2820. const newBranch = n2.ssContent;
  2821. const newFallback = n2.ssFallback;
  2822. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  2823. if (pendingBranch) {
  2824. suspense.pendingBranch = newBranch;
  2825. if (isSameVNodeType(newBranch, pendingBranch)) {
  2826. patch(
  2827. pendingBranch,
  2828. newBranch,
  2829. suspense.hiddenContainer,
  2830. null,
  2831. parentComponent,
  2832. suspense,
  2833. namespace,
  2834. slotScopeIds,
  2835. optimized
  2836. );
  2837. if (suspense.deps <= 0) {
  2838. suspense.resolve();
  2839. } else if (isInFallback) {
  2840. if (!isHydrating) {
  2841. patch(
  2842. activeBranch,
  2843. newFallback,
  2844. container,
  2845. anchor,
  2846. parentComponent,
  2847. null,
  2848. // fallback tree will not have suspense context
  2849. namespace,
  2850. slotScopeIds,
  2851. optimized
  2852. );
  2853. setActiveBranch(suspense, newFallback);
  2854. }
  2855. }
  2856. } else {
  2857. suspense.pendingId = suspenseId++;
  2858. if (isHydrating) {
  2859. suspense.isHydrating = false;
  2860. suspense.activeBranch = pendingBranch;
  2861. } else {
  2862. unmount(pendingBranch, parentComponent, suspense);
  2863. }
  2864. suspense.deps = 0;
  2865. suspense.effects.length = 0;
  2866. suspense.hiddenContainer = createElement("div");
  2867. if (isInFallback) {
  2868. patch(
  2869. null,
  2870. newBranch,
  2871. suspense.hiddenContainer,
  2872. null,
  2873. parentComponent,
  2874. suspense,
  2875. namespace,
  2876. slotScopeIds,
  2877. optimized
  2878. );
  2879. if (suspense.deps <= 0) {
  2880. suspense.resolve();
  2881. } else {
  2882. patch(
  2883. activeBranch,
  2884. newFallback,
  2885. container,
  2886. anchor,
  2887. parentComponent,
  2888. null,
  2889. // fallback tree will not have suspense context
  2890. namespace,
  2891. slotScopeIds,
  2892. optimized
  2893. );
  2894. setActiveBranch(suspense, newFallback);
  2895. }
  2896. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2897. patch(
  2898. activeBranch,
  2899. newBranch,
  2900. container,
  2901. anchor,
  2902. parentComponent,
  2903. suspense,
  2904. namespace,
  2905. slotScopeIds,
  2906. optimized
  2907. );
  2908. suspense.resolve(true);
  2909. } else {
  2910. patch(
  2911. null,
  2912. newBranch,
  2913. suspense.hiddenContainer,
  2914. null,
  2915. parentComponent,
  2916. suspense,
  2917. namespace,
  2918. slotScopeIds,
  2919. optimized
  2920. );
  2921. if (suspense.deps <= 0) {
  2922. suspense.resolve();
  2923. }
  2924. }
  2925. }
  2926. } else {
  2927. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2928. patch(
  2929. activeBranch,
  2930. newBranch,
  2931. container,
  2932. anchor,
  2933. parentComponent,
  2934. suspense,
  2935. namespace,
  2936. slotScopeIds,
  2937. optimized
  2938. );
  2939. setActiveBranch(suspense, newBranch);
  2940. } else {
  2941. triggerEvent(n2, "onPending");
  2942. suspense.pendingBranch = newBranch;
  2943. if (newBranch.shapeFlag & 512) {
  2944. suspense.pendingId = newBranch.component.suspenseId;
  2945. } else {
  2946. suspense.pendingId = suspenseId++;
  2947. }
  2948. patch(
  2949. null,
  2950. newBranch,
  2951. suspense.hiddenContainer,
  2952. null,
  2953. parentComponent,
  2954. suspense,
  2955. namespace,
  2956. slotScopeIds,
  2957. optimized
  2958. );
  2959. if (suspense.deps <= 0) {
  2960. suspense.resolve();
  2961. } else {
  2962. const { timeout, pendingId } = suspense;
  2963. if (timeout > 0) {
  2964. setTimeout(() => {
  2965. if (suspense.pendingId === pendingId) {
  2966. suspense.fallback(newFallback);
  2967. }
  2968. }, timeout);
  2969. } else if (timeout === 0) {
  2970. suspense.fallback(newFallback);
  2971. }
  2972. }
  2973. }
  2974. }
  2975. }
  2976. let hasWarned = false;
  2977. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  2978. if (!hasWarned) {
  2979. hasWarned = true;
  2980. console[console.info ? "info" : "log"](
  2981. `<Suspense> is an experimental feature and its API will likely change.`
  2982. );
  2983. }
  2984. const {
  2985. p: patch,
  2986. m: move,
  2987. um: unmount,
  2988. n: next,
  2989. o: { parentNode, remove }
  2990. } = rendererInternals;
  2991. let parentSuspenseId;
  2992. const isSuspensible = isVNodeSuspensible(vnode);
  2993. if (isSuspensible) {
  2994. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  2995. parentSuspenseId = parentSuspense.pendingId;
  2996. parentSuspense.deps++;
  2997. }
  2998. }
  2999. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  3000. {
  3001. assertNumber(timeout, `Suspense timeout`);
  3002. }
  3003. const initialAnchor = anchor;
  3004. const suspense = {
  3005. vnode,
  3006. parent: parentSuspense,
  3007. parentComponent,
  3008. namespace,
  3009. container,
  3010. hiddenContainer,
  3011. deps: 0,
  3012. pendingId: suspenseId++,
  3013. timeout: typeof timeout === "number" ? timeout : -1,
  3014. activeBranch: null,
  3015. pendingBranch: null,
  3016. isInFallback: !isHydrating,
  3017. isHydrating,
  3018. isUnmounted: false,
  3019. effects: [],
  3020. resolve(resume = false, sync = false) {
  3021. {
  3022. if (!resume && !suspense.pendingBranch) {
  3023. throw new Error(
  3024. `suspense.resolve() is called without a pending branch.`
  3025. );
  3026. }
  3027. if (suspense.isUnmounted) {
  3028. throw new Error(
  3029. `suspense.resolve() is called on an already unmounted suspense boundary.`
  3030. );
  3031. }
  3032. }
  3033. const {
  3034. vnode: vnode2,
  3035. activeBranch,
  3036. pendingBranch,
  3037. pendingId,
  3038. effects,
  3039. parentComponent: parentComponent2,
  3040. container: container2
  3041. } = suspense;
  3042. let delayEnter = false;
  3043. if (suspense.isHydrating) {
  3044. suspense.isHydrating = false;
  3045. } else if (!resume) {
  3046. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  3047. if (delayEnter) {
  3048. activeBranch.transition.afterLeave = () => {
  3049. if (pendingId === suspense.pendingId) {
  3050. move(
  3051. pendingBranch,
  3052. container2,
  3053. anchor === initialAnchor ? next(activeBranch) : anchor,
  3054. 0
  3055. );
  3056. queuePostFlushCb(effects);
  3057. }
  3058. };
  3059. }
  3060. if (activeBranch) {
  3061. if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
  3062. anchor = next(activeBranch);
  3063. }
  3064. unmount(activeBranch, parentComponent2, suspense, true);
  3065. }
  3066. if (!delayEnter) {
  3067. move(pendingBranch, container2, anchor, 0);
  3068. }
  3069. }
  3070. setActiveBranch(suspense, pendingBranch);
  3071. suspense.pendingBranch = null;
  3072. suspense.isInFallback = false;
  3073. let parent = suspense.parent;
  3074. let hasUnresolvedAncestor = false;
  3075. while (parent) {
  3076. if (parent.pendingBranch) {
  3077. parent.effects.push(...effects);
  3078. hasUnresolvedAncestor = true;
  3079. break;
  3080. }
  3081. parent = parent.parent;
  3082. }
  3083. if (!hasUnresolvedAncestor && !delayEnter) {
  3084. queuePostFlushCb(effects);
  3085. }
  3086. suspense.effects = [];
  3087. if (isSuspensible) {
  3088. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  3089. parentSuspense.deps--;
  3090. if (parentSuspense.deps === 0 && !sync) {
  3091. parentSuspense.resolve();
  3092. }
  3093. }
  3094. }
  3095. triggerEvent(vnode2, "onResolve");
  3096. },
  3097. fallback(fallbackVNode) {
  3098. if (!suspense.pendingBranch) {
  3099. return;
  3100. }
  3101. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  3102. triggerEvent(vnode2, "onFallback");
  3103. const anchor2 = next(activeBranch);
  3104. const mountFallback = () => {
  3105. if (!suspense.isInFallback) {
  3106. return;
  3107. }
  3108. patch(
  3109. null,
  3110. fallbackVNode,
  3111. container2,
  3112. anchor2,
  3113. parentComponent2,
  3114. null,
  3115. // fallback tree will not have suspense context
  3116. namespace2,
  3117. slotScopeIds,
  3118. optimized
  3119. );
  3120. setActiveBranch(suspense, fallbackVNode);
  3121. };
  3122. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  3123. if (delayEnter) {
  3124. activeBranch.transition.afterLeave = mountFallback;
  3125. }
  3126. suspense.isInFallback = true;
  3127. unmount(
  3128. activeBranch,
  3129. parentComponent2,
  3130. null,
  3131. // no suspense so unmount hooks fire now
  3132. true
  3133. // shouldRemove
  3134. );
  3135. if (!delayEnter) {
  3136. mountFallback();
  3137. }
  3138. },
  3139. move(container2, anchor2, type) {
  3140. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  3141. suspense.container = container2;
  3142. },
  3143. next() {
  3144. return suspense.activeBranch && next(suspense.activeBranch);
  3145. },
  3146. registerDep(instance, setupRenderEffect) {
  3147. const isInPendingSuspense = !!suspense.pendingBranch;
  3148. if (isInPendingSuspense) {
  3149. suspense.deps++;
  3150. }
  3151. const hydratedEl = instance.vnode.el;
  3152. instance.asyncDep.catch((err) => {
  3153. handleError(err, instance, 0);
  3154. }).then((asyncSetupResult) => {
  3155. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  3156. return;
  3157. }
  3158. instance.asyncResolved = true;
  3159. const { vnode: vnode2 } = instance;
  3160. {
  3161. pushWarningContext(vnode2);
  3162. }
  3163. handleSetupResult(instance, asyncSetupResult, false);
  3164. if (hydratedEl) {
  3165. vnode2.el = hydratedEl;
  3166. }
  3167. const placeholder = !hydratedEl && instance.subTree.el;
  3168. setupRenderEffect(
  3169. instance,
  3170. vnode2,
  3171. // component may have been moved before resolve.
  3172. // if this is not a hydration, instance.subTree will be the comment
  3173. // placeholder.
  3174. parentNode(hydratedEl || instance.subTree.el),
  3175. // anchor will not be used if this is hydration, so only need to
  3176. // consider the comment placeholder case.
  3177. hydratedEl ? null : next(instance.subTree),
  3178. suspense,
  3179. namespace,
  3180. optimized
  3181. );
  3182. if (placeholder) {
  3183. remove(placeholder);
  3184. }
  3185. updateHOCHostEl(instance, vnode2.el);
  3186. {
  3187. popWarningContext();
  3188. }
  3189. if (isInPendingSuspense && --suspense.deps === 0) {
  3190. suspense.resolve();
  3191. }
  3192. });
  3193. },
  3194. unmount(parentSuspense2, doRemove) {
  3195. suspense.isUnmounted = true;
  3196. if (suspense.activeBranch) {
  3197. unmount(
  3198. suspense.activeBranch,
  3199. parentComponent,
  3200. parentSuspense2,
  3201. doRemove
  3202. );
  3203. }
  3204. if (suspense.pendingBranch) {
  3205. unmount(
  3206. suspense.pendingBranch,
  3207. parentComponent,
  3208. parentSuspense2,
  3209. doRemove
  3210. );
  3211. }
  3212. }
  3213. };
  3214. return suspense;
  3215. }
  3216. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  3217. const suspense = vnode.suspense = createSuspenseBoundary(
  3218. vnode,
  3219. parentSuspense,
  3220. parentComponent,
  3221. node.parentNode,
  3222. // eslint-disable-next-line no-restricted-globals
  3223. document.createElement("div"),
  3224. null,
  3225. namespace,
  3226. slotScopeIds,
  3227. optimized,
  3228. rendererInternals,
  3229. true
  3230. );
  3231. const result = hydrateNode(
  3232. node,
  3233. suspense.pendingBranch = vnode.ssContent,
  3234. parentComponent,
  3235. suspense,
  3236. slotScopeIds,
  3237. optimized
  3238. );
  3239. if (suspense.deps === 0) {
  3240. suspense.resolve(false, true);
  3241. }
  3242. return result;
  3243. }
  3244. function normalizeSuspenseChildren(vnode) {
  3245. const { shapeFlag, children } = vnode;
  3246. const isSlotChildren = shapeFlag & 32;
  3247. vnode.ssContent = normalizeSuspenseSlot(
  3248. isSlotChildren ? children.default : children
  3249. );
  3250. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  3251. }
  3252. function normalizeSuspenseSlot(s) {
  3253. let block;
  3254. if (isFunction(s)) {
  3255. const trackBlock = isBlockTreeEnabled && s._c;
  3256. if (trackBlock) {
  3257. s._d = false;
  3258. openBlock();
  3259. }
  3260. s = s();
  3261. if (trackBlock) {
  3262. s._d = true;
  3263. block = currentBlock;
  3264. closeBlock();
  3265. }
  3266. }
  3267. if (isArray(s)) {
  3268. const singleChild = filterSingleRoot(s);
  3269. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  3270. warn$1(`<Suspense> slots expect a single root node.`);
  3271. }
  3272. s = singleChild;
  3273. }
  3274. s = normalizeVNode(s);
  3275. if (block && !s.dynamicChildren) {
  3276. s.dynamicChildren = block.filter((c) => c !== s);
  3277. }
  3278. return s;
  3279. }
  3280. function queueEffectWithSuspense(fn, suspense) {
  3281. if (suspense && suspense.pendingBranch) {
  3282. if (isArray(fn)) {
  3283. suspense.effects.push(...fn);
  3284. } else {
  3285. suspense.effects.push(fn);
  3286. }
  3287. } else {
  3288. queuePostFlushCb(fn);
  3289. }
  3290. }
  3291. function setActiveBranch(suspense, branch) {
  3292. suspense.activeBranch = branch;
  3293. const { vnode, parentComponent } = suspense;
  3294. let el = branch.el;
  3295. while (!el && branch.component) {
  3296. branch = branch.component.subTree;
  3297. el = branch.el;
  3298. }
  3299. vnode.el = el;
  3300. if (parentComponent && parentComponent.subTree === vnode) {
  3301. parentComponent.vnode.el = el;
  3302. updateHOCHostEl(parentComponent, el);
  3303. }
  3304. }
  3305. function isVNodeSuspensible(vnode) {
  3306. var _a;
  3307. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  3308. }
  3309. const ssrContextKey = Symbol.for("v-scx");
  3310. const useSSRContext = () => {
  3311. {
  3312. const ctx = inject(ssrContextKey);
  3313. if (!ctx) {
  3314. warn$1(
  3315. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  3316. );
  3317. }
  3318. return ctx;
  3319. }
  3320. };
  3321. function watchEffect(effect, options) {
  3322. return doWatch(effect, null, options);
  3323. }
  3324. function watchPostEffect(effect, options) {
  3325. return doWatch(
  3326. effect,
  3327. null,
  3328. extend({}, options, { flush: "post" })
  3329. );
  3330. }
  3331. function watchSyncEffect(effect, options) {
  3332. return doWatch(
  3333. effect,
  3334. null,
  3335. extend({}, options, { flush: "sync" })
  3336. );
  3337. }
  3338. const INITIAL_WATCHER_VALUE = {};
  3339. function watch(source, cb, options) {
  3340. if (!isFunction(cb)) {
  3341. warn$1(
  3342. `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
  3343. );
  3344. }
  3345. return doWatch(source, cb, options);
  3346. }
  3347. function doWatch(source, cb, {
  3348. immediate,
  3349. deep,
  3350. flush,
  3351. once,
  3352. onTrack,
  3353. onTrigger
  3354. } = EMPTY_OBJ) {
  3355. if (cb && once) {
  3356. const _cb = cb;
  3357. cb = (...args) => {
  3358. _cb(...args);
  3359. unwatch();
  3360. };
  3361. }
  3362. if (deep !== void 0 && typeof deep === "number") {
  3363. warn$1(
  3364. `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
  3365. );
  3366. }
  3367. if (!cb) {
  3368. if (immediate !== void 0) {
  3369. warn$1(
  3370. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3371. );
  3372. }
  3373. if (deep !== void 0) {
  3374. warn$1(
  3375. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3376. );
  3377. }
  3378. if (once !== void 0) {
  3379. warn$1(
  3380. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  3381. );
  3382. }
  3383. }
  3384. const warnInvalidSource = (s) => {
  3385. warn$1(
  3386. `Invalid watch source: `,
  3387. s,
  3388. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  3389. );
  3390. };
  3391. const instance = currentInstance;
  3392. const reactiveGetter = (source2) => deep === true ? source2 : (
  3393. // for deep: false, only traverse root-level properties
  3394. traverse(source2, deep === false ? 1 : void 0)
  3395. );
  3396. let getter;
  3397. let forceTrigger = false;
  3398. let isMultiSource = false;
  3399. if (isRef(source)) {
  3400. getter = () => source.value;
  3401. forceTrigger = isShallow(source);
  3402. } else if (isReactive(source)) {
  3403. getter = () => reactiveGetter(source);
  3404. forceTrigger = true;
  3405. } else if (isArray(source)) {
  3406. isMultiSource = true;
  3407. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  3408. getter = () => source.map((s) => {
  3409. if (isRef(s)) {
  3410. return s.value;
  3411. } else if (isReactive(s)) {
  3412. return reactiveGetter(s);
  3413. } else if (isFunction(s)) {
  3414. return callWithErrorHandling(s, instance, 2);
  3415. } else {
  3416. warnInvalidSource(s);
  3417. }
  3418. });
  3419. } else if (isFunction(source)) {
  3420. if (cb) {
  3421. getter = () => callWithErrorHandling(source, instance, 2);
  3422. } else {
  3423. getter = () => {
  3424. if (cleanup) {
  3425. cleanup();
  3426. }
  3427. return callWithAsyncErrorHandling(
  3428. source,
  3429. instance,
  3430. 3,
  3431. [onCleanup]
  3432. );
  3433. };
  3434. }
  3435. } else {
  3436. getter = NOOP;
  3437. warnInvalidSource(source);
  3438. }
  3439. if (cb && deep) {
  3440. const baseGetter = getter;
  3441. getter = () => traverse(baseGetter());
  3442. }
  3443. let cleanup;
  3444. let onCleanup = (fn) => {
  3445. cleanup = effect.onStop = () => {
  3446. callWithErrorHandling(fn, instance, 4);
  3447. cleanup = effect.onStop = void 0;
  3448. };
  3449. };
  3450. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3451. const job = () => {
  3452. if (!effect.active || !effect.dirty) {
  3453. return;
  3454. }
  3455. if (cb) {
  3456. const newValue = effect.run();
  3457. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  3458. if (cleanup) {
  3459. cleanup();
  3460. }
  3461. callWithAsyncErrorHandling(cb, instance, 3, [
  3462. newValue,
  3463. // pass undefined as the old value when it's changed for the first time
  3464. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3465. onCleanup
  3466. ]);
  3467. oldValue = newValue;
  3468. }
  3469. } else {
  3470. effect.run();
  3471. }
  3472. };
  3473. job.allowRecurse = !!cb;
  3474. let scheduler;
  3475. if (flush === "sync") {
  3476. scheduler = job;
  3477. } else if (flush === "post") {
  3478. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3479. } else {
  3480. job.pre = true;
  3481. if (instance)
  3482. job.id = instance.uid;
  3483. scheduler = () => queueJob(job);
  3484. }
  3485. const effect = new ReactiveEffect(getter, NOOP, scheduler);
  3486. const scope = getCurrentScope();
  3487. const unwatch = () => {
  3488. effect.stop();
  3489. if (scope) {
  3490. remove(scope.effects, effect);
  3491. }
  3492. };
  3493. {
  3494. effect.onTrack = onTrack;
  3495. effect.onTrigger = onTrigger;
  3496. }
  3497. if (cb) {
  3498. if (immediate) {
  3499. job();
  3500. } else {
  3501. oldValue = effect.run();
  3502. }
  3503. } else if (flush === "post") {
  3504. queuePostRenderEffect(
  3505. effect.run.bind(effect),
  3506. instance && instance.suspense
  3507. );
  3508. } else {
  3509. effect.run();
  3510. }
  3511. return unwatch;
  3512. }
  3513. function instanceWatch(source, value, options) {
  3514. const publicThis = this.proxy;
  3515. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3516. let cb;
  3517. if (isFunction(value)) {
  3518. cb = value;
  3519. } else {
  3520. cb = value.handler;
  3521. options = value;
  3522. }
  3523. const reset = setCurrentInstance(this);
  3524. const res = doWatch(getter, cb.bind(publicThis), options);
  3525. reset();
  3526. return res;
  3527. }
  3528. function createPathGetter(ctx, path) {
  3529. const segments = path.split(".");
  3530. return () => {
  3531. let cur = ctx;
  3532. for (let i = 0; i < segments.length && cur; i++) {
  3533. cur = cur[segments[i]];
  3534. }
  3535. return cur;
  3536. };
  3537. }
  3538. function traverse(value, depth, currentDepth = 0, seen) {
  3539. if (!isObject(value) || value["__v_skip"]) {
  3540. return value;
  3541. }
  3542. if (depth && depth > 0) {
  3543. if (currentDepth >= depth) {
  3544. return value;
  3545. }
  3546. currentDepth++;
  3547. }
  3548. seen = seen || /* @__PURE__ */ new Set();
  3549. if (seen.has(value)) {
  3550. return value;
  3551. }
  3552. seen.add(value);
  3553. if (isRef(value)) {
  3554. traverse(value.value, depth, currentDepth, seen);
  3555. } else if (isArray(value)) {
  3556. for (let i = 0; i < value.length; i++) {
  3557. traverse(value[i], depth, currentDepth, seen);
  3558. }
  3559. } else if (isSet(value) || isMap(value)) {
  3560. value.forEach((v) => {
  3561. traverse(v, depth, currentDepth, seen);
  3562. });
  3563. } else if (isPlainObject(value)) {
  3564. for (const key in value) {
  3565. traverse(value[key], depth, currentDepth, seen);
  3566. }
  3567. }
  3568. return value;
  3569. }
  3570. function validateDirectiveName(name) {
  3571. if (isBuiltInDirective(name)) {
  3572. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  3573. }
  3574. }
  3575. function withDirectives(vnode, directives) {
  3576. if (currentRenderingInstance === null) {
  3577. warn$1(`withDirectives can only be used inside render functions.`);
  3578. return vnode;
  3579. }
  3580. const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
  3581. const bindings = vnode.dirs || (vnode.dirs = []);
  3582. for (let i = 0; i < directives.length; i++) {
  3583. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3584. if (dir) {
  3585. if (isFunction(dir)) {
  3586. dir = {
  3587. mounted: dir,
  3588. updated: dir
  3589. };
  3590. }
  3591. if (dir.deep) {
  3592. traverse(value);
  3593. }
  3594. bindings.push({
  3595. dir,
  3596. instance,
  3597. value,
  3598. oldValue: void 0,
  3599. arg,
  3600. modifiers
  3601. });
  3602. }
  3603. }
  3604. return vnode;
  3605. }
  3606. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3607. const bindings = vnode.dirs;
  3608. const oldBindings = prevVNode && prevVNode.dirs;
  3609. for (let i = 0; i < bindings.length; i++) {
  3610. const binding = bindings[i];
  3611. if (oldBindings) {
  3612. binding.oldValue = oldBindings[i].value;
  3613. }
  3614. let hook = binding.dir[name];
  3615. if (hook) {
  3616. pauseTracking();
  3617. callWithAsyncErrorHandling(hook, instance, 8, [
  3618. vnode.el,
  3619. binding,
  3620. vnode,
  3621. prevVNode
  3622. ]);
  3623. resetTracking();
  3624. }
  3625. }
  3626. }
  3627. const leaveCbKey = Symbol("_leaveCb");
  3628. const enterCbKey$1 = Symbol("_enterCb");
  3629. function useTransitionState() {
  3630. const state = {
  3631. isMounted: false,
  3632. isLeaving: false,
  3633. isUnmounting: false,
  3634. leavingVNodes: /* @__PURE__ */ new Map()
  3635. };
  3636. onMounted(() => {
  3637. state.isMounted = true;
  3638. });
  3639. onBeforeUnmount(() => {
  3640. state.isUnmounting = true;
  3641. });
  3642. return state;
  3643. }
  3644. const TransitionHookValidator = [Function, Array];
  3645. const BaseTransitionPropsValidators = {
  3646. mode: String,
  3647. appear: Boolean,
  3648. persisted: Boolean,
  3649. // enter
  3650. onBeforeEnter: TransitionHookValidator,
  3651. onEnter: TransitionHookValidator,
  3652. onAfterEnter: TransitionHookValidator,
  3653. onEnterCancelled: TransitionHookValidator,
  3654. // leave
  3655. onBeforeLeave: TransitionHookValidator,
  3656. onLeave: TransitionHookValidator,
  3657. onAfterLeave: TransitionHookValidator,
  3658. onLeaveCancelled: TransitionHookValidator,
  3659. // appear
  3660. onBeforeAppear: TransitionHookValidator,
  3661. onAppear: TransitionHookValidator,
  3662. onAfterAppear: TransitionHookValidator,
  3663. onAppearCancelled: TransitionHookValidator
  3664. };
  3665. const BaseTransitionImpl = {
  3666. name: `BaseTransition`,
  3667. props: BaseTransitionPropsValidators,
  3668. setup(props, { slots }) {
  3669. const instance = getCurrentInstance();
  3670. const state = useTransitionState();
  3671. return () => {
  3672. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3673. if (!children || !children.length) {
  3674. return;
  3675. }
  3676. let child = children[0];
  3677. if (children.length > 1) {
  3678. let hasFound = false;
  3679. for (const c of children) {
  3680. if (c.type !== Comment) {
  3681. if (hasFound) {
  3682. warn$1(
  3683. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3684. );
  3685. break;
  3686. }
  3687. child = c;
  3688. hasFound = true;
  3689. }
  3690. }
  3691. }
  3692. const rawProps = toRaw(props);
  3693. const { mode } = rawProps;
  3694. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3695. warn$1(`invalid <transition> mode: ${mode}`);
  3696. }
  3697. if (state.isLeaving) {
  3698. return emptyPlaceholder(child);
  3699. }
  3700. const innerChild = getKeepAliveChild(child);
  3701. if (!innerChild) {
  3702. return emptyPlaceholder(child);
  3703. }
  3704. const enterHooks = resolveTransitionHooks(
  3705. innerChild,
  3706. rawProps,
  3707. state,
  3708. instance
  3709. );
  3710. setTransitionHooks(innerChild, enterHooks);
  3711. const oldChild = instance.subTree;
  3712. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3713. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
  3714. const leavingHooks = resolveTransitionHooks(
  3715. oldInnerChild,
  3716. rawProps,
  3717. state,
  3718. instance
  3719. );
  3720. setTransitionHooks(oldInnerChild, leavingHooks);
  3721. if (mode === "out-in") {
  3722. state.isLeaving = true;
  3723. leavingHooks.afterLeave = () => {
  3724. state.isLeaving = false;
  3725. if (instance.update.active !== false) {
  3726. instance.effect.dirty = true;
  3727. instance.update();
  3728. }
  3729. };
  3730. return emptyPlaceholder(child);
  3731. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3732. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3733. const leavingVNodesCache = getLeavingNodesForType(
  3734. state,
  3735. oldInnerChild
  3736. );
  3737. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3738. el[leaveCbKey] = () => {
  3739. earlyRemove();
  3740. el[leaveCbKey] = void 0;
  3741. delete enterHooks.delayedLeave;
  3742. };
  3743. enterHooks.delayedLeave = delayedLeave;
  3744. };
  3745. }
  3746. }
  3747. return child;
  3748. };
  3749. }
  3750. };
  3751. const BaseTransition = BaseTransitionImpl;
  3752. function getLeavingNodesForType(state, vnode) {
  3753. const { leavingVNodes } = state;
  3754. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3755. if (!leavingVNodesCache) {
  3756. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3757. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3758. }
  3759. return leavingVNodesCache;
  3760. }
  3761. function resolveTransitionHooks(vnode, props, state, instance) {
  3762. const {
  3763. appear,
  3764. mode,
  3765. persisted = false,
  3766. onBeforeEnter,
  3767. onEnter,
  3768. onAfterEnter,
  3769. onEnterCancelled,
  3770. onBeforeLeave,
  3771. onLeave,
  3772. onAfterLeave,
  3773. onLeaveCancelled,
  3774. onBeforeAppear,
  3775. onAppear,
  3776. onAfterAppear,
  3777. onAppearCancelled
  3778. } = props;
  3779. const key = String(vnode.key);
  3780. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3781. const callHook = (hook, args) => {
  3782. hook && callWithAsyncErrorHandling(
  3783. hook,
  3784. instance,
  3785. 9,
  3786. args
  3787. );
  3788. };
  3789. const callAsyncHook = (hook, args) => {
  3790. const done = args[1];
  3791. callHook(hook, args);
  3792. if (isArray(hook)) {
  3793. if (hook.every((hook2) => hook2.length <= 1))
  3794. done();
  3795. } else if (hook.length <= 1) {
  3796. done();
  3797. }
  3798. };
  3799. const hooks = {
  3800. mode,
  3801. persisted,
  3802. beforeEnter(el) {
  3803. let hook = onBeforeEnter;
  3804. if (!state.isMounted) {
  3805. if (appear) {
  3806. hook = onBeforeAppear || onBeforeEnter;
  3807. } else {
  3808. return;
  3809. }
  3810. }
  3811. if (el[leaveCbKey]) {
  3812. el[leaveCbKey](
  3813. true
  3814. /* cancelled */
  3815. );
  3816. }
  3817. const leavingVNode = leavingVNodesCache[key];
  3818. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3819. leavingVNode.el[leaveCbKey]();
  3820. }
  3821. callHook(hook, [el]);
  3822. },
  3823. enter(el) {
  3824. let hook = onEnter;
  3825. let afterHook = onAfterEnter;
  3826. let cancelHook = onEnterCancelled;
  3827. if (!state.isMounted) {
  3828. if (appear) {
  3829. hook = onAppear || onEnter;
  3830. afterHook = onAfterAppear || onAfterEnter;
  3831. cancelHook = onAppearCancelled || onEnterCancelled;
  3832. } else {
  3833. return;
  3834. }
  3835. }
  3836. let called = false;
  3837. const done = el[enterCbKey$1] = (cancelled) => {
  3838. if (called)
  3839. return;
  3840. called = true;
  3841. if (cancelled) {
  3842. callHook(cancelHook, [el]);
  3843. } else {
  3844. callHook(afterHook, [el]);
  3845. }
  3846. if (hooks.delayedLeave) {
  3847. hooks.delayedLeave();
  3848. }
  3849. el[enterCbKey$1] = void 0;
  3850. };
  3851. if (hook) {
  3852. callAsyncHook(hook, [el, done]);
  3853. } else {
  3854. done();
  3855. }
  3856. },
  3857. leave(el, remove) {
  3858. const key2 = String(vnode.key);
  3859. if (el[enterCbKey$1]) {
  3860. el[enterCbKey$1](
  3861. true
  3862. /* cancelled */
  3863. );
  3864. }
  3865. if (state.isUnmounting) {
  3866. return remove();
  3867. }
  3868. callHook(onBeforeLeave, [el]);
  3869. let called = false;
  3870. const done = el[leaveCbKey] = (cancelled) => {
  3871. if (called)
  3872. return;
  3873. called = true;
  3874. remove();
  3875. if (cancelled) {
  3876. callHook(onLeaveCancelled, [el]);
  3877. } else {
  3878. callHook(onAfterLeave, [el]);
  3879. }
  3880. el[leaveCbKey] = void 0;
  3881. if (leavingVNodesCache[key2] === vnode) {
  3882. delete leavingVNodesCache[key2];
  3883. }
  3884. };
  3885. leavingVNodesCache[key2] = vnode;
  3886. if (onLeave) {
  3887. callAsyncHook(onLeave, [el, done]);
  3888. } else {
  3889. done();
  3890. }
  3891. },
  3892. clone(vnode2) {
  3893. return resolveTransitionHooks(vnode2, props, state, instance);
  3894. }
  3895. };
  3896. return hooks;
  3897. }
  3898. function emptyPlaceholder(vnode) {
  3899. if (isKeepAlive(vnode)) {
  3900. vnode = cloneVNode(vnode);
  3901. vnode.children = null;
  3902. return vnode;
  3903. }
  3904. }
  3905. function getKeepAliveChild(vnode) {
  3906. return isKeepAlive(vnode) ? (
  3907. // #7121 ensure get the child component subtree in case
  3908. // it's been replaced during HMR
  3909. vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
  3910. ) : vnode;
  3911. }
  3912. function setTransitionHooks(vnode, hooks) {
  3913. if (vnode.shapeFlag & 6 && vnode.component) {
  3914. setTransitionHooks(vnode.component.subTree, hooks);
  3915. } else if (vnode.shapeFlag & 128) {
  3916. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3917. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3918. } else {
  3919. vnode.transition = hooks;
  3920. }
  3921. }
  3922. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3923. let ret = [];
  3924. let keyedFragmentCount = 0;
  3925. for (let i = 0; i < children.length; i++) {
  3926. let child = children[i];
  3927. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3928. if (child.type === Fragment) {
  3929. if (child.patchFlag & 128)
  3930. keyedFragmentCount++;
  3931. ret = ret.concat(
  3932. getTransitionRawChildren(child.children, keepComment, key)
  3933. );
  3934. } else if (keepComment || child.type !== Comment) {
  3935. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3936. }
  3937. }
  3938. if (keyedFragmentCount > 1) {
  3939. for (let i = 0; i < ret.length; i++) {
  3940. ret[i].patchFlag = -2;
  3941. }
  3942. }
  3943. return ret;
  3944. }
  3945. /*! #__NO_SIDE_EFFECTS__ */
  3946. // @__NO_SIDE_EFFECTS__
  3947. function defineComponent(options, extraOptions) {
  3948. return isFunction(options) ? (
  3949. // #8326: extend call and options.name access are considered side-effects
  3950. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3951. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3952. ) : options;
  3953. }
  3954. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  3955. /*! #__NO_SIDE_EFFECTS__ */
  3956. // @__NO_SIDE_EFFECTS__
  3957. function defineAsyncComponent(source) {
  3958. if (isFunction(source)) {
  3959. source = { loader: source };
  3960. }
  3961. const {
  3962. loader,
  3963. loadingComponent,
  3964. errorComponent,
  3965. delay = 200,
  3966. timeout,
  3967. // undefined = never times out
  3968. suspensible = true,
  3969. onError: userOnError
  3970. } = source;
  3971. let pendingRequest = null;
  3972. let resolvedComp;
  3973. let retries = 0;
  3974. const retry = () => {
  3975. retries++;
  3976. pendingRequest = null;
  3977. return load();
  3978. };
  3979. const load = () => {
  3980. let thisRequest;
  3981. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  3982. err = err instanceof Error ? err : new Error(String(err));
  3983. if (userOnError) {
  3984. return new Promise((resolve, reject) => {
  3985. const userRetry = () => resolve(retry());
  3986. const userFail = () => reject(err);
  3987. userOnError(err, userRetry, userFail, retries + 1);
  3988. });
  3989. } else {
  3990. throw err;
  3991. }
  3992. }).then((comp) => {
  3993. if (thisRequest !== pendingRequest && pendingRequest) {
  3994. return pendingRequest;
  3995. }
  3996. if (!comp) {
  3997. warn$1(
  3998. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  3999. );
  4000. }
  4001. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4002. comp = comp.default;
  4003. }
  4004. if (comp && !isObject(comp) && !isFunction(comp)) {
  4005. throw new Error(`Invalid async component load result: ${comp}`);
  4006. }
  4007. resolvedComp = comp;
  4008. return comp;
  4009. }));
  4010. };
  4011. return defineComponent({
  4012. name: "AsyncComponentWrapper",
  4013. __asyncLoader: load,
  4014. get __asyncResolved() {
  4015. return resolvedComp;
  4016. },
  4017. setup() {
  4018. const instance = currentInstance;
  4019. if (resolvedComp) {
  4020. return () => createInnerComp(resolvedComp, instance);
  4021. }
  4022. const onError = (err) => {
  4023. pendingRequest = null;
  4024. handleError(
  4025. err,
  4026. instance,
  4027. 13,
  4028. !errorComponent
  4029. );
  4030. };
  4031. if (suspensible && instance.suspense || false) {
  4032. return load().then((comp) => {
  4033. return () => createInnerComp(comp, instance);
  4034. }).catch((err) => {
  4035. onError(err);
  4036. return () => errorComponent ? createVNode(errorComponent, {
  4037. error: err
  4038. }) : null;
  4039. });
  4040. }
  4041. const loaded = ref(false);
  4042. const error = ref();
  4043. const delayed = ref(!!delay);
  4044. if (delay) {
  4045. setTimeout(() => {
  4046. delayed.value = false;
  4047. }, delay);
  4048. }
  4049. if (timeout != null) {
  4050. setTimeout(() => {
  4051. if (!loaded.value && !error.value) {
  4052. const err = new Error(
  4053. `Async component timed out after ${timeout}ms.`
  4054. );
  4055. onError(err);
  4056. error.value = err;
  4057. }
  4058. }, timeout);
  4059. }
  4060. load().then(() => {
  4061. loaded.value = true;
  4062. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4063. instance.parent.effect.dirty = true;
  4064. queueJob(instance.parent.update);
  4065. }
  4066. }).catch((err) => {
  4067. onError(err);
  4068. error.value = err;
  4069. });
  4070. return () => {
  4071. if (loaded.value && resolvedComp) {
  4072. return createInnerComp(resolvedComp, instance);
  4073. } else if (error.value && errorComponent) {
  4074. return createVNode(errorComponent, {
  4075. error: error.value
  4076. });
  4077. } else if (loadingComponent && !delayed.value) {
  4078. return createVNode(loadingComponent);
  4079. }
  4080. };
  4081. }
  4082. });
  4083. }
  4084. function createInnerComp(comp, parent) {
  4085. const { ref: ref2, props, children, ce } = parent.vnode;
  4086. const vnode = createVNode(comp, props, children);
  4087. vnode.ref = ref2;
  4088. vnode.ce = ce;
  4089. delete parent.vnode.ce;
  4090. return vnode;
  4091. }
  4092. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  4093. const KeepAliveImpl = {
  4094. name: `KeepAlive`,
  4095. // Marker for special handling inside the renderer. We are not using a ===
  4096. // check directly on KeepAlive in the renderer, because importing it directly
  4097. // would prevent it from being tree-shaken.
  4098. __isKeepAlive: true,
  4099. props: {
  4100. include: [String, RegExp, Array],
  4101. exclude: [String, RegExp, Array],
  4102. max: [String, Number]
  4103. },
  4104. setup(props, { slots }) {
  4105. const instance = getCurrentInstance();
  4106. const sharedContext = instance.ctx;
  4107. const cache = /* @__PURE__ */ new Map();
  4108. const keys = /* @__PURE__ */ new Set();
  4109. let current = null;
  4110. {
  4111. instance.__v_cache = cache;
  4112. }
  4113. const parentSuspense = instance.suspense;
  4114. const {
  4115. renderer: {
  4116. p: patch,
  4117. m: move,
  4118. um: _unmount,
  4119. o: { createElement }
  4120. }
  4121. } = sharedContext;
  4122. const storageContainer = createElement("div");
  4123. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  4124. const instance2 = vnode.component;
  4125. move(vnode, container, anchor, 0, parentSuspense);
  4126. patch(
  4127. instance2.vnode,
  4128. vnode,
  4129. container,
  4130. anchor,
  4131. instance2,
  4132. parentSuspense,
  4133. namespace,
  4134. vnode.slotScopeIds,
  4135. optimized
  4136. );
  4137. queuePostRenderEffect(() => {
  4138. instance2.isDeactivated = false;
  4139. if (instance2.a) {
  4140. invokeArrayFns(instance2.a);
  4141. }
  4142. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  4143. if (vnodeHook) {
  4144. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4145. }
  4146. }, parentSuspense);
  4147. {
  4148. devtoolsComponentAdded(instance2);
  4149. }
  4150. };
  4151. sharedContext.deactivate = (vnode) => {
  4152. const instance2 = vnode.component;
  4153. move(vnode, storageContainer, null, 1, parentSuspense);
  4154. queuePostRenderEffect(() => {
  4155. if (instance2.da) {
  4156. invokeArrayFns(instance2.da);
  4157. }
  4158. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  4159. if (vnodeHook) {
  4160. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  4161. }
  4162. instance2.isDeactivated = true;
  4163. }, parentSuspense);
  4164. {
  4165. devtoolsComponentAdded(instance2);
  4166. }
  4167. };
  4168. function unmount(vnode) {
  4169. resetShapeFlag(vnode);
  4170. _unmount(vnode, instance, parentSuspense, true);
  4171. }
  4172. function pruneCache(filter) {
  4173. cache.forEach((vnode, key) => {
  4174. const name = getComponentName(vnode.type);
  4175. if (name && (!filter || !filter(name))) {
  4176. pruneCacheEntry(key);
  4177. }
  4178. });
  4179. }
  4180. function pruneCacheEntry(key) {
  4181. const cached = cache.get(key);
  4182. if (!current || !isSameVNodeType(cached, current)) {
  4183. unmount(cached);
  4184. } else if (current) {
  4185. resetShapeFlag(current);
  4186. }
  4187. cache.delete(key);
  4188. keys.delete(key);
  4189. }
  4190. watch(
  4191. () => [props.include, props.exclude],
  4192. ([include, exclude]) => {
  4193. include && pruneCache((name) => matches(include, name));
  4194. exclude && pruneCache((name) => !matches(exclude, name));
  4195. },
  4196. // prune post-render after `current` has been updated
  4197. { flush: "post", deep: true }
  4198. );
  4199. let pendingCacheKey = null;
  4200. const cacheSubtree = () => {
  4201. if (pendingCacheKey != null) {
  4202. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  4203. }
  4204. };
  4205. onMounted(cacheSubtree);
  4206. onUpdated(cacheSubtree);
  4207. onBeforeUnmount(() => {
  4208. cache.forEach((cached) => {
  4209. const { subTree, suspense } = instance;
  4210. const vnode = getInnerChild(subTree);
  4211. if (cached.type === vnode.type && cached.key === vnode.key) {
  4212. resetShapeFlag(vnode);
  4213. const da = vnode.component.da;
  4214. da && queuePostRenderEffect(da, suspense);
  4215. return;
  4216. }
  4217. unmount(cached);
  4218. });
  4219. });
  4220. return () => {
  4221. pendingCacheKey = null;
  4222. if (!slots.default) {
  4223. return null;
  4224. }
  4225. const children = slots.default();
  4226. const rawVNode = children[0];
  4227. if (children.length > 1) {
  4228. {
  4229. warn$1(`KeepAlive should contain exactly one component child.`);
  4230. }
  4231. current = null;
  4232. return children;
  4233. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  4234. current = null;
  4235. return rawVNode;
  4236. }
  4237. let vnode = getInnerChild(rawVNode);
  4238. const comp = vnode.type;
  4239. const name = getComponentName(
  4240. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  4241. );
  4242. const { include, exclude, max } = props;
  4243. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  4244. current = vnode;
  4245. return rawVNode;
  4246. }
  4247. const key = vnode.key == null ? comp : vnode.key;
  4248. const cachedVNode = cache.get(key);
  4249. if (vnode.el) {
  4250. vnode = cloneVNode(vnode);
  4251. if (rawVNode.shapeFlag & 128) {
  4252. rawVNode.ssContent = vnode;
  4253. }
  4254. }
  4255. pendingCacheKey = key;
  4256. if (cachedVNode) {
  4257. vnode.el = cachedVNode.el;
  4258. vnode.component = cachedVNode.component;
  4259. if (vnode.transition) {
  4260. setTransitionHooks(vnode, vnode.transition);
  4261. }
  4262. vnode.shapeFlag |= 512;
  4263. keys.delete(key);
  4264. keys.add(key);
  4265. } else {
  4266. keys.add(key);
  4267. if (max && keys.size > parseInt(max, 10)) {
  4268. pruneCacheEntry(keys.values().next().value);
  4269. }
  4270. }
  4271. vnode.shapeFlag |= 256;
  4272. current = vnode;
  4273. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  4274. };
  4275. }
  4276. };
  4277. const KeepAlive = KeepAliveImpl;
  4278. function matches(pattern, name) {
  4279. if (isArray(pattern)) {
  4280. return pattern.some((p) => matches(p, name));
  4281. } else if (isString(pattern)) {
  4282. return pattern.split(",").includes(name);
  4283. } else if (isRegExp(pattern)) {
  4284. return pattern.test(name);
  4285. }
  4286. return false;
  4287. }
  4288. function onActivated(hook, target) {
  4289. registerKeepAliveHook(hook, "a", target);
  4290. }
  4291. function onDeactivated(hook, target) {
  4292. registerKeepAliveHook(hook, "da", target);
  4293. }
  4294. function registerKeepAliveHook(hook, type, target = currentInstance) {
  4295. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  4296. let current = target;
  4297. while (current) {
  4298. if (current.isDeactivated) {
  4299. return;
  4300. }
  4301. current = current.parent;
  4302. }
  4303. return hook();
  4304. });
  4305. injectHook(type, wrappedHook, target);
  4306. if (target) {
  4307. let current = target.parent;
  4308. while (current && current.parent) {
  4309. if (isKeepAlive(current.parent.vnode)) {
  4310. injectToKeepAliveRoot(wrappedHook, type, target, current);
  4311. }
  4312. current = current.parent;
  4313. }
  4314. }
  4315. }
  4316. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  4317. const injected = injectHook(
  4318. type,
  4319. hook,
  4320. keepAliveRoot,
  4321. true
  4322. /* prepend */
  4323. );
  4324. onUnmounted(() => {
  4325. remove(keepAliveRoot[type], injected);
  4326. }, target);
  4327. }
  4328. function resetShapeFlag(vnode) {
  4329. vnode.shapeFlag &= ~256;
  4330. vnode.shapeFlag &= ~512;
  4331. }
  4332. function getInnerChild(vnode) {
  4333. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  4334. }
  4335. function injectHook(type, hook, target = currentInstance, prepend = false) {
  4336. if (target) {
  4337. const hooks = target[type] || (target[type] = []);
  4338. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  4339. if (target.isUnmounted) {
  4340. return;
  4341. }
  4342. pauseTracking();
  4343. const reset = setCurrentInstance(target);
  4344. const res = callWithAsyncErrorHandling(hook, target, type, args);
  4345. reset();
  4346. resetTracking();
  4347. return res;
  4348. });
  4349. if (prepend) {
  4350. hooks.unshift(wrappedHook);
  4351. } else {
  4352. hooks.push(wrappedHook);
  4353. }
  4354. return wrappedHook;
  4355. } else {
  4356. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  4357. warn$1(
  4358. `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
  4359. );
  4360. }
  4361. }
  4362. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  4363. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4364. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4365. );
  4366. const onBeforeMount = createHook("bm");
  4367. const onMounted = createHook("m");
  4368. const onBeforeUpdate = createHook("bu");
  4369. const onUpdated = createHook("u");
  4370. const onBeforeUnmount = createHook("bum");
  4371. const onUnmounted = createHook("um");
  4372. const onServerPrefetch = createHook("sp");
  4373. const onRenderTriggered = createHook(
  4374. "rtg"
  4375. );
  4376. const onRenderTracked = createHook(
  4377. "rtc"
  4378. );
  4379. function onErrorCaptured(hook, target = currentInstance) {
  4380. injectHook("ec", hook, target);
  4381. }
  4382. function renderList(source, renderItem, cache, index) {
  4383. let ret;
  4384. const cached = cache && cache[index];
  4385. if (isArray(source) || isString(source)) {
  4386. ret = new Array(source.length);
  4387. for (let i = 0, l = source.length; i < l; i++) {
  4388. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  4389. }
  4390. } else if (typeof source === "number") {
  4391. if (!Number.isInteger(source)) {
  4392. warn$1(`The v-for range expect an integer value but got ${source}.`);
  4393. }
  4394. ret = new Array(source);
  4395. for (let i = 0; i < source; i++) {
  4396. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  4397. }
  4398. } else if (isObject(source)) {
  4399. if (source[Symbol.iterator]) {
  4400. ret = Array.from(
  4401. source,
  4402. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  4403. );
  4404. } else {
  4405. const keys = Object.keys(source);
  4406. ret = new Array(keys.length);
  4407. for (let i = 0, l = keys.length; i < l; i++) {
  4408. const key = keys[i];
  4409. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  4410. }
  4411. }
  4412. } else {
  4413. ret = [];
  4414. }
  4415. if (cache) {
  4416. cache[index] = ret;
  4417. }
  4418. return ret;
  4419. }
  4420. function createSlots(slots, dynamicSlots) {
  4421. for (let i = 0; i < dynamicSlots.length; i++) {
  4422. const slot = dynamicSlots[i];
  4423. if (isArray(slot)) {
  4424. for (let j = 0; j < slot.length; j++) {
  4425. slots[slot[j].name] = slot[j].fn;
  4426. }
  4427. } else if (slot) {
  4428. slots[slot.name] = slot.key ? (...args) => {
  4429. const res = slot.fn(...args);
  4430. if (res)
  4431. res.key = slot.key;
  4432. return res;
  4433. } : slot.fn;
  4434. }
  4435. }
  4436. return slots;
  4437. }
  4438. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  4439. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4440. if (name !== "default")
  4441. props.name = name;
  4442. return createVNode("slot", props, fallback && fallback());
  4443. }
  4444. let slot = slots[name];
  4445. if (slot && slot.length > 1) {
  4446. warn$1(
  4447. `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
  4448. );
  4449. slot = () => [];
  4450. }
  4451. if (slot && slot._c) {
  4452. slot._d = false;
  4453. }
  4454. openBlock();
  4455. const validSlotContent = slot && ensureValidVNode(slot(props));
  4456. const rendered = createBlock(
  4457. Fragment,
  4458. {
  4459. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  4460. // key attached in the `createSlots` helper, respect that
  4461. validSlotContent && validSlotContent.key || `_${name}`
  4462. },
  4463. validSlotContent || (fallback ? fallback() : []),
  4464. validSlotContent && slots._ === 1 ? 64 : -2
  4465. );
  4466. if (!noSlotted && rendered.scopeId) {
  4467. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  4468. }
  4469. if (slot && slot._c) {
  4470. slot._d = true;
  4471. }
  4472. return rendered;
  4473. }
  4474. function ensureValidVNode(vnodes) {
  4475. return vnodes.some((child) => {
  4476. if (!isVNode(child))
  4477. return true;
  4478. if (child.type === Comment)
  4479. return false;
  4480. if (child.type === Fragment && !ensureValidVNode(child.children))
  4481. return false;
  4482. return true;
  4483. }) ? vnodes : null;
  4484. }
  4485. function toHandlers(obj, preserveCaseIfNecessary) {
  4486. const ret = {};
  4487. if (!isObject(obj)) {
  4488. warn$1(`v-on with no argument expects an object value.`);
  4489. return ret;
  4490. }
  4491. for (const key in obj) {
  4492. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  4493. }
  4494. return ret;
  4495. }
  4496. const getPublicInstance = (i) => {
  4497. if (!i)
  4498. return null;
  4499. if (isStatefulComponent(i))
  4500. return getExposeProxy(i) || i.proxy;
  4501. return getPublicInstance(i.parent);
  4502. };
  4503. const publicPropertiesMap = (
  4504. // Move PURE marker to new line to workaround compiler discarding it
  4505. // due to type annotation
  4506. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4507. $: (i) => i,
  4508. $el: (i) => i.vnode.el,
  4509. $data: (i) => i.data,
  4510. $props: (i) => shallowReadonly(i.props) ,
  4511. $attrs: (i) => shallowReadonly(i.attrs) ,
  4512. $slots: (i) => shallowReadonly(i.slots) ,
  4513. $refs: (i) => shallowReadonly(i.refs) ,
  4514. $parent: (i) => getPublicInstance(i.parent),
  4515. $root: (i) => getPublicInstance(i.root),
  4516. $emit: (i) => i.emit,
  4517. $options: (i) => resolveMergedOptions(i) ,
  4518. $forceUpdate: (i) => i.f || (i.f = () => {
  4519. i.effect.dirty = true;
  4520. queueJob(i.update);
  4521. }),
  4522. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  4523. $watch: (i) => instanceWatch.bind(i)
  4524. })
  4525. );
  4526. const isReservedPrefix = (key) => key === "_" || key === "$";
  4527. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4528. const PublicInstanceProxyHandlers = {
  4529. get({ _: instance }, key) {
  4530. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  4531. if (key === "__isVue") {
  4532. return true;
  4533. }
  4534. let normalizedProps;
  4535. if (key[0] !== "$") {
  4536. const n = accessCache[key];
  4537. if (n !== void 0) {
  4538. switch (n) {
  4539. case 1 /* SETUP */:
  4540. return setupState[key];
  4541. case 2 /* DATA */:
  4542. return data[key];
  4543. case 4 /* CONTEXT */:
  4544. return ctx[key];
  4545. case 3 /* PROPS */:
  4546. return props[key];
  4547. }
  4548. } else if (hasSetupBinding(setupState, key)) {
  4549. accessCache[key] = 1 /* SETUP */;
  4550. return setupState[key];
  4551. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4552. accessCache[key] = 2 /* DATA */;
  4553. return data[key];
  4554. } else if (
  4555. // only cache other properties when instance has declared (thus stable)
  4556. // props
  4557. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  4558. ) {
  4559. accessCache[key] = 3 /* PROPS */;
  4560. return props[key];
  4561. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4562. accessCache[key] = 4 /* CONTEXT */;
  4563. return ctx[key];
  4564. } else if (shouldCacheAccess) {
  4565. accessCache[key] = 0 /* OTHER */;
  4566. }
  4567. }
  4568. const publicGetter = publicPropertiesMap[key];
  4569. let cssModule, globalProperties;
  4570. if (publicGetter) {
  4571. if (key === "$attrs") {
  4572. track(instance, "get", key);
  4573. markAttrsAccessed();
  4574. } else if (key === "$slots") {
  4575. track(instance, "get", key);
  4576. }
  4577. return publicGetter(instance);
  4578. } else if (
  4579. // css module (injected by vue-loader)
  4580. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4581. ) {
  4582. return cssModule;
  4583. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4584. accessCache[key] = 4 /* CONTEXT */;
  4585. return ctx[key];
  4586. } else if (
  4587. // global properties
  4588. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  4589. ) {
  4590. {
  4591. return globalProperties[key];
  4592. }
  4593. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4594. // to infinite warning loop
  4595. key.indexOf("__v") !== 0)) {
  4596. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4597. warn$1(
  4598. `Property ${JSON.stringify(
  4599. key
  4600. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4601. );
  4602. } else if (instance === currentRenderingInstance) {
  4603. warn$1(
  4604. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4605. );
  4606. }
  4607. }
  4608. },
  4609. set({ _: instance }, key, value) {
  4610. const { data, setupState, ctx } = instance;
  4611. if (hasSetupBinding(setupState, key)) {
  4612. setupState[key] = value;
  4613. return true;
  4614. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4615. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4616. return false;
  4617. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4618. data[key] = value;
  4619. return true;
  4620. } else if (hasOwn(instance.props, key)) {
  4621. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  4622. return false;
  4623. }
  4624. if (key[0] === "$" && key.slice(1) in instance) {
  4625. warn$1(
  4626. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4627. );
  4628. return false;
  4629. } else {
  4630. if (key in instance.appContext.config.globalProperties) {
  4631. Object.defineProperty(ctx, key, {
  4632. enumerable: true,
  4633. configurable: true,
  4634. value
  4635. });
  4636. } else {
  4637. ctx[key] = value;
  4638. }
  4639. }
  4640. return true;
  4641. },
  4642. has({
  4643. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  4644. }, key) {
  4645. let normalizedProps;
  4646. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  4647. },
  4648. defineProperty(target, key, descriptor) {
  4649. if (descriptor.get != null) {
  4650. target._.accessCache[key] = 0;
  4651. } else if (hasOwn(descriptor, "value")) {
  4652. this.set(target, key, descriptor.value, null);
  4653. }
  4654. return Reflect.defineProperty(target, key, descriptor);
  4655. }
  4656. };
  4657. {
  4658. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4659. warn$1(
  4660. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4661. );
  4662. return Reflect.ownKeys(target);
  4663. };
  4664. }
  4665. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  4666. {},
  4667. PublicInstanceProxyHandlers,
  4668. {
  4669. get(target, key) {
  4670. if (key === Symbol.unscopables) {
  4671. return;
  4672. }
  4673. return PublicInstanceProxyHandlers.get(target, key, target);
  4674. },
  4675. has(_, key) {
  4676. const has = key[0] !== "_" && !isGloballyAllowed(key);
  4677. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4678. warn$1(
  4679. `Property ${JSON.stringify(
  4680. key
  4681. )} should not start with _ which is a reserved prefix for Vue internals.`
  4682. );
  4683. }
  4684. return has;
  4685. }
  4686. }
  4687. );
  4688. function createDevRenderContext(instance) {
  4689. const target = {};
  4690. Object.defineProperty(target, `_`, {
  4691. configurable: true,
  4692. enumerable: false,
  4693. get: () => instance
  4694. });
  4695. Object.keys(publicPropertiesMap).forEach((key) => {
  4696. Object.defineProperty(target, key, {
  4697. configurable: true,
  4698. enumerable: false,
  4699. get: () => publicPropertiesMap[key](instance),
  4700. // intercepted by the proxy so no need for implementation,
  4701. // but needed to prevent set errors
  4702. set: NOOP
  4703. });
  4704. });
  4705. return target;
  4706. }
  4707. function exposePropsOnRenderContext(instance) {
  4708. const {
  4709. ctx,
  4710. propsOptions: [propsOptions]
  4711. } = instance;
  4712. if (propsOptions) {
  4713. Object.keys(propsOptions).forEach((key) => {
  4714. Object.defineProperty(ctx, key, {
  4715. enumerable: true,
  4716. configurable: true,
  4717. get: () => instance.props[key],
  4718. set: NOOP
  4719. });
  4720. });
  4721. }
  4722. }
  4723. function exposeSetupStateOnRenderContext(instance) {
  4724. const { ctx, setupState } = instance;
  4725. Object.keys(toRaw(setupState)).forEach((key) => {
  4726. if (!setupState.__isScriptSetup) {
  4727. if (isReservedPrefix(key[0])) {
  4728. warn$1(
  4729. `setup() return property ${JSON.stringify(
  4730. key
  4731. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4732. );
  4733. return;
  4734. }
  4735. Object.defineProperty(ctx, key, {
  4736. enumerable: true,
  4737. configurable: true,
  4738. get: () => setupState[key],
  4739. set: NOOP
  4740. });
  4741. }
  4742. });
  4743. }
  4744. const warnRuntimeUsage = (method) => warn$1(
  4745. `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
  4746. );
  4747. function defineProps() {
  4748. {
  4749. warnRuntimeUsage(`defineProps`);
  4750. }
  4751. return null;
  4752. }
  4753. function defineEmits() {
  4754. {
  4755. warnRuntimeUsage(`defineEmits`);
  4756. }
  4757. return null;
  4758. }
  4759. function defineExpose(exposed) {
  4760. {
  4761. warnRuntimeUsage(`defineExpose`);
  4762. }
  4763. }
  4764. function defineOptions(options) {
  4765. {
  4766. warnRuntimeUsage(`defineOptions`);
  4767. }
  4768. }
  4769. function defineSlots() {
  4770. {
  4771. warnRuntimeUsage(`defineSlots`);
  4772. }
  4773. return null;
  4774. }
  4775. function defineModel() {
  4776. {
  4777. warnRuntimeUsage("defineModel");
  4778. }
  4779. }
  4780. function withDefaults(props, defaults) {
  4781. {
  4782. warnRuntimeUsage(`withDefaults`);
  4783. }
  4784. return null;
  4785. }
  4786. function useSlots() {
  4787. return getContext().slots;
  4788. }
  4789. function useAttrs() {
  4790. return getContext().attrs;
  4791. }
  4792. function getContext() {
  4793. const i = getCurrentInstance();
  4794. if (!i) {
  4795. warn$1(`useContext() called without active instance.`);
  4796. }
  4797. return i.setupContext || (i.setupContext = createSetupContext(i));
  4798. }
  4799. function normalizePropsOrEmits(props) {
  4800. return isArray(props) ? props.reduce(
  4801. (normalized, p) => (normalized[p] = null, normalized),
  4802. {}
  4803. ) : props;
  4804. }
  4805. function mergeDefaults(raw, defaults) {
  4806. const props = normalizePropsOrEmits(raw);
  4807. for (const key in defaults) {
  4808. if (key.startsWith("__skip"))
  4809. continue;
  4810. let opt = props[key];
  4811. if (opt) {
  4812. if (isArray(opt) || isFunction(opt)) {
  4813. opt = props[key] = { type: opt, default: defaults[key] };
  4814. } else {
  4815. opt.default = defaults[key];
  4816. }
  4817. } else if (opt === null) {
  4818. opt = props[key] = { default: defaults[key] };
  4819. } else {
  4820. warn$1(`props default key "${key}" has no corresponding declaration.`);
  4821. }
  4822. if (opt && defaults[`__skip_${key}`]) {
  4823. opt.skipFactory = true;
  4824. }
  4825. }
  4826. return props;
  4827. }
  4828. function mergeModels(a, b) {
  4829. if (!a || !b)
  4830. return a || b;
  4831. if (isArray(a) && isArray(b))
  4832. return a.concat(b);
  4833. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  4834. }
  4835. function createPropsRestProxy(props, excludedKeys) {
  4836. const ret = {};
  4837. for (const key in props) {
  4838. if (!excludedKeys.includes(key)) {
  4839. Object.defineProperty(ret, key, {
  4840. enumerable: true,
  4841. get: () => props[key]
  4842. });
  4843. }
  4844. }
  4845. return ret;
  4846. }
  4847. function withAsyncContext(getAwaitable) {
  4848. const ctx = getCurrentInstance();
  4849. if (!ctx) {
  4850. warn$1(
  4851. `withAsyncContext called without active current instance. This is likely a bug.`
  4852. );
  4853. }
  4854. let awaitable = getAwaitable();
  4855. unsetCurrentInstance();
  4856. if (isPromise(awaitable)) {
  4857. awaitable = awaitable.catch((e) => {
  4858. setCurrentInstance(ctx);
  4859. throw e;
  4860. });
  4861. }
  4862. return [awaitable, () => setCurrentInstance(ctx)];
  4863. }
  4864. function createDuplicateChecker() {
  4865. const cache = /* @__PURE__ */ Object.create(null);
  4866. return (type, key) => {
  4867. if (cache[key]) {
  4868. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4869. } else {
  4870. cache[key] = type;
  4871. }
  4872. };
  4873. }
  4874. let shouldCacheAccess = true;
  4875. function applyOptions(instance) {
  4876. const options = resolveMergedOptions(instance);
  4877. const publicThis = instance.proxy;
  4878. const ctx = instance.ctx;
  4879. shouldCacheAccess = false;
  4880. if (options.beforeCreate) {
  4881. callHook$1(options.beforeCreate, instance, "bc");
  4882. }
  4883. const {
  4884. // state
  4885. data: dataOptions,
  4886. computed: computedOptions,
  4887. methods,
  4888. watch: watchOptions,
  4889. provide: provideOptions,
  4890. inject: injectOptions,
  4891. // lifecycle
  4892. created,
  4893. beforeMount,
  4894. mounted,
  4895. beforeUpdate,
  4896. updated,
  4897. activated,
  4898. deactivated,
  4899. beforeDestroy,
  4900. beforeUnmount,
  4901. destroyed,
  4902. unmounted,
  4903. render,
  4904. renderTracked,
  4905. renderTriggered,
  4906. errorCaptured,
  4907. serverPrefetch,
  4908. // public API
  4909. expose,
  4910. inheritAttrs,
  4911. // assets
  4912. components,
  4913. directives,
  4914. filters
  4915. } = options;
  4916. const checkDuplicateProperties = createDuplicateChecker() ;
  4917. {
  4918. const [propsOptions] = instance.propsOptions;
  4919. if (propsOptions) {
  4920. for (const key in propsOptions) {
  4921. checkDuplicateProperties("Props" /* PROPS */, key);
  4922. }
  4923. }
  4924. }
  4925. if (injectOptions) {
  4926. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4927. }
  4928. if (methods) {
  4929. for (const key in methods) {
  4930. const methodHandler = methods[key];
  4931. if (isFunction(methodHandler)) {
  4932. {
  4933. Object.defineProperty(ctx, key, {
  4934. value: methodHandler.bind(publicThis),
  4935. configurable: true,
  4936. enumerable: true,
  4937. writable: true
  4938. });
  4939. }
  4940. {
  4941. checkDuplicateProperties("Methods" /* METHODS */, key);
  4942. }
  4943. } else {
  4944. warn$1(
  4945. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4946. );
  4947. }
  4948. }
  4949. }
  4950. if (dataOptions) {
  4951. if (!isFunction(dataOptions)) {
  4952. warn$1(
  4953. `The data option must be a function. Plain object usage is no longer supported.`
  4954. );
  4955. }
  4956. const data = dataOptions.call(publicThis, publicThis);
  4957. if (isPromise(data)) {
  4958. warn$1(
  4959. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4960. );
  4961. }
  4962. if (!isObject(data)) {
  4963. warn$1(`data() should return an object.`);
  4964. } else {
  4965. instance.data = reactive(data);
  4966. {
  4967. for (const key in data) {
  4968. checkDuplicateProperties("Data" /* DATA */, key);
  4969. if (!isReservedPrefix(key[0])) {
  4970. Object.defineProperty(ctx, key, {
  4971. configurable: true,
  4972. enumerable: true,
  4973. get: () => data[key],
  4974. set: NOOP
  4975. });
  4976. }
  4977. }
  4978. }
  4979. }
  4980. }
  4981. shouldCacheAccess = true;
  4982. if (computedOptions) {
  4983. for (const key in computedOptions) {
  4984. const opt = computedOptions[key];
  4985. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4986. if (get === NOOP) {
  4987. warn$1(`Computed property "${key}" has no getter.`);
  4988. }
  4989. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4990. warn$1(
  4991. `Write operation failed: computed property "${key}" is readonly.`
  4992. );
  4993. } ;
  4994. const c = computed({
  4995. get,
  4996. set
  4997. });
  4998. Object.defineProperty(ctx, key, {
  4999. enumerable: true,
  5000. configurable: true,
  5001. get: () => c.value,
  5002. set: (v) => c.value = v
  5003. });
  5004. {
  5005. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  5006. }
  5007. }
  5008. }
  5009. if (watchOptions) {
  5010. for (const key in watchOptions) {
  5011. createWatcher(watchOptions[key], ctx, publicThis, key);
  5012. }
  5013. }
  5014. if (provideOptions) {
  5015. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  5016. Reflect.ownKeys(provides).forEach((key) => {
  5017. provide(key, provides[key]);
  5018. });
  5019. }
  5020. if (created) {
  5021. callHook$1(created, instance, "c");
  5022. }
  5023. function registerLifecycleHook(register, hook) {
  5024. if (isArray(hook)) {
  5025. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  5026. } else if (hook) {
  5027. register(hook.bind(publicThis));
  5028. }
  5029. }
  5030. registerLifecycleHook(onBeforeMount, beforeMount);
  5031. registerLifecycleHook(onMounted, mounted);
  5032. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  5033. registerLifecycleHook(onUpdated, updated);
  5034. registerLifecycleHook(onActivated, activated);
  5035. registerLifecycleHook(onDeactivated, deactivated);
  5036. registerLifecycleHook(onErrorCaptured, errorCaptured);
  5037. registerLifecycleHook(onRenderTracked, renderTracked);
  5038. registerLifecycleHook(onRenderTriggered, renderTriggered);
  5039. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  5040. registerLifecycleHook(onUnmounted, unmounted);
  5041. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  5042. if (isArray(expose)) {
  5043. if (expose.length) {
  5044. const exposed = instance.exposed || (instance.exposed = {});
  5045. expose.forEach((key) => {
  5046. Object.defineProperty(exposed, key, {
  5047. get: () => publicThis[key],
  5048. set: (val) => publicThis[key] = val
  5049. });
  5050. });
  5051. } else if (!instance.exposed) {
  5052. instance.exposed = {};
  5053. }
  5054. }
  5055. if (render && instance.render === NOOP) {
  5056. instance.render = render;
  5057. }
  5058. if (inheritAttrs != null) {
  5059. instance.inheritAttrs = inheritAttrs;
  5060. }
  5061. if (components)
  5062. instance.components = components;
  5063. if (directives)
  5064. instance.directives = directives;
  5065. }
  5066. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  5067. if (isArray(injectOptions)) {
  5068. injectOptions = normalizeInject(injectOptions);
  5069. }
  5070. for (const key in injectOptions) {
  5071. const opt = injectOptions[key];
  5072. let injected;
  5073. if (isObject(opt)) {
  5074. if ("default" in opt) {
  5075. injected = inject(
  5076. opt.from || key,
  5077. opt.default,
  5078. true
  5079. );
  5080. } else {
  5081. injected = inject(opt.from || key);
  5082. }
  5083. } else {
  5084. injected = inject(opt);
  5085. }
  5086. if (isRef(injected)) {
  5087. Object.defineProperty(ctx, key, {
  5088. enumerable: true,
  5089. configurable: true,
  5090. get: () => injected.value,
  5091. set: (v) => injected.value = v
  5092. });
  5093. } else {
  5094. ctx[key] = injected;
  5095. }
  5096. {
  5097. checkDuplicateProperties("Inject" /* INJECT */, key);
  5098. }
  5099. }
  5100. }
  5101. function callHook$1(hook, instance, type) {
  5102. callWithAsyncErrorHandling(
  5103. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  5104. instance,
  5105. type
  5106. );
  5107. }
  5108. function createWatcher(raw, ctx, publicThis, key) {
  5109. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  5110. if (isString(raw)) {
  5111. const handler = ctx[raw];
  5112. if (isFunction(handler)) {
  5113. watch(getter, handler);
  5114. } else {
  5115. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  5116. }
  5117. } else if (isFunction(raw)) {
  5118. watch(getter, raw.bind(publicThis));
  5119. } else if (isObject(raw)) {
  5120. if (isArray(raw)) {
  5121. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  5122. } else {
  5123. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  5124. if (isFunction(handler)) {
  5125. watch(getter, handler, raw);
  5126. } else {
  5127. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  5128. }
  5129. }
  5130. } else {
  5131. warn$1(`Invalid watch option: "${key}"`, raw);
  5132. }
  5133. }
  5134. function resolveMergedOptions(instance) {
  5135. const base = instance.type;
  5136. const { mixins, extends: extendsOptions } = base;
  5137. const {
  5138. mixins: globalMixins,
  5139. optionsCache: cache,
  5140. config: { optionMergeStrategies }
  5141. } = instance.appContext;
  5142. const cached = cache.get(base);
  5143. let resolved;
  5144. if (cached) {
  5145. resolved = cached;
  5146. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  5147. {
  5148. resolved = base;
  5149. }
  5150. } else {
  5151. resolved = {};
  5152. if (globalMixins.length) {
  5153. globalMixins.forEach(
  5154. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  5155. );
  5156. }
  5157. mergeOptions(resolved, base, optionMergeStrategies);
  5158. }
  5159. if (isObject(base)) {
  5160. cache.set(base, resolved);
  5161. }
  5162. return resolved;
  5163. }
  5164. function mergeOptions(to, from, strats, asMixin = false) {
  5165. const { mixins, extends: extendsOptions } = from;
  5166. if (extendsOptions) {
  5167. mergeOptions(to, extendsOptions, strats, true);
  5168. }
  5169. if (mixins) {
  5170. mixins.forEach(
  5171. (m) => mergeOptions(to, m, strats, true)
  5172. );
  5173. }
  5174. for (const key in from) {
  5175. if (asMixin && key === "expose") {
  5176. warn$1(
  5177. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  5178. );
  5179. } else {
  5180. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  5181. to[key] = strat ? strat(to[key], from[key]) : from[key];
  5182. }
  5183. }
  5184. return to;
  5185. }
  5186. const internalOptionMergeStrats = {
  5187. data: mergeDataFn,
  5188. props: mergeEmitsOrPropsOptions,
  5189. emits: mergeEmitsOrPropsOptions,
  5190. // objects
  5191. methods: mergeObjectOptions,
  5192. computed: mergeObjectOptions,
  5193. // lifecycle
  5194. beforeCreate: mergeAsArray$1,
  5195. created: mergeAsArray$1,
  5196. beforeMount: mergeAsArray$1,
  5197. mounted: mergeAsArray$1,
  5198. beforeUpdate: mergeAsArray$1,
  5199. updated: mergeAsArray$1,
  5200. beforeDestroy: mergeAsArray$1,
  5201. beforeUnmount: mergeAsArray$1,
  5202. destroyed: mergeAsArray$1,
  5203. unmounted: mergeAsArray$1,
  5204. activated: mergeAsArray$1,
  5205. deactivated: mergeAsArray$1,
  5206. errorCaptured: mergeAsArray$1,
  5207. serverPrefetch: mergeAsArray$1,
  5208. // assets
  5209. components: mergeObjectOptions,
  5210. directives: mergeObjectOptions,
  5211. // watch
  5212. watch: mergeWatchOptions,
  5213. // provide / inject
  5214. provide: mergeDataFn,
  5215. inject: mergeInject
  5216. };
  5217. function mergeDataFn(to, from) {
  5218. if (!from) {
  5219. return to;
  5220. }
  5221. if (!to) {
  5222. return from;
  5223. }
  5224. return function mergedDataFn() {
  5225. return (extend)(
  5226. isFunction(to) ? to.call(this, this) : to,
  5227. isFunction(from) ? from.call(this, this) : from
  5228. );
  5229. };
  5230. }
  5231. function mergeInject(to, from) {
  5232. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  5233. }
  5234. function normalizeInject(raw) {
  5235. if (isArray(raw)) {
  5236. const res = {};
  5237. for (let i = 0; i < raw.length; i++) {
  5238. res[raw[i]] = raw[i];
  5239. }
  5240. return res;
  5241. }
  5242. return raw;
  5243. }
  5244. function mergeAsArray$1(to, from) {
  5245. return to ? [...new Set([].concat(to, from))] : from;
  5246. }
  5247. function mergeObjectOptions(to, from) {
  5248. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  5249. }
  5250. function mergeEmitsOrPropsOptions(to, from) {
  5251. if (to) {
  5252. if (isArray(to) && isArray(from)) {
  5253. return [.../* @__PURE__ */ new Set([...to, ...from])];
  5254. }
  5255. return extend(
  5256. /* @__PURE__ */ Object.create(null),
  5257. normalizePropsOrEmits(to),
  5258. normalizePropsOrEmits(from != null ? from : {})
  5259. );
  5260. } else {
  5261. return from;
  5262. }
  5263. }
  5264. function mergeWatchOptions(to, from) {
  5265. if (!to)
  5266. return from;
  5267. if (!from)
  5268. return to;
  5269. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5270. for (const key in from) {
  5271. merged[key] = mergeAsArray$1(to[key], from[key]);
  5272. }
  5273. return merged;
  5274. }
  5275. function createAppContext() {
  5276. return {
  5277. app: null,
  5278. config: {
  5279. isNativeTag: NO,
  5280. performance: false,
  5281. globalProperties: {},
  5282. optionMergeStrategies: {},
  5283. errorHandler: void 0,
  5284. warnHandler: void 0,
  5285. compilerOptions: {}
  5286. },
  5287. mixins: [],
  5288. components: {},
  5289. directives: {},
  5290. provides: /* @__PURE__ */ Object.create(null),
  5291. optionsCache: /* @__PURE__ */ new WeakMap(),
  5292. propsCache: /* @__PURE__ */ new WeakMap(),
  5293. emitsCache: /* @__PURE__ */ new WeakMap()
  5294. };
  5295. }
  5296. let uid$1 = 0;
  5297. function createAppAPI(render, hydrate) {
  5298. return function createApp(rootComponent, rootProps = null) {
  5299. if (!isFunction(rootComponent)) {
  5300. rootComponent = extend({}, rootComponent);
  5301. }
  5302. if (rootProps != null && !isObject(rootProps)) {
  5303. warn$1(`root props passed to app.mount() must be an object.`);
  5304. rootProps = null;
  5305. }
  5306. const context = createAppContext();
  5307. const installedPlugins = /* @__PURE__ */ new WeakSet();
  5308. let isMounted = false;
  5309. const app = context.app = {
  5310. _uid: uid$1++,
  5311. _component: rootComponent,
  5312. _props: rootProps,
  5313. _container: null,
  5314. _context: context,
  5315. _instance: null,
  5316. version,
  5317. get config() {
  5318. return context.config;
  5319. },
  5320. set config(v) {
  5321. {
  5322. warn$1(
  5323. `app.config cannot be replaced. Modify individual options instead.`
  5324. );
  5325. }
  5326. },
  5327. use(plugin, ...options) {
  5328. if (installedPlugins.has(plugin)) {
  5329. warn$1(`Plugin has already been applied to target app.`);
  5330. } else if (plugin && isFunction(plugin.install)) {
  5331. installedPlugins.add(plugin);
  5332. plugin.install(app, ...options);
  5333. } else if (isFunction(plugin)) {
  5334. installedPlugins.add(plugin);
  5335. plugin(app, ...options);
  5336. } else {
  5337. warn$1(
  5338. `A plugin must either be a function or an object with an "install" function.`
  5339. );
  5340. }
  5341. return app;
  5342. },
  5343. mixin(mixin) {
  5344. {
  5345. if (!context.mixins.includes(mixin)) {
  5346. context.mixins.push(mixin);
  5347. } else {
  5348. warn$1(
  5349. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5350. );
  5351. }
  5352. }
  5353. return app;
  5354. },
  5355. component(name, component) {
  5356. {
  5357. validateComponentName(name, context.config);
  5358. }
  5359. if (!component) {
  5360. return context.components[name];
  5361. }
  5362. if (context.components[name]) {
  5363. warn$1(`Component "${name}" has already been registered in target app.`);
  5364. }
  5365. context.components[name] = component;
  5366. return app;
  5367. },
  5368. directive(name, directive) {
  5369. {
  5370. validateDirectiveName(name);
  5371. }
  5372. if (!directive) {
  5373. return context.directives[name];
  5374. }
  5375. if (context.directives[name]) {
  5376. warn$1(`Directive "${name}" has already been registered in target app.`);
  5377. }
  5378. context.directives[name] = directive;
  5379. return app;
  5380. },
  5381. mount(rootContainer, isHydrate, namespace) {
  5382. if (!isMounted) {
  5383. if (rootContainer.__vue_app__) {
  5384. warn$1(
  5385. `There is already an app instance mounted on the host container.
  5386. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  5387. );
  5388. }
  5389. const vnode = createVNode(rootComponent, rootProps);
  5390. vnode.appContext = context;
  5391. if (namespace === true) {
  5392. namespace = "svg";
  5393. } else if (namespace === false) {
  5394. namespace = void 0;
  5395. }
  5396. {
  5397. context.reload = () => {
  5398. render(
  5399. cloneVNode(vnode),
  5400. rootContainer,
  5401. namespace
  5402. );
  5403. };
  5404. }
  5405. if (isHydrate && hydrate) {
  5406. hydrate(vnode, rootContainer);
  5407. } else {
  5408. render(vnode, rootContainer, namespace);
  5409. }
  5410. isMounted = true;
  5411. app._container = rootContainer;
  5412. rootContainer.__vue_app__ = app;
  5413. {
  5414. app._instance = vnode.component;
  5415. devtoolsInitApp(app, version);
  5416. }
  5417. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5418. } else {
  5419. warn$1(
  5420. `App has already been mounted.
  5421. If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
  5422. );
  5423. }
  5424. },
  5425. unmount() {
  5426. if (isMounted) {
  5427. render(null, app._container);
  5428. {
  5429. app._instance = null;
  5430. devtoolsUnmountApp(app);
  5431. }
  5432. delete app._container.__vue_app__;
  5433. } else {
  5434. warn$1(`Cannot unmount an app that is not mounted.`);
  5435. }
  5436. },
  5437. provide(key, value) {
  5438. if (key in context.provides) {
  5439. warn$1(
  5440. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  5441. );
  5442. }
  5443. context.provides[key] = value;
  5444. return app;
  5445. },
  5446. runWithContext(fn) {
  5447. const lastApp = currentApp;
  5448. currentApp = app;
  5449. try {
  5450. return fn();
  5451. } finally {
  5452. currentApp = lastApp;
  5453. }
  5454. }
  5455. };
  5456. return app;
  5457. };
  5458. }
  5459. let currentApp = null;
  5460. function provide(key, value) {
  5461. if (!currentInstance) {
  5462. {
  5463. warn$1(`provide() can only be used inside setup().`);
  5464. }
  5465. } else {
  5466. let provides = currentInstance.provides;
  5467. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  5468. if (parentProvides === provides) {
  5469. provides = currentInstance.provides = Object.create(parentProvides);
  5470. }
  5471. provides[key] = value;
  5472. }
  5473. }
  5474. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  5475. const instance = currentInstance || currentRenderingInstance;
  5476. if (instance || currentApp) {
  5477. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  5478. if (provides && key in provides) {
  5479. return provides[key];
  5480. } else if (arguments.length > 1) {
  5481. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  5482. } else {
  5483. warn$1(`injection "${String(key)}" not found.`);
  5484. }
  5485. } else {
  5486. warn$1(`inject() can only be used inside setup() or functional components.`);
  5487. }
  5488. }
  5489. function hasInjectionContext() {
  5490. return !!(currentInstance || currentRenderingInstance || currentApp);
  5491. }
  5492. function initProps(instance, rawProps, isStateful, isSSR = false) {
  5493. const props = {};
  5494. const attrs = {};
  5495. def(attrs, InternalObjectKey, 1);
  5496. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5497. setFullProps(instance, rawProps, props, attrs);
  5498. for (const key in instance.propsOptions[0]) {
  5499. if (!(key in props)) {
  5500. props[key] = void 0;
  5501. }
  5502. }
  5503. {
  5504. validateProps(rawProps || {}, props, instance);
  5505. }
  5506. if (isStateful) {
  5507. instance.props = isSSR ? props : shallowReactive(props);
  5508. } else {
  5509. if (!instance.type.props) {
  5510. instance.props = attrs;
  5511. } else {
  5512. instance.props = props;
  5513. }
  5514. }
  5515. instance.attrs = attrs;
  5516. }
  5517. function isInHmrContext(instance) {
  5518. while (instance) {
  5519. if (instance.type.__hmrId)
  5520. return true;
  5521. instance = instance.parent;
  5522. }
  5523. }
  5524. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5525. const {
  5526. props,
  5527. attrs,
  5528. vnode: { patchFlag }
  5529. } = instance;
  5530. const rawCurrentProps = toRaw(props);
  5531. const [options] = instance.propsOptions;
  5532. let hasAttrsChanged = false;
  5533. if (
  5534. // always force full diff in dev
  5535. // - #1942 if hmr is enabled with sfc component
  5536. // - vite#872 non-sfc component used by sfc component
  5537. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5538. ) {
  5539. if (patchFlag & 8) {
  5540. const propsToUpdate = instance.vnode.dynamicProps;
  5541. for (let i = 0; i < propsToUpdate.length; i++) {
  5542. let key = propsToUpdate[i];
  5543. if (isEmitListener(instance.emitsOptions, key)) {
  5544. continue;
  5545. }
  5546. const value = rawProps[key];
  5547. if (options) {
  5548. if (hasOwn(attrs, key)) {
  5549. if (value !== attrs[key]) {
  5550. attrs[key] = value;
  5551. hasAttrsChanged = true;
  5552. }
  5553. } else {
  5554. const camelizedKey = camelize(key);
  5555. props[camelizedKey] = resolvePropValue(
  5556. options,
  5557. rawCurrentProps,
  5558. camelizedKey,
  5559. value,
  5560. instance,
  5561. false
  5562. );
  5563. }
  5564. } else {
  5565. if (value !== attrs[key]) {
  5566. attrs[key] = value;
  5567. hasAttrsChanged = true;
  5568. }
  5569. }
  5570. }
  5571. }
  5572. } else {
  5573. if (setFullProps(instance, rawProps, props, attrs)) {
  5574. hasAttrsChanged = true;
  5575. }
  5576. let kebabKey;
  5577. for (const key in rawCurrentProps) {
  5578. if (!rawProps || // for camelCase
  5579. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5580. // and converted to camelCase (#955)
  5581. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  5582. if (options) {
  5583. if (rawPrevProps && // for camelCase
  5584. (rawPrevProps[key] !== void 0 || // for kebab-case
  5585. rawPrevProps[kebabKey] !== void 0)) {
  5586. props[key] = resolvePropValue(
  5587. options,
  5588. rawCurrentProps,
  5589. key,
  5590. void 0,
  5591. instance,
  5592. true
  5593. );
  5594. }
  5595. } else {
  5596. delete props[key];
  5597. }
  5598. }
  5599. }
  5600. if (attrs !== rawCurrentProps) {
  5601. for (const key in attrs) {
  5602. if (!rawProps || !hasOwn(rawProps, key) && true) {
  5603. delete attrs[key];
  5604. hasAttrsChanged = true;
  5605. }
  5606. }
  5607. }
  5608. }
  5609. if (hasAttrsChanged) {
  5610. trigger(instance, "set", "$attrs");
  5611. }
  5612. {
  5613. validateProps(rawProps || {}, props, instance);
  5614. }
  5615. }
  5616. function setFullProps(instance, rawProps, props, attrs) {
  5617. const [options, needCastKeys] = instance.propsOptions;
  5618. let hasAttrsChanged = false;
  5619. let rawCastValues;
  5620. if (rawProps) {
  5621. for (let key in rawProps) {
  5622. if (isReservedProp(key)) {
  5623. continue;
  5624. }
  5625. const value = rawProps[key];
  5626. let camelKey;
  5627. if (options && hasOwn(options, camelKey = camelize(key))) {
  5628. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5629. props[camelKey] = value;
  5630. } else {
  5631. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5632. }
  5633. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5634. if (!(key in attrs) || value !== attrs[key]) {
  5635. attrs[key] = value;
  5636. hasAttrsChanged = true;
  5637. }
  5638. }
  5639. }
  5640. }
  5641. if (needCastKeys) {
  5642. const rawCurrentProps = toRaw(props);
  5643. const castValues = rawCastValues || EMPTY_OBJ;
  5644. for (let i = 0; i < needCastKeys.length; i++) {
  5645. const key = needCastKeys[i];
  5646. props[key] = resolvePropValue(
  5647. options,
  5648. rawCurrentProps,
  5649. key,
  5650. castValues[key],
  5651. instance,
  5652. !hasOwn(castValues, key)
  5653. );
  5654. }
  5655. }
  5656. return hasAttrsChanged;
  5657. }
  5658. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5659. const opt = options[key];
  5660. if (opt != null) {
  5661. const hasDefault = hasOwn(opt, "default");
  5662. if (hasDefault && value === void 0) {
  5663. const defaultValue = opt.default;
  5664. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5665. const { propsDefaults } = instance;
  5666. if (key in propsDefaults) {
  5667. value = propsDefaults[key];
  5668. } else {
  5669. const reset = setCurrentInstance(instance);
  5670. value = propsDefaults[key] = defaultValue.call(
  5671. null,
  5672. props
  5673. );
  5674. reset();
  5675. }
  5676. } else {
  5677. value = defaultValue;
  5678. }
  5679. }
  5680. if (opt[0 /* shouldCast */]) {
  5681. if (isAbsent && !hasDefault) {
  5682. value = false;
  5683. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  5684. value = true;
  5685. }
  5686. }
  5687. }
  5688. return value;
  5689. }
  5690. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5691. const cache = appContext.propsCache;
  5692. const cached = cache.get(comp);
  5693. if (cached) {
  5694. return cached;
  5695. }
  5696. const raw = comp.props;
  5697. const normalized = {};
  5698. const needCastKeys = [];
  5699. let hasExtends = false;
  5700. if (!isFunction(comp)) {
  5701. const extendProps = (raw2) => {
  5702. hasExtends = true;
  5703. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5704. extend(normalized, props);
  5705. if (keys)
  5706. needCastKeys.push(...keys);
  5707. };
  5708. if (!asMixin && appContext.mixins.length) {
  5709. appContext.mixins.forEach(extendProps);
  5710. }
  5711. if (comp.extends) {
  5712. extendProps(comp.extends);
  5713. }
  5714. if (comp.mixins) {
  5715. comp.mixins.forEach(extendProps);
  5716. }
  5717. }
  5718. if (!raw && !hasExtends) {
  5719. if (isObject(comp)) {
  5720. cache.set(comp, EMPTY_ARR);
  5721. }
  5722. return EMPTY_ARR;
  5723. }
  5724. if (isArray(raw)) {
  5725. for (let i = 0; i < raw.length; i++) {
  5726. if (!isString(raw[i])) {
  5727. warn$1(`props must be strings when using array syntax.`, raw[i]);
  5728. }
  5729. const normalizedKey = camelize(raw[i]);
  5730. if (validatePropName(normalizedKey)) {
  5731. normalized[normalizedKey] = EMPTY_OBJ;
  5732. }
  5733. }
  5734. } else if (raw) {
  5735. if (!isObject(raw)) {
  5736. warn$1(`invalid props options`, raw);
  5737. }
  5738. for (const key in raw) {
  5739. const normalizedKey = camelize(key);
  5740. if (validatePropName(normalizedKey)) {
  5741. const opt = raw[key];
  5742. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  5743. if (prop) {
  5744. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5745. const stringIndex = getTypeIndex(String, prop.type);
  5746. prop[0 /* shouldCast */] = booleanIndex > -1;
  5747. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5748. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  5749. needCastKeys.push(normalizedKey);
  5750. }
  5751. }
  5752. }
  5753. }
  5754. }
  5755. const res = [normalized, needCastKeys];
  5756. if (isObject(comp)) {
  5757. cache.set(comp, res);
  5758. }
  5759. return res;
  5760. }
  5761. function validatePropName(key) {
  5762. if (key[0] !== "$" && !isReservedProp(key)) {
  5763. return true;
  5764. } else {
  5765. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  5766. }
  5767. return false;
  5768. }
  5769. function getType(ctor) {
  5770. if (ctor === null) {
  5771. return "null";
  5772. }
  5773. if (typeof ctor === "function") {
  5774. return ctor.name || "";
  5775. } else if (typeof ctor === "object") {
  5776. const name = ctor.constructor && ctor.constructor.name;
  5777. return name || "";
  5778. }
  5779. return "";
  5780. }
  5781. function isSameType(a, b) {
  5782. return getType(a) === getType(b);
  5783. }
  5784. function getTypeIndex(type, expectedTypes) {
  5785. if (isArray(expectedTypes)) {
  5786. return expectedTypes.findIndex((t) => isSameType(t, type));
  5787. } else if (isFunction(expectedTypes)) {
  5788. return isSameType(expectedTypes, type) ? 0 : -1;
  5789. }
  5790. return -1;
  5791. }
  5792. function validateProps(rawProps, props, instance) {
  5793. const resolvedValues = toRaw(props);
  5794. const options = instance.propsOptions[0];
  5795. for (const key in options) {
  5796. let opt = options[key];
  5797. if (opt == null)
  5798. continue;
  5799. validateProp(
  5800. key,
  5801. resolvedValues[key],
  5802. opt,
  5803. shallowReadonly(resolvedValues) ,
  5804. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  5805. );
  5806. }
  5807. }
  5808. function validateProp(name, value, prop, props, isAbsent) {
  5809. const { type, required, validator, skipCheck } = prop;
  5810. if (required && isAbsent) {
  5811. warn$1('Missing required prop: "' + name + '"');
  5812. return;
  5813. }
  5814. if (value == null && !required) {
  5815. return;
  5816. }
  5817. if (type != null && type !== true && !skipCheck) {
  5818. let isValid = false;
  5819. const types = isArray(type) ? type : [type];
  5820. const expectedTypes = [];
  5821. for (let i = 0; i < types.length && !isValid; i++) {
  5822. const { valid, expectedType } = assertType(value, types[i]);
  5823. expectedTypes.push(expectedType || "");
  5824. isValid = valid;
  5825. }
  5826. if (!isValid) {
  5827. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  5828. return;
  5829. }
  5830. }
  5831. if (validator && !validator(value, props)) {
  5832. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  5833. }
  5834. }
  5835. const isSimpleType = /* @__PURE__ */ makeMap(
  5836. "String,Number,Boolean,Function,Symbol,BigInt"
  5837. );
  5838. function assertType(value, type) {
  5839. let valid;
  5840. const expectedType = getType(type);
  5841. if (isSimpleType(expectedType)) {
  5842. const t = typeof value;
  5843. valid = t === expectedType.toLowerCase();
  5844. if (!valid && t === "object") {
  5845. valid = value instanceof type;
  5846. }
  5847. } else if (expectedType === "Object") {
  5848. valid = isObject(value);
  5849. } else if (expectedType === "Array") {
  5850. valid = isArray(value);
  5851. } else if (expectedType === "null") {
  5852. valid = value === null;
  5853. } else {
  5854. valid = value instanceof type;
  5855. }
  5856. return {
  5857. valid,
  5858. expectedType
  5859. };
  5860. }
  5861. function getInvalidTypeMessage(name, value, expectedTypes) {
  5862. if (expectedTypes.length === 0) {
  5863. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  5864. }
  5865. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5866. const expectedType = expectedTypes[0];
  5867. const receivedType = toRawType(value);
  5868. const expectedValue = styleValue(value, expectedType);
  5869. const receivedValue = styleValue(value, receivedType);
  5870. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5871. message += ` with value ${expectedValue}`;
  5872. }
  5873. message += `, got ${receivedType} `;
  5874. if (isExplicable(receivedType)) {
  5875. message += `with value ${receivedValue}.`;
  5876. }
  5877. return message;
  5878. }
  5879. function styleValue(value, type) {
  5880. if (type === "String") {
  5881. return `"${value}"`;
  5882. } else if (type === "Number") {
  5883. return `${Number(value)}`;
  5884. } else {
  5885. return `${value}`;
  5886. }
  5887. }
  5888. function isExplicable(type) {
  5889. const explicitTypes = ["string", "number", "boolean"];
  5890. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5891. }
  5892. function isBoolean(...args) {
  5893. return args.some((elem) => elem.toLowerCase() === "boolean");
  5894. }
  5895. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  5896. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5897. const normalizeSlot = (key, rawSlot, ctx) => {
  5898. if (rawSlot._n) {
  5899. return rawSlot;
  5900. }
  5901. const normalized = withCtx((...args) => {
  5902. if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
  5903. warn$1(
  5904. `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
  5905. );
  5906. }
  5907. return normalizeSlotValue(rawSlot(...args));
  5908. }, ctx);
  5909. normalized._c = false;
  5910. return normalized;
  5911. };
  5912. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  5913. const ctx = rawSlots._ctx;
  5914. for (const key in rawSlots) {
  5915. if (isInternalKey(key))
  5916. continue;
  5917. const value = rawSlots[key];
  5918. if (isFunction(value)) {
  5919. slots[key] = normalizeSlot(key, value, ctx);
  5920. } else if (value != null) {
  5921. {
  5922. warn$1(
  5923. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  5924. );
  5925. }
  5926. const normalized = normalizeSlotValue(value);
  5927. slots[key] = () => normalized;
  5928. }
  5929. }
  5930. };
  5931. const normalizeVNodeSlots = (instance, children) => {
  5932. if (!isKeepAlive(instance.vnode) && true) {
  5933. warn$1(
  5934. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  5935. );
  5936. }
  5937. const normalized = normalizeSlotValue(children);
  5938. instance.slots.default = () => normalized;
  5939. };
  5940. const initSlots = (instance, children) => {
  5941. if (instance.vnode.shapeFlag & 32) {
  5942. const type = children._;
  5943. if (type) {
  5944. instance.slots = toRaw(children);
  5945. def(children, "_", type);
  5946. } else {
  5947. normalizeObjectSlots(
  5948. children,
  5949. instance.slots = {});
  5950. }
  5951. } else {
  5952. instance.slots = {};
  5953. if (children) {
  5954. normalizeVNodeSlots(instance, children);
  5955. }
  5956. }
  5957. def(instance.slots, InternalObjectKey, 1);
  5958. };
  5959. const updateSlots = (instance, children, optimized) => {
  5960. const { vnode, slots } = instance;
  5961. let needDeletionCheck = true;
  5962. let deletionComparisonTarget = EMPTY_OBJ;
  5963. if (vnode.shapeFlag & 32) {
  5964. const type = children._;
  5965. if (type) {
  5966. if (isHmrUpdating) {
  5967. extend(slots, children);
  5968. trigger(instance, "set", "$slots");
  5969. } else if (optimized && type === 1) {
  5970. needDeletionCheck = false;
  5971. } else {
  5972. extend(slots, children);
  5973. if (!optimized && type === 1) {
  5974. delete slots._;
  5975. }
  5976. }
  5977. } else {
  5978. needDeletionCheck = !children.$stable;
  5979. normalizeObjectSlots(children, slots);
  5980. }
  5981. deletionComparisonTarget = children;
  5982. } else if (children) {
  5983. normalizeVNodeSlots(instance, children);
  5984. deletionComparisonTarget = { default: 1 };
  5985. }
  5986. if (needDeletionCheck) {
  5987. for (const key in slots) {
  5988. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  5989. delete slots[key];
  5990. }
  5991. }
  5992. }
  5993. };
  5994. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  5995. if (isArray(rawRef)) {
  5996. rawRef.forEach(
  5997. (r, i) => setRef(
  5998. r,
  5999. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  6000. parentSuspense,
  6001. vnode,
  6002. isUnmount
  6003. )
  6004. );
  6005. return;
  6006. }
  6007. if (isAsyncWrapper(vnode) && !isUnmount) {
  6008. return;
  6009. }
  6010. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  6011. const value = isUnmount ? null : refValue;
  6012. const { i: owner, r: ref } = rawRef;
  6013. if (!owner) {
  6014. warn$1(
  6015. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  6016. );
  6017. return;
  6018. }
  6019. const oldRef = oldRawRef && oldRawRef.r;
  6020. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  6021. const setupState = owner.setupState;
  6022. if (oldRef != null && oldRef !== ref) {
  6023. if (isString(oldRef)) {
  6024. refs[oldRef] = null;
  6025. if (hasOwn(setupState, oldRef)) {
  6026. setupState[oldRef] = null;
  6027. }
  6028. } else if (isRef(oldRef)) {
  6029. oldRef.value = null;
  6030. }
  6031. }
  6032. if (isFunction(ref)) {
  6033. callWithErrorHandling(ref, owner, 12, [value, refs]);
  6034. } else {
  6035. const _isString = isString(ref);
  6036. const _isRef = isRef(ref);
  6037. if (_isString || _isRef) {
  6038. const doSet = () => {
  6039. if (rawRef.f) {
  6040. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  6041. if (isUnmount) {
  6042. isArray(existing) && remove(existing, refValue);
  6043. } else {
  6044. if (!isArray(existing)) {
  6045. if (_isString) {
  6046. refs[ref] = [refValue];
  6047. if (hasOwn(setupState, ref)) {
  6048. setupState[ref] = refs[ref];
  6049. }
  6050. } else {
  6051. ref.value = [refValue];
  6052. if (rawRef.k)
  6053. refs[rawRef.k] = ref.value;
  6054. }
  6055. } else if (!existing.includes(refValue)) {
  6056. existing.push(refValue);
  6057. }
  6058. }
  6059. } else if (_isString) {
  6060. refs[ref] = value;
  6061. if (hasOwn(setupState, ref)) {
  6062. setupState[ref] = value;
  6063. }
  6064. } else if (_isRef) {
  6065. ref.value = value;
  6066. if (rawRef.k)
  6067. refs[rawRef.k] = value;
  6068. } else {
  6069. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  6070. }
  6071. };
  6072. if (value) {
  6073. doSet.id = -1;
  6074. queuePostRenderEffect(doSet, parentSuspense);
  6075. } else {
  6076. doSet();
  6077. }
  6078. } else {
  6079. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  6080. }
  6081. }
  6082. }
  6083. let hasMismatch = false;
  6084. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  6085. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  6086. const getContainerType = (container) => {
  6087. if (isSVGContainer(container))
  6088. return "svg";
  6089. if (isMathMLContainer(container))
  6090. return "mathml";
  6091. return void 0;
  6092. };
  6093. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  6094. function createHydrationFunctions(rendererInternals) {
  6095. const {
  6096. mt: mountComponent,
  6097. p: patch,
  6098. o: {
  6099. patchProp,
  6100. createText,
  6101. nextSibling,
  6102. parentNode,
  6103. remove,
  6104. insert,
  6105. createComment
  6106. }
  6107. } = rendererInternals;
  6108. const hydrate = (vnode, container) => {
  6109. if (!container.hasChildNodes()) {
  6110. warn$1(
  6111. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  6112. );
  6113. patch(null, vnode, container);
  6114. flushPostFlushCbs();
  6115. container._vnode = vnode;
  6116. return;
  6117. }
  6118. hasMismatch = false;
  6119. hydrateNode(container.firstChild, vnode, null, null, null);
  6120. flushPostFlushCbs();
  6121. container._vnode = vnode;
  6122. if (hasMismatch && true) {
  6123. console.error(`Hydration completed but contains mismatches.`);
  6124. }
  6125. };
  6126. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  6127. const isFragmentStart = isComment(node) && node.data === "[";
  6128. const onMismatch = () => handleMismatch(
  6129. node,
  6130. vnode,
  6131. parentComponent,
  6132. parentSuspense,
  6133. slotScopeIds,
  6134. isFragmentStart
  6135. );
  6136. const { type, ref, shapeFlag, patchFlag } = vnode;
  6137. let domType = node.nodeType;
  6138. vnode.el = node;
  6139. {
  6140. if (!("__vnode" in node)) {
  6141. Object.defineProperty(node, "__vnode", {
  6142. value: vnode,
  6143. enumerable: false
  6144. });
  6145. }
  6146. if (!("__vueParentComponent" in node)) {
  6147. Object.defineProperty(node, "__vueParentComponent", {
  6148. value: parentComponent,
  6149. enumerable: false
  6150. });
  6151. }
  6152. }
  6153. if (patchFlag === -2) {
  6154. optimized = false;
  6155. vnode.dynamicChildren = null;
  6156. }
  6157. let nextNode = null;
  6158. switch (type) {
  6159. case Text:
  6160. if (domType !== 3 /* TEXT */) {
  6161. if (vnode.children === "") {
  6162. insert(vnode.el = createText(""), parentNode(node), node);
  6163. nextNode = node;
  6164. } else {
  6165. nextNode = onMismatch();
  6166. }
  6167. } else {
  6168. if (node.data !== vnode.children) {
  6169. hasMismatch = true;
  6170. warn$1(
  6171. `Hydration text mismatch in`,
  6172. node.parentNode,
  6173. `
  6174. - rendered on server: ${JSON.stringify(
  6175. node.data
  6176. )}
  6177. - expected on client: ${JSON.stringify(vnode.children)}`
  6178. );
  6179. node.data = vnode.children;
  6180. }
  6181. nextNode = nextSibling(node);
  6182. }
  6183. break;
  6184. case Comment:
  6185. if (isTemplateNode(node)) {
  6186. nextNode = nextSibling(node);
  6187. replaceNode(
  6188. vnode.el = node.content.firstChild,
  6189. node,
  6190. parentComponent
  6191. );
  6192. } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  6193. nextNode = onMismatch();
  6194. } else {
  6195. nextNode = nextSibling(node);
  6196. }
  6197. break;
  6198. case Static:
  6199. if (isFragmentStart) {
  6200. node = nextSibling(node);
  6201. domType = node.nodeType;
  6202. }
  6203. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  6204. nextNode = node;
  6205. const needToAdoptContent = !vnode.children.length;
  6206. for (let i = 0; i < vnode.staticCount; i++) {
  6207. if (needToAdoptContent)
  6208. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  6209. if (i === vnode.staticCount - 1) {
  6210. vnode.anchor = nextNode;
  6211. }
  6212. nextNode = nextSibling(nextNode);
  6213. }
  6214. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  6215. } else {
  6216. onMismatch();
  6217. }
  6218. break;
  6219. case Fragment:
  6220. if (!isFragmentStart) {
  6221. nextNode = onMismatch();
  6222. } else {
  6223. nextNode = hydrateFragment(
  6224. node,
  6225. vnode,
  6226. parentComponent,
  6227. parentSuspense,
  6228. slotScopeIds,
  6229. optimized
  6230. );
  6231. }
  6232. break;
  6233. default:
  6234. if (shapeFlag & 1) {
  6235. if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  6236. nextNode = onMismatch();
  6237. } else {
  6238. nextNode = hydrateElement(
  6239. node,
  6240. vnode,
  6241. parentComponent,
  6242. parentSuspense,
  6243. slotScopeIds,
  6244. optimized
  6245. );
  6246. }
  6247. } else if (shapeFlag & 6) {
  6248. vnode.slotScopeIds = slotScopeIds;
  6249. const container = parentNode(node);
  6250. if (isFragmentStart) {
  6251. nextNode = locateClosingAnchor(node);
  6252. } else if (isComment(node) && node.data === "teleport start") {
  6253. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  6254. } else {
  6255. nextNode = nextSibling(node);
  6256. }
  6257. mountComponent(
  6258. vnode,
  6259. container,
  6260. null,
  6261. parentComponent,
  6262. parentSuspense,
  6263. getContainerType(container),
  6264. optimized
  6265. );
  6266. if (isAsyncWrapper(vnode)) {
  6267. let subTree;
  6268. if (isFragmentStart) {
  6269. subTree = createVNode(Fragment);
  6270. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  6271. } else {
  6272. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  6273. }
  6274. subTree.el = node;
  6275. vnode.component.subTree = subTree;
  6276. }
  6277. } else if (shapeFlag & 64) {
  6278. if (domType !== 8 /* COMMENT */) {
  6279. nextNode = onMismatch();
  6280. } else {
  6281. nextNode = vnode.type.hydrate(
  6282. node,
  6283. vnode,
  6284. parentComponent,
  6285. parentSuspense,
  6286. slotScopeIds,
  6287. optimized,
  6288. rendererInternals,
  6289. hydrateChildren
  6290. );
  6291. }
  6292. } else if (shapeFlag & 128) {
  6293. nextNode = vnode.type.hydrate(
  6294. node,
  6295. vnode,
  6296. parentComponent,
  6297. parentSuspense,
  6298. getContainerType(parentNode(node)),
  6299. slotScopeIds,
  6300. optimized,
  6301. rendererInternals,
  6302. hydrateNode
  6303. );
  6304. } else {
  6305. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  6306. }
  6307. }
  6308. if (ref != null) {
  6309. setRef(ref, null, parentSuspense, vnode);
  6310. }
  6311. return nextNode;
  6312. };
  6313. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6314. optimized = optimized || !!vnode.dynamicChildren;
  6315. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  6316. const forcePatch = type === "input" || type === "option";
  6317. {
  6318. if (dirs) {
  6319. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6320. }
  6321. let needCallTransitionHooks = false;
  6322. if (isTemplateNode(el)) {
  6323. needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  6324. const content = el.content.firstChild;
  6325. if (needCallTransitionHooks) {
  6326. transition.beforeEnter(content);
  6327. }
  6328. replaceNode(content, el, parentComponent);
  6329. vnode.el = el = content;
  6330. }
  6331. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  6332. !(props && (props.innerHTML || props.textContent))) {
  6333. let next = hydrateChildren(
  6334. el.firstChild,
  6335. vnode,
  6336. el,
  6337. parentComponent,
  6338. parentSuspense,
  6339. slotScopeIds,
  6340. optimized
  6341. );
  6342. let hasWarned = false;
  6343. while (next) {
  6344. hasMismatch = true;
  6345. if (!hasWarned) {
  6346. warn$1(
  6347. `Hydration children mismatch on`,
  6348. el,
  6349. `
  6350. Server rendered element contains more child nodes than client vdom.`
  6351. );
  6352. hasWarned = true;
  6353. }
  6354. const cur = next;
  6355. next = next.nextSibling;
  6356. remove(cur);
  6357. }
  6358. } else if (shapeFlag & 8) {
  6359. if (el.textContent !== vnode.children) {
  6360. hasMismatch = true;
  6361. warn$1(
  6362. `Hydration text content mismatch on`,
  6363. el,
  6364. `
  6365. - rendered on server: ${el.textContent}
  6366. - expected on client: ${vnode.children}`
  6367. );
  6368. el.textContent = vnode.children;
  6369. }
  6370. }
  6371. if (props) {
  6372. {
  6373. for (const key in props) {
  6374. if (propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  6375. hasMismatch = true;
  6376. }
  6377. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  6378. key[0] === ".") {
  6379. patchProp(
  6380. el,
  6381. key,
  6382. null,
  6383. props[key],
  6384. void 0,
  6385. void 0,
  6386. parentComponent
  6387. );
  6388. }
  6389. }
  6390. }
  6391. }
  6392. let vnodeHooks;
  6393. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6394. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6395. }
  6396. if (dirs) {
  6397. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6398. }
  6399. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  6400. queueEffectWithSuspense(() => {
  6401. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6402. needCallTransitionHooks && transition.enter(el);
  6403. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6404. }, parentSuspense);
  6405. }
  6406. }
  6407. return el.nextSibling;
  6408. };
  6409. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6410. optimized = optimized || !!parentVNode.dynamicChildren;
  6411. const children = parentVNode.children;
  6412. const l = children.length;
  6413. let hasWarned = false;
  6414. for (let i = 0; i < l; i++) {
  6415. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6416. if (node) {
  6417. node = hydrateNode(
  6418. node,
  6419. vnode,
  6420. parentComponent,
  6421. parentSuspense,
  6422. slotScopeIds,
  6423. optimized
  6424. );
  6425. } else if (vnode.type === Text && !vnode.children) {
  6426. continue;
  6427. } else {
  6428. hasMismatch = true;
  6429. if (!hasWarned) {
  6430. warn$1(
  6431. `Hydration children mismatch on`,
  6432. container,
  6433. `
  6434. Server rendered element contains fewer child nodes than client vdom.`
  6435. );
  6436. hasWarned = true;
  6437. }
  6438. patch(
  6439. null,
  6440. vnode,
  6441. container,
  6442. null,
  6443. parentComponent,
  6444. parentSuspense,
  6445. getContainerType(container),
  6446. slotScopeIds
  6447. );
  6448. }
  6449. }
  6450. return node;
  6451. };
  6452. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6453. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  6454. if (fragmentSlotScopeIds) {
  6455. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6456. }
  6457. const container = parentNode(node);
  6458. const next = hydrateChildren(
  6459. nextSibling(node),
  6460. vnode,
  6461. container,
  6462. parentComponent,
  6463. parentSuspense,
  6464. slotScopeIds,
  6465. optimized
  6466. );
  6467. if (next && isComment(next) && next.data === "]") {
  6468. return nextSibling(vnode.anchor = next);
  6469. } else {
  6470. hasMismatch = true;
  6471. insert(vnode.anchor = createComment(`]`), container, next);
  6472. return next;
  6473. }
  6474. };
  6475. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6476. hasMismatch = true;
  6477. warn$1(
  6478. `Hydration node mismatch:
  6479. - rendered on server:`,
  6480. node,
  6481. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  6482. `
  6483. - expected on client:`,
  6484. vnode.type
  6485. );
  6486. vnode.el = null;
  6487. if (isFragment) {
  6488. const end = locateClosingAnchor(node);
  6489. while (true) {
  6490. const next2 = nextSibling(node);
  6491. if (next2 && next2 !== end) {
  6492. remove(next2);
  6493. } else {
  6494. break;
  6495. }
  6496. }
  6497. }
  6498. const next = nextSibling(node);
  6499. const container = parentNode(node);
  6500. remove(node);
  6501. patch(
  6502. null,
  6503. vnode,
  6504. container,
  6505. next,
  6506. parentComponent,
  6507. parentSuspense,
  6508. getContainerType(container),
  6509. slotScopeIds
  6510. );
  6511. return next;
  6512. };
  6513. const locateClosingAnchor = (node, open = "[", close = "]") => {
  6514. let match = 0;
  6515. while (node) {
  6516. node = nextSibling(node);
  6517. if (node && isComment(node)) {
  6518. if (node.data === open)
  6519. match++;
  6520. if (node.data === close) {
  6521. if (match === 0) {
  6522. return nextSibling(node);
  6523. } else {
  6524. match--;
  6525. }
  6526. }
  6527. }
  6528. }
  6529. return node;
  6530. };
  6531. const replaceNode = (newNode, oldNode, parentComponent) => {
  6532. const parentNode2 = oldNode.parentNode;
  6533. if (parentNode2) {
  6534. parentNode2.replaceChild(newNode, oldNode);
  6535. }
  6536. let parent = parentComponent;
  6537. while (parent) {
  6538. if (parent.vnode.el === oldNode) {
  6539. parent.vnode.el = parent.subTree.el = newNode;
  6540. }
  6541. parent = parent.parent;
  6542. }
  6543. };
  6544. const isTemplateNode = (node) => {
  6545. return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
  6546. };
  6547. return [hydrate, hydrateNode];
  6548. }
  6549. function propHasMismatch(el, key, clientValue, vnode, instance) {
  6550. var _a;
  6551. let mismatchType;
  6552. let mismatchKey;
  6553. let actual;
  6554. let expected;
  6555. if (key === "class") {
  6556. actual = el.getAttribute("class");
  6557. expected = normalizeClass(clientValue);
  6558. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  6559. mismatchType = mismatchKey = `class`;
  6560. }
  6561. } else if (key === "style") {
  6562. actual = el.getAttribute("style");
  6563. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  6564. const actualMap = toStyleMap(actual);
  6565. const expectedMap = toStyleMap(expected);
  6566. if (vnode.dirs) {
  6567. for (const { dir, value } of vnode.dirs) {
  6568. if (dir.name === "show" && !value) {
  6569. expectedMap.set("display", "none");
  6570. }
  6571. }
  6572. }
  6573. const root = instance == null ? void 0 : instance.subTree;
  6574. if (vnode === root || (root == null ? void 0 : root.type) === Fragment && root.children.includes(vnode)) {
  6575. const cssVars = (_a = instance == null ? void 0 : instance.getCssVars) == null ? void 0 : _a.call(instance);
  6576. for (const key2 in cssVars) {
  6577. expectedMap.set(`--${key2}`, String(cssVars[key2]));
  6578. }
  6579. }
  6580. if (!isMapEqual(actualMap, expectedMap)) {
  6581. mismatchType = mismatchKey = "style";
  6582. }
  6583. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  6584. if (isBooleanAttr(key)) {
  6585. actual = el.hasAttribute(key);
  6586. expected = includeBooleanAttr(clientValue);
  6587. } else if (clientValue == null) {
  6588. actual = el.hasAttribute(key);
  6589. expected = false;
  6590. } else {
  6591. if (el.hasAttribute(key)) {
  6592. actual = el.getAttribute(key);
  6593. } else if (key === "value" && el.tagName === "TEXTAREA") {
  6594. actual = el.value;
  6595. } else {
  6596. actual = false;
  6597. }
  6598. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  6599. }
  6600. if (actual !== expected) {
  6601. mismatchType = `attribute`;
  6602. mismatchKey = key;
  6603. }
  6604. }
  6605. if (mismatchType) {
  6606. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  6607. const preSegment = `Hydration ${mismatchType} mismatch on`;
  6608. const postSegment = `
  6609. - rendered on server: ${format(actual)}
  6610. - expected on client: ${format(expected)}
  6611. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  6612. You should fix the source of the mismatch.`;
  6613. {
  6614. warn$1(preSegment, el, postSegment);
  6615. }
  6616. return true;
  6617. }
  6618. return false;
  6619. }
  6620. function toClassSet(str) {
  6621. return new Set(str.trim().split(/\s+/));
  6622. }
  6623. function isSetEqual(a, b) {
  6624. if (a.size !== b.size) {
  6625. return false;
  6626. }
  6627. for (const s of a) {
  6628. if (!b.has(s)) {
  6629. return false;
  6630. }
  6631. }
  6632. return true;
  6633. }
  6634. function toStyleMap(str) {
  6635. const styleMap = /* @__PURE__ */ new Map();
  6636. for (const item of str.split(";")) {
  6637. let [key, value] = item.split(":");
  6638. key = key == null ? void 0 : key.trim();
  6639. value = value == null ? void 0 : value.trim();
  6640. if (key && value) {
  6641. styleMap.set(key, value);
  6642. }
  6643. }
  6644. return styleMap;
  6645. }
  6646. function isMapEqual(a, b) {
  6647. if (a.size !== b.size) {
  6648. return false;
  6649. }
  6650. for (const [key, value] of a) {
  6651. if (value !== b.get(key)) {
  6652. return false;
  6653. }
  6654. }
  6655. return true;
  6656. }
  6657. let supported;
  6658. let perf;
  6659. function startMeasure(instance, type) {
  6660. if (instance.appContext.config.performance && isSupported()) {
  6661. perf.mark(`vue-${type}-${instance.uid}`);
  6662. }
  6663. {
  6664. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6665. }
  6666. }
  6667. function endMeasure(instance, type) {
  6668. if (instance.appContext.config.performance && isSupported()) {
  6669. const startTag = `vue-${type}-${instance.uid}`;
  6670. const endTag = startTag + `:end`;
  6671. perf.mark(endTag);
  6672. perf.measure(
  6673. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6674. startTag,
  6675. endTag
  6676. );
  6677. perf.clearMarks(startTag);
  6678. perf.clearMarks(endTag);
  6679. }
  6680. {
  6681. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6682. }
  6683. }
  6684. function isSupported() {
  6685. if (supported !== void 0) {
  6686. return supported;
  6687. }
  6688. if (typeof window !== "undefined" && window.performance) {
  6689. supported = true;
  6690. perf = window.performance;
  6691. } else {
  6692. supported = false;
  6693. }
  6694. return supported;
  6695. }
  6696. const queuePostRenderEffect = queueEffectWithSuspense ;
  6697. function createRenderer(options) {
  6698. return baseCreateRenderer(options);
  6699. }
  6700. function createHydrationRenderer(options) {
  6701. return baseCreateRenderer(options, createHydrationFunctions);
  6702. }
  6703. function baseCreateRenderer(options, createHydrationFns) {
  6704. const target = getGlobalThis();
  6705. target.__VUE__ = true;
  6706. {
  6707. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6708. }
  6709. const {
  6710. insert: hostInsert,
  6711. remove: hostRemove,
  6712. patchProp: hostPatchProp,
  6713. createElement: hostCreateElement,
  6714. createText: hostCreateText,
  6715. createComment: hostCreateComment,
  6716. setText: hostSetText,
  6717. setElementText: hostSetElementText,
  6718. parentNode: hostParentNode,
  6719. nextSibling: hostNextSibling,
  6720. setScopeId: hostSetScopeId = NOOP,
  6721. insertStaticContent: hostInsertStaticContent
  6722. } = options;
  6723. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6724. if (n1 === n2) {
  6725. return;
  6726. }
  6727. if (n1 && !isSameVNodeType(n1, n2)) {
  6728. anchor = getNextHostNode(n1);
  6729. unmount(n1, parentComponent, parentSuspense, true);
  6730. n1 = null;
  6731. }
  6732. if (n2.patchFlag === -2) {
  6733. optimized = false;
  6734. n2.dynamicChildren = null;
  6735. }
  6736. const { type, ref, shapeFlag } = n2;
  6737. switch (type) {
  6738. case Text:
  6739. processText(n1, n2, container, anchor);
  6740. break;
  6741. case Comment:
  6742. processCommentNode(n1, n2, container, anchor);
  6743. break;
  6744. case Static:
  6745. if (n1 == null) {
  6746. mountStaticNode(n2, container, anchor, namespace);
  6747. } else {
  6748. patchStaticNode(n1, n2, container, namespace);
  6749. }
  6750. break;
  6751. case Fragment:
  6752. processFragment(
  6753. n1,
  6754. n2,
  6755. container,
  6756. anchor,
  6757. parentComponent,
  6758. parentSuspense,
  6759. namespace,
  6760. slotScopeIds,
  6761. optimized
  6762. );
  6763. break;
  6764. default:
  6765. if (shapeFlag & 1) {
  6766. processElement(
  6767. n1,
  6768. n2,
  6769. container,
  6770. anchor,
  6771. parentComponent,
  6772. parentSuspense,
  6773. namespace,
  6774. slotScopeIds,
  6775. optimized
  6776. );
  6777. } else if (shapeFlag & 6) {
  6778. processComponent(
  6779. n1,
  6780. n2,
  6781. container,
  6782. anchor,
  6783. parentComponent,
  6784. parentSuspense,
  6785. namespace,
  6786. slotScopeIds,
  6787. optimized
  6788. );
  6789. } else if (shapeFlag & 64) {
  6790. type.process(
  6791. n1,
  6792. n2,
  6793. container,
  6794. anchor,
  6795. parentComponent,
  6796. parentSuspense,
  6797. namespace,
  6798. slotScopeIds,
  6799. optimized,
  6800. internals
  6801. );
  6802. } else if (shapeFlag & 128) {
  6803. type.process(
  6804. n1,
  6805. n2,
  6806. container,
  6807. anchor,
  6808. parentComponent,
  6809. parentSuspense,
  6810. namespace,
  6811. slotScopeIds,
  6812. optimized,
  6813. internals
  6814. );
  6815. } else {
  6816. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  6817. }
  6818. }
  6819. if (ref != null && parentComponent) {
  6820. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6821. }
  6822. };
  6823. const processText = (n1, n2, container, anchor) => {
  6824. if (n1 == null) {
  6825. hostInsert(
  6826. n2.el = hostCreateText(n2.children),
  6827. container,
  6828. anchor
  6829. );
  6830. } else {
  6831. const el = n2.el = n1.el;
  6832. if (n2.children !== n1.children) {
  6833. hostSetText(el, n2.children);
  6834. }
  6835. }
  6836. };
  6837. const processCommentNode = (n1, n2, container, anchor) => {
  6838. if (n1 == null) {
  6839. hostInsert(
  6840. n2.el = hostCreateComment(n2.children || ""),
  6841. container,
  6842. anchor
  6843. );
  6844. } else {
  6845. n2.el = n1.el;
  6846. }
  6847. };
  6848. const mountStaticNode = (n2, container, anchor, namespace) => {
  6849. [n2.el, n2.anchor] = hostInsertStaticContent(
  6850. n2.children,
  6851. container,
  6852. anchor,
  6853. namespace,
  6854. n2.el,
  6855. n2.anchor
  6856. );
  6857. };
  6858. const patchStaticNode = (n1, n2, container, namespace) => {
  6859. if (n2.children !== n1.children) {
  6860. const anchor = hostNextSibling(n1.anchor);
  6861. removeStaticNode(n1);
  6862. [n2.el, n2.anchor] = hostInsertStaticContent(
  6863. n2.children,
  6864. container,
  6865. anchor,
  6866. namespace
  6867. );
  6868. } else {
  6869. n2.el = n1.el;
  6870. n2.anchor = n1.anchor;
  6871. }
  6872. };
  6873. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6874. let next;
  6875. while (el && el !== anchor) {
  6876. next = hostNextSibling(el);
  6877. hostInsert(el, container, nextSibling);
  6878. el = next;
  6879. }
  6880. hostInsert(anchor, container, nextSibling);
  6881. };
  6882. const removeStaticNode = ({ el, anchor }) => {
  6883. let next;
  6884. while (el && el !== anchor) {
  6885. next = hostNextSibling(el);
  6886. hostRemove(el);
  6887. el = next;
  6888. }
  6889. hostRemove(anchor);
  6890. };
  6891. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6892. if (n2.type === "svg") {
  6893. namespace = "svg";
  6894. } else if (n2.type === "math") {
  6895. namespace = "mathml";
  6896. }
  6897. if (n1 == null) {
  6898. mountElement(
  6899. n2,
  6900. container,
  6901. anchor,
  6902. parentComponent,
  6903. parentSuspense,
  6904. namespace,
  6905. slotScopeIds,
  6906. optimized
  6907. );
  6908. } else {
  6909. patchElement(
  6910. n1,
  6911. n2,
  6912. parentComponent,
  6913. parentSuspense,
  6914. namespace,
  6915. slotScopeIds,
  6916. optimized
  6917. );
  6918. }
  6919. };
  6920. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  6921. let el;
  6922. let vnodeHook;
  6923. const { props, shapeFlag, transition, dirs } = vnode;
  6924. el = vnode.el = hostCreateElement(
  6925. vnode.type,
  6926. namespace,
  6927. props && props.is,
  6928. props
  6929. );
  6930. if (shapeFlag & 8) {
  6931. hostSetElementText(el, vnode.children);
  6932. } else if (shapeFlag & 16) {
  6933. mountChildren(
  6934. vnode.children,
  6935. el,
  6936. null,
  6937. parentComponent,
  6938. parentSuspense,
  6939. resolveChildrenNamespace(vnode, namespace),
  6940. slotScopeIds,
  6941. optimized
  6942. );
  6943. }
  6944. if (dirs) {
  6945. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6946. }
  6947. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6948. if (props) {
  6949. for (const key in props) {
  6950. if (key !== "value" && !isReservedProp(key)) {
  6951. hostPatchProp(
  6952. el,
  6953. key,
  6954. null,
  6955. props[key],
  6956. namespace,
  6957. vnode.children,
  6958. parentComponent,
  6959. parentSuspense,
  6960. unmountChildren
  6961. );
  6962. }
  6963. }
  6964. if ("value" in props) {
  6965. hostPatchProp(el, "value", null, props.value, namespace);
  6966. }
  6967. if (vnodeHook = props.onVnodeBeforeMount) {
  6968. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6969. }
  6970. }
  6971. {
  6972. Object.defineProperty(el, "__vnode", {
  6973. value: vnode,
  6974. enumerable: false
  6975. });
  6976. Object.defineProperty(el, "__vueParentComponent", {
  6977. value: parentComponent,
  6978. enumerable: false
  6979. });
  6980. }
  6981. if (dirs) {
  6982. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6983. }
  6984. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  6985. if (needCallTransitionHooks) {
  6986. transition.beforeEnter(el);
  6987. }
  6988. hostInsert(el, container, anchor);
  6989. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6990. queuePostRenderEffect(() => {
  6991. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6992. needCallTransitionHooks && transition.enter(el);
  6993. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6994. }, parentSuspense);
  6995. }
  6996. };
  6997. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6998. if (scopeId) {
  6999. hostSetScopeId(el, scopeId);
  7000. }
  7001. if (slotScopeIds) {
  7002. for (let i = 0; i < slotScopeIds.length; i++) {
  7003. hostSetScopeId(el, slotScopeIds[i]);
  7004. }
  7005. }
  7006. if (parentComponent) {
  7007. let subTree = parentComponent.subTree;
  7008. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  7009. subTree = filterSingleRoot(subTree.children) || subTree;
  7010. }
  7011. if (vnode === subTree) {
  7012. const parentVNode = parentComponent.vnode;
  7013. setScopeId(
  7014. el,
  7015. parentVNode,
  7016. parentVNode.scopeId,
  7017. parentVNode.slotScopeIds,
  7018. parentComponent.parent
  7019. );
  7020. }
  7021. }
  7022. };
  7023. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  7024. for (let i = start; i < children.length; i++) {
  7025. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  7026. patch(
  7027. null,
  7028. child,
  7029. container,
  7030. anchor,
  7031. parentComponent,
  7032. parentSuspense,
  7033. namespace,
  7034. slotScopeIds,
  7035. optimized
  7036. );
  7037. }
  7038. };
  7039. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7040. const el = n2.el = n1.el;
  7041. let { patchFlag, dynamicChildren, dirs } = n2;
  7042. patchFlag |= n1.patchFlag & 16;
  7043. const oldProps = n1.props || EMPTY_OBJ;
  7044. const newProps = n2.props || EMPTY_OBJ;
  7045. let vnodeHook;
  7046. parentComponent && toggleRecurse(parentComponent, false);
  7047. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7048. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7049. }
  7050. if (dirs) {
  7051. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7052. }
  7053. parentComponent && toggleRecurse(parentComponent, true);
  7054. if (isHmrUpdating) {
  7055. patchFlag = 0;
  7056. optimized = false;
  7057. dynamicChildren = null;
  7058. }
  7059. if (dynamicChildren) {
  7060. patchBlockChildren(
  7061. n1.dynamicChildren,
  7062. dynamicChildren,
  7063. el,
  7064. parentComponent,
  7065. parentSuspense,
  7066. resolveChildrenNamespace(n2, namespace),
  7067. slotScopeIds
  7068. );
  7069. {
  7070. traverseStaticChildren(n1, n2);
  7071. }
  7072. } else if (!optimized) {
  7073. patchChildren(
  7074. n1,
  7075. n2,
  7076. el,
  7077. null,
  7078. parentComponent,
  7079. parentSuspense,
  7080. resolveChildrenNamespace(n2, namespace),
  7081. slotScopeIds,
  7082. false
  7083. );
  7084. }
  7085. if (patchFlag > 0) {
  7086. if (patchFlag & 16) {
  7087. patchProps(
  7088. el,
  7089. n2,
  7090. oldProps,
  7091. newProps,
  7092. parentComponent,
  7093. parentSuspense,
  7094. namespace
  7095. );
  7096. } else {
  7097. if (patchFlag & 2) {
  7098. if (oldProps.class !== newProps.class) {
  7099. hostPatchProp(el, "class", null, newProps.class, namespace);
  7100. }
  7101. }
  7102. if (patchFlag & 4) {
  7103. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7104. }
  7105. if (patchFlag & 8) {
  7106. const propsToUpdate = n2.dynamicProps;
  7107. for (let i = 0; i < propsToUpdate.length; i++) {
  7108. const key = propsToUpdate[i];
  7109. const prev = oldProps[key];
  7110. const next = newProps[key];
  7111. if (next !== prev || key === "value") {
  7112. hostPatchProp(
  7113. el,
  7114. key,
  7115. prev,
  7116. next,
  7117. namespace,
  7118. n1.children,
  7119. parentComponent,
  7120. parentSuspense,
  7121. unmountChildren
  7122. );
  7123. }
  7124. }
  7125. }
  7126. }
  7127. if (patchFlag & 1) {
  7128. if (n1.children !== n2.children) {
  7129. hostSetElementText(el, n2.children);
  7130. }
  7131. }
  7132. } else if (!optimized && dynamicChildren == null) {
  7133. patchProps(
  7134. el,
  7135. n2,
  7136. oldProps,
  7137. newProps,
  7138. parentComponent,
  7139. parentSuspense,
  7140. namespace
  7141. );
  7142. }
  7143. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7144. queuePostRenderEffect(() => {
  7145. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7146. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7147. }, parentSuspense);
  7148. }
  7149. };
  7150. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7151. for (let i = 0; i < newChildren.length; i++) {
  7152. const oldVNode = oldChildren[i];
  7153. const newVNode = newChildren[i];
  7154. const container = (
  7155. // oldVNode may be an errored async setup() component inside Suspense
  7156. // which will not have a mounted element
  7157. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7158. // of the Fragment itself so it can move its children.
  7159. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7160. // which also requires the correct parent container
  7161. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7162. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  7163. // In other cases, the parent container is not actually used so we
  7164. // just pass the block element here to avoid a DOM parentNode call.
  7165. fallbackContainer
  7166. )
  7167. );
  7168. patch(
  7169. oldVNode,
  7170. newVNode,
  7171. container,
  7172. null,
  7173. parentComponent,
  7174. parentSuspense,
  7175. namespace,
  7176. slotScopeIds,
  7177. true
  7178. );
  7179. }
  7180. };
  7181. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
  7182. if (oldProps !== newProps) {
  7183. if (oldProps !== EMPTY_OBJ) {
  7184. for (const key in oldProps) {
  7185. if (!isReservedProp(key) && !(key in newProps)) {
  7186. hostPatchProp(
  7187. el,
  7188. key,
  7189. oldProps[key],
  7190. null,
  7191. namespace,
  7192. vnode.children,
  7193. parentComponent,
  7194. parentSuspense,
  7195. unmountChildren
  7196. );
  7197. }
  7198. }
  7199. }
  7200. for (const key in newProps) {
  7201. if (isReservedProp(key))
  7202. continue;
  7203. const next = newProps[key];
  7204. const prev = oldProps[key];
  7205. if (next !== prev && key !== "value") {
  7206. hostPatchProp(
  7207. el,
  7208. key,
  7209. prev,
  7210. next,
  7211. namespace,
  7212. vnode.children,
  7213. parentComponent,
  7214. parentSuspense,
  7215. unmountChildren
  7216. );
  7217. }
  7218. }
  7219. if ("value" in newProps) {
  7220. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  7221. }
  7222. }
  7223. };
  7224. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7225. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  7226. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  7227. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  7228. if (
  7229. // #5523 dev root fragment may inherit directives
  7230. isHmrUpdating || patchFlag & 2048
  7231. ) {
  7232. patchFlag = 0;
  7233. optimized = false;
  7234. dynamicChildren = null;
  7235. }
  7236. if (fragmentSlotScopeIds) {
  7237. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  7238. }
  7239. if (n1 == null) {
  7240. hostInsert(fragmentStartAnchor, container, anchor);
  7241. hostInsert(fragmentEndAnchor, container, anchor);
  7242. mountChildren(
  7243. // #10007
  7244. // such fragment like `<></>` will be compiled into
  7245. // a fragment which doesn't have a children.
  7246. // In this case fallback to an empty array
  7247. n2.children || [],
  7248. container,
  7249. fragmentEndAnchor,
  7250. parentComponent,
  7251. parentSuspense,
  7252. namespace,
  7253. slotScopeIds,
  7254. optimized
  7255. );
  7256. } else {
  7257. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  7258. // of renderSlot() with no valid children
  7259. n1.dynamicChildren) {
  7260. patchBlockChildren(
  7261. n1.dynamicChildren,
  7262. dynamicChildren,
  7263. container,
  7264. parentComponent,
  7265. parentSuspense,
  7266. namespace,
  7267. slotScopeIds
  7268. );
  7269. {
  7270. traverseStaticChildren(n1, n2);
  7271. }
  7272. } else {
  7273. patchChildren(
  7274. n1,
  7275. n2,
  7276. container,
  7277. fragmentEndAnchor,
  7278. parentComponent,
  7279. parentSuspense,
  7280. namespace,
  7281. slotScopeIds,
  7282. optimized
  7283. );
  7284. }
  7285. }
  7286. };
  7287. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7288. n2.slotScopeIds = slotScopeIds;
  7289. if (n1 == null) {
  7290. if (n2.shapeFlag & 512) {
  7291. parentComponent.ct