runtime-dom.esm-browser.js 372 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825
  1. /**
  2. * @vue/runtime-dom v3.5.33
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. // @__NO_SIDE_EFFECTS__
  7. function makeMap(str) {
  8. const map = /* @__PURE__ */ Object.create(null);
  9. for (const key of str.split(",")) map[key] = 1;
  10. return (val) => val in map;
  11. }
  12. const EMPTY_OBJ = Object.freeze({}) ;
  13. const EMPTY_ARR = Object.freeze([]) ;
  14. const NOOP = () => {
  15. };
  16. const NO = () => false;
  17. const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
  18. (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
  19. const isModelListener = (key) => key.startsWith("onUpdate:");
  20. const extend = Object.assign;
  21. const remove = (arr, el) => {
  22. const i = arr.indexOf(el);
  23. if (i > -1) {
  24. arr.splice(i, 1);
  25. }
  26. };
  27. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  28. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  29. const isArray = Array.isArray;
  30. const isMap = (val) => toTypeString(val) === "[object Map]";
  31. const isSet = (val) => toTypeString(val) === "[object Set]";
  32. const isDate = (val) => toTypeString(val) === "[object Date]";
  33. const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  34. const isFunction = (val) => typeof val === "function";
  35. const isString = (val) => typeof val === "string";
  36. const isSymbol = (val) => typeof val === "symbol";
  37. const isObject = (val) => val !== null && typeof val === "object";
  38. const isPromise = (val) => {
  39. return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
  40. };
  41. const objectToString = Object.prototype.toString;
  42. const toTypeString = (value) => objectToString.call(value);
  43. const toRawType = (value) => {
  44. return toTypeString(value).slice(8, -1);
  45. };
  46. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  47. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  48. const isReservedProp = /* @__PURE__ */ makeMap(
  49. // the leading comma is intentional so empty string "" is also included
  50. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  51. );
  52. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  53. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  54. );
  55. const cacheStringFunction = (fn) => {
  56. const cache = /* @__PURE__ */ Object.create(null);
  57. return ((str) => {
  58. const hit = cache[str];
  59. return hit || (cache[str] = fn(str));
  60. });
  61. };
  62. const camelizeRE = /-\w/g;
  63. const camelize = cacheStringFunction(
  64. (str) => {
  65. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  66. }
  67. );
  68. const hyphenateRE = /\B([A-Z])/g;
  69. const hyphenate = cacheStringFunction(
  70. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  71. );
  72. const capitalize = cacheStringFunction((str) => {
  73. return str.charAt(0).toUpperCase() + str.slice(1);
  74. });
  75. const toHandlerKey = cacheStringFunction(
  76. (str) => {
  77. const s = str ? `on${capitalize(str)}` : ``;
  78. return s;
  79. }
  80. );
  81. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  82. const invokeArrayFns = (fns, ...arg) => {
  83. for (let i = 0; i < fns.length; i++) {
  84. fns[i](...arg);
  85. }
  86. };
  87. const def = (obj, key, value, writable = false) => {
  88. Object.defineProperty(obj, key, {
  89. configurable: true,
  90. enumerable: false,
  91. writable,
  92. value
  93. });
  94. };
  95. const looseToNumber = (val) => {
  96. const n = parseFloat(val);
  97. return isNaN(n) ? val : n;
  98. };
  99. const toNumber = (val) => {
  100. const n = isString(val) ? Number(val) : NaN;
  101. return isNaN(n) ? val : n;
  102. };
  103. let _globalThis;
  104. const getGlobalThis = () => {
  105. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  106. };
  107. 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,Symbol";
  108. const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
  109. function normalizeStyle(value) {
  110. if (isArray(value)) {
  111. const res = {};
  112. for (let i = 0; i < value.length; i++) {
  113. const item = value[i];
  114. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  115. if (normalized) {
  116. for (const key in normalized) {
  117. res[key] = normalized[key];
  118. }
  119. }
  120. }
  121. return res;
  122. } else if (isString(value) || isObject(value)) {
  123. return value;
  124. }
  125. }
  126. const listDelimiterRE = /;(?![^(]*\))/g;
  127. const propertyDelimiterRE = /:([^]+)/;
  128. const styleCommentRE = /\/\*[^]*?\*\//g;
  129. function parseStringStyle(cssText) {
  130. const ret = {};
  131. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  132. if (item) {
  133. const tmp = item.split(propertyDelimiterRE);
  134. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  135. }
  136. });
  137. return ret;
  138. }
  139. function stringifyStyle(styles) {
  140. if (!styles) return "";
  141. if (isString(styles)) return styles;
  142. let ret = "";
  143. for (const key in styles) {
  144. const value = styles[key];
  145. if (isString(value) || typeof value === "number") {
  146. const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
  147. ret += `${normalizedKey}:${value};`;
  148. }
  149. }
  150. return ret;
  151. }
  152. function normalizeClass(value) {
  153. let res = "";
  154. if (isString(value)) {
  155. res = value;
  156. } else if (isArray(value)) {
  157. for (let i = 0; i < value.length; i++) {
  158. const normalized = normalizeClass(value[i]);
  159. if (normalized) {
  160. res += normalized + " ";
  161. }
  162. }
  163. } else if (isObject(value)) {
  164. for (const name in value) {
  165. if (value[name]) {
  166. res += name + " ";
  167. }
  168. }
  169. }
  170. return res.trim();
  171. }
  172. function normalizeProps(props) {
  173. if (!props) return null;
  174. let { class: klass, style } = props;
  175. if (klass && !isString(klass)) {
  176. props.class = normalizeClass(klass);
  177. }
  178. if (style) {
  179. props.style = normalizeStyle(style);
  180. }
  181. return props;
  182. }
  183. 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";
  184. 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";
  185. 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";
  186. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  187. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  188. const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
  189. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  190. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  191. const isBooleanAttr = /* @__PURE__ */ makeMap(
  192. specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
  193. );
  194. function includeBooleanAttr(value) {
  195. return !!value || value === "";
  196. }
  197. const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
  198. `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`
  199. );
  200. const isKnownSvgAttr = /* @__PURE__ */ makeMap(
  201. `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`
  202. );
  203. function isRenderableAttrValue(value) {
  204. if (value == null) {
  205. return false;
  206. }
  207. const type = typeof value;
  208. return type === "string" || type === "number" || type === "boolean";
  209. }
  210. const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
  211. function getEscapedCssVarName(key, doubleEscape) {
  212. return key.replace(
  213. cssVarNameEscapeSymbolsRE,
  214. (s) => `\\${s}`
  215. );
  216. }
  217. function looseCompareArrays(a, b) {
  218. if (a.length !== b.length) return false;
  219. let equal = true;
  220. for (let i = 0; equal && i < a.length; i++) {
  221. equal = looseEqual(a[i], b[i]);
  222. }
  223. return equal;
  224. }
  225. function looseEqual(a, b) {
  226. if (a === b) return true;
  227. let aValidType = isDate(a);
  228. let bValidType = isDate(b);
  229. if (aValidType || bValidType) {
  230. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  231. }
  232. aValidType = isSymbol(a);
  233. bValidType = isSymbol(b);
  234. if (aValidType || bValidType) {
  235. return a === b;
  236. }
  237. aValidType = isArray(a);
  238. bValidType = isArray(b);
  239. if (aValidType || bValidType) {
  240. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  241. }
  242. aValidType = isObject(a);
  243. bValidType = isObject(b);
  244. if (aValidType || bValidType) {
  245. if (!aValidType || !bValidType) {
  246. return false;
  247. }
  248. const aKeysCount = Object.keys(a).length;
  249. const bKeysCount = Object.keys(b).length;
  250. if (aKeysCount !== bKeysCount) {
  251. return false;
  252. }
  253. for (const key in a) {
  254. const aHasKey = a.hasOwnProperty(key);
  255. const bHasKey = b.hasOwnProperty(key);
  256. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  257. return false;
  258. }
  259. }
  260. }
  261. return String(a) === String(b);
  262. }
  263. function looseIndexOf(arr, val) {
  264. return arr.findIndex((item) => looseEqual(item, val));
  265. }
  266. const isRef$1 = (val) => {
  267. return !!(val && val["__v_isRef"] === true);
  268. };
  269. const toDisplayString = (val) => {
  270. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef$1(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
  271. };
  272. const replacer = (_key, val) => {
  273. if (isRef$1(val)) {
  274. return replacer(_key, val.value);
  275. } else if (isMap(val)) {
  276. return {
  277. [`Map(${val.size})`]: [...val.entries()].reduce(
  278. (entries, [key, val2], i) => {
  279. entries[stringifySymbol(key, i) + " =>"] = val2;
  280. return entries;
  281. },
  282. {}
  283. )
  284. };
  285. } else if (isSet(val)) {
  286. return {
  287. [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
  288. };
  289. } else if (isSymbol(val)) {
  290. return stringifySymbol(val);
  291. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  292. return String(val);
  293. }
  294. return val;
  295. };
  296. const stringifySymbol = (v, i = "") => {
  297. var _a;
  298. return (
  299. // Symbol.description in es2019+ so we need to cast here to pass
  300. // the lib: es2016 check
  301. isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
  302. );
  303. };
  304. function normalizeCssVarValue(value) {
  305. if (value == null) {
  306. return "initial";
  307. }
  308. if (typeof value === "string") {
  309. return value === "" ? " " : value;
  310. }
  311. if (typeof value !== "number" || !Number.isFinite(value)) {
  312. {
  313. console.warn(
  314. "[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",
  315. value
  316. );
  317. }
  318. }
  319. return String(value);
  320. }
  321. function warn$2(msg, ...args) {
  322. console.warn(`[Vue warn] ${msg}`, ...args);
  323. }
  324. let activeEffectScope;
  325. class EffectScope {
  326. // TODO isolatedDeclarations "__v_skip"
  327. constructor(detached = false) {
  328. this.detached = detached;
  329. /**
  330. * @internal
  331. */
  332. this._active = true;
  333. /**
  334. * @internal track `on` calls, allow `on` call multiple times
  335. */
  336. this._on = 0;
  337. /**
  338. * @internal
  339. */
  340. this.effects = [];
  341. /**
  342. * @internal
  343. */
  344. this.cleanups = [];
  345. this._isPaused = false;
  346. this.__v_skip = true;
  347. this.parent = activeEffectScope;
  348. if (!detached && activeEffectScope) {
  349. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  350. this
  351. ) - 1;
  352. }
  353. }
  354. get active() {
  355. return this._active;
  356. }
  357. pause() {
  358. if (this._active) {
  359. this._isPaused = true;
  360. let i, l;
  361. if (this.scopes) {
  362. for (i = 0, l = this.scopes.length; i < l; i++) {
  363. this.scopes[i].pause();
  364. }
  365. }
  366. for (i = 0, l = this.effects.length; i < l; i++) {
  367. this.effects[i].pause();
  368. }
  369. }
  370. }
  371. /**
  372. * Resumes the effect scope, including all child scopes and effects.
  373. */
  374. resume() {
  375. if (this._active) {
  376. if (this._isPaused) {
  377. this._isPaused = false;
  378. let i, l;
  379. if (this.scopes) {
  380. for (i = 0, l = this.scopes.length; i < l; i++) {
  381. this.scopes[i].resume();
  382. }
  383. }
  384. for (i = 0, l = this.effects.length; i < l; i++) {
  385. this.effects[i].resume();
  386. }
  387. }
  388. }
  389. }
  390. run(fn) {
  391. if (this._active) {
  392. const currentEffectScope = activeEffectScope;
  393. try {
  394. activeEffectScope = this;
  395. return fn();
  396. } finally {
  397. activeEffectScope = currentEffectScope;
  398. }
  399. } else {
  400. warn$2(`cannot run an inactive effect scope.`);
  401. }
  402. }
  403. /**
  404. * This should only be called on non-detached scopes
  405. * @internal
  406. */
  407. on() {
  408. if (++this._on === 1) {
  409. this.prevScope = activeEffectScope;
  410. activeEffectScope = this;
  411. }
  412. }
  413. /**
  414. * This should only be called on non-detached scopes
  415. * @internal
  416. */
  417. off() {
  418. if (this._on > 0 && --this._on === 0) {
  419. if (activeEffectScope === this) {
  420. activeEffectScope = this.prevScope;
  421. } else {
  422. let current = activeEffectScope;
  423. while (current) {
  424. if (current.prevScope === this) {
  425. current.prevScope = this.prevScope;
  426. break;
  427. }
  428. current = current.prevScope;
  429. }
  430. }
  431. this.prevScope = void 0;
  432. }
  433. }
  434. stop(fromParent) {
  435. if (this._active) {
  436. this._active = false;
  437. let i, l;
  438. for (i = 0, l = this.effects.length; i < l; i++) {
  439. this.effects[i].stop();
  440. }
  441. this.effects.length = 0;
  442. for (i = 0, l = this.cleanups.length; i < l; i++) {
  443. this.cleanups[i]();
  444. }
  445. this.cleanups.length = 0;
  446. if (this.scopes) {
  447. for (i = 0, l = this.scopes.length; i < l; i++) {
  448. this.scopes[i].stop(true);
  449. }
  450. this.scopes.length = 0;
  451. }
  452. if (!this.detached && this.parent && !fromParent) {
  453. const last = this.parent.scopes.pop();
  454. if (last && last !== this) {
  455. this.parent.scopes[this.index] = last;
  456. last.index = this.index;
  457. }
  458. }
  459. this.parent = void 0;
  460. }
  461. }
  462. }
  463. function effectScope(detached) {
  464. return new EffectScope(detached);
  465. }
  466. function getCurrentScope() {
  467. return activeEffectScope;
  468. }
  469. function onScopeDispose(fn, failSilently = false) {
  470. if (activeEffectScope) {
  471. activeEffectScope.cleanups.push(fn);
  472. } else if (!failSilently) {
  473. warn$2(
  474. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  475. );
  476. }
  477. }
  478. let activeSub;
  479. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  480. class ReactiveEffect {
  481. constructor(fn) {
  482. this.fn = fn;
  483. /**
  484. * @internal
  485. */
  486. this.deps = void 0;
  487. /**
  488. * @internal
  489. */
  490. this.depsTail = void 0;
  491. /**
  492. * @internal
  493. */
  494. this.flags = 1 | 4;
  495. /**
  496. * @internal
  497. */
  498. this.next = void 0;
  499. /**
  500. * @internal
  501. */
  502. this.cleanup = void 0;
  503. this.scheduler = void 0;
  504. if (activeEffectScope && activeEffectScope.active) {
  505. activeEffectScope.effects.push(this);
  506. }
  507. }
  508. pause() {
  509. this.flags |= 64;
  510. }
  511. resume() {
  512. if (this.flags & 64) {
  513. this.flags &= -65;
  514. if (pausedQueueEffects.has(this)) {
  515. pausedQueueEffects.delete(this);
  516. this.trigger();
  517. }
  518. }
  519. }
  520. /**
  521. * @internal
  522. */
  523. notify() {
  524. if (this.flags & 2 && !(this.flags & 32)) {
  525. return;
  526. }
  527. if (!(this.flags & 8)) {
  528. batch(this);
  529. }
  530. }
  531. run() {
  532. if (!(this.flags & 1)) {
  533. return this.fn();
  534. }
  535. this.flags |= 2;
  536. cleanupEffect(this);
  537. prepareDeps(this);
  538. const prevEffect = activeSub;
  539. const prevShouldTrack = shouldTrack;
  540. activeSub = this;
  541. shouldTrack = true;
  542. try {
  543. return this.fn();
  544. } finally {
  545. if (activeSub !== this) {
  546. warn$2(
  547. "Active effect was not restored correctly - this is likely a Vue internal bug."
  548. );
  549. }
  550. cleanupDeps(this);
  551. activeSub = prevEffect;
  552. shouldTrack = prevShouldTrack;
  553. this.flags &= -3;
  554. }
  555. }
  556. stop() {
  557. if (this.flags & 1) {
  558. for (let link = this.deps; link; link = link.nextDep) {
  559. removeSub(link);
  560. }
  561. this.deps = this.depsTail = void 0;
  562. cleanupEffect(this);
  563. this.onStop && this.onStop();
  564. this.flags &= -2;
  565. }
  566. }
  567. trigger() {
  568. if (this.flags & 64) {
  569. pausedQueueEffects.add(this);
  570. } else if (this.scheduler) {
  571. this.scheduler();
  572. } else {
  573. this.runIfDirty();
  574. }
  575. }
  576. /**
  577. * @internal
  578. */
  579. runIfDirty() {
  580. if (isDirty(this)) {
  581. this.run();
  582. }
  583. }
  584. get dirty() {
  585. return isDirty(this);
  586. }
  587. }
  588. let batchDepth = 0;
  589. let batchedSub;
  590. let batchedComputed;
  591. function batch(sub, isComputed = false) {
  592. sub.flags |= 8;
  593. if (isComputed) {
  594. sub.next = batchedComputed;
  595. batchedComputed = sub;
  596. return;
  597. }
  598. sub.next = batchedSub;
  599. batchedSub = sub;
  600. }
  601. function startBatch() {
  602. batchDepth++;
  603. }
  604. function endBatch() {
  605. if (--batchDepth > 0) {
  606. return;
  607. }
  608. if (batchedComputed) {
  609. let e = batchedComputed;
  610. batchedComputed = void 0;
  611. while (e) {
  612. const next = e.next;
  613. e.next = void 0;
  614. e.flags &= -9;
  615. e = next;
  616. }
  617. }
  618. let error;
  619. while (batchedSub) {
  620. let e = batchedSub;
  621. batchedSub = void 0;
  622. while (e) {
  623. const next = e.next;
  624. e.next = void 0;
  625. e.flags &= -9;
  626. if (e.flags & 1) {
  627. try {
  628. ;
  629. e.trigger();
  630. } catch (err) {
  631. if (!error) error = err;
  632. }
  633. }
  634. e = next;
  635. }
  636. }
  637. if (error) throw error;
  638. }
  639. function prepareDeps(sub) {
  640. for (let link = sub.deps; link; link = link.nextDep) {
  641. link.version = -1;
  642. link.prevActiveLink = link.dep.activeLink;
  643. link.dep.activeLink = link;
  644. }
  645. }
  646. function cleanupDeps(sub) {
  647. let head;
  648. let tail = sub.depsTail;
  649. let link = tail;
  650. while (link) {
  651. const prev = link.prevDep;
  652. if (link.version === -1) {
  653. if (link === tail) tail = prev;
  654. removeSub(link);
  655. removeDep(link);
  656. } else {
  657. head = link;
  658. }
  659. link.dep.activeLink = link.prevActiveLink;
  660. link.prevActiveLink = void 0;
  661. link = prev;
  662. }
  663. sub.deps = head;
  664. sub.depsTail = tail;
  665. }
  666. function isDirty(sub) {
  667. for (let link = sub.deps; link; link = link.nextDep) {
  668. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  669. return true;
  670. }
  671. }
  672. if (sub._dirty) {
  673. return true;
  674. }
  675. return false;
  676. }
  677. function refreshComputed(computed) {
  678. if (computed.flags & 4 && !(computed.flags & 16)) {
  679. return;
  680. }
  681. computed.flags &= -17;
  682. if (computed.globalVersion === globalVersion) {
  683. return;
  684. }
  685. computed.globalVersion = globalVersion;
  686. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  687. return;
  688. }
  689. computed.flags |= 2;
  690. const dep = computed.dep;
  691. const prevSub = activeSub;
  692. const prevShouldTrack = shouldTrack;
  693. activeSub = computed;
  694. shouldTrack = true;
  695. try {
  696. prepareDeps(computed);
  697. const value = computed.fn(computed._value);
  698. if (dep.version === 0 || hasChanged(value, computed._value)) {
  699. computed.flags |= 128;
  700. computed._value = value;
  701. dep.version++;
  702. }
  703. } catch (err) {
  704. dep.version++;
  705. throw err;
  706. } finally {
  707. activeSub = prevSub;
  708. shouldTrack = prevShouldTrack;
  709. cleanupDeps(computed);
  710. computed.flags &= -3;
  711. }
  712. }
  713. function removeSub(link, soft = false) {
  714. const { dep, prevSub, nextSub } = link;
  715. if (prevSub) {
  716. prevSub.nextSub = nextSub;
  717. link.prevSub = void 0;
  718. }
  719. if (nextSub) {
  720. nextSub.prevSub = prevSub;
  721. link.nextSub = void 0;
  722. }
  723. if (dep.subsHead === link) {
  724. dep.subsHead = nextSub;
  725. }
  726. if (dep.subs === link) {
  727. dep.subs = prevSub;
  728. if (!prevSub && dep.computed) {
  729. dep.computed.flags &= -5;
  730. for (let l = dep.computed.deps; l; l = l.nextDep) {
  731. removeSub(l, true);
  732. }
  733. }
  734. }
  735. if (!soft && !--dep.sc && dep.map) {
  736. dep.map.delete(dep.key);
  737. }
  738. }
  739. function removeDep(link) {
  740. const { prevDep, nextDep } = link;
  741. if (prevDep) {
  742. prevDep.nextDep = nextDep;
  743. link.prevDep = void 0;
  744. }
  745. if (nextDep) {
  746. nextDep.prevDep = prevDep;
  747. link.nextDep = void 0;
  748. }
  749. }
  750. function effect(fn, options) {
  751. if (fn.effect instanceof ReactiveEffect) {
  752. fn = fn.effect.fn;
  753. }
  754. const e = new ReactiveEffect(fn);
  755. if (options) {
  756. extend(e, options);
  757. }
  758. try {
  759. e.run();
  760. } catch (err) {
  761. e.stop();
  762. throw err;
  763. }
  764. const runner = e.run.bind(e);
  765. runner.effect = e;
  766. return runner;
  767. }
  768. function stop(runner) {
  769. runner.effect.stop();
  770. }
  771. let shouldTrack = true;
  772. const trackStack = [];
  773. function pauseTracking() {
  774. trackStack.push(shouldTrack);
  775. shouldTrack = false;
  776. }
  777. function resetTracking() {
  778. const last = trackStack.pop();
  779. shouldTrack = last === void 0 ? true : last;
  780. }
  781. function cleanupEffect(e) {
  782. const { cleanup } = e;
  783. e.cleanup = void 0;
  784. if (cleanup) {
  785. const prevSub = activeSub;
  786. activeSub = void 0;
  787. try {
  788. cleanup();
  789. } finally {
  790. activeSub = prevSub;
  791. }
  792. }
  793. }
  794. let globalVersion = 0;
  795. class Link {
  796. constructor(sub, dep) {
  797. this.sub = sub;
  798. this.dep = dep;
  799. this.version = dep.version;
  800. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  801. }
  802. }
  803. class Dep {
  804. // TODO isolatedDeclarations "__v_skip"
  805. constructor(computed) {
  806. this.computed = computed;
  807. this.version = 0;
  808. /**
  809. * Link between this dep and the current active effect
  810. */
  811. this.activeLink = void 0;
  812. /**
  813. * Doubly linked list representing the subscribing effects (tail)
  814. */
  815. this.subs = void 0;
  816. /**
  817. * For object property deps cleanup
  818. */
  819. this.map = void 0;
  820. this.key = void 0;
  821. /**
  822. * Subscriber counter
  823. */
  824. this.sc = 0;
  825. /**
  826. * @internal
  827. */
  828. this.__v_skip = true;
  829. {
  830. this.subsHead = void 0;
  831. }
  832. }
  833. track(debugInfo) {
  834. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  835. return;
  836. }
  837. let link = this.activeLink;
  838. if (link === void 0 || link.sub !== activeSub) {
  839. link = this.activeLink = new Link(activeSub, this);
  840. if (!activeSub.deps) {
  841. activeSub.deps = activeSub.depsTail = link;
  842. } else {
  843. link.prevDep = activeSub.depsTail;
  844. activeSub.depsTail.nextDep = link;
  845. activeSub.depsTail = link;
  846. }
  847. addSub(link);
  848. } else if (link.version === -1) {
  849. link.version = this.version;
  850. if (link.nextDep) {
  851. const next = link.nextDep;
  852. next.prevDep = link.prevDep;
  853. if (link.prevDep) {
  854. link.prevDep.nextDep = next;
  855. }
  856. link.prevDep = activeSub.depsTail;
  857. link.nextDep = void 0;
  858. activeSub.depsTail.nextDep = link;
  859. activeSub.depsTail = link;
  860. if (activeSub.deps === link) {
  861. activeSub.deps = next;
  862. }
  863. }
  864. }
  865. if (activeSub.onTrack) {
  866. activeSub.onTrack(
  867. extend(
  868. {
  869. effect: activeSub
  870. },
  871. debugInfo
  872. )
  873. );
  874. }
  875. return link;
  876. }
  877. trigger(debugInfo) {
  878. this.version++;
  879. globalVersion++;
  880. this.notify(debugInfo);
  881. }
  882. notify(debugInfo) {
  883. startBatch();
  884. try {
  885. if (true) {
  886. for (let head = this.subsHead; head; head = head.nextSub) {
  887. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  888. head.sub.onTrigger(
  889. extend(
  890. {
  891. effect: head.sub
  892. },
  893. debugInfo
  894. )
  895. );
  896. }
  897. }
  898. }
  899. for (let link = this.subs; link; link = link.prevSub) {
  900. if (link.sub.notify()) {
  901. ;
  902. link.sub.dep.notify();
  903. }
  904. }
  905. } finally {
  906. endBatch();
  907. }
  908. }
  909. }
  910. function addSub(link) {
  911. link.dep.sc++;
  912. if (link.sub.flags & 4) {
  913. const computed = link.dep.computed;
  914. if (computed && !link.dep.subs) {
  915. computed.flags |= 4 | 16;
  916. for (let l = computed.deps; l; l = l.nextDep) {
  917. addSub(l);
  918. }
  919. }
  920. const currentTail = link.dep.subs;
  921. if (currentTail !== link) {
  922. link.prevSub = currentTail;
  923. if (currentTail) currentTail.nextSub = link;
  924. }
  925. if (link.dep.subsHead === void 0) {
  926. link.dep.subsHead = link;
  927. }
  928. link.dep.subs = link;
  929. }
  930. }
  931. const targetMap = /* @__PURE__ */ new WeakMap();
  932. const ITERATE_KEY = /* @__PURE__ */ Symbol(
  933. "Object iterate"
  934. );
  935. const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  936. "Map keys iterate"
  937. );
  938. const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  939. "Array iterate"
  940. );
  941. function track(target, type, key) {
  942. if (shouldTrack && activeSub) {
  943. let depsMap = targetMap.get(target);
  944. if (!depsMap) {
  945. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  946. }
  947. let dep = depsMap.get(key);
  948. if (!dep) {
  949. depsMap.set(key, dep = new Dep());
  950. dep.map = depsMap;
  951. dep.key = key;
  952. }
  953. {
  954. dep.track({
  955. target,
  956. type,
  957. key
  958. });
  959. }
  960. }
  961. }
  962. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  963. const depsMap = targetMap.get(target);
  964. if (!depsMap) {
  965. globalVersion++;
  966. return;
  967. }
  968. const run = (dep) => {
  969. if (dep) {
  970. {
  971. dep.trigger({
  972. target,
  973. type,
  974. key,
  975. newValue,
  976. oldValue,
  977. oldTarget
  978. });
  979. }
  980. }
  981. };
  982. startBatch();
  983. if (type === "clear") {
  984. depsMap.forEach(run);
  985. } else {
  986. const targetIsArray = isArray(target);
  987. const isArrayIndex = targetIsArray && isIntegerKey(key);
  988. if (targetIsArray && key === "length") {
  989. const newLength = Number(newValue);
  990. depsMap.forEach((dep, key2) => {
  991. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  992. run(dep);
  993. }
  994. });
  995. } else {
  996. if (key !== void 0 || depsMap.has(void 0)) {
  997. run(depsMap.get(key));
  998. }
  999. if (isArrayIndex) {
  1000. run(depsMap.get(ARRAY_ITERATE_KEY));
  1001. }
  1002. switch (type) {
  1003. case "add":
  1004. if (!targetIsArray) {
  1005. run(depsMap.get(ITERATE_KEY));
  1006. if (isMap(target)) {
  1007. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1008. }
  1009. } else if (isArrayIndex) {
  1010. run(depsMap.get("length"));
  1011. }
  1012. break;
  1013. case "delete":
  1014. if (!targetIsArray) {
  1015. run(depsMap.get(ITERATE_KEY));
  1016. if (isMap(target)) {
  1017. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  1018. }
  1019. }
  1020. break;
  1021. case "set":
  1022. if (isMap(target)) {
  1023. run(depsMap.get(ITERATE_KEY));
  1024. }
  1025. break;
  1026. }
  1027. }
  1028. }
  1029. endBatch();
  1030. }
  1031. function getDepFromReactive(object, key) {
  1032. const depMap = targetMap.get(object);
  1033. return depMap && depMap.get(key);
  1034. }
  1035. function reactiveReadArray(array) {
  1036. const raw = toRaw(array);
  1037. if (raw === array) return raw;
  1038. track(raw, "iterate", ARRAY_ITERATE_KEY);
  1039. return isShallow(array) ? raw : raw.map(toReactive);
  1040. }
  1041. function shallowReadArray(arr) {
  1042. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  1043. return arr;
  1044. }
  1045. function toWrapped(target, item) {
  1046. if (isReadonly(target)) {
  1047. return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
  1048. }
  1049. return toReactive(item);
  1050. }
  1051. const arrayInstrumentations = {
  1052. __proto__: null,
  1053. [Symbol.iterator]() {
  1054. return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
  1055. },
  1056. concat(...args) {
  1057. return reactiveReadArray(this).concat(
  1058. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  1059. );
  1060. },
  1061. entries() {
  1062. return iterator(this, "entries", (value) => {
  1063. value[1] = toWrapped(this, value[1]);
  1064. return value;
  1065. });
  1066. },
  1067. every(fn, thisArg) {
  1068. return apply(this, "every", fn, thisArg, void 0, arguments);
  1069. },
  1070. filter(fn, thisArg) {
  1071. return apply(
  1072. this,
  1073. "filter",
  1074. fn,
  1075. thisArg,
  1076. (v) => v.map((item) => toWrapped(this, item)),
  1077. arguments
  1078. );
  1079. },
  1080. find(fn, thisArg) {
  1081. return apply(
  1082. this,
  1083. "find",
  1084. fn,
  1085. thisArg,
  1086. (item) => toWrapped(this, item),
  1087. arguments
  1088. );
  1089. },
  1090. findIndex(fn, thisArg) {
  1091. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  1092. },
  1093. findLast(fn, thisArg) {
  1094. return apply(
  1095. this,
  1096. "findLast",
  1097. fn,
  1098. thisArg,
  1099. (item) => toWrapped(this, item),
  1100. arguments
  1101. );
  1102. },
  1103. findLastIndex(fn, thisArg) {
  1104. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  1105. },
  1106. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  1107. forEach(fn, thisArg) {
  1108. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  1109. },
  1110. includes(...args) {
  1111. return searchProxy(this, "includes", args);
  1112. },
  1113. indexOf(...args) {
  1114. return searchProxy(this, "indexOf", args);
  1115. },
  1116. join(separator) {
  1117. return reactiveReadArray(this).join(separator);
  1118. },
  1119. // keys() iterator only reads `length`, no optimization required
  1120. lastIndexOf(...args) {
  1121. return searchProxy(this, "lastIndexOf", args);
  1122. },
  1123. map(fn, thisArg) {
  1124. return apply(this, "map", fn, thisArg, void 0, arguments);
  1125. },
  1126. pop() {
  1127. return noTracking(this, "pop");
  1128. },
  1129. push(...args) {
  1130. return noTracking(this, "push", args);
  1131. },
  1132. reduce(fn, ...args) {
  1133. return reduce(this, "reduce", fn, args);
  1134. },
  1135. reduceRight(fn, ...args) {
  1136. return reduce(this, "reduceRight", fn, args);
  1137. },
  1138. shift() {
  1139. return noTracking(this, "shift");
  1140. },
  1141. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  1142. some(fn, thisArg) {
  1143. return apply(this, "some", fn, thisArg, void 0, arguments);
  1144. },
  1145. splice(...args) {
  1146. return noTracking(this, "splice", args);
  1147. },
  1148. toReversed() {
  1149. return reactiveReadArray(this).toReversed();
  1150. },
  1151. toSorted(comparer) {
  1152. return reactiveReadArray(this).toSorted(comparer);
  1153. },
  1154. toSpliced(...args) {
  1155. return reactiveReadArray(this).toSpliced(...args);
  1156. },
  1157. unshift(...args) {
  1158. return noTracking(this, "unshift", args);
  1159. },
  1160. values() {
  1161. return iterator(this, "values", (item) => toWrapped(this, item));
  1162. }
  1163. };
  1164. function iterator(self, method, wrapValue) {
  1165. const arr = shallowReadArray(self);
  1166. const iter = arr[method]();
  1167. if (arr !== self && !isShallow(self)) {
  1168. iter._next = iter.next;
  1169. iter.next = () => {
  1170. const result = iter._next();
  1171. if (!result.done) {
  1172. result.value = wrapValue(result.value);
  1173. }
  1174. return result;
  1175. };
  1176. }
  1177. return iter;
  1178. }
  1179. const arrayProto = Array.prototype;
  1180. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  1181. const arr = shallowReadArray(self);
  1182. const needsWrap = arr !== self && !isShallow(self);
  1183. const methodFn = arr[method];
  1184. if (methodFn !== arrayProto[method]) {
  1185. const result2 = methodFn.apply(self, args);
  1186. return needsWrap ? toReactive(result2) : result2;
  1187. }
  1188. let wrappedFn = fn;
  1189. if (arr !== self) {
  1190. if (needsWrap) {
  1191. wrappedFn = function(item, index) {
  1192. return fn.call(this, toWrapped(self, item), index, self);
  1193. };
  1194. } else if (fn.length > 2) {
  1195. wrappedFn = function(item, index) {
  1196. return fn.call(this, item, index, self);
  1197. };
  1198. }
  1199. }
  1200. const result = methodFn.call(arr, wrappedFn, thisArg);
  1201. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  1202. }
  1203. function reduce(self, method, fn, args) {
  1204. const arr = shallowReadArray(self);
  1205. const needsWrap = arr !== self && !isShallow(self);
  1206. let wrappedFn = fn;
  1207. let wrapInitialAccumulator = false;
  1208. if (arr !== self) {
  1209. if (needsWrap) {
  1210. wrapInitialAccumulator = args.length === 0;
  1211. wrappedFn = function(acc, item, index) {
  1212. if (wrapInitialAccumulator) {
  1213. wrapInitialAccumulator = false;
  1214. acc = toWrapped(self, acc);
  1215. }
  1216. return fn.call(this, acc, toWrapped(self, item), index, self);
  1217. };
  1218. } else if (fn.length > 3) {
  1219. wrappedFn = function(acc, item, index) {
  1220. return fn.call(this, acc, item, index, self);
  1221. };
  1222. }
  1223. }
  1224. const result = arr[method](wrappedFn, ...args);
  1225. return wrapInitialAccumulator ? toWrapped(self, result) : result;
  1226. }
  1227. function searchProxy(self, method, args) {
  1228. const arr = toRaw(self);
  1229. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1230. const res = arr[method](...args);
  1231. if ((res === -1 || res === false) && isProxy(args[0])) {
  1232. args[0] = toRaw(args[0]);
  1233. return arr[method](...args);
  1234. }
  1235. return res;
  1236. }
  1237. function noTracking(self, method, args = []) {
  1238. pauseTracking();
  1239. startBatch();
  1240. const res = toRaw(self)[method].apply(self, args);
  1241. endBatch();
  1242. resetTracking();
  1243. return res;
  1244. }
  1245. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1246. const builtInSymbols = new Set(
  1247. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1248. );
  1249. function hasOwnProperty(key) {
  1250. if (!isSymbol(key)) key = String(key);
  1251. const obj = toRaw(this);
  1252. track(obj, "has", key);
  1253. return obj.hasOwnProperty(key);
  1254. }
  1255. class BaseReactiveHandler {
  1256. constructor(_isReadonly = false, _isShallow = false) {
  1257. this._isReadonly = _isReadonly;
  1258. this._isShallow = _isShallow;
  1259. }
  1260. get(target, key, receiver) {
  1261. if (key === "__v_skip") return target["__v_skip"];
  1262. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1263. if (key === "__v_isReactive") {
  1264. return !isReadonly2;
  1265. } else if (key === "__v_isReadonly") {
  1266. return isReadonly2;
  1267. } else if (key === "__v_isShallow") {
  1268. return isShallow2;
  1269. } else if (key === "__v_raw") {
  1270. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1271. // this means the receiver is a user proxy of the reactive proxy
  1272. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1273. return target;
  1274. }
  1275. return;
  1276. }
  1277. const targetIsArray = isArray(target);
  1278. if (!isReadonly2) {
  1279. let fn;
  1280. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1281. return fn;
  1282. }
  1283. if (key === "hasOwnProperty") {
  1284. return hasOwnProperty;
  1285. }
  1286. }
  1287. const res = Reflect.get(
  1288. target,
  1289. key,
  1290. // if this is a proxy wrapping a ref, return methods using the raw ref
  1291. // as receiver so that we don't have to call `toRaw` on the ref in all
  1292. // its class methods
  1293. isRef(target) ? target : receiver
  1294. );
  1295. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1296. return res;
  1297. }
  1298. if (!isReadonly2) {
  1299. track(target, "get", key);
  1300. }
  1301. if (isShallow2) {
  1302. return res;
  1303. }
  1304. if (isRef(res)) {
  1305. const value = targetIsArray && isIntegerKey(key) ? res : res.value;
  1306. return isReadonly2 && isObject(value) ? readonly(value) : value;
  1307. }
  1308. if (isObject(res)) {
  1309. return isReadonly2 ? readonly(res) : reactive(res);
  1310. }
  1311. return res;
  1312. }
  1313. }
  1314. class MutableReactiveHandler extends BaseReactiveHandler {
  1315. constructor(isShallow2 = false) {
  1316. super(false, isShallow2);
  1317. }
  1318. set(target, key, value, receiver) {
  1319. let oldValue = target[key];
  1320. const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
  1321. if (!this._isShallow) {
  1322. const isOldValueReadonly = isReadonly(oldValue);
  1323. if (!isShallow(value) && !isReadonly(value)) {
  1324. oldValue = toRaw(oldValue);
  1325. value = toRaw(value);
  1326. }
  1327. if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
  1328. if (isOldValueReadonly) {
  1329. {
  1330. warn$2(
  1331. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1332. target[key]
  1333. );
  1334. }
  1335. return true;
  1336. } else {
  1337. oldValue.value = value;
  1338. return true;
  1339. }
  1340. }
  1341. }
  1342. const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
  1343. const result = Reflect.set(
  1344. target,
  1345. key,
  1346. value,
  1347. isRef(target) ? target : receiver
  1348. );
  1349. if (target === toRaw(receiver)) {
  1350. if (!hadKey) {
  1351. trigger(target, "add", key, value);
  1352. } else if (hasChanged(value, oldValue)) {
  1353. trigger(target, "set", key, value, oldValue);
  1354. }
  1355. }
  1356. return result;
  1357. }
  1358. deleteProperty(target, key) {
  1359. const hadKey = hasOwn(target, key);
  1360. const oldValue = target[key];
  1361. const result = Reflect.deleteProperty(target, key);
  1362. if (result && hadKey) {
  1363. trigger(target, "delete", key, void 0, oldValue);
  1364. }
  1365. return result;
  1366. }
  1367. has(target, key) {
  1368. const result = Reflect.has(target, key);
  1369. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1370. track(target, "has", key);
  1371. }
  1372. return result;
  1373. }
  1374. ownKeys(target) {
  1375. track(
  1376. target,
  1377. "iterate",
  1378. isArray(target) ? "length" : ITERATE_KEY
  1379. );
  1380. return Reflect.ownKeys(target);
  1381. }
  1382. }
  1383. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1384. constructor(isShallow2 = false) {
  1385. super(true, isShallow2);
  1386. }
  1387. set(target, key) {
  1388. {
  1389. warn$2(
  1390. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1391. target
  1392. );
  1393. }
  1394. return true;
  1395. }
  1396. deleteProperty(target, key) {
  1397. {
  1398. warn$2(
  1399. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1400. target
  1401. );
  1402. }
  1403. return true;
  1404. }
  1405. }
  1406. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1407. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1408. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1409. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1410. const toShallow = (value) => value;
  1411. const getProto = (v) => Reflect.getPrototypeOf(v);
  1412. function createIterableMethod(method, isReadonly2, isShallow2) {
  1413. return function(...args) {
  1414. const target = this["__v_raw"];
  1415. const rawTarget = toRaw(target);
  1416. const targetIsMap = isMap(rawTarget);
  1417. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1418. const isKeyOnly = method === "keys" && targetIsMap;
  1419. const innerIterator = target[method](...args);
  1420. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1421. !isReadonly2 && track(
  1422. rawTarget,
  1423. "iterate",
  1424. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1425. );
  1426. return extend(
  1427. // inheriting all iterator properties
  1428. Object.create(innerIterator),
  1429. {
  1430. // iterator protocol
  1431. next() {
  1432. const { value, done } = innerIterator.next();
  1433. return done ? { value, done } : {
  1434. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1435. done
  1436. };
  1437. }
  1438. }
  1439. );
  1440. };
  1441. }
  1442. function createReadonlyMethod(type) {
  1443. return function(...args) {
  1444. {
  1445. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1446. warn$2(
  1447. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1448. toRaw(this)
  1449. );
  1450. }
  1451. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1452. };
  1453. }
  1454. function createInstrumentations(readonly, shallow) {
  1455. const instrumentations = {
  1456. get(key) {
  1457. const target = this["__v_raw"];
  1458. const rawTarget = toRaw(target);
  1459. const rawKey = toRaw(key);
  1460. if (!readonly) {
  1461. if (hasChanged(key, rawKey)) {
  1462. track(rawTarget, "get", key);
  1463. }
  1464. track(rawTarget, "get", rawKey);
  1465. }
  1466. const { has } = getProto(rawTarget);
  1467. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1468. if (has.call(rawTarget, key)) {
  1469. return wrap(target.get(key));
  1470. } else if (has.call(rawTarget, rawKey)) {
  1471. return wrap(target.get(rawKey));
  1472. } else if (target !== rawTarget) {
  1473. target.get(key);
  1474. }
  1475. },
  1476. get size() {
  1477. const target = this["__v_raw"];
  1478. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1479. return target.size;
  1480. },
  1481. has(key) {
  1482. const target = this["__v_raw"];
  1483. const rawTarget = toRaw(target);
  1484. const rawKey = toRaw(key);
  1485. if (!readonly) {
  1486. if (hasChanged(key, rawKey)) {
  1487. track(rawTarget, "has", key);
  1488. }
  1489. track(rawTarget, "has", rawKey);
  1490. }
  1491. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1492. },
  1493. forEach(callback, thisArg) {
  1494. const observed = this;
  1495. const target = observed["__v_raw"];
  1496. const rawTarget = toRaw(target);
  1497. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1498. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1499. return target.forEach((value, key) => {
  1500. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1501. });
  1502. }
  1503. };
  1504. extend(
  1505. instrumentations,
  1506. readonly ? {
  1507. add: createReadonlyMethod("add"),
  1508. set: createReadonlyMethod("set"),
  1509. delete: createReadonlyMethod("delete"),
  1510. clear: createReadonlyMethod("clear")
  1511. } : {
  1512. add(value) {
  1513. const target = toRaw(this);
  1514. const proto = getProto(target);
  1515. const rawValue = toRaw(value);
  1516. const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
  1517. const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
  1518. if (!hadKey) {
  1519. target.add(valueToAdd);
  1520. trigger(target, "add", valueToAdd, valueToAdd);
  1521. }
  1522. return this;
  1523. },
  1524. set(key, value) {
  1525. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1526. value = toRaw(value);
  1527. }
  1528. const target = toRaw(this);
  1529. const { has, get } = getProto(target);
  1530. let hadKey = has.call(target, key);
  1531. if (!hadKey) {
  1532. key = toRaw(key);
  1533. hadKey = has.call(target, key);
  1534. } else {
  1535. checkIdentityKeys(target, has, key);
  1536. }
  1537. const oldValue = get.call(target, key);
  1538. target.set(key, value);
  1539. if (!hadKey) {
  1540. trigger(target, "add", key, value);
  1541. } else if (hasChanged(value, oldValue)) {
  1542. trigger(target, "set", key, value, oldValue);
  1543. }
  1544. return this;
  1545. },
  1546. delete(key) {
  1547. const target = toRaw(this);
  1548. const { has, get } = getProto(target);
  1549. let hadKey = has.call(target, key);
  1550. if (!hadKey) {
  1551. key = toRaw(key);
  1552. hadKey = has.call(target, key);
  1553. } else {
  1554. checkIdentityKeys(target, has, key);
  1555. }
  1556. const oldValue = get ? get.call(target, key) : void 0;
  1557. const result = target.delete(key);
  1558. if (hadKey) {
  1559. trigger(target, "delete", key, void 0, oldValue);
  1560. }
  1561. return result;
  1562. },
  1563. clear() {
  1564. const target = toRaw(this);
  1565. const hadItems = target.size !== 0;
  1566. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1567. const result = target.clear();
  1568. if (hadItems) {
  1569. trigger(
  1570. target,
  1571. "clear",
  1572. void 0,
  1573. void 0,
  1574. oldTarget
  1575. );
  1576. }
  1577. return result;
  1578. }
  1579. }
  1580. );
  1581. const iteratorMethods = [
  1582. "keys",
  1583. "values",
  1584. "entries",
  1585. Symbol.iterator
  1586. ];
  1587. iteratorMethods.forEach((method) => {
  1588. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1589. });
  1590. return instrumentations;
  1591. }
  1592. function createInstrumentationGetter(isReadonly2, shallow) {
  1593. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1594. return (target, key, receiver) => {
  1595. if (key === "__v_isReactive") {
  1596. return !isReadonly2;
  1597. } else if (key === "__v_isReadonly") {
  1598. return isReadonly2;
  1599. } else if (key === "__v_raw") {
  1600. return target;
  1601. }
  1602. return Reflect.get(
  1603. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1604. key,
  1605. receiver
  1606. );
  1607. };
  1608. }
  1609. const mutableCollectionHandlers = {
  1610. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1611. };
  1612. const shallowCollectionHandlers = {
  1613. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1614. };
  1615. const readonlyCollectionHandlers = {
  1616. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1617. };
  1618. const shallowReadonlyCollectionHandlers = {
  1619. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1620. };
  1621. function checkIdentityKeys(target, has, key) {
  1622. const rawKey = toRaw(key);
  1623. if (rawKey !== key && has.call(target, rawKey)) {
  1624. const type = toRawType(target);
  1625. warn$2(
  1626. `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.`
  1627. );
  1628. }
  1629. }
  1630. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1631. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1632. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1633. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1634. function targetTypeMap(rawType) {
  1635. switch (rawType) {
  1636. case "Object":
  1637. case "Array":
  1638. return 1 /* COMMON */;
  1639. case "Map":
  1640. case "Set":
  1641. case "WeakMap":
  1642. case "WeakSet":
  1643. return 2 /* COLLECTION */;
  1644. default:
  1645. return 0 /* INVALID */;
  1646. }
  1647. }
  1648. function getTargetType(value) {
  1649. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1650. }
  1651. // @__NO_SIDE_EFFECTS__
  1652. function reactive(target) {
  1653. if (/* @__PURE__ */ isReadonly(target)) {
  1654. return target;
  1655. }
  1656. return createReactiveObject(
  1657. target,
  1658. false,
  1659. mutableHandlers,
  1660. mutableCollectionHandlers,
  1661. reactiveMap
  1662. );
  1663. }
  1664. // @__NO_SIDE_EFFECTS__
  1665. function shallowReactive(target) {
  1666. return createReactiveObject(
  1667. target,
  1668. false,
  1669. shallowReactiveHandlers,
  1670. shallowCollectionHandlers,
  1671. shallowReactiveMap
  1672. );
  1673. }
  1674. // @__NO_SIDE_EFFECTS__
  1675. function readonly(target) {
  1676. return createReactiveObject(
  1677. target,
  1678. true,
  1679. readonlyHandlers,
  1680. readonlyCollectionHandlers,
  1681. readonlyMap
  1682. );
  1683. }
  1684. // @__NO_SIDE_EFFECTS__
  1685. function shallowReadonly(target) {
  1686. return createReactiveObject(
  1687. target,
  1688. true,
  1689. shallowReadonlyHandlers,
  1690. shallowReadonlyCollectionHandlers,
  1691. shallowReadonlyMap
  1692. );
  1693. }
  1694. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1695. if (!isObject(target)) {
  1696. {
  1697. warn$2(
  1698. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1699. target
  1700. )}`
  1701. );
  1702. }
  1703. return target;
  1704. }
  1705. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1706. return target;
  1707. }
  1708. const targetType = getTargetType(target);
  1709. if (targetType === 0 /* INVALID */) {
  1710. return target;
  1711. }
  1712. const existingProxy = proxyMap.get(target);
  1713. if (existingProxy) {
  1714. return existingProxy;
  1715. }
  1716. const proxy = new Proxy(
  1717. target,
  1718. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1719. );
  1720. proxyMap.set(target, proxy);
  1721. return proxy;
  1722. }
  1723. // @__NO_SIDE_EFFECTS__
  1724. function isReactive(value) {
  1725. if (/* @__PURE__ */ isReadonly(value)) {
  1726. return /* @__PURE__ */ isReactive(value["__v_raw"]);
  1727. }
  1728. return !!(value && value["__v_isReactive"]);
  1729. }
  1730. // @__NO_SIDE_EFFECTS__
  1731. function isReadonly(value) {
  1732. return !!(value && value["__v_isReadonly"]);
  1733. }
  1734. // @__NO_SIDE_EFFECTS__
  1735. function isShallow(value) {
  1736. return !!(value && value["__v_isShallow"]);
  1737. }
  1738. // @__NO_SIDE_EFFECTS__
  1739. function isProxy(value) {
  1740. return value ? !!value["__v_raw"] : false;
  1741. }
  1742. // @__NO_SIDE_EFFECTS__
  1743. function toRaw(observed) {
  1744. const raw = observed && observed["__v_raw"];
  1745. return raw ? /* @__PURE__ */ toRaw(raw) : observed;
  1746. }
  1747. function markRaw(value) {
  1748. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1749. def(value, "__v_skip", true);
  1750. }
  1751. return value;
  1752. }
  1753. const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
  1754. const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
  1755. // @__NO_SIDE_EFFECTS__
  1756. function isRef(r) {
  1757. return r ? r["__v_isRef"] === true : false;
  1758. }
  1759. // @__NO_SIDE_EFFECTS__
  1760. function ref(value) {
  1761. return createRef(value, false);
  1762. }
  1763. // @__NO_SIDE_EFFECTS__
  1764. function shallowRef(value) {
  1765. return createRef(value, true);
  1766. }
  1767. function createRef(rawValue, shallow) {
  1768. if (/* @__PURE__ */ isRef(rawValue)) {
  1769. return rawValue;
  1770. }
  1771. return new RefImpl(rawValue, shallow);
  1772. }
  1773. class RefImpl {
  1774. constructor(value, isShallow2) {
  1775. this.dep = new Dep();
  1776. this["__v_isRef"] = true;
  1777. this["__v_isShallow"] = false;
  1778. this._rawValue = isShallow2 ? value : toRaw(value);
  1779. this._value = isShallow2 ? value : toReactive(value);
  1780. this["__v_isShallow"] = isShallow2;
  1781. }
  1782. get value() {
  1783. {
  1784. this.dep.track({
  1785. target: this,
  1786. type: "get",
  1787. key: "value"
  1788. });
  1789. }
  1790. return this._value;
  1791. }
  1792. set value(newValue) {
  1793. const oldValue = this._rawValue;
  1794. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1795. newValue = useDirectValue ? newValue : toRaw(newValue);
  1796. if (hasChanged(newValue, oldValue)) {
  1797. this._rawValue = newValue;
  1798. this._value = useDirectValue ? newValue : toReactive(newValue);
  1799. {
  1800. this.dep.trigger({
  1801. target: this,
  1802. type: "set",
  1803. key: "value",
  1804. newValue,
  1805. oldValue
  1806. });
  1807. }
  1808. }
  1809. }
  1810. }
  1811. function triggerRef(ref2) {
  1812. if (ref2.dep) {
  1813. {
  1814. ref2.dep.trigger({
  1815. target: ref2,
  1816. type: "set",
  1817. key: "value",
  1818. newValue: ref2._value
  1819. });
  1820. }
  1821. }
  1822. }
  1823. function unref(ref2) {
  1824. return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
  1825. }
  1826. function toValue(source) {
  1827. return isFunction(source) ? source() : unref(source);
  1828. }
  1829. const shallowUnwrapHandlers = {
  1830. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1831. set: (target, key, value, receiver) => {
  1832. const oldValue = target[key];
  1833. if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
  1834. oldValue.value = value;
  1835. return true;
  1836. } else {
  1837. return Reflect.set(target, key, value, receiver);
  1838. }
  1839. }
  1840. };
  1841. function proxyRefs(objectWithRefs) {
  1842. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1843. }
  1844. class CustomRefImpl {
  1845. constructor(factory) {
  1846. this["__v_isRef"] = true;
  1847. this._value = void 0;
  1848. const dep = this.dep = new Dep();
  1849. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1850. this._get = get;
  1851. this._set = set;
  1852. }
  1853. get value() {
  1854. return this._value = this._get();
  1855. }
  1856. set value(newVal) {
  1857. this._set(newVal);
  1858. }
  1859. }
  1860. function customRef(factory) {
  1861. return new CustomRefImpl(factory);
  1862. }
  1863. // @__NO_SIDE_EFFECTS__
  1864. function toRefs(object) {
  1865. if (!isProxy(object)) {
  1866. warn$2(`toRefs() expects a reactive object but received a plain one.`);
  1867. }
  1868. const ret = isArray(object) ? new Array(object.length) : {};
  1869. for (const key in object) {
  1870. ret[key] = propertyToRef(object, key);
  1871. }
  1872. return ret;
  1873. }
  1874. class ObjectRefImpl {
  1875. constructor(_object, key, _defaultValue) {
  1876. this._object = _object;
  1877. this._defaultValue = _defaultValue;
  1878. this["__v_isRef"] = true;
  1879. this._value = void 0;
  1880. this._key = isSymbol(key) ? key : String(key);
  1881. this._raw = toRaw(_object);
  1882. let shallow = true;
  1883. let obj = _object;
  1884. if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) {
  1885. do {
  1886. shallow = !isProxy(obj) || isShallow(obj);
  1887. } while (shallow && (obj = obj["__v_raw"]));
  1888. }
  1889. this._shallow = shallow;
  1890. }
  1891. get value() {
  1892. let val = this._object[this._key];
  1893. if (this._shallow) {
  1894. val = unref(val);
  1895. }
  1896. return this._value = val === void 0 ? this._defaultValue : val;
  1897. }
  1898. set value(newVal) {
  1899. if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
  1900. const nestedRef = this._object[this._key];
  1901. if (/* @__PURE__ */ isRef(nestedRef)) {
  1902. nestedRef.value = newVal;
  1903. return;
  1904. }
  1905. }
  1906. this._object[this._key] = newVal;
  1907. }
  1908. get dep() {
  1909. return getDepFromReactive(this._raw, this._key);
  1910. }
  1911. }
  1912. class GetterRefImpl {
  1913. constructor(_getter) {
  1914. this._getter = _getter;
  1915. this["__v_isRef"] = true;
  1916. this["__v_isReadonly"] = true;
  1917. this._value = void 0;
  1918. }
  1919. get value() {
  1920. return this._value = this._getter();
  1921. }
  1922. }
  1923. // @__NO_SIDE_EFFECTS__
  1924. function toRef(source, key, defaultValue) {
  1925. if (/* @__PURE__ */ isRef(source)) {
  1926. return source;
  1927. } else if (isFunction(source)) {
  1928. return new GetterRefImpl(source);
  1929. } else if (isObject(source) && arguments.length > 1) {
  1930. return propertyToRef(source, key, defaultValue);
  1931. } else {
  1932. return /* @__PURE__ */ ref(source);
  1933. }
  1934. }
  1935. function propertyToRef(source, key, defaultValue) {
  1936. return new ObjectRefImpl(source, key, defaultValue);
  1937. }
  1938. class ComputedRefImpl {
  1939. constructor(fn, setter, isSSR) {
  1940. this.fn = fn;
  1941. this.setter = setter;
  1942. /**
  1943. * @internal
  1944. */
  1945. this._value = void 0;
  1946. /**
  1947. * @internal
  1948. */
  1949. this.dep = new Dep(this);
  1950. /**
  1951. * @internal
  1952. */
  1953. this.__v_isRef = true;
  1954. // TODO isolatedDeclarations "__v_isReadonly"
  1955. // A computed is also a subscriber that tracks other deps
  1956. /**
  1957. * @internal
  1958. */
  1959. this.deps = void 0;
  1960. /**
  1961. * @internal
  1962. */
  1963. this.depsTail = void 0;
  1964. /**
  1965. * @internal
  1966. */
  1967. this.flags = 16;
  1968. /**
  1969. * @internal
  1970. */
  1971. this.globalVersion = globalVersion - 1;
  1972. /**
  1973. * @internal
  1974. */
  1975. this.next = void 0;
  1976. // for backwards compat
  1977. this.effect = this;
  1978. this["__v_isReadonly"] = !setter;
  1979. this.isSSR = isSSR;
  1980. }
  1981. /**
  1982. * @internal
  1983. */
  1984. notify() {
  1985. this.flags |= 16;
  1986. if (!(this.flags & 8) && // avoid infinite self recursion
  1987. activeSub !== this) {
  1988. batch(this, true);
  1989. return true;
  1990. }
  1991. }
  1992. get value() {
  1993. const link = this.dep.track({
  1994. target: this,
  1995. type: "get",
  1996. key: "value"
  1997. }) ;
  1998. refreshComputed(this);
  1999. if (link) {
  2000. link.version = this.dep.version;
  2001. }
  2002. return this._value;
  2003. }
  2004. set value(newValue) {
  2005. if (this.setter) {
  2006. this.setter(newValue);
  2007. } else {
  2008. warn$2("Write operation failed: computed value is readonly");
  2009. }
  2010. }
  2011. }
  2012. // @__NO_SIDE_EFFECTS__
  2013. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  2014. let getter;
  2015. let setter;
  2016. if (isFunction(getterOrOptions)) {
  2017. getter = getterOrOptions;
  2018. } else {
  2019. getter = getterOrOptions.get;
  2020. setter = getterOrOptions.set;
  2021. }
  2022. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  2023. if (debugOptions && !isSSR) {
  2024. cRef.onTrack = debugOptions.onTrack;
  2025. cRef.onTrigger = debugOptions.onTrigger;
  2026. }
  2027. return cRef;
  2028. }
  2029. const TrackOpTypes = {
  2030. "GET": "get",
  2031. "HAS": "has",
  2032. "ITERATE": "iterate"
  2033. };
  2034. const TriggerOpTypes = {
  2035. "SET": "set",
  2036. "ADD": "add",
  2037. "DELETE": "delete",
  2038. "CLEAR": "clear"
  2039. };
  2040. const INITIAL_WATCHER_VALUE = {};
  2041. const cleanupMap = /* @__PURE__ */ new WeakMap();
  2042. let activeWatcher = void 0;
  2043. function getCurrentWatcher() {
  2044. return activeWatcher;
  2045. }
  2046. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  2047. if (owner) {
  2048. let cleanups = cleanupMap.get(owner);
  2049. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  2050. cleanups.push(cleanupFn);
  2051. } else if (!failSilently) {
  2052. warn$2(
  2053. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  2054. );
  2055. }
  2056. }
  2057. function watch$1(source, cb, options = EMPTY_OBJ) {
  2058. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  2059. const warnInvalidSource = (s) => {
  2060. (options.onWarn || warn$2)(
  2061. `Invalid watch source: `,
  2062. s,
  2063. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  2064. );
  2065. };
  2066. const reactiveGetter = (source2) => {
  2067. if (deep) return source2;
  2068. if (isShallow(source2) || deep === false || deep === 0)
  2069. return traverse(source2, 1);
  2070. return traverse(source2);
  2071. };
  2072. let effect;
  2073. let getter;
  2074. let cleanup;
  2075. let boundCleanup;
  2076. let forceTrigger = false;
  2077. let isMultiSource = false;
  2078. if (isRef(source)) {
  2079. getter = () => source.value;
  2080. forceTrigger = isShallow(source);
  2081. } else if (isReactive(source)) {
  2082. getter = () => reactiveGetter(source);
  2083. forceTrigger = true;
  2084. } else if (isArray(source)) {
  2085. isMultiSource = true;
  2086. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  2087. getter = () => source.map((s) => {
  2088. if (isRef(s)) {
  2089. return s.value;
  2090. } else if (isReactive(s)) {
  2091. return reactiveGetter(s);
  2092. } else if (isFunction(s)) {
  2093. return call ? call(s, 2) : s();
  2094. } else {
  2095. warnInvalidSource(s);
  2096. }
  2097. });
  2098. } else if (isFunction(source)) {
  2099. if (cb) {
  2100. getter = call ? () => call(source, 2) : source;
  2101. } else {
  2102. getter = () => {
  2103. if (cleanup) {
  2104. pauseTracking();
  2105. try {
  2106. cleanup();
  2107. } finally {
  2108. resetTracking();
  2109. }
  2110. }
  2111. const currentEffect = activeWatcher;
  2112. activeWatcher = effect;
  2113. try {
  2114. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  2115. } finally {
  2116. activeWatcher = currentEffect;
  2117. }
  2118. };
  2119. }
  2120. } else {
  2121. getter = NOOP;
  2122. warnInvalidSource(source);
  2123. }
  2124. if (cb && deep) {
  2125. const baseGetter = getter;
  2126. const depth = deep === true ? Infinity : deep;
  2127. getter = () => traverse(baseGetter(), depth);
  2128. }
  2129. const scope = getCurrentScope();
  2130. const watchHandle = () => {
  2131. effect.stop();
  2132. if (scope && scope.active) {
  2133. remove(scope.effects, effect);
  2134. }
  2135. };
  2136. if (once && cb) {
  2137. const _cb = cb;
  2138. cb = (...args) => {
  2139. _cb(...args);
  2140. watchHandle();
  2141. };
  2142. }
  2143. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  2144. const job = (immediateFirstRun) => {
  2145. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  2146. return;
  2147. }
  2148. if (cb) {
  2149. const newValue = effect.run();
  2150. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  2151. if (cleanup) {
  2152. cleanup();
  2153. }
  2154. const currentWatcher = activeWatcher;
  2155. activeWatcher = effect;
  2156. try {
  2157. const args = [
  2158. newValue,
  2159. // pass undefined as the old value when it's changed for the first time
  2160. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  2161. boundCleanup
  2162. ];
  2163. oldValue = newValue;
  2164. call ? call(cb, 3, args) : (
  2165. // @ts-expect-error
  2166. cb(...args)
  2167. );
  2168. } finally {
  2169. activeWatcher = currentWatcher;
  2170. }
  2171. }
  2172. } else {
  2173. effect.run();
  2174. }
  2175. };
  2176. if (augmentJob) {
  2177. augmentJob(job);
  2178. }
  2179. effect = new ReactiveEffect(getter);
  2180. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  2181. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  2182. cleanup = effect.onStop = () => {
  2183. const cleanups = cleanupMap.get(effect);
  2184. if (cleanups) {
  2185. if (call) {
  2186. call(cleanups, 4);
  2187. } else {
  2188. for (const cleanup2 of cleanups) cleanup2();
  2189. }
  2190. cleanupMap.delete(effect);
  2191. }
  2192. };
  2193. {
  2194. effect.onTrack = options.onTrack;
  2195. effect.onTrigger = options.onTrigger;
  2196. }
  2197. if (cb) {
  2198. if (immediate) {
  2199. job(true);
  2200. } else {
  2201. oldValue = effect.run();
  2202. }
  2203. } else if (scheduler) {
  2204. scheduler(job.bind(null, true), true);
  2205. } else {
  2206. effect.run();
  2207. }
  2208. watchHandle.pause = effect.pause.bind(effect);
  2209. watchHandle.resume = effect.resume.bind(effect);
  2210. watchHandle.stop = watchHandle;
  2211. return watchHandle;
  2212. }
  2213. function traverse(value, depth = Infinity, seen) {
  2214. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2215. return value;
  2216. }
  2217. seen = seen || /* @__PURE__ */ new Map();
  2218. if ((seen.get(value) || 0) >= depth) {
  2219. return value;
  2220. }
  2221. seen.set(value, depth);
  2222. depth--;
  2223. if (isRef(value)) {
  2224. traverse(value.value, depth, seen);
  2225. } else if (isArray(value)) {
  2226. for (let i = 0; i < value.length; i++) {
  2227. traverse(value[i], depth, seen);
  2228. }
  2229. } else if (isSet(value) || isMap(value)) {
  2230. value.forEach((v) => {
  2231. traverse(v, depth, seen);
  2232. });
  2233. } else if (isPlainObject(value)) {
  2234. for (const key in value) {
  2235. traverse(value[key], depth, seen);
  2236. }
  2237. for (const key of Object.getOwnPropertySymbols(value)) {
  2238. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2239. traverse(value[key], depth, seen);
  2240. }
  2241. }
  2242. }
  2243. return value;
  2244. }
  2245. const stack = [];
  2246. function pushWarningContext(vnode) {
  2247. stack.push(vnode);
  2248. }
  2249. function popWarningContext() {
  2250. stack.pop();
  2251. }
  2252. let isWarning = false;
  2253. function warn$1(msg, ...args) {
  2254. if (isWarning) return;
  2255. isWarning = true;
  2256. pauseTracking();
  2257. const instance = stack.length ? stack[stack.length - 1].component : null;
  2258. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2259. const trace = getComponentTrace();
  2260. if (appWarnHandler) {
  2261. callWithErrorHandling(
  2262. appWarnHandler,
  2263. instance,
  2264. 11,
  2265. [
  2266. // eslint-disable-next-line no-restricted-syntax
  2267. msg + args.map((a) => {
  2268. var _a, _b;
  2269. return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
  2270. }).join(""),
  2271. instance && instance.proxy,
  2272. trace.map(
  2273. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  2274. ).join("\n"),
  2275. trace
  2276. ]
  2277. );
  2278. } else {
  2279. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2280. if (trace.length && // avoid spamming console during tests
  2281. true) {
  2282. warnArgs.push(`
  2283. `, ...formatTrace(trace));
  2284. }
  2285. console.warn(...warnArgs);
  2286. }
  2287. resetTracking();
  2288. isWarning = false;
  2289. }
  2290. function getComponentTrace() {
  2291. let currentVNode = stack[stack.length - 1];
  2292. if (!currentVNode) {
  2293. return [];
  2294. }
  2295. const normalizedStack = [];
  2296. while (currentVNode) {
  2297. const last = normalizedStack[0];
  2298. if (last && last.vnode === currentVNode) {
  2299. last.recurseCount++;
  2300. } else {
  2301. normalizedStack.push({
  2302. vnode: currentVNode,
  2303. recurseCount: 0
  2304. });
  2305. }
  2306. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2307. currentVNode = parentInstance && parentInstance.vnode;
  2308. }
  2309. return normalizedStack;
  2310. }
  2311. function formatTrace(trace) {
  2312. const logs = [];
  2313. trace.forEach((entry, i) => {
  2314. logs.push(...i === 0 ? [] : [`
  2315. `], ...formatTraceEntry(entry));
  2316. });
  2317. return logs;
  2318. }
  2319. function formatTraceEntry({ vnode, recurseCount }) {
  2320. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2321. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2322. const open = ` at <${formatComponentName(
  2323. vnode.component,
  2324. vnode.type,
  2325. isRoot
  2326. )}`;
  2327. const close = `>` + postfix;
  2328. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2329. }
  2330. function formatProps(props) {
  2331. const res = [];
  2332. const keys = Object.keys(props);
  2333. keys.slice(0, 3).forEach((key) => {
  2334. res.push(...formatProp(key, props[key]));
  2335. });
  2336. if (keys.length > 3) {
  2337. res.push(` ...`);
  2338. }
  2339. return res;
  2340. }
  2341. function formatProp(key, value, raw) {
  2342. if (isString(value)) {
  2343. value = JSON.stringify(value);
  2344. return raw ? value : [`${key}=${value}`];
  2345. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2346. return raw ? value : [`${key}=${value}`];
  2347. } else if (isRef(value)) {
  2348. value = formatProp(key, toRaw(value.value), true);
  2349. return raw ? value : [`${key}=Ref<`, value, `>`];
  2350. } else if (isFunction(value)) {
  2351. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2352. } else {
  2353. value = toRaw(value);
  2354. return raw ? value : [`${key}=`, value];
  2355. }
  2356. }
  2357. function assertNumber(val, type) {
  2358. if (val === void 0) {
  2359. return;
  2360. } else if (typeof val !== "number") {
  2361. warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  2362. } else if (isNaN(val)) {
  2363. warn$1(`${type} is NaN - the duration expression might be incorrect.`);
  2364. }
  2365. }
  2366. const ErrorCodes = {
  2367. "SETUP_FUNCTION": 0,
  2368. "0": "SETUP_FUNCTION",
  2369. "RENDER_FUNCTION": 1,
  2370. "1": "RENDER_FUNCTION",
  2371. "NATIVE_EVENT_HANDLER": 5,
  2372. "5": "NATIVE_EVENT_HANDLER",
  2373. "COMPONENT_EVENT_HANDLER": 6,
  2374. "6": "COMPONENT_EVENT_HANDLER",
  2375. "VNODE_HOOK": 7,
  2376. "7": "VNODE_HOOK",
  2377. "DIRECTIVE_HOOK": 8,
  2378. "8": "DIRECTIVE_HOOK",
  2379. "TRANSITION_HOOK": 9,
  2380. "9": "TRANSITION_HOOK",
  2381. "APP_ERROR_HANDLER": 10,
  2382. "10": "APP_ERROR_HANDLER",
  2383. "APP_WARN_HANDLER": 11,
  2384. "11": "APP_WARN_HANDLER",
  2385. "FUNCTION_REF": 12,
  2386. "12": "FUNCTION_REF",
  2387. "ASYNC_COMPONENT_LOADER": 13,
  2388. "13": "ASYNC_COMPONENT_LOADER",
  2389. "SCHEDULER": 14,
  2390. "14": "SCHEDULER",
  2391. "COMPONENT_UPDATE": 15,
  2392. "15": "COMPONENT_UPDATE",
  2393. "APP_UNMOUNT_CLEANUP": 16,
  2394. "16": "APP_UNMOUNT_CLEANUP"
  2395. };
  2396. const ErrorTypeStrings$1 = {
  2397. ["sp"]: "serverPrefetch hook",
  2398. ["bc"]: "beforeCreate hook",
  2399. ["c"]: "created hook",
  2400. ["bm"]: "beforeMount hook",
  2401. ["m"]: "mounted hook",
  2402. ["bu"]: "beforeUpdate hook",
  2403. ["u"]: "updated",
  2404. ["bum"]: "beforeUnmount hook",
  2405. ["um"]: "unmounted hook",
  2406. ["a"]: "activated hook",
  2407. ["da"]: "deactivated hook",
  2408. ["ec"]: "errorCaptured hook",
  2409. ["rtc"]: "renderTracked hook",
  2410. ["rtg"]: "renderTriggered hook",
  2411. [0]: "setup function",
  2412. [1]: "render function",
  2413. [2]: "watcher getter",
  2414. [3]: "watcher callback",
  2415. [4]: "watcher cleanup function",
  2416. [5]: "native event handler",
  2417. [6]: "component event handler",
  2418. [7]: "vnode hook",
  2419. [8]: "directive hook",
  2420. [9]: "transition hook",
  2421. [10]: "app errorHandler",
  2422. [11]: "app warnHandler",
  2423. [12]: "ref function",
  2424. [13]: "async component loader",
  2425. [14]: "scheduler flush",
  2426. [15]: "component update",
  2427. [16]: "app unmount cleanup function"
  2428. };
  2429. function callWithErrorHandling(fn, instance, type, args) {
  2430. try {
  2431. return args ? fn(...args) : fn();
  2432. } catch (err) {
  2433. handleError(err, instance, type);
  2434. }
  2435. }
  2436. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2437. if (isFunction(fn)) {
  2438. const res = callWithErrorHandling(fn, instance, type, args);
  2439. if (res && isPromise(res)) {
  2440. res.catch((err) => {
  2441. handleError(err, instance, type);
  2442. });
  2443. }
  2444. return res;
  2445. }
  2446. if (isArray(fn)) {
  2447. const values = [];
  2448. for (let i = 0; i < fn.length; i++) {
  2449. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2450. }
  2451. return values;
  2452. } else {
  2453. warn$1(
  2454. `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
  2455. );
  2456. }
  2457. }
  2458. function handleError(err, instance, type, throwInDev = true) {
  2459. const contextVNode = instance ? instance.vnode : null;
  2460. const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
  2461. if (instance) {
  2462. let cur = instance.parent;
  2463. const exposedInstance = instance.proxy;
  2464. const errorInfo = ErrorTypeStrings$1[type] ;
  2465. while (cur) {
  2466. const errorCapturedHooks = cur.ec;
  2467. if (errorCapturedHooks) {
  2468. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2469. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2470. return;
  2471. }
  2472. }
  2473. }
  2474. cur = cur.parent;
  2475. }
  2476. if (errorHandler) {
  2477. pauseTracking();
  2478. callWithErrorHandling(errorHandler, null, 10, [
  2479. err,
  2480. exposedInstance,
  2481. errorInfo
  2482. ]);
  2483. resetTracking();
  2484. return;
  2485. }
  2486. }
  2487. logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
  2488. }
  2489. function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
  2490. {
  2491. const info = ErrorTypeStrings$1[type];
  2492. if (contextVNode) {
  2493. pushWarningContext(contextVNode);
  2494. }
  2495. warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2496. if (contextVNode) {
  2497. popWarningContext();
  2498. }
  2499. if (throwInDev) {
  2500. throw err;
  2501. } else {
  2502. console.error(err);
  2503. }
  2504. }
  2505. }
  2506. const queue = [];
  2507. let flushIndex = -1;
  2508. const pendingPostFlushCbs = [];
  2509. let activePostFlushCbs = null;
  2510. let postFlushIndex = 0;
  2511. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2512. let currentFlushPromise = null;
  2513. const RECURSION_LIMIT = 100;
  2514. function nextTick(fn) {
  2515. const p = currentFlushPromise || resolvedPromise;
  2516. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  2517. }
  2518. function findInsertionIndex(id) {
  2519. let start = flushIndex + 1;
  2520. let end = queue.length;
  2521. while (start < end) {
  2522. const middle = start + end >>> 1;
  2523. const middleJob = queue[middle];
  2524. const middleJobId = getId(middleJob);
  2525. if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
  2526. start = middle + 1;
  2527. } else {
  2528. end = middle;
  2529. }
  2530. }
  2531. return start;
  2532. }
  2533. function queueJob(job) {
  2534. if (!(job.flags & 1)) {
  2535. const jobId = getId(job);
  2536. const lastJob = queue[queue.length - 1];
  2537. if (!lastJob || // fast path when the job id is larger than the tail
  2538. !(job.flags & 2) && jobId >= getId(lastJob)) {
  2539. queue.push(job);
  2540. } else {
  2541. queue.splice(findInsertionIndex(jobId), 0, job);
  2542. }
  2543. job.flags |= 1;
  2544. queueFlush();
  2545. }
  2546. }
  2547. function queueFlush() {
  2548. if (!currentFlushPromise) {
  2549. currentFlushPromise = resolvedPromise.then(flushJobs);
  2550. }
  2551. }
  2552. function queuePostFlushCb(cb) {
  2553. if (!isArray(cb)) {
  2554. if (activePostFlushCbs && cb.id === -1) {
  2555. activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
  2556. } else if (!(cb.flags & 1)) {
  2557. pendingPostFlushCbs.push(cb);
  2558. cb.flags |= 1;
  2559. }
  2560. } else {
  2561. pendingPostFlushCbs.push(...cb);
  2562. }
  2563. queueFlush();
  2564. }
  2565. function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
  2566. {
  2567. seen = seen || /* @__PURE__ */ new Map();
  2568. }
  2569. for (; i < queue.length; i++) {
  2570. const cb = queue[i];
  2571. if (cb && cb.flags & 2) {
  2572. if (instance && cb.id !== instance.uid) {
  2573. continue;
  2574. }
  2575. if (checkRecursiveUpdates(seen, cb)) {
  2576. continue;
  2577. }
  2578. queue.splice(i, 1);
  2579. i--;
  2580. if (cb.flags & 4) {
  2581. cb.flags &= -2;
  2582. }
  2583. cb();
  2584. if (!(cb.flags & 4)) {
  2585. cb.flags &= -2;
  2586. }
  2587. }
  2588. }
  2589. }
  2590. function flushPostFlushCbs(seen) {
  2591. if (pendingPostFlushCbs.length) {
  2592. const deduped = [...new Set(pendingPostFlushCbs)].sort(
  2593. (a, b) => getId(a) - getId(b)
  2594. );
  2595. pendingPostFlushCbs.length = 0;
  2596. if (activePostFlushCbs) {
  2597. activePostFlushCbs.push(...deduped);
  2598. return;
  2599. }
  2600. activePostFlushCbs = deduped;
  2601. {
  2602. seen = seen || /* @__PURE__ */ new Map();
  2603. }
  2604. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2605. const cb = activePostFlushCbs[postFlushIndex];
  2606. if (checkRecursiveUpdates(seen, cb)) {
  2607. continue;
  2608. }
  2609. if (cb.flags & 4) {
  2610. cb.flags &= -2;
  2611. }
  2612. if (!(cb.flags & 8)) cb();
  2613. cb.flags &= -2;
  2614. }
  2615. activePostFlushCbs = null;
  2616. postFlushIndex = 0;
  2617. }
  2618. }
  2619. const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
  2620. function flushJobs(seen) {
  2621. {
  2622. seen = seen || /* @__PURE__ */ new Map();
  2623. }
  2624. const check = (job) => checkRecursiveUpdates(seen, job) ;
  2625. try {
  2626. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  2627. const job = queue[flushIndex];
  2628. if (job && !(job.flags & 8)) {
  2629. if (check(job)) {
  2630. continue;
  2631. }
  2632. if (job.flags & 4) {
  2633. job.flags &= ~1;
  2634. }
  2635. callWithErrorHandling(
  2636. job,
  2637. job.i,
  2638. job.i ? 15 : 14
  2639. );
  2640. if (!(job.flags & 4)) {
  2641. job.flags &= ~1;
  2642. }
  2643. }
  2644. }
  2645. } finally {
  2646. for (; flushIndex < queue.length; flushIndex++) {
  2647. const job = queue[flushIndex];
  2648. if (job) {
  2649. job.flags &= -2;
  2650. }
  2651. }
  2652. flushIndex = -1;
  2653. queue.length = 0;
  2654. flushPostFlushCbs(seen);
  2655. currentFlushPromise = null;
  2656. if (queue.length || pendingPostFlushCbs.length) {
  2657. flushJobs(seen);
  2658. }
  2659. }
  2660. }
  2661. function checkRecursiveUpdates(seen, fn) {
  2662. const count = seen.get(fn) || 0;
  2663. if (count > RECURSION_LIMIT) {
  2664. const instance = fn.i;
  2665. const componentName = instance && getComponentName(instance.type);
  2666. handleError(
  2667. `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.`,
  2668. null,
  2669. 10
  2670. );
  2671. return true;
  2672. }
  2673. seen.set(fn, count + 1);
  2674. return false;
  2675. }
  2676. let isHmrUpdating = false;
  2677. const setHmrUpdating = (v) => {
  2678. try {
  2679. return isHmrUpdating;
  2680. } finally {
  2681. isHmrUpdating = v;
  2682. }
  2683. };
  2684. const hmrDirtyComponents = /* @__PURE__ */ new Map();
  2685. {
  2686. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  2687. createRecord: tryWrap(createRecord),
  2688. rerender: tryWrap(rerender),
  2689. reload: tryWrap(reload)
  2690. };
  2691. }
  2692. const map = /* @__PURE__ */ new Map();
  2693. function registerHMR(instance) {
  2694. const id = instance.type.__hmrId;
  2695. let record = map.get(id);
  2696. if (!record) {
  2697. createRecord(id, instance.type);
  2698. record = map.get(id);
  2699. }
  2700. record.instances.add(instance);
  2701. }
  2702. function unregisterHMR(instance) {
  2703. map.get(instance.type.__hmrId).instances.delete(instance);
  2704. }
  2705. function createRecord(id, initialDef) {
  2706. if (map.has(id)) {
  2707. return false;
  2708. }
  2709. map.set(id, {
  2710. initialDef: normalizeClassComponent(initialDef),
  2711. instances: /* @__PURE__ */ new Set()
  2712. });
  2713. return true;
  2714. }
  2715. function normalizeClassComponent(component) {
  2716. return isClassComponent(component) ? component.__vccOpts : component;
  2717. }
  2718. function rerender(id, newRender) {
  2719. const record = map.get(id);
  2720. if (!record) {
  2721. return;
  2722. }
  2723. record.initialDef.render = newRender;
  2724. [...record.instances].forEach((instance) => {
  2725. if (newRender) {
  2726. instance.render = newRender;
  2727. normalizeClassComponent(instance.type).render = newRender;
  2728. }
  2729. instance.renderCache = [];
  2730. isHmrUpdating = true;
  2731. if (!(instance.job.flags & 8)) {
  2732. instance.update();
  2733. }
  2734. isHmrUpdating = false;
  2735. });
  2736. }
  2737. function reload(id, newComp) {
  2738. const record = map.get(id);
  2739. if (!record) return;
  2740. newComp = normalizeClassComponent(newComp);
  2741. updateComponentDef(record.initialDef, newComp);
  2742. const instances = [...record.instances];
  2743. for (let i = 0; i < instances.length; i++) {
  2744. const instance = instances[i];
  2745. const oldComp = normalizeClassComponent(instance.type);
  2746. let dirtyInstances = hmrDirtyComponents.get(oldComp);
  2747. if (!dirtyInstances) {
  2748. if (oldComp !== record.initialDef) {
  2749. updateComponentDef(oldComp, newComp);
  2750. }
  2751. hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
  2752. }
  2753. dirtyInstances.add(instance);
  2754. instance.appContext.propsCache.delete(instance.type);
  2755. instance.appContext.emitsCache.delete(instance.type);
  2756. instance.appContext.optionsCache.delete(instance.type);
  2757. if (instance.ceReload) {
  2758. dirtyInstances.add(instance);
  2759. instance.ceReload(newComp.styles);
  2760. dirtyInstances.delete(instance);
  2761. } else if (instance.parent) {
  2762. queueJob(() => {
  2763. if (!(instance.job.flags & 8)) {
  2764. isHmrUpdating = true;
  2765. instance.parent.update();
  2766. isHmrUpdating = false;
  2767. dirtyInstances.delete(instance);
  2768. }
  2769. });
  2770. } else if (instance.appContext.reload) {
  2771. instance.appContext.reload();
  2772. } else if (typeof window !== "undefined") {
  2773. window.location.reload();
  2774. } else {
  2775. console.warn(
  2776. "[HMR] Root or manually mounted instance modified. Full reload required."
  2777. );
  2778. }
  2779. if (instance.root.ce && instance !== instance.root) {
  2780. instance.root.ce._removeChildStyle(oldComp);
  2781. }
  2782. }
  2783. queuePostFlushCb(() => {
  2784. hmrDirtyComponents.clear();
  2785. });
  2786. }
  2787. function updateComponentDef(oldComp, newComp) {
  2788. extend(oldComp, newComp);
  2789. for (const key in oldComp) {
  2790. if (key !== "__file" && !(key in newComp)) {
  2791. delete oldComp[key];
  2792. }
  2793. }
  2794. }
  2795. function tryWrap(fn) {
  2796. return (id, arg) => {
  2797. try {
  2798. return fn(id, arg);
  2799. } catch (e) {
  2800. console.error(e);
  2801. console.warn(
  2802. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  2803. );
  2804. }
  2805. };
  2806. }
  2807. let devtools$1;
  2808. let buffer = [];
  2809. let devtoolsNotInstalled = false;
  2810. function emit$1(event, ...args) {
  2811. if (devtools$1) {
  2812. devtools$1.emit(event, ...args);
  2813. } else if (!devtoolsNotInstalled) {
  2814. buffer.push({ event, args });
  2815. }
  2816. }
  2817. function setDevtoolsHook$1(hook, target) {
  2818. var _a, _b;
  2819. devtools$1 = hook;
  2820. if (devtools$1) {
  2821. devtools$1.enabled = true;
  2822. buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
  2823. buffer = [];
  2824. } else if (
  2825. // handle late devtools injection - only do this if we are in an actual
  2826. // browser environment to avoid the timer handle stalling test runner exit
  2827. // (#4815)
  2828. typeof window !== "undefined" && // some envs mock window but not fully
  2829. window.HTMLElement && // also exclude jsdom
  2830. // eslint-disable-next-line no-restricted-syntax
  2831. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  2832. ) {
  2833. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  2834. replay.push((newHook) => {
  2835. setDevtoolsHook$1(newHook, target);
  2836. });
  2837. setTimeout(() => {
  2838. if (!devtools$1) {
  2839. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  2840. devtoolsNotInstalled = true;
  2841. buffer = [];
  2842. }
  2843. }, 3e3);
  2844. } else {
  2845. devtoolsNotInstalled = true;
  2846. buffer = [];
  2847. }
  2848. }
  2849. function devtoolsInitApp(app, version) {
  2850. emit$1("app:init" /* APP_INIT */, app, version, {
  2851. Fragment,
  2852. Text,
  2853. Comment,
  2854. Static
  2855. });
  2856. }
  2857. function devtoolsUnmountApp(app) {
  2858. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  2859. }
  2860. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
  2861. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  2862. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  2863. "component:removed" /* COMPONENT_REMOVED */
  2864. );
  2865. const devtoolsComponentRemoved = (component) => {
  2866. if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  2867. !devtools$1.cleanupBuffer(component)) {
  2868. _devtoolsComponentRemoved(component);
  2869. }
  2870. };
  2871. // @__NO_SIDE_EFFECTS__
  2872. function createDevtoolsComponentHook(hook) {
  2873. return (component) => {
  2874. emit$1(
  2875. hook,
  2876. component.appContext.app,
  2877. component.uid,
  2878. component.parent ? component.parent.uid : void 0,
  2879. component
  2880. );
  2881. };
  2882. }
  2883. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
  2884. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
  2885. function createDevtoolsPerformanceHook(hook) {
  2886. return (component, type, time) => {
  2887. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  2888. };
  2889. }
  2890. function devtoolsComponentEmit(component, event, params) {
  2891. emit$1(
  2892. "component:emit" /* COMPONENT_EMIT */,
  2893. component.appContext.app,
  2894. component,
  2895. event,
  2896. params
  2897. );
  2898. }
  2899. let currentRenderingInstance = null;
  2900. let currentScopeId = null;
  2901. function setCurrentRenderingInstance(instance) {
  2902. const prev = currentRenderingInstance;
  2903. currentRenderingInstance = instance;
  2904. currentScopeId = instance && instance.type.__scopeId || null;
  2905. return prev;
  2906. }
  2907. function pushScopeId(id) {
  2908. currentScopeId = id;
  2909. }
  2910. function popScopeId() {
  2911. currentScopeId = null;
  2912. }
  2913. const withScopeId = (_id) => withCtx;
  2914. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2915. if (!ctx) return fn;
  2916. if (fn._n) {
  2917. return fn;
  2918. }
  2919. const renderFnWithContext = (...args) => {
  2920. if (renderFnWithContext._d) {
  2921. setBlockTracking(-1);
  2922. }
  2923. const prevInstance = setCurrentRenderingInstance(ctx);
  2924. let res;
  2925. try {
  2926. res = fn(...args);
  2927. } finally {
  2928. setCurrentRenderingInstance(prevInstance);
  2929. if (renderFnWithContext._d) {
  2930. setBlockTracking(1);
  2931. }
  2932. }
  2933. {
  2934. devtoolsComponentUpdated(ctx);
  2935. }
  2936. return res;
  2937. };
  2938. renderFnWithContext._n = true;
  2939. renderFnWithContext._c = true;
  2940. renderFnWithContext._d = true;
  2941. return renderFnWithContext;
  2942. }
  2943. function validateDirectiveName(name) {
  2944. if (isBuiltInDirective(name)) {
  2945. warn$1("Do not use built-in directive ids as custom directive id: " + name);
  2946. }
  2947. }
  2948. function withDirectives(vnode, directives) {
  2949. if (currentRenderingInstance === null) {
  2950. warn$1(`withDirectives can only be used inside render functions.`);
  2951. return vnode;
  2952. }
  2953. const instance = getComponentPublicInstance(currentRenderingInstance);
  2954. const bindings = vnode.dirs || (vnode.dirs = []);
  2955. for (let i = 0; i < directives.length; i++) {
  2956. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2957. if (dir) {
  2958. if (isFunction(dir)) {
  2959. dir = {
  2960. mounted: dir,
  2961. updated: dir
  2962. };
  2963. }
  2964. if (dir.deep) {
  2965. traverse(value);
  2966. }
  2967. bindings.push({
  2968. dir,
  2969. instance,
  2970. value,
  2971. oldValue: void 0,
  2972. arg,
  2973. modifiers
  2974. });
  2975. }
  2976. }
  2977. return vnode;
  2978. }
  2979. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2980. const bindings = vnode.dirs;
  2981. const oldBindings = prevVNode && prevVNode.dirs;
  2982. for (let i = 0; i < bindings.length; i++) {
  2983. const binding = bindings[i];
  2984. if (oldBindings) {
  2985. binding.oldValue = oldBindings[i].value;
  2986. }
  2987. let hook = binding.dir[name];
  2988. if (hook) {
  2989. pauseTracking();
  2990. callWithAsyncErrorHandling(hook, instance, 8, [
  2991. vnode.el,
  2992. binding,
  2993. vnode,
  2994. prevVNode
  2995. ]);
  2996. resetTracking();
  2997. }
  2998. }
  2999. }
  3000. function provide(key, value) {
  3001. {
  3002. if (!currentInstance || currentInstance.isMounted) {
  3003. warn$1(`provide() can only be used inside setup().`);
  3004. }
  3005. }
  3006. if (currentInstance) {
  3007. let provides = currentInstance.provides;
  3008. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3009. if (parentProvides === provides) {
  3010. provides = currentInstance.provides = Object.create(parentProvides);
  3011. }
  3012. provides[key] = value;
  3013. }
  3014. }
  3015. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3016. const instance = getCurrentInstance();
  3017. if (instance || currentApp) {
  3018. let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
  3019. if (provides && key in provides) {
  3020. return provides[key];
  3021. } else if (arguments.length > 1) {
  3022. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  3023. } else {
  3024. warn$1(`injection "${String(key)}" not found.`);
  3025. }
  3026. } else {
  3027. warn$1(`inject() can only be used inside setup() or functional components.`);
  3028. }
  3029. }
  3030. function hasInjectionContext() {
  3031. return !!(getCurrentInstance() || currentApp);
  3032. }
  3033. const ssrContextKey = /* @__PURE__ */ Symbol.for("v-scx");
  3034. const useSSRContext = () => {
  3035. {
  3036. const ctx = inject(ssrContextKey);
  3037. if (!ctx) {
  3038. warn$1(
  3039. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  3040. );
  3041. }
  3042. return ctx;
  3043. }
  3044. };
  3045. function watchEffect(effect, options) {
  3046. return doWatch(effect, null, options);
  3047. }
  3048. function watchPostEffect(effect, options) {
  3049. return doWatch(
  3050. effect,
  3051. null,
  3052. extend({}, options, { flush: "post" })
  3053. );
  3054. }
  3055. function watchSyncEffect(effect, options) {
  3056. return doWatch(
  3057. effect,
  3058. null,
  3059. extend({}, options, { flush: "sync" })
  3060. );
  3061. }
  3062. function watch(source, cb, options) {
  3063. if (!isFunction(cb)) {
  3064. warn$1(
  3065. `\`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.`
  3066. );
  3067. }
  3068. return doWatch(source, cb, options);
  3069. }
  3070. function doWatch(source, cb, options = EMPTY_OBJ) {
  3071. const { immediate, deep, flush, once } = options;
  3072. if (!cb) {
  3073. if (immediate !== void 0) {
  3074. warn$1(
  3075. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3076. );
  3077. }
  3078. if (deep !== void 0) {
  3079. warn$1(
  3080. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3081. );
  3082. }
  3083. if (once !== void 0) {
  3084. warn$1(
  3085. `watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
  3086. );
  3087. }
  3088. }
  3089. const baseWatchOptions = extend({}, options);
  3090. baseWatchOptions.onWarn = warn$1;
  3091. const runsImmediately = cb && immediate || !cb && flush !== "post";
  3092. let ssrCleanup;
  3093. if (isInSSRComponentSetup) {
  3094. if (flush === "sync") {
  3095. const ctx = useSSRContext();
  3096. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  3097. } else if (!runsImmediately) {
  3098. const watchStopHandle = () => {
  3099. };
  3100. watchStopHandle.stop = NOOP;
  3101. watchStopHandle.resume = NOOP;
  3102. watchStopHandle.pause = NOOP;
  3103. return watchStopHandle;
  3104. }
  3105. }
  3106. const instance = currentInstance;
  3107. baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
  3108. let isPre = false;
  3109. if (flush === "post") {
  3110. baseWatchOptions.scheduler = (job) => {
  3111. queuePostRenderEffect(job, instance && instance.suspense);
  3112. };
  3113. } else if (flush !== "sync") {
  3114. isPre = true;
  3115. baseWatchOptions.scheduler = (job, isFirstRun) => {
  3116. if (isFirstRun) {
  3117. job();
  3118. } else {
  3119. queueJob(job);
  3120. }
  3121. };
  3122. }
  3123. baseWatchOptions.augmentJob = (job) => {
  3124. if (cb) {
  3125. job.flags |= 4;
  3126. }
  3127. if (isPre) {
  3128. job.flags |= 2;
  3129. if (instance) {
  3130. job.id = instance.uid;
  3131. job.i = instance;
  3132. }
  3133. }
  3134. };
  3135. const watchHandle = watch$1(source, cb, baseWatchOptions);
  3136. if (isInSSRComponentSetup) {
  3137. if (ssrCleanup) {
  3138. ssrCleanup.push(watchHandle);
  3139. } else if (runsImmediately) {
  3140. watchHandle();
  3141. }
  3142. }
  3143. return watchHandle;
  3144. }
  3145. function instanceWatch(source, value, options) {
  3146. const publicThis = this.proxy;
  3147. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3148. let cb;
  3149. if (isFunction(value)) {
  3150. cb = value;
  3151. } else {
  3152. cb = value.handler;
  3153. options = value;
  3154. }
  3155. const reset = setCurrentInstance(this);
  3156. const res = doWatch(getter, cb.bind(publicThis), options);
  3157. reset();
  3158. return res;
  3159. }
  3160. function createPathGetter(ctx, path) {
  3161. const segments = path.split(".");
  3162. return () => {
  3163. let cur = ctx;
  3164. for (let i = 0; i < segments.length && cur; i++) {
  3165. cur = cur[segments[i]];
  3166. }
  3167. return cur;
  3168. };
  3169. }
  3170. const pendingMounts = /* @__PURE__ */ new WeakMap();
  3171. const TeleportEndKey = /* @__PURE__ */ Symbol("_vte");
  3172. const isTeleport = (type) => type.__isTeleport;
  3173. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  3174. const isTeleportDeferred = (props) => props && (props.defer || props.defer === "");
  3175. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  3176. const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
  3177. const resolveTarget = (props, select) => {
  3178. const targetSelector = props && props.to;
  3179. if (isString(targetSelector)) {
  3180. if (!select) {
  3181. warn$1(
  3182. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  3183. );
  3184. return null;
  3185. } else {
  3186. const target = select(targetSelector);
  3187. if (!target && !isTeleportDisabled(props)) {
  3188. warn$1(
  3189. `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
  3190. );
  3191. }
  3192. return target;
  3193. }
  3194. } else {
  3195. if (!targetSelector && !isTeleportDisabled(props)) {
  3196. warn$1(`Invalid Teleport target: ${targetSelector}`);
  3197. }
  3198. return targetSelector;
  3199. }
  3200. };
  3201. const TeleportImpl = {
  3202. name: "Teleport",
  3203. __isTeleport: true,
  3204. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
  3205. const {
  3206. mc: mountChildren,
  3207. pc: patchChildren,
  3208. pbc: patchBlockChildren,
  3209. o: { insert, querySelector, createText, createComment, parentNode }
  3210. } = internals;
  3211. const disabled = isTeleportDisabled(n2.props);
  3212. let { dynamicChildren } = n2;
  3213. if (isHmrUpdating) {
  3214. optimized = false;
  3215. dynamicChildren = null;
  3216. }
  3217. const mount = (vnode, container2, anchor2) => {
  3218. if (vnode.shapeFlag & 16) {
  3219. mountChildren(
  3220. vnode.children,
  3221. container2,
  3222. anchor2,
  3223. parentComponent,
  3224. parentSuspense,
  3225. namespace,
  3226. slotScopeIds,
  3227. optimized
  3228. );
  3229. }
  3230. };
  3231. const mountToTarget = (vnode = n2) => {
  3232. const disabled2 = isTeleportDisabled(vnode.props);
  3233. const target = vnode.target = resolveTarget(vnode.props, querySelector);
  3234. const targetAnchor = prepareAnchor(target, vnode, createText, insert);
  3235. if (target) {
  3236. if (namespace !== "svg" && isTargetSVG(target)) {
  3237. namespace = "svg";
  3238. } else if (namespace !== "mathml" && isTargetMathML(target)) {
  3239. namespace = "mathml";
  3240. }
  3241. if (parentComponent && parentComponent.isCE) {
  3242. (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
  3243. }
  3244. if (!disabled2) {
  3245. mount(vnode, target, targetAnchor);
  3246. updateCssVars(vnode, false);
  3247. }
  3248. } else if (!disabled2) {
  3249. warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
  3250. }
  3251. };
  3252. const queuePendingMount = (vnode) => {
  3253. const mountJob = () => {
  3254. if (pendingMounts.get(vnode) !== mountJob) return;
  3255. pendingMounts.delete(vnode);
  3256. if (isTeleportDisabled(vnode.props)) {
  3257. const mountContainer = parentNode(vnode.el) || container;
  3258. mount(vnode, mountContainer, vnode.anchor);
  3259. updateCssVars(vnode, true);
  3260. }
  3261. mountToTarget(vnode);
  3262. };
  3263. pendingMounts.set(vnode, mountJob);
  3264. queuePostRenderEffect(mountJob, parentSuspense);
  3265. };
  3266. if (n1 == null) {
  3267. const placeholder = n2.el = createComment("teleport start") ;
  3268. const mainAnchor = n2.anchor = createComment("teleport end") ;
  3269. insert(placeholder, container, anchor);
  3270. insert(mainAnchor, container, anchor);
  3271. if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
  3272. queuePendingMount(n2);
  3273. return;
  3274. }
  3275. if (disabled) {
  3276. mount(n2, container, mainAnchor);
  3277. updateCssVars(n2, true);
  3278. }
  3279. mountToTarget();
  3280. } else {
  3281. n2.el = n1.el;
  3282. const mainAnchor = n2.anchor = n1.anchor;
  3283. const pendingMount = pendingMounts.get(n1);
  3284. if (pendingMount) {
  3285. pendingMount.flags |= 8;
  3286. pendingMounts.delete(n1);
  3287. queuePendingMount(n2);
  3288. return;
  3289. }
  3290. n2.targetStart = n1.targetStart;
  3291. const target = n2.target = n1.target;
  3292. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  3293. const wasDisabled = isTeleportDisabled(n1.props);
  3294. const currentContainer = wasDisabled ? container : target;
  3295. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  3296. if (namespace === "svg" || isTargetSVG(target)) {
  3297. namespace = "svg";
  3298. } else if (namespace === "mathml" || isTargetMathML(target)) {
  3299. namespace = "mathml";
  3300. }
  3301. if (dynamicChildren) {
  3302. patchBlockChildren(
  3303. n1.dynamicChildren,
  3304. dynamicChildren,
  3305. currentContainer,
  3306. parentComponent,
  3307. parentSuspense,
  3308. namespace,
  3309. slotScopeIds
  3310. );
  3311. traverseStaticChildren(n1, n2, false);
  3312. } else if (!optimized) {
  3313. patchChildren(
  3314. n1,
  3315. n2,
  3316. currentContainer,
  3317. currentAnchor,
  3318. parentComponent,
  3319. parentSuspense,
  3320. namespace,
  3321. slotScopeIds,
  3322. false
  3323. );
  3324. }
  3325. if (disabled) {
  3326. if (!wasDisabled) {
  3327. moveTeleport(
  3328. n2,
  3329. container,
  3330. mainAnchor,
  3331. internals,
  3332. 1
  3333. );
  3334. } else {
  3335. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  3336. n2.props.to = n1.props.to;
  3337. }
  3338. }
  3339. } else {
  3340. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  3341. const nextTarget = n2.target = resolveTarget(
  3342. n2.props,
  3343. querySelector
  3344. );
  3345. if (nextTarget) {
  3346. moveTeleport(
  3347. n2,
  3348. nextTarget,
  3349. null,
  3350. internals,
  3351. 0
  3352. );
  3353. } else {
  3354. warn$1(
  3355. "Invalid Teleport target on update:",
  3356. target,
  3357. `(${typeof target})`
  3358. );
  3359. }
  3360. } else if (wasDisabled) {
  3361. moveTeleport(
  3362. n2,
  3363. target,
  3364. targetAnchor,
  3365. internals,
  3366. 1
  3367. );
  3368. }
  3369. }
  3370. updateCssVars(n2, disabled);
  3371. }
  3372. },
  3373. remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  3374. const {
  3375. shapeFlag,
  3376. children,
  3377. anchor,
  3378. targetStart,
  3379. targetAnchor,
  3380. target,
  3381. props
  3382. } = vnode;
  3383. let shouldRemove = doRemove || !isTeleportDisabled(props);
  3384. const pendingMount = pendingMounts.get(vnode);
  3385. if (pendingMount) {
  3386. pendingMount.flags |= 8;
  3387. pendingMounts.delete(vnode);
  3388. shouldRemove = false;
  3389. }
  3390. if (target) {
  3391. hostRemove(targetStart);
  3392. hostRemove(targetAnchor);
  3393. }
  3394. doRemove && hostRemove(anchor);
  3395. if (shapeFlag & 16) {
  3396. for (let i = 0; i < children.length; i++) {
  3397. const child = children[i];
  3398. unmount(
  3399. child,
  3400. parentComponent,
  3401. parentSuspense,
  3402. shouldRemove,
  3403. !!child.dynamicChildren
  3404. );
  3405. }
  3406. }
  3407. },
  3408. move: moveTeleport,
  3409. hydrate: hydrateTeleport
  3410. };
  3411. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  3412. if (moveType === 0) {
  3413. insert(vnode.targetAnchor, container, parentAnchor);
  3414. }
  3415. const { el, anchor, shapeFlag, children, props } = vnode;
  3416. const isReorder = moveType === 2;
  3417. if (isReorder) {
  3418. insert(el, container, parentAnchor);
  3419. }
  3420. if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
  3421. if (shapeFlag & 16) {
  3422. for (let i = 0; i < children.length; i++) {
  3423. move(
  3424. children[i],
  3425. container,
  3426. parentAnchor,
  3427. 2
  3428. );
  3429. }
  3430. }
  3431. }
  3432. if (isReorder) {
  3433. insert(anchor, container, parentAnchor);
  3434. }
  3435. }
  3436. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  3437. o: { nextSibling, parentNode, querySelector, insert, createText }
  3438. }, hydrateChildren) {
  3439. function hydrateAnchor(target2, targetNode) {
  3440. let targetAnchor = targetNode;
  3441. while (targetAnchor) {
  3442. if (targetAnchor && targetAnchor.nodeType === 8) {
  3443. if (targetAnchor.data === "teleport start anchor") {
  3444. vnode.targetStart = targetAnchor;
  3445. } else if (targetAnchor.data === "teleport anchor") {
  3446. vnode.targetAnchor = targetAnchor;
  3447. target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  3448. break;
  3449. }
  3450. }
  3451. targetAnchor = nextSibling(targetAnchor);
  3452. }
  3453. }
  3454. function hydrateDisabledTeleport(node2, vnode2) {
  3455. vnode2.anchor = hydrateChildren(
  3456. nextSibling(node2),
  3457. vnode2,
  3458. parentNode(node2),
  3459. parentComponent,
  3460. parentSuspense,
  3461. slotScopeIds,
  3462. optimized
  3463. );
  3464. }
  3465. const target = vnode.target = resolveTarget(
  3466. vnode.props,
  3467. querySelector
  3468. );
  3469. const disabled = isTeleportDisabled(vnode.props);
  3470. if (target) {
  3471. const targetNode = target._lpa || target.firstChild;
  3472. if (vnode.shapeFlag & 16) {
  3473. if (disabled) {
  3474. hydrateDisabledTeleport(node, vnode);
  3475. hydrateAnchor(target, targetNode);
  3476. if (!vnode.targetAnchor) {
  3477. prepareAnchor(
  3478. target,
  3479. vnode,
  3480. createText,
  3481. insert,
  3482. // if target is the same as the main view, insert anchors before current node
  3483. // to avoid hydrating mismatch
  3484. parentNode(node) === target ? node : null
  3485. );
  3486. }
  3487. } else {
  3488. vnode.anchor = nextSibling(node);
  3489. hydrateAnchor(target, targetNode);
  3490. if (!vnode.targetAnchor) {
  3491. prepareAnchor(target, vnode, createText, insert);
  3492. }
  3493. hydrateChildren(
  3494. targetNode && nextSibling(targetNode),
  3495. vnode,
  3496. target,
  3497. parentComponent,
  3498. parentSuspense,
  3499. slotScopeIds,
  3500. optimized
  3501. );
  3502. }
  3503. }
  3504. updateCssVars(vnode, disabled);
  3505. } else if (disabled) {
  3506. if (vnode.shapeFlag & 16) {
  3507. hydrateDisabledTeleport(node, vnode);
  3508. vnode.targetStart = node;
  3509. vnode.targetAnchor = nextSibling(node);
  3510. }
  3511. }
  3512. return vnode.anchor && nextSibling(vnode.anchor);
  3513. }
  3514. const Teleport = TeleportImpl;
  3515. function updateCssVars(vnode, isDisabled) {
  3516. const ctx = vnode.ctx;
  3517. if (ctx && ctx.ut) {
  3518. let node, anchor;
  3519. if (isDisabled) {
  3520. node = vnode.el;
  3521. anchor = vnode.anchor;
  3522. } else {
  3523. node = vnode.targetStart;
  3524. anchor = vnode.targetAnchor;
  3525. }
  3526. while (node && node !== anchor) {
  3527. if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
  3528. node = node.nextSibling;
  3529. }
  3530. ctx.ut();
  3531. }
  3532. }
  3533. function prepareAnchor(target, vnode, createText, insert, anchor = null) {
  3534. const targetStart = vnode.targetStart = createText("");
  3535. const targetAnchor = vnode.targetAnchor = createText("");
  3536. targetStart[TeleportEndKey] = targetAnchor;
  3537. if (target) {
  3538. insert(targetStart, target, anchor);
  3539. insert(targetAnchor, target, anchor);
  3540. }
  3541. return targetAnchor;
  3542. }
  3543. const leaveCbKey = /* @__PURE__ */ Symbol("_leaveCb");
  3544. const enterCbKey$1 = /* @__PURE__ */ Symbol("_enterCb");
  3545. function useTransitionState() {
  3546. const state = {
  3547. isMounted: false,
  3548. isLeaving: false,
  3549. isUnmounting: false,
  3550. leavingVNodes: /* @__PURE__ */ new Map()
  3551. };
  3552. onMounted(() => {
  3553. state.isMounted = true;
  3554. });
  3555. onBeforeUnmount(() => {
  3556. state.isUnmounting = true;
  3557. });
  3558. return state;
  3559. }
  3560. const TransitionHookValidator = [Function, Array];
  3561. const BaseTransitionPropsValidators = {
  3562. mode: String,
  3563. appear: Boolean,
  3564. persisted: Boolean,
  3565. // enter
  3566. onBeforeEnter: TransitionHookValidator,
  3567. onEnter: TransitionHookValidator,
  3568. onAfterEnter: TransitionHookValidator,
  3569. onEnterCancelled: TransitionHookValidator,
  3570. // leave
  3571. onBeforeLeave: TransitionHookValidator,
  3572. onLeave: TransitionHookValidator,
  3573. onAfterLeave: TransitionHookValidator,
  3574. onLeaveCancelled: TransitionHookValidator,
  3575. // appear
  3576. onBeforeAppear: TransitionHookValidator,
  3577. onAppear: TransitionHookValidator,
  3578. onAfterAppear: TransitionHookValidator,
  3579. onAppearCancelled: TransitionHookValidator
  3580. };
  3581. const recursiveGetSubtree = (instance) => {
  3582. const subTree = instance.subTree;
  3583. return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
  3584. };
  3585. const BaseTransitionImpl = {
  3586. name: `BaseTransition`,
  3587. props: BaseTransitionPropsValidators,
  3588. setup(props, { slots }) {
  3589. const instance = getCurrentInstance();
  3590. const state = useTransitionState();
  3591. return () => {
  3592. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3593. const child = children && children.length ? findNonCommentChild(children) : (
  3594. // Keep explicit default-slot conditionals on the same transition path
  3595. // as regular v-if branches, which render a comment placeholder.
  3596. instance.subTree ? createCommentVNode() : void 0
  3597. );
  3598. if (!child) {
  3599. return;
  3600. }
  3601. const rawProps = toRaw(props);
  3602. const { mode } = rawProps;
  3603. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3604. warn$1(`invalid <transition> mode: ${mode}`);
  3605. }
  3606. if (state.isLeaving) {
  3607. return emptyPlaceholder(child);
  3608. }
  3609. const innerChild = getInnerChild$1(child);
  3610. if (!innerChild) {
  3611. return emptyPlaceholder(child);
  3612. }
  3613. let enterHooks = resolveTransitionHooks(
  3614. innerChild,
  3615. rawProps,
  3616. state,
  3617. instance,
  3618. // #11061, ensure enterHooks is fresh after clone
  3619. (hooks) => enterHooks = hooks
  3620. );
  3621. if (innerChild.type !== Comment) {
  3622. setTransitionHooks(innerChild, enterHooks);
  3623. }
  3624. let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
  3625. if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
  3626. let leavingHooks = resolveTransitionHooks(
  3627. oldInnerChild,
  3628. rawProps,
  3629. state,
  3630. instance
  3631. );
  3632. setTransitionHooks(oldInnerChild, leavingHooks);
  3633. if (mode === "out-in" && innerChild.type !== Comment) {
  3634. state.isLeaving = true;
  3635. leavingHooks.afterLeave = () => {
  3636. state.isLeaving = false;
  3637. if (!(instance.job.flags & 8)) {
  3638. instance.update();
  3639. }
  3640. delete leavingHooks.afterLeave;
  3641. oldInnerChild = void 0;
  3642. };
  3643. return emptyPlaceholder(child);
  3644. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3645. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3646. const leavingVNodesCache = getLeavingNodesForType(
  3647. state,
  3648. oldInnerChild
  3649. );
  3650. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3651. el[leaveCbKey] = () => {
  3652. earlyRemove();
  3653. el[leaveCbKey] = void 0;
  3654. delete enterHooks.delayedLeave;
  3655. oldInnerChild = void 0;
  3656. };
  3657. enterHooks.delayedLeave = () => {
  3658. delayedLeave();
  3659. delete enterHooks.delayedLeave;
  3660. oldInnerChild = void 0;
  3661. };
  3662. };
  3663. } else {
  3664. oldInnerChild = void 0;
  3665. }
  3666. } else if (oldInnerChild) {
  3667. oldInnerChild = void 0;
  3668. }
  3669. return child;
  3670. };
  3671. }
  3672. };
  3673. function findNonCommentChild(children) {
  3674. let child = children[0];
  3675. if (children.length > 1) {
  3676. let hasFound = false;
  3677. for (const c of children) {
  3678. if (c.type !== Comment) {
  3679. if (hasFound) {
  3680. warn$1(
  3681. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3682. );
  3683. break;
  3684. }
  3685. child = c;
  3686. hasFound = true;
  3687. }
  3688. }
  3689. }
  3690. return child;
  3691. }
  3692. const BaseTransition = BaseTransitionImpl;
  3693. function getLeavingNodesForType(state, vnode) {
  3694. const { leavingVNodes } = state;
  3695. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3696. if (!leavingVNodesCache) {
  3697. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3698. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3699. }
  3700. return leavingVNodesCache;
  3701. }
  3702. function resolveTransitionHooks(vnode, props, state, instance, postClone) {
  3703. const {
  3704. appear,
  3705. mode,
  3706. persisted = false,
  3707. onBeforeEnter,
  3708. onEnter,
  3709. onAfterEnter,
  3710. onEnterCancelled,
  3711. onBeforeLeave,
  3712. onLeave,
  3713. onAfterLeave,
  3714. onLeaveCancelled,
  3715. onBeforeAppear,
  3716. onAppear,
  3717. onAfterAppear,
  3718. onAppearCancelled
  3719. } = props;
  3720. const key = String(vnode.key);
  3721. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3722. const callHook = (hook, args) => {
  3723. hook && callWithAsyncErrorHandling(
  3724. hook,
  3725. instance,
  3726. 9,
  3727. args
  3728. );
  3729. };
  3730. const callAsyncHook = (hook, args) => {
  3731. const done = args[1];
  3732. callHook(hook, args);
  3733. if (isArray(hook)) {
  3734. if (hook.every((hook2) => hook2.length <= 1)) done();
  3735. } else if (hook.length <= 1) {
  3736. done();
  3737. }
  3738. };
  3739. const hooks = {
  3740. mode,
  3741. persisted,
  3742. beforeEnter(el) {
  3743. let hook = onBeforeEnter;
  3744. if (!state.isMounted) {
  3745. if (appear) {
  3746. hook = onBeforeAppear || onBeforeEnter;
  3747. } else {
  3748. return;
  3749. }
  3750. }
  3751. if (el[leaveCbKey]) {
  3752. el[leaveCbKey](
  3753. true
  3754. /* cancelled */
  3755. );
  3756. }
  3757. const leavingVNode = leavingVNodesCache[key];
  3758. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  3759. leavingVNode.el[leaveCbKey]();
  3760. }
  3761. callHook(hook, [el]);
  3762. },
  3763. enter(el) {
  3764. if (!isHmrUpdating && leavingVNodesCache[key] === vnode) return;
  3765. let hook = onEnter;
  3766. let afterHook = onAfterEnter;
  3767. let cancelHook = onEnterCancelled;
  3768. if (!state.isMounted) {
  3769. if (appear) {
  3770. hook = onAppear || onEnter;
  3771. afterHook = onAfterAppear || onAfterEnter;
  3772. cancelHook = onAppearCancelled || onEnterCancelled;
  3773. } else {
  3774. return;
  3775. }
  3776. }
  3777. let called = false;
  3778. el[enterCbKey$1] = (cancelled) => {
  3779. if (called) return;
  3780. called = true;
  3781. if (cancelled) {
  3782. callHook(cancelHook, [el]);
  3783. } else {
  3784. callHook(afterHook, [el]);
  3785. }
  3786. if (hooks.delayedLeave) {
  3787. hooks.delayedLeave();
  3788. }
  3789. el[enterCbKey$1] = void 0;
  3790. };
  3791. const done = el[enterCbKey$1].bind(null, false);
  3792. if (hook) {
  3793. callAsyncHook(hook, [el, done]);
  3794. } else {
  3795. done();
  3796. }
  3797. },
  3798. leave(el, remove) {
  3799. const key2 = String(vnode.key);
  3800. if (el[enterCbKey$1]) {
  3801. el[enterCbKey$1](
  3802. true
  3803. /* cancelled */
  3804. );
  3805. }
  3806. if (state.isUnmounting) {
  3807. return remove();
  3808. }
  3809. callHook(onBeforeLeave, [el]);
  3810. let called = false;
  3811. el[leaveCbKey] = (cancelled) => {
  3812. if (called) return;
  3813. called = true;
  3814. remove();
  3815. if (cancelled) {
  3816. callHook(onLeaveCancelled, [el]);
  3817. } else {
  3818. callHook(onAfterLeave, [el]);
  3819. }
  3820. el[leaveCbKey] = void 0;
  3821. if (leavingVNodesCache[key2] === vnode) {
  3822. delete leavingVNodesCache[key2];
  3823. }
  3824. };
  3825. const done = el[leaveCbKey].bind(null, false);
  3826. leavingVNodesCache[key2] = vnode;
  3827. if (onLeave) {
  3828. callAsyncHook(onLeave, [el, done]);
  3829. } else {
  3830. done();
  3831. }
  3832. },
  3833. clone(vnode2) {
  3834. const hooks2 = resolveTransitionHooks(
  3835. vnode2,
  3836. props,
  3837. state,
  3838. instance,
  3839. postClone
  3840. );
  3841. if (postClone) postClone(hooks2);
  3842. return hooks2;
  3843. }
  3844. };
  3845. return hooks;
  3846. }
  3847. function emptyPlaceholder(vnode) {
  3848. if (isKeepAlive(vnode)) {
  3849. vnode = cloneVNode(vnode);
  3850. vnode.children = null;
  3851. return vnode;
  3852. }
  3853. }
  3854. function getInnerChild$1(vnode) {
  3855. if (!isKeepAlive(vnode)) {
  3856. if (isTeleport(vnode.type) && vnode.children) {
  3857. return findNonCommentChild(vnode.children);
  3858. }
  3859. return vnode;
  3860. }
  3861. if (vnode.component) {
  3862. return vnode.component.subTree;
  3863. }
  3864. const { shapeFlag, children } = vnode;
  3865. if (children) {
  3866. if (shapeFlag & 16) {
  3867. return children[0];
  3868. }
  3869. if (shapeFlag & 32 && isFunction(children.default)) {
  3870. return children.default();
  3871. }
  3872. }
  3873. }
  3874. function setTransitionHooks(vnode, hooks) {
  3875. if (vnode.shapeFlag & 6 && vnode.component) {
  3876. vnode.transition = hooks;
  3877. setTransitionHooks(vnode.component.subTree, hooks);
  3878. } else if (vnode.shapeFlag & 128) {
  3879. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3880. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3881. } else {
  3882. vnode.transition = hooks;
  3883. }
  3884. }
  3885. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3886. let ret = [];
  3887. let keyedFragmentCount = 0;
  3888. for (let i = 0; i < children.length; i++) {
  3889. let child = children[i];
  3890. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3891. if (child.type === Fragment) {
  3892. if (child.patchFlag & 128) keyedFragmentCount++;
  3893. ret = ret.concat(
  3894. getTransitionRawChildren(child.children, keepComment, key)
  3895. );
  3896. } else if (keepComment || child.type !== Comment) {
  3897. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3898. }
  3899. }
  3900. if (keyedFragmentCount > 1) {
  3901. for (let i = 0; i < ret.length; i++) {
  3902. ret[i].patchFlag = -2;
  3903. }
  3904. }
  3905. return ret;
  3906. }
  3907. // @__NO_SIDE_EFFECTS__
  3908. function defineComponent(options, extraOptions) {
  3909. return isFunction(options) ? (
  3910. // #8236: extend call and options.name access are considered side-effects
  3911. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3912. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3913. ) : options;
  3914. }
  3915. function useId() {
  3916. const i = getCurrentInstance();
  3917. if (i) {
  3918. return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
  3919. } else {
  3920. warn$1(
  3921. `useId() is called when there is no active component instance to be associated with.`
  3922. );
  3923. }
  3924. return "";
  3925. }
  3926. function markAsyncBoundary(instance) {
  3927. instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
  3928. }
  3929. const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
  3930. function useTemplateRef(key) {
  3931. const i = getCurrentInstance();
  3932. const r = shallowRef(null);
  3933. if (i) {
  3934. const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
  3935. if (isTemplateRefKey(refs, key)) {
  3936. warn$1(`useTemplateRef('${key}') already exists.`);
  3937. } else {
  3938. Object.defineProperty(refs, key, {
  3939. enumerable: true,
  3940. get: () => r.value,
  3941. set: (val) => r.value = val
  3942. });
  3943. }
  3944. } else {
  3945. warn$1(
  3946. `useTemplateRef() is called when there is no active component instance to be associated with.`
  3947. );
  3948. }
  3949. const ret = readonly(r) ;
  3950. {
  3951. knownTemplateRefs.add(ret);
  3952. }
  3953. return ret;
  3954. }
  3955. function isTemplateRefKey(refs, key) {
  3956. let desc;
  3957. return !!((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable);
  3958. }
  3959. const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
  3960. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3961. if (isArray(rawRef)) {
  3962. rawRef.forEach(
  3963. (r, i) => setRef(
  3964. r,
  3965. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3966. parentSuspense,
  3967. vnode,
  3968. isUnmount
  3969. )
  3970. );
  3971. return;
  3972. }
  3973. if (isAsyncWrapper(vnode) && !isUnmount) {
  3974. if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {
  3975. setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);
  3976. }
  3977. return;
  3978. }
  3979. const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
  3980. const value = isUnmount ? null : refValue;
  3981. const { i: owner, r: ref } = rawRef;
  3982. if (!owner) {
  3983. warn$1(
  3984. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  3985. );
  3986. return;
  3987. }
  3988. const oldRef = oldRawRef && oldRawRef.r;
  3989. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3990. const setupState = owner.setupState;
  3991. const rawSetupState = toRaw(setupState);
  3992. const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
  3993. {
  3994. if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
  3995. warn$1(
  3996. `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
  3997. );
  3998. }
  3999. if (knownTemplateRefs.has(rawSetupState[key])) {
  4000. return false;
  4001. }
  4002. }
  4003. if (isTemplateRefKey(refs, key)) {
  4004. return false;
  4005. }
  4006. return hasOwn(rawSetupState, key);
  4007. };
  4008. const canSetRef = (ref2, key) => {
  4009. if (knownTemplateRefs.has(ref2)) {
  4010. return false;
  4011. }
  4012. if (key && isTemplateRefKey(refs, key)) {
  4013. return false;
  4014. }
  4015. return true;
  4016. };
  4017. if (oldRef != null && oldRef !== ref) {
  4018. invalidatePendingSetRef(oldRawRef);
  4019. if (isString(oldRef)) {
  4020. refs[oldRef] = null;
  4021. if (canSetSetupRef(oldRef)) {
  4022. setupState[oldRef] = null;
  4023. }
  4024. } else if (isRef(oldRef)) {
  4025. const oldRawRefAtom = oldRawRef;
  4026. if (canSetRef(oldRef, oldRawRefAtom.k)) {
  4027. oldRef.value = null;
  4028. }
  4029. if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
  4030. }
  4031. }
  4032. if (isFunction(ref)) {
  4033. callWithErrorHandling(ref, owner, 12, [value, refs]);
  4034. } else {
  4035. const _isString = isString(ref);
  4036. const _isRef = isRef(ref);
  4037. if (_isString || _isRef) {
  4038. const doSet = () => {
  4039. if (rawRef.f) {
  4040. const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
  4041. if (isUnmount) {
  4042. isArray(existing) && remove(existing, refValue);
  4043. } else {
  4044. if (!isArray(existing)) {
  4045. if (_isString) {
  4046. refs[ref] = [refValue];
  4047. if (canSetSetupRef(ref)) {
  4048. setupState[ref] = refs[ref];
  4049. }
  4050. } else {
  4051. const newVal = [refValue];
  4052. if (canSetRef(ref, rawRef.k)) {
  4053. ref.value = newVal;
  4054. }
  4055. if (rawRef.k) refs[rawRef.k] = newVal;
  4056. }
  4057. } else if (!existing.includes(refValue)) {
  4058. existing.push(refValue);
  4059. }
  4060. }
  4061. } else if (_isString) {
  4062. refs[ref] = value;
  4063. if (canSetSetupRef(ref)) {
  4064. setupState[ref] = value;
  4065. }
  4066. } else if (_isRef) {
  4067. if (canSetRef(ref, rawRef.k)) {
  4068. ref.value = value;
  4069. }
  4070. if (rawRef.k) refs[rawRef.k] = value;
  4071. } else {
  4072. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4073. }
  4074. };
  4075. if (value) {
  4076. const job = () => {
  4077. doSet();
  4078. pendingSetRefMap.delete(rawRef);
  4079. };
  4080. job.id = -1;
  4081. pendingSetRefMap.set(rawRef, job);
  4082. queuePostRenderEffect(job, parentSuspense);
  4083. } else {
  4084. invalidatePendingSetRef(rawRef);
  4085. doSet();
  4086. }
  4087. } else {
  4088. warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
  4089. }
  4090. }
  4091. }
  4092. function invalidatePendingSetRef(rawRef) {
  4093. const pendingSetRef = pendingSetRefMap.get(rawRef);
  4094. if (pendingSetRef) {
  4095. pendingSetRef.flags |= 8;
  4096. pendingSetRefMap.delete(rawRef);
  4097. }
  4098. }
  4099. let hasLoggedMismatchError = false;
  4100. const logMismatchError = () => {
  4101. if (hasLoggedMismatchError) {
  4102. return;
  4103. }
  4104. console.error("Hydration completed but contains mismatches.");
  4105. hasLoggedMismatchError = true;
  4106. };
  4107. const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
  4108. const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
  4109. const getContainerType = (container) => {
  4110. if (container.nodeType !== 1) return void 0;
  4111. if (isSVGContainer(container)) return "svg";
  4112. if (isMathMLContainer(container)) return "mathml";
  4113. return void 0;
  4114. };
  4115. const isComment = (node) => node.nodeType === 8;
  4116. function createHydrationFunctions(rendererInternals) {
  4117. const {
  4118. mt: mountComponent,
  4119. p: patch,
  4120. o: {
  4121. patchProp,
  4122. createText,
  4123. nextSibling,
  4124. parentNode,
  4125. remove,
  4126. insert,
  4127. createComment
  4128. }
  4129. } = rendererInternals;
  4130. const hydrate = (vnode, container) => {
  4131. if (!container.hasChildNodes()) {
  4132. warn$1(
  4133. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  4134. );
  4135. patch(null, vnode, container);
  4136. flushPostFlushCbs();
  4137. container._vnode = vnode;
  4138. return;
  4139. }
  4140. hydrateNode(container.firstChild, vnode, null, null, null);
  4141. flushPostFlushCbs();
  4142. container._vnode = vnode;
  4143. };
  4144. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  4145. optimized = optimized || !!vnode.dynamicChildren;
  4146. const isFragmentStart = isComment(node) && node.data === "[";
  4147. const onMismatch = () => handleMismatch(
  4148. node,
  4149. vnode,
  4150. parentComponent,
  4151. parentSuspense,
  4152. slotScopeIds,
  4153. isFragmentStart
  4154. );
  4155. const { type, ref, shapeFlag, patchFlag } = vnode;
  4156. let domType = node.nodeType;
  4157. vnode.el = node;
  4158. {
  4159. def(node, "__vnode", vnode, true);
  4160. def(node, "__vueParentComponent", parentComponent, true);
  4161. }
  4162. if (patchFlag === -2) {
  4163. optimized = false;
  4164. vnode.dynamicChildren = null;
  4165. }
  4166. let nextNode = null;
  4167. switch (type) {
  4168. case Text:
  4169. if (domType !== 3) {
  4170. if (vnode.children === "") {
  4171. insert(vnode.el = createText(""), parentNode(node), node);
  4172. nextNode = node;
  4173. } else {
  4174. nextNode = onMismatch();
  4175. }
  4176. } else {
  4177. if (node.data !== vnode.children) {
  4178. warn$1(
  4179. `Hydration text mismatch in`,
  4180. node.parentNode,
  4181. `
  4182. - rendered on server: ${JSON.stringify(
  4183. node.data
  4184. )}
  4185. - expected on client: ${JSON.stringify(vnode.children)}`
  4186. );
  4187. logMismatchError();
  4188. node.data = vnode.children;
  4189. }
  4190. nextNode = nextSibling(node);
  4191. }
  4192. break;
  4193. case Comment:
  4194. if (isTemplateNode(node)) {
  4195. nextNode = nextSibling(node);
  4196. replaceNode(
  4197. vnode.el = node.content.firstChild,
  4198. node,
  4199. parentComponent
  4200. );
  4201. } else if (domType !== 8 || isFragmentStart) {
  4202. nextNode = onMismatch();
  4203. } else {
  4204. nextNode = nextSibling(node);
  4205. }
  4206. break;
  4207. case Static:
  4208. if (isFragmentStart) {
  4209. node = nextSibling(node);
  4210. domType = node.nodeType;
  4211. }
  4212. if (domType === 1 || domType === 3) {
  4213. nextNode = node;
  4214. const needToAdoptContent = !vnode.children.length;
  4215. for (let i = 0; i < vnode.staticCount; i++) {
  4216. if (needToAdoptContent)
  4217. vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;
  4218. if (i === vnode.staticCount - 1) {
  4219. vnode.anchor = nextNode;
  4220. }
  4221. nextNode = nextSibling(nextNode);
  4222. }
  4223. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  4224. } else {
  4225. onMismatch();
  4226. }
  4227. break;
  4228. case Fragment:
  4229. if (!isFragmentStart) {
  4230. nextNode = onMismatch();
  4231. } else {
  4232. nextNode = hydrateFragment(
  4233. node,
  4234. vnode,
  4235. parentComponent,
  4236. parentSuspense,
  4237. slotScopeIds,
  4238. optimized
  4239. );
  4240. }
  4241. break;
  4242. default:
  4243. if (shapeFlag & 1) {
  4244. if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
  4245. nextNode = onMismatch();
  4246. } else {
  4247. nextNode = hydrateElement(
  4248. node,
  4249. vnode,
  4250. parentComponent,
  4251. parentSuspense,
  4252. slotScopeIds,
  4253. optimized
  4254. );
  4255. }
  4256. } else if (shapeFlag & 6) {
  4257. vnode.slotScopeIds = slotScopeIds;
  4258. const container = parentNode(node);
  4259. if (isFragmentStart) {
  4260. nextNode = locateClosingAnchor(node);
  4261. } else if (isComment(node) && node.data === "teleport start") {
  4262. nextNode = locateClosingAnchor(node, node.data, "teleport end");
  4263. } else {
  4264. nextNode = nextSibling(node);
  4265. }
  4266. mountComponent(
  4267. vnode,
  4268. container,
  4269. null,
  4270. parentComponent,
  4271. parentSuspense,
  4272. getContainerType(container),
  4273. optimized
  4274. );
  4275. if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
  4276. let subTree;
  4277. if (isFragmentStart) {
  4278. subTree = createVNode(Fragment);
  4279. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  4280. } else {
  4281. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  4282. }
  4283. subTree.el = node;
  4284. vnode.component.subTree = subTree;
  4285. }
  4286. } else if (shapeFlag & 64) {
  4287. if (domType !== 8) {
  4288. nextNode = onMismatch();
  4289. } else {
  4290. nextNode = vnode.type.hydrate(
  4291. node,
  4292. vnode,
  4293. parentComponent,
  4294. parentSuspense,
  4295. slotScopeIds,
  4296. optimized,
  4297. rendererInternals,
  4298. hydrateChildren
  4299. );
  4300. }
  4301. } else if (shapeFlag & 128) {
  4302. nextNode = vnode.type.hydrate(
  4303. node,
  4304. vnode,
  4305. parentComponent,
  4306. parentSuspense,
  4307. getContainerType(parentNode(node)),
  4308. slotScopeIds,
  4309. optimized,
  4310. rendererInternals,
  4311. hydrateNode
  4312. );
  4313. } else {
  4314. warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
  4315. }
  4316. }
  4317. if (ref != null) {
  4318. setRef(ref, null, parentSuspense, vnode);
  4319. }
  4320. return nextNode;
  4321. };
  4322. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4323. optimized = optimized || !!vnode.dynamicChildren;
  4324. const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
  4325. const forcePatch = type === "input" || type === "option";
  4326. {
  4327. if (dirs) {
  4328. invokeDirectiveHook(vnode, null, parentComponent, "created");
  4329. }
  4330. let needCallTransitionHooks = false;
  4331. if (isTemplateNode(el)) {
  4332. needCallTransitionHooks = needTransition(
  4333. null,
  4334. // no need check parentSuspense in hydration
  4335. transition
  4336. ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
  4337. const content = el.content.firstChild;
  4338. if (needCallTransitionHooks) {
  4339. const cls = content.getAttribute("class");
  4340. if (cls) content.$cls = cls;
  4341. transition.beforeEnter(content);
  4342. }
  4343. replaceNode(content, el, parentComponent);
  4344. vnode.el = el = content;
  4345. }
  4346. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  4347. !(props && (props.innerHTML || props.textContent))) {
  4348. let next = hydrateChildren(
  4349. el.firstChild,
  4350. vnode,
  4351. el,
  4352. parentComponent,
  4353. parentSuspense,
  4354. slotScopeIds,
  4355. optimized
  4356. );
  4357. let hasWarned = false;
  4358. while (next) {
  4359. if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
  4360. if (!hasWarned) {
  4361. warn$1(
  4362. `Hydration children mismatch on`,
  4363. el,
  4364. `
  4365. Server rendered element contains more child nodes than client vdom.`
  4366. );
  4367. hasWarned = true;
  4368. }
  4369. logMismatchError();
  4370. }
  4371. const cur = next;
  4372. next = next.nextSibling;
  4373. remove(cur);
  4374. }
  4375. } else if (shapeFlag & 8) {
  4376. let clientText = vnode.children;
  4377. if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
  4378. clientText = clientText.slice(1);
  4379. }
  4380. const { textContent } = el;
  4381. if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
  4382. textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
  4383. if (!isMismatchAllowed(el, 0 /* TEXT */)) {
  4384. warn$1(
  4385. `Hydration text content mismatch on`,
  4386. el,
  4387. `
  4388. - rendered on server: ${textContent}
  4389. - expected on client: ${clientText}`
  4390. );
  4391. logMismatchError();
  4392. }
  4393. el.textContent = vnode.children;
  4394. }
  4395. }
  4396. if (props) {
  4397. {
  4398. const isCustomElement = el.tagName.includes("-");
  4399. for (const key in props) {
  4400. if (// #11189 skip if this node has directives that have created hooks
  4401. // as it could have mutated the DOM in any possible way
  4402. !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {
  4403. logMismatchError();
  4404. }
  4405. if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
  4406. key[0] === "." || isCustomElement && !isReservedProp(key)) {
  4407. patchProp(el, key, null, props[key], void 0, parentComponent);
  4408. }
  4409. }
  4410. }
  4411. }
  4412. let vnodeHooks;
  4413. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  4414. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4415. }
  4416. if (dirs) {
  4417. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  4418. }
  4419. if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
  4420. queueEffectWithSuspense(() => {
  4421. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  4422. needCallTransitionHooks && transition.enter(el);
  4423. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  4424. }, parentSuspense);
  4425. }
  4426. }
  4427. return el.nextSibling;
  4428. };
  4429. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4430. optimized = optimized || !!parentVNode.dynamicChildren;
  4431. const children = parentVNode.children;
  4432. const l = children.length;
  4433. let hasWarned = false;
  4434. for (let i = 0; i < l; i++) {
  4435. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  4436. const isText = vnode.type === Text;
  4437. if (node) {
  4438. if (isText && !optimized) {
  4439. if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {
  4440. insert(
  4441. createText(
  4442. node.data.slice(vnode.children.length)
  4443. ),
  4444. container,
  4445. nextSibling(node)
  4446. );
  4447. node.data = vnode.children;
  4448. }
  4449. }
  4450. node = hydrateNode(
  4451. node,
  4452. vnode,
  4453. parentComponent,
  4454. parentSuspense,
  4455. slotScopeIds,
  4456. optimized
  4457. );
  4458. } else if (isText && !vnode.children) {
  4459. insert(vnode.el = createText(""), container);
  4460. } else {
  4461. if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
  4462. if (!hasWarned) {
  4463. warn$1(
  4464. `Hydration children mismatch on`,
  4465. container,
  4466. `
  4467. Server rendered element contains fewer child nodes than client vdom.`
  4468. );
  4469. hasWarned = true;
  4470. }
  4471. logMismatchError();
  4472. }
  4473. patch(
  4474. null,
  4475. vnode,
  4476. container,
  4477. null,
  4478. parentComponent,
  4479. parentSuspense,
  4480. getContainerType(container),
  4481. slotScopeIds
  4482. );
  4483. }
  4484. }
  4485. return node;
  4486. };
  4487. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  4488. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  4489. if (fragmentSlotScopeIds) {
  4490. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4491. }
  4492. const container = parentNode(node);
  4493. const next = hydrateChildren(
  4494. nextSibling(node),
  4495. vnode,
  4496. container,
  4497. parentComponent,
  4498. parentSuspense,
  4499. slotScopeIds,
  4500. optimized
  4501. );
  4502. if (next && isComment(next) && next.data === "]") {
  4503. return nextSibling(vnode.anchor = next);
  4504. } else {
  4505. logMismatchError();
  4506. insert(vnode.anchor = createComment(`]`), container, next);
  4507. return next;
  4508. }
  4509. };
  4510. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  4511. if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
  4512. warn$1(
  4513. `Hydration node mismatch:
  4514. - rendered on server:`,
  4515. node,
  4516. node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
  4517. `
  4518. - expected on client:`,
  4519. vnode.type
  4520. );
  4521. logMismatchError();
  4522. }
  4523. vnode.el = null;
  4524. if (isFragment) {
  4525. const end = locateClosingAnchor(node);
  4526. while (true) {
  4527. const next2 = nextSibling(node);
  4528. if (next2 && next2 !== end) {
  4529. remove(next2);
  4530. } else {
  4531. break;
  4532. }
  4533. }
  4534. }
  4535. const next = nextSibling(node);
  4536. const container = parentNode(node);
  4537. remove(node);
  4538. patch(
  4539. null,
  4540. vnode,
  4541. container,
  4542. next,
  4543. parentComponent,
  4544. parentSuspense,
  4545. getContainerType(container),
  4546. slotScopeIds
  4547. );
  4548. if (parentComponent) {
  4549. parentComponent.vnode.el = vnode.el;
  4550. updateHOCHostEl(parentComponent, vnode.el);
  4551. }
  4552. return next;
  4553. };
  4554. const locateClosingAnchor = (node, open = "[", close = "]") => {
  4555. let match = 0;
  4556. while (node) {
  4557. node = nextSibling(node);
  4558. if (node && isComment(node)) {
  4559. if (node.data === open) match++;
  4560. if (node.data === close) {
  4561. if (match === 0) {
  4562. return nextSibling(node);
  4563. } else {
  4564. match--;
  4565. }
  4566. }
  4567. }
  4568. }
  4569. return node;
  4570. };
  4571. const replaceNode = (newNode, oldNode, parentComponent) => {
  4572. const parentNode2 = oldNode.parentNode;
  4573. if (parentNode2) {
  4574. parentNode2.replaceChild(newNode, oldNode);
  4575. }
  4576. let parent = parentComponent;
  4577. while (parent) {
  4578. if (parent.vnode.el === oldNode) {
  4579. parent.vnode.el = parent.subTree.el = newNode;
  4580. }
  4581. parent = parent.parent;
  4582. }
  4583. };
  4584. const isTemplateNode = (node) => {
  4585. return node.nodeType === 1 && node.tagName === "TEMPLATE";
  4586. };
  4587. return [hydrate, hydrateNode];
  4588. }
  4589. function propHasMismatch(el, key, clientValue, vnode, instance) {
  4590. let mismatchType;
  4591. let mismatchKey;
  4592. let actual;
  4593. let expected;
  4594. if (key === "class") {
  4595. if (el.$cls) {
  4596. actual = el.$cls;
  4597. delete el.$cls;
  4598. } else {
  4599. actual = el.getAttribute("class");
  4600. }
  4601. expected = normalizeClass(clientValue);
  4602. if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
  4603. mismatchType = 2 /* CLASS */;
  4604. mismatchKey = `class`;
  4605. }
  4606. } else if (key === "style") {
  4607. actual = el.getAttribute("style") || "";
  4608. expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
  4609. const actualMap = toStyleMap(actual);
  4610. const expectedMap = toStyleMap(expected);
  4611. if (vnode.dirs) {
  4612. for (const { dir, value } of vnode.dirs) {
  4613. if (dir.name === "show" && !value) {
  4614. expectedMap.set("display", "none");
  4615. }
  4616. }
  4617. }
  4618. if (instance) {
  4619. resolveCssVars(instance, vnode, expectedMap);
  4620. }
  4621. if (!isMapEqual(actualMap, expectedMap)) {
  4622. mismatchType = 3 /* STYLE */;
  4623. mismatchKey = "style";
  4624. }
  4625. } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
  4626. if (isBooleanAttr(key)) {
  4627. actual = el.hasAttribute(key);
  4628. expected = includeBooleanAttr(clientValue);
  4629. } else if (clientValue == null) {
  4630. actual = el.hasAttribute(key);
  4631. expected = false;
  4632. } else {
  4633. if (el.hasAttribute(key)) {
  4634. actual = el.getAttribute(key);
  4635. } else if (key === "value" && el.tagName === "TEXTAREA") {
  4636. actual = el.value;
  4637. } else {
  4638. actual = false;
  4639. }
  4640. expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
  4641. }
  4642. if (actual !== expected) {
  4643. mismatchType = 4 /* ATTRIBUTE */;
  4644. mismatchKey = key;
  4645. }
  4646. }
  4647. if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
  4648. const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
  4649. const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
  4650. const postSegment = `
  4651. - rendered on server: ${format(actual)}
  4652. - expected on client: ${format(expected)}
  4653. Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
  4654. You should fix the source of the mismatch.`;
  4655. {
  4656. warn$1(preSegment, el, postSegment);
  4657. }
  4658. return true;
  4659. }
  4660. return false;
  4661. }
  4662. function toClassSet(str) {
  4663. return new Set(str.trim().split(/\s+/));
  4664. }
  4665. function isSetEqual(a, b) {
  4666. if (a.size !== b.size) {
  4667. return false;
  4668. }
  4669. for (const s of a) {
  4670. if (!b.has(s)) {
  4671. return false;
  4672. }
  4673. }
  4674. return true;
  4675. }
  4676. function toStyleMap(str) {
  4677. const styleMap = /* @__PURE__ */ new Map();
  4678. for (const item of str.split(";")) {
  4679. let [key, value] = item.split(":");
  4680. key = key.trim();
  4681. value = value && value.trim();
  4682. if (key && value) {
  4683. styleMap.set(key, value);
  4684. }
  4685. }
  4686. return styleMap;
  4687. }
  4688. function isMapEqual(a, b) {
  4689. if (a.size !== b.size) {
  4690. return false;
  4691. }
  4692. for (const [key, value] of a) {
  4693. if (value !== b.get(key)) {
  4694. return false;
  4695. }
  4696. }
  4697. return true;
  4698. }
  4699. function resolveCssVars(instance, vnode, expectedMap) {
  4700. const root = instance.subTree;
  4701. if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {
  4702. const cssVars = instance.getCssVars();
  4703. for (const key in cssVars) {
  4704. const value = normalizeCssVarValue(cssVars[key]);
  4705. expectedMap.set(`--${getEscapedCssVarName(key)}`, value);
  4706. }
  4707. }
  4708. if (vnode === root && instance.parent) {
  4709. resolveCssVars(instance.parent, instance.vnode, expectedMap);
  4710. }
  4711. }
  4712. const allowMismatchAttr = "data-allow-mismatch";
  4713. const MismatchTypeString = {
  4714. [0 /* TEXT */]: "text",
  4715. [1 /* CHILDREN */]: "children",
  4716. [2 /* CLASS */]: "class",
  4717. [3 /* STYLE */]: "style",
  4718. [4 /* ATTRIBUTE */]: "attribute"
  4719. };
  4720. function isMismatchAllowed(el, allowedType) {
  4721. if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
  4722. while (el && !el.hasAttribute(allowMismatchAttr)) {
  4723. el = el.parentElement;
  4724. }
  4725. }
  4726. const allowedAttr = el && el.getAttribute(allowMismatchAttr);
  4727. if (allowedAttr == null) {
  4728. return false;
  4729. } else if (allowedAttr === "") {
  4730. return true;
  4731. } else {
  4732. const list = allowedAttr.split(",");
  4733. if (allowedType === 0 /* TEXT */ && list.includes("children")) {
  4734. return true;
  4735. }
  4736. return list.includes(MismatchTypeString[allowedType]);
  4737. }
  4738. }
  4739. const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
  4740. const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
  4741. const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
  4742. const id = requestIdleCallback(hydrate, { timeout });
  4743. return () => cancelIdleCallback(id);
  4744. };
  4745. function elementIsVisibleInViewport(el) {
  4746. const { top, left, bottom, right } = el.getBoundingClientRect();
  4747. const { innerHeight, innerWidth } = window;
  4748. return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);
  4749. }
  4750. const hydrateOnVisible = (opts) => (hydrate, forEach) => {
  4751. const ob = new IntersectionObserver((entries) => {
  4752. for (const e of entries) {
  4753. if (!e.isIntersecting) continue;
  4754. ob.disconnect();
  4755. hydrate();
  4756. break;
  4757. }
  4758. }, opts);
  4759. forEach((el) => {
  4760. if (!(el instanceof Element)) return;
  4761. if (elementIsVisibleInViewport(el)) {
  4762. hydrate();
  4763. ob.disconnect();
  4764. return false;
  4765. }
  4766. ob.observe(el);
  4767. });
  4768. return () => ob.disconnect();
  4769. };
  4770. const hydrateOnMediaQuery = (query) => (hydrate) => {
  4771. if (query) {
  4772. const mql = matchMedia(query);
  4773. if (mql.matches) {
  4774. hydrate();
  4775. } else {
  4776. mql.addEventListener("change", hydrate, { once: true });
  4777. return () => mql.removeEventListener("change", hydrate);
  4778. }
  4779. }
  4780. };
  4781. const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
  4782. if (isString(interactions)) interactions = [interactions];
  4783. let hasHydrated = false;
  4784. const doHydrate = (e) => {
  4785. if (!hasHydrated) {
  4786. hasHydrated = true;
  4787. teardown();
  4788. hydrate();
  4789. e.target.dispatchEvent(new e.constructor(e.type, e));
  4790. }
  4791. };
  4792. const teardown = () => {
  4793. forEach((el) => {
  4794. for (const i of interactions) {
  4795. el.removeEventListener(i, doHydrate);
  4796. }
  4797. });
  4798. };
  4799. forEach((el) => {
  4800. for (const i of interactions) {
  4801. el.addEventListener(i, doHydrate, { once: true });
  4802. }
  4803. });
  4804. return teardown;
  4805. };
  4806. function forEachElement(node, cb) {
  4807. if (isComment(node) && node.data === "[") {
  4808. let depth = 1;
  4809. let next = node.nextSibling;
  4810. while (next) {
  4811. if (next.nodeType === 1) {
  4812. const result = cb(next);
  4813. if (result === false) {
  4814. break;
  4815. }
  4816. } else if (isComment(next)) {
  4817. if (next.data === "]") {
  4818. if (--depth === 0) break;
  4819. } else if (next.data === "[") {
  4820. depth++;
  4821. }
  4822. }
  4823. next = next.nextSibling;
  4824. }
  4825. } else {
  4826. cb(node);
  4827. }
  4828. }
  4829. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  4830. // @__NO_SIDE_EFFECTS__
  4831. function defineAsyncComponent(source) {
  4832. if (isFunction(source)) {
  4833. source = { loader: source };
  4834. }
  4835. const {
  4836. loader,
  4837. loadingComponent,
  4838. errorComponent,
  4839. delay = 200,
  4840. hydrate: hydrateStrategy,
  4841. timeout,
  4842. // undefined = never times out
  4843. suspensible = true,
  4844. onError: userOnError
  4845. } = source;
  4846. let pendingRequest = null;
  4847. let resolvedComp;
  4848. let retries = 0;
  4849. const retry = () => {
  4850. retries++;
  4851. pendingRequest = null;
  4852. return load();
  4853. };
  4854. const load = () => {
  4855. let thisRequest;
  4856. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  4857. err = err instanceof Error ? err : new Error(String(err));
  4858. if (userOnError) {
  4859. return new Promise((resolve, reject) => {
  4860. const userRetry = () => resolve(retry());
  4861. const userFail = () => reject(err);
  4862. userOnError(err, userRetry, userFail, retries + 1);
  4863. });
  4864. } else {
  4865. throw err;
  4866. }
  4867. }).then((comp) => {
  4868. if (thisRequest !== pendingRequest && pendingRequest) {
  4869. return pendingRequest;
  4870. }
  4871. if (!comp) {
  4872. warn$1(
  4873. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  4874. );
  4875. }
  4876. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  4877. comp = comp.default;
  4878. }
  4879. if (comp && !isObject(comp) && !isFunction(comp)) {
  4880. throw new Error(`Invalid async component load result: ${comp}`);
  4881. }
  4882. resolvedComp = comp;
  4883. return comp;
  4884. }));
  4885. };
  4886. return defineComponent({
  4887. name: "AsyncComponentWrapper",
  4888. __asyncLoader: load,
  4889. __asyncHydrate(el, instance, hydrate) {
  4890. let patched = false;
  4891. (instance.bu || (instance.bu = [])).push(() => patched = true);
  4892. const performHydrate = () => {
  4893. if (patched) {
  4894. {
  4895. warn$1(
  4896. `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
  4897. );
  4898. }
  4899. return;
  4900. }
  4901. hydrate();
  4902. };
  4903. const doHydrate = hydrateStrategy ? () => {
  4904. const teardown = hydrateStrategy(
  4905. performHydrate,
  4906. (cb) => forEachElement(el, cb)
  4907. );
  4908. if (teardown) {
  4909. (instance.bum || (instance.bum = [])).push(teardown);
  4910. }
  4911. } : performHydrate;
  4912. if (resolvedComp) {
  4913. doHydrate();
  4914. } else {
  4915. load().then(() => !instance.isUnmounted && doHydrate());
  4916. }
  4917. },
  4918. get __asyncResolved() {
  4919. return resolvedComp;
  4920. },
  4921. setup() {
  4922. const instance = currentInstance;
  4923. markAsyncBoundary(instance);
  4924. if (resolvedComp) {
  4925. return () => createInnerComp(resolvedComp, instance);
  4926. }
  4927. const onError = (err) => {
  4928. pendingRequest = null;
  4929. handleError(
  4930. err,
  4931. instance,
  4932. 13,
  4933. !errorComponent
  4934. );
  4935. };
  4936. if (suspensible && instance.suspense || isInSSRComponentSetup) {
  4937. return load().then((comp) => {
  4938. return () => createInnerComp(comp, instance);
  4939. }).catch((err) => {
  4940. onError(err);
  4941. return () => errorComponent ? createVNode(errorComponent, {
  4942. error: err
  4943. }) : null;
  4944. });
  4945. }
  4946. const loaded = ref(false);
  4947. const error = ref();
  4948. const delayed = ref(!!delay);
  4949. if (delay) {
  4950. setTimeout(() => {
  4951. delayed.value = false;
  4952. }, delay);
  4953. }
  4954. if (timeout != null) {
  4955. setTimeout(() => {
  4956. if (!loaded.value && !error.value) {
  4957. const err = new Error(
  4958. `Async component timed out after ${timeout}ms.`
  4959. );
  4960. onError(err);
  4961. error.value = err;
  4962. }
  4963. }, timeout);
  4964. }
  4965. load().then(() => {
  4966. loaded.value = true;
  4967. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  4968. instance.parent.update();
  4969. }
  4970. }).catch((err) => {
  4971. onError(err);
  4972. error.value = err;
  4973. });
  4974. return () => {
  4975. if (loaded.value && resolvedComp) {
  4976. return createInnerComp(resolvedComp, instance);
  4977. } else if (error.value && errorComponent) {
  4978. return createVNode(errorComponent, {
  4979. error: error.value
  4980. });
  4981. } else if (loadingComponent && !delayed.value) {
  4982. return createInnerComp(
  4983. loadingComponent,
  4984. instance
  4985. );
  4986. }
  4987. };
  4988. }
  4989. });
  4990. }
  4991. function createInnerComp(comp, parent) {
  4992. const { ref: ref2, props, children, ce } = parent.vnode;
  4993. const vnode = createVNode(comp, props, children);
  4994. vnode.ref = ref2;
  4995. vnode.ce = ce;
  4996. delete parent.vnode.ce;
  4997. return vnode;
  4998. }
  4999. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  5000. const KeepAliveImpl = {
  5001. name: `KeepAlive`,
  5002. // Marker for special handling inside the renderer. We are not using a ===
  5003. // check directly on KeepAlive in the renderer, because importing it directly
  5004. // would prevent it from being tree-shaken.
  5005. __isKeepAlive: true,
  5006. props: {
  5007. include: [String, RegExp, Array],
  5008. exclude: [String, RegExp, Array],
  5009. max: [String, Number]
  5010. },
  5011. setup(props, { slots }) {
  5012. const instance = getCurrentInstance();
  5013. const sharedContext = instance.ctx;
  5014. if (!sharedContext.renderer) {
  5015. return () => {
  5016. const children = slots.default && slots.default();
  5017. return children && children.length === 1 ? children[0] : children;
  5018. };
  5019. }
  5020. const cache = /* @__PURE__ */ new Map();
  5021. const keys = /* @__PURE__ */ new Set();
  5022. let current = null;
  5023. {
  5024. instance.__v_cache = cache;
  5025. }
  5026. const parentSuspense = instance.suspense;
  5027. const {
  5028. renderer: {
  5029. p: patch,
  5030. m: move,
  5031. um: _unmount,
  5032. o: { createElement }
  5033. }
  5034. } = sharedContext;
  5035. const storageContainer = createElement("div");
  5036. sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
  5037. const instance2 = vnode.component;
  5038. move(vnode, container, anchor, 0, parentSuspense);
  5039. patch(
  5040. instance2.vnode,
  5041. vnode,
  5042. container,
  5043. anchor,
  5044. instance2,
  5045. parentSuspense,
  5046. namespace,
  5047. vnode.slotScopeIds,
  5048. optimized
  5049. );
  5050. queuePostRenderEffect(() => {
  5051. instance2.isDeactivated = false;
  5052. if (instance2.a) {
  5053. invokeArrayFns(instance2.a);
  5054. }
  5055. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  5056. if (vnodeHook) {
  5057. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  5058. }
  5059. }, parentSuspense);
  5060. {
  5061. devtoolsComponentAdded(instance2);
  5062. }
  5063. };
  5064. sharedContext.deactivate = (vnode) => {
  5065. const instance2 = vnode.component;
  5066. invalidateMount(instance2.m);
  5067. invalidateMount(instance2.a);
  5068. move(vnode, storageContainer, null, 1, parentSuspense);
  5069. queuePostRenderEffect(() => {
  5070. if (instance2.da) {
  5071. invokeArrayFns(instance2.da);
  5072. }
  5073. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  5074. if (vnodeHook) {
  5075. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  5076. }
  5077. instance2.isDeactivated = true;
  5078. }, parentSuspense);
  5079. {
  5080. devtoolsComponentAdded(instance2);
  5081. }
  5082. {
  5083. instance2.__keepAliveStorageContainer = storageContainer;
  5084. }
  5085. };
  5086. function unmount(vnode) {
  5087. resetShapeFlag(vnode);
  5088. _unmount(vnode, instance, parentSuspense, true);
  5089. }
  5090. function pruneCache(filter) {
  5091. cache.forEach((vnode, key) => {
  5092. const name = getComponentName(
  5093. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : vnode.type
  5094. );
  5095. if (name && !filter(name)) {
  5096. pruneCacheEntry(key);
  5097. }
  5098. });
  5099. }
  5100. function pruneCacheEntry(key) {
  5101. const cached = cache.get(key);
  5102. if (cached && (!current || !isSameVNodeType(cached, current))) {
  5103. unmount(cached);
  5104. } else if (current) {
  5105. resetShapeFlag(current);
  5106. }
  5107. cache.delete(key);
  5108. keys.delete(key);
  5109. }
  5110. watch(
  5111. () => [props.include, props.exclude],
  5112. ([include, exclude]) => {
  5113. include && pruneCache((name) => matches(include, name));
  5114. exclude && pruneCache((name) => !matches(exclude, name));
  5115. },
  5116. // prune post-render after `current` has been updated
  5117. { flush: "post", deep: true }
  5118. );
  5119. let pendingCacheKey = null;
  5120. const cacheSubtree = () => {
  5121. if (pendingCacheKey != null) {
  5122. if (isSuspense(instance.subTree.type)) {
  5123. queuePostRenderEffect(() => {
  5124. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  5125. }, instance.subTree.suspense);
  5126. } else {
  5127. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  5128. }
  5129. }
  5130. };
  5131. onMounted(cacheSubtree);
  5132. onUpdated(cacheSubtree);
  5133. onBeforeUnmount(() => {
  5134. cache.forEach((cached) => {
  5135. const { subTree, suspense } = instance;
  5136. const vnode = getInnerChild(subTree);
  5137. if (cached.type === vnode.type && cached.key === vnode.key) {
  5138. resetShapeFlag(vnode);
  5139. const da = vnode.component.da;
  5140. da && queuePostRenderEffect(da, suspense);
  5141. return;
  5142. }
  5143. unmount(cached);
  5144. });
  5145. });
  5146. return () => {
  5147. pendingCacheKey = null;
  5148. if (!slots.default) {
  5149. return current = null;
  5150. }
  5151. const children = slots.default();
  5152. const rawVNode = children[0];
  5153. if (children.length > 1) {
  5154. {
  5155. warn$1(`KeepAlive should contain exactly one component child.`);
  5156. }
  5157. current = null;
  5158. return children;
  5159. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  5160. current = null;
  5161. return rawVNode;
  5162. }
  5163. let vnode = getInnerChild(rawVNode);
  5164. if (vnode.type === Comment) {
  5165. current = null;
  5166. return vnode;
  5167. }
  5168. const comp = vnode.type;
  5169. const name = getComponentName(
  5170. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  5171. );
  5172. const { include, exclude, max } = props;
  5173. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  5174. vnode.shapeFlag &= -257;
  5175. current = vnode;
  5176. return rawVNode;
  5177. }
  5178. const key = vnode.key == null ? comp : vnode.key;
  5179. const cachedVNode = cache.get(key);
  5180. if (vnode.el) {
  5181. vnode = cloneVNode(vnode);
  5182. if (rawVNode.shapeFlag & 128) {
  5183. rawVNode.ssContent = vnode;
  5184. }
  5185. }
  5186. pendingCacheKey = key;
  5187. if (cachedVNode) {
  5188. vnode.el = cachedVNode.el;
  5189. vnode.component = cachedVNode.component;
  5190. if (vnode.transition) {
  5191. setTransitionHooks(vnode, vnode.transition);
  5192. }
  5193. vnode.shapeFlag |= 512;
  5194. keys.delete(key);
  5195. keys.add(key);
  5196. } else {
  5197. keys.add(key);
  5198. if (max && keys.size > parseInt(max, 10)) {
  5199. pruneCacheEntry(keys.values().next().value);
  5200. }
  5201. }
  5202. vnode.shapeFlag |= 256;
  5203. current = vnode;
  5204. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  5205. };
  5206. }
  5207. };
  5208. const KeepAlive = KeepAliveImpl;
  5209. function matches(pattern, name) {
  5210. if (isArray(pattern)) {
  5211. return pattern.some((p) => matches(p, name));
  5212. } else if (isString(pattern)) {
  5213. return pattern.split(",").includes(name);
  5214. } else if (isRegExp(pattern)) {
  5215. pattern.lastIndex = 0;
  5216. return pattern.test(name);
  5217. }
  5218. return false;
  5219. }
  5220. function onActivated(hook, target) {
  5221. registerKeepAliveHook(hook, "a", target);
  5222. }
  5223. function onDeactivated(hook, target) {
  5224. registerKeepAliveHook(hook, "da", target);
  5225. }
  5226. function registerKeepAliveHook(hook, type, target = currentInstance) {
  5227. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  5228. let current = target;
  5229. while (current) {
  5230. if (current.isDeactivated) {
  5231. return;
  5232. }
  5233. current = current.parent;
  5234. }
  5235. return hook();
  5236. });
  5237. injectHook(type, wrappedHook, target);
  5238. if (target) {
  5239. let current = target.parent;
  5240. while (current && current.parent) {
  5241. if (isKeepAlive(current.parent.vnode)) {
  5242. injectToKeepAliveRoot(wrappedHook, type, target, current);
  5243. }
  5244. current = current.parent;
  5245. }
  5246. }
  5247. }
  5248. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  5249. const injected = injectHook(
  5250. type,
  5251. hook,
  5252. keepAliveRoot,
  5253. true
  5254. /* prepend */
  5255. );
  5256. onUnmounted(() => {
  5257. remove(keepAliveRoot[type], injected);
  5258. }, target);
  5259. }
  5260. function resetShapeFlag(vnode) {
  5261. vnode.shapeFlag &= -257;
  5262. vnode.shapeFlag &= -513;
  5263. }
  5264. function getInnerChild(vnode) {
  5265. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  5266. }
  5267. function injectHook(type, hook, target = currentInstance, prepend = false) {
  5268. if (target) {
  5269. const hooks = target[type] || (target[type] = []);
  5270. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  5271. pauseTracking();
  5272. const reset = setCurrentInstance(target);
  5273. const res = callWithAsyncErrorHandling(hook, target, type, args);
  5274. reset();
  5275. resetTracking();
  5276. return res;
  5277. });
  5278. if (prepend) {
  5279. hooks.unshift(wrappedHook);
  5280. } else {
  5281. hooks.push(wrappedHook);
  5282. }
  5283. return wrappedHook;
  5284. } else {
  5285. const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
  5286. warn$1(
  5287. `${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.` )
  5288. );
  5289. }
  5290. }
  5291. const createHook = (lifecycle) => (hook, target = currentInstance) => {
  5292. if (!isInSSRComponentSetup || lifecycle === "sp") {
  5293. injectHook(lifecycle, (...args) => hook(...args), target);
  5294. }
  5295. };
  5296. const onBeforeMount = createHook("bm");
  5297. const onMounted = createHook("m");
  5298. const onBeforeUpdate = createHook(
  5299. "bu"
  5300. );
  5301. const onUpdated = createHook("u");
  5302. const onBeforeUnmount = createHook(
  5303. "bum"
  5304. );
  5305. const onUnmounted = createHook("um");
  5306. const onServerPrefetch = createHook(
  5307. "sp"
  5308. );
  5309. const onRenderTriggered = createHook("rtg");
  5310. const onRenderTracked = createHook("rtc");
  5311. function onErrorCaptured(hook, target = currentInstance) {
  5312. injectHook("ec", hook, target);
  5313. }
  5314. const COMPONENTS = "components";
  5315. const DIRECTIVES = "directives";
  5316. function resolveComponent(name, maybeSelfReference) {
  5317. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  5318. }
  5319. const NULL_DYNAMIC_COMPONENT = /* @__PURE__ */ Symbol.for("v-ndc");
  5320. function resolveDynamicComponent(component) {
  5321. if (isString(component)) {
  5322. return resolveAsset(COMPONENTS, component, false) || component;
  5323. } else {
  5324. return component || NULL_DYNAMIC_COMPONENT;
  5325. }
  5326. }
  5327. function resolveDirective(name) {
  5328. return resolveAsset(DIRECTIVES, name);
  5329. }
  5330. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  5331. const instance = currentRenderingInstance || currentInstance;
  5332. if (instance) {
  5333. const Component = instance.type;
  5334. if (type === COMPONENTS) {
  5335. const selfName = getComponentName(
  5336. Component,
  5337. false
  5338. );
  5339. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  5340. return Component;
  5341. }
  5342. }
  5343. const res = (
  5344. // local registration
  5345. // check instance[type] first which is resolved for options API
  5346. resolve(instance[type] || Component[type], name) || // global registration
  5347. resolve(instance.appContext[type], name)
  5348. );
  5349. if (!res && maybeSelfReference) {
  5350. return Component;
  5351. }
  5352. if (warnMissing && !res) {
  5353. const extra = type === COMPONENTS ? `
  5354. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  5355. warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  5356. }
  5357. return res;
  5358. } else {
  5359. warn$1(
  5360. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  5361. );
  5362. }
  5363. }
  5364. function resolve(registry, name) {
  5365. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  5366. }
  5367. function renderList(source, renderItem, cache, index) {
  5368. let ret;
  5369. const cached = cache && cache[index];
  5370. const sourceIsArray = isArray(source);
  5371. if (sourceIsArray || isString(source)) {
  5372. const sourceIsReactiveArray = sourceIsArray && isReactive(source);
  5373. let needsWrap = false;
  5374. let isReadonlySource = false;
  5375. if (sourceIsReactiveArray) {
  5376. needsWrap = !isShallow(source);
  5377. isReadonlySource = isReadonly(source);
  5378. source = shallowReadArray(source);
  5379. }
  5380. ret = new Array(source.length);
  5381. for (let i = 0, l = source.length; i < l; i++) {
  5382. ret[i] = renderItem(
  5383. needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
  5384. i,
  5385. void 0,
  5386. cached && cached[i]
  5387. );
  5388. }
  5389. } else if (typeof source === "number") {
  5390. if (!Number.isInteger(source) || source < 0) {
  5391. warn$1(
  5392. `The v-for range expects a positive integer value but got ${source}.`
  5393. );
  5394. ret = [];
  5395. } else {
  5396. ret = new Array(source);
  5397. for (let i = 0; i < source; i++) {
  5398. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  5399. }
  5400. }
  5401. } else if (isObject(source)) {
  5402. if (source[Symbol.iterator]) {
  5403. ret = Array.from(
  5404. source,
  5405. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  5406. );
  5407. } else {
  5408. const keys = Object.keys(source);
  5409. ret = new Array(keys.length);
  5410. for (let i = 0, l = keys.length; i < l; i++) {
  5411. const key = keys[i];
  5412. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  5413. }
  5414. }
  5415. } else {
  5416. ret = [];
  5417. }
  5418. if (cache) {
  5419. cache[index] = ret;
  5420. }
  5421. return ret;
  5422. }
  5423. function createSlots(slots, dynamicSlots) {
  5424. for (let i = 0; i < dynamicSlots.length; i++) {
  5425. const slot = dynamicSlots[i];
  5426. if (isArray(slot)) {
  5427. for (let j = 0; j < slot.length; j++) {
  5428. slots[slot[j].name] = slot[j].fn;
  5429. }
  5430. } else if (slot) {
  5431. slots[slot.name] = slot.key ? (...args) => {
  5432. const res = slot.fn(...args);
  5433. if (res) res.key = slot.key;
  5434. return res;
  5435. } : slot.fn;
  5436. }
  5437. }
  5438. return slots;
  5439. }
  5440. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  5441. if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
  5442. const hasProps = Object.keys(props).length > 0;
  5443. if (name !== "default") props.name = name;
  5444. return openBlock(), createBlock(
  5445. Fragment,
  5446. null,
  5447. [createVNode("slot", props, fallback && fallback())],
  5448. hasProps ? -2 : 64
  5449. );
  5450. }
  5451. let slot = slots[name];
  5452. if (slot && slot.length > 1) {
  5453. warn$1(
  5454. `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.`
  5455. );
  5456. slot = () => [];
  5457. }
  5458. if (slot && slot._c) {
  5459. slot._d = false;
  5460. }
  5461. openBlock();
  5462. const validSlotContent = slot && ensureValidVNode(slot(props));
  5463. const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
  5464. // key attached in the `createSlots` helper, respect that
  5465. validSlotContent && validSlotContent.key;
  5466. const rendered = createBlock(
  5467. Fragment,
  5468. {
  5469. key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
  5470. (!validSlotContent && fallback ? "_fb" : "")
  5471. },
  5472. validSlotContent || (fallback ? fallback() : []),
  5473. validSlotContent && slots._ === 1 ? 64 : -2
  5474. );
  5475. if (!noSlotted && rendered.scopeId) {
  5476. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  5477. }
  5478. if (slot && slot._c) {
  5479. slot._d = true;
  5480. }
  5481. return rendered;
  5482. }
  5483. function ensureValidVNode(vnodes) {
  5484. return vnodes.some((child) => {
  5485. if (!isVNode(child)) return true;
  5486. if (child.type === Comment) return false;
  5487. if (child.type === Fragment && !ensureValidVNode(child.children))
  5488. return false;
  5489. return true;
  5490. }) ? vnodes : null;
  5491. }
  5492. function toHandlers(obj, preserveCaseIfNecessary) {
  5493. const ret = {};
  5494. if (!isObject(obj)) {
  5495. warn$1(`v-on with no argument expects an object value.`);
  5496. return ret;
  5497. }
  5498. for (const key in obj) {
  5499. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  5500. }
  5501. return ret;
  5502. }
  5503. const getPublicInstance = (i) => {
  5504. if (!i) return null;
  5505. if (isStatefulComponent(i)) return getComponentPublicInstance(i);
  5506. return getPublicInstance(i.parent);
  5507. };
  5508. const publicPropertiesMap = (
  5509. // Move PURE marker to new line to workaround compiler discarding it
  5510. // due to type annotation
  5511. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  5512. $: (i) => i,
  5513. $el: (i) => i.vnode.el,
  5514. $data: (i) => i.data,
  5515. $props: (i) => shallowReadonly(i.props) ,
  5516. $attrs: (i) => shallowReadonly(i.attrs) ,
  5517. $slots: (i) => shallowReadonly(i.slots) ,
  5518. $refs: (i) => shallowReadonly(i.refs) ,
  5519. $parent: (i) => getPublicInstance(i.parent),
  5520. $root: (i) => getPublicInstance(i.root),
  5521. $host: (i) => i.ce,
  5522. $emit: (i) => i.emit,
  5523. $options: (i) => resolveMergedOptions(i) ,
  5524. $forceUpdate: (i) => i.f || (i.f = () => {
  5525. queueJob(i.update);
  5526. }),
  5527. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  5528. $watch: (i) => instanceWatch.bind(i)
  5529. })
  5530. );
  5531. const isReservedPrefix = (key) => key === "_" || key === "$";
  5532. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  5533. const PublicInstanceProxyHandlers = {
  5534. get({ _: instance }, key) {
  5535. if (key === "__v_skip") {
  5536. return true;
  5537. }
  5538. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  5539. if (key === "__isVue") {
  5540. return true;
  5541. }
  5542. if (key[0] !== "$") {
  5543. const n = accessCache[key];
  5544. if (n !== void 0) {
  5545. switch (n) {
  5546. case 1 /* SETUP */:
  5547. return setupState[key];
  5548. case 2 /* DATA */:
  5549. return data[key];
  5550. case 4 /* CONTEXT */:
  5551. return ctx[key];
  5552. case 3 /* PROPS */:
  5553. return props[key];
  5554. }
  5555. } else if (hasSetupBinding(setupState, key)) {
  5556. accessCache[key] = 1 /* SETUP */;
  5557. return setupState[key];
  5558. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5559. accessCache[key] = 2 /* DATA */;
  5560. return data[key];
  5561. } else if (hasOwn(props, key)) {
  5562. accessCache[key] = 3 /* PROPS */;
  5563. return props[key];
  5564. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5565. accessCache[key] = 4 /* CONTEXT */;
  5566. return ctx[key];
  5567. } else if (shouldCacheAccess) {
  5568. accessCache[key] = 0 /* OTHER */;
  5569. }
  5570. }
  5571. const publicGetter = publicPropertiesMap[key];
  5572. let cssModule, globalProperties;
  5573. if (publicGetter) {
  5574. if (key === "$attrs") {
  5575. track(instance.attrs, "get", "");
  5576. markAttrsAccessed();
  5577. } else if (key === "$slots") {
  5578. track(instance, "get", key);
  5579. }
  5580. return publicGetter(instance);
  5581. } else if (
  5582. // css module (injected by vue-loader)
  5583. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  5584. ) {
  5585. return cssModule;
  5586. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  5587. accessCache[key] = 4 /* CONTEXT */;
  5588. return ctx[key];
  5589. } else if (
  5590. // global properties
  5591. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  5592. ) {
  5593. {
  5594. return globalProperties[key];
  5595. }
  5596. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  5597. // to infinite warning loop
  5598. key.indexOf("__v") !== 0)) {
  5599. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  5600. warn$1(
  5601. `Property ${JSON.stringify(
  5602. key
  5603. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  5604. );
  5605. } else if (instance === currentRenderingInstance) {
  5606. warn$1(
  5607. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  5608. );
  5609. }
  5610. }
  5611. },
  5612. set({ _: instance }, key, value) {
  5613. const { data, setupState, ctx } = instance;
  5614. if (hasSetupBinding(setupState, key)) {
  5615. setupState[key] = value;
  5616. return true;
  5617. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  5618. warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  5619. return false;
  5620. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  5621. data[key] = value;
  5622. return true;
  5623. } else if (hasOwn(instance.props, key)) {
  5624. warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
  5625. return false;
  5626. }
  5627. if (key[0] === "$" && key.slice(1) in instance) {
  5628. warn$1(
  5629. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  5630. );
  5631. return false;
  5632. } else {
  5633. if (key in instance.appContext.config.globalProperties) {
  5634. Object.defineProperty(ctx, key, {
  5635. enumerable: true,
  5636. configurable: true,
  5637. value
  5638. });
  5639. } else {
  5640. ctx[key] = value;
  5641. }
  5642. }
  5643. return true;
  5644. },
  5645. has({
  5646. _: { data, setupState, accessCache, ctx, appContext, props, type }
  5647. }, key) {
  5648. let cssModules;
  5649. return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
  5650. },
  5651. defineProperty(target, key, descriptor) {
  5652. if (descriptor.get != null) {
  5653. target._.accessCache[key] = 0;
  5654. } else if (hasOwn(descriptor, "value")) {
  5655. this.set(target, key, descriptor.value, null);
  5656. }
  5657. return Reflect.defineProperty(target, key, descriptor);
  5658. }
  5659. };
  5660. {
  5661. PublicInstanceProxyHandlers.ownKeys = (target) => {
  5662. warn$1(
  5663. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  5664. );
  5665. return Reflect.ownKeys(target);
  5666. };
  5667. }
  5668. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
  5669. get(target, key) {
  5670. if (key === Symbol.unscopables) {
  5671. return;
  5672. }
  5673. return PublicInstanceProxyHandlers.get(target, key, target);
  5674. },
  5675. has(_, key) {
  5676. const has = key[0] !== "_" && !isGloballyAllowed(key);
  5677. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  5678. warn$1(
  5679. `Property ${JSON.stringify(
  5680. key
  5681. )} should not start with _ which is a reserved prefix for Vue internals.`
  5682. );
  5683. }
  5684. return has;
  5685. }
  5686. });
  5687. function createDevRenderContext(instance) {
  5688. const target = {};
  5689. Object.defineProperty(target, `_`, {
  5690. configurable: true,
  5691. enumerable: false,
  5692. get: () => instance
  5693. });
  5694. Object.keys(publicPropertiesMap).forEach((key) => {
  5695. Object.defineProperty(target, key, {
  5696. configurable: true,
  5697. enumerable: false,
  5698. get: () => publicPropertiesMap[key](instance),
  5699. // intercepted by the proxy so no need for implementation,
  5700. // but needed to prevent set errors
  5701. set: NOOP
  5702. });
  5703. });
  5704. return target;
  5705. }
  5706. function exposePropsOnRenderContext(instance) {
  5707. const {
  5708. ctx,
  5709. propsOptions: [propsOptions]
  5710. } = instance;
  5711. if (propsOptions) {
  5712. Object.keys(propsOptions).forEach((key) => {
  5713. Object.defineProperty(ctx, key, {
  5714. enumerable: true,
  5715. configurable: true,
  5716. get: () => instance.props[key],
  5717. set: NOOP
  5718. });
  5719. });
  5720. }
  5721. }
  5722. function exposeSetupStateOnRenderContext(instance) {
  5723. const { ctx, setupState } = instance;
  5724. Object.keys(toRaw(setupState)).forEach((key) => {
  5725. if (!setupState.__isScriptSetup) {
  5726. if (isReservedPrefix(key[0])) {
  5727. warn$1(
  5728. `setup() return property ${JSON.stringify(
  5729. key
  5730. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  5731. );
  5732. return;
  5733. }
  5734. Object.defineProperty(ctx, key, {
  5735. enumerable: true,
  5736. configurable: true,
  5737. get: () => setupState[key],
  5738. set: NOOP
  5739. });
  5740. }
  5741. });
  5742. }
  5743. const warnRuntimeUsage = (method) => warn$1(
  5744. `${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.`
  5745. );
  5746. function defineProps() {
  5747. {
  5748. warnRuntimeUsage(`defineProps`);
  5749. }
  5750. return null;
  5751. }
  5752. function defineEmits() {
  5753. {
  5754. warnRuntimeUsage(`defineEmits`);
  5755. }
  5756. return null;
  5757. }
  5758. function defineExpose(exposed) {
  5759. {
  5760. warnRuntimeUsage(`defineExpose`);
  5761. }
  5762. }
  5763. function defineOptions(options) {
  5764. {
  5765. warnRuntimeUsage(`defineOptions`);
  5766. }
  5767. }
  5768. function defineSlots() {
  5769. {
  5770. warnRuntimeUsage(`defineSlots`);
  5771. }
  5772. return null;
  5773. }
  5774. function defineModel() {
  5775. {
  5776. warnRuntimeUsage("defineModel");
  5777. }
  5778. }
  5779. function withDefaults(props, defaults) {
  5780. {
  5781. warnRuntimeUsage(`withDefaults`);
  5782. }
  5783. return null;
  5784. }
  5785. function useSlots() {
  5786. return getContext("useSlots").slots;
  5787. }
  5788. function useAttrs() {
  5789. return getContext("useAttrs").attrs;
  5790. }
  5791. function getContext(calledFunctionName) {
  5792. const i = getCurrentInstance();
  5793. if (!i) {
  5794. warn$1(`${calledFunctionName}() called without active instance.`);
  5795. }
  5796. return i.setupContext || (i.setupContext = createSetupContext(i));
  5797. }
  5798. function normalizePropsOrEmits(props) {
  5799. return isArray(props) ? props.reduce(
  5800. (normalized, p) => (normalized[p] = null, normalized),
  5801. {}
  5802. ) : props;
  5803. }
  5804. function mergeDefaults(raw, defaults) {
  5805. const props = normalizePropsOrEmits(raw);
  5806. for (const key in defaults) {
  5807. if (key.startsWith("__skip")) continue;
  5808. let opt = props[key];
  5809. if (opt) {
  5810. if (isArray(opt) || isFunction(opt)) {
  5811. opt = props[key] = { type: opt, default: defaults[key] };
  5812. } else {
  5813. opt.default = defaults[key];
  5814. }
  5815. } else if (opt === null) {
  5816. opt = props[key] = { default: defaults[key] };
  5817. } else {
  5818. warn$1(`props default key "${key}" has no corresponding declaration.`);
  5819. }
  5820. if (opt && defaults[`__skip_${key}`]) {
  5821. opt.skipFactory = true;
  5822. }
  5823. }
  5824. return props;
  5825. }
  5826. function mergeModels(a, b) {
  5827. if (!a || !b) return a || b;
  5828. if (isArray(a) && isArray(b)) return a.concat(b);
  5829. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  5830. }
  5831. function createPropsRestProxy(props, excludedKeys) {
  5832. const ret = {};
  5833. for (const key in props) {
  5834. if (!excludedKeys.includes(key)) {
  5835. Object.defineProperty(ret, key, {
  5836. enumerable: true,
  5837. get: () => props[key]
  5838. });
  5839. }
  5840. }
  5841. return ret;
  5842. }
  5843. function withAsyncContext(getAwaitable) {
  5844. const ctx = getCurrentInstance();
  5845. const inSSRSetup = isInSSRComponentSetup;
  5846. if (!ctx) {
  5847. warn$1(
  5848. `withAsyncContext called without active current instance. This is likely a bug.`
  5849. );
  5850. }
  5851. let awaitable = getAwaitable();
  5852. unsetCurrentInstance();
  5853. if (inSSRSetup) {
  5854. setInSSRSetupState(false);
  5855. }
  5856. const restore = () => {
  5857. setCurrentInstance(ctx);
  5858. if (inSSRSetup) {
  5859. setInSSRSetupState(true);
  5860. }
  5861. };
  5862. const cleanup = () => {
  5863. if (getCurrentInstance() !== ctx) ctx.scope.off();
  5864. unsetCurrentInstance();
  5865. if (inSSRSetup) {
  5866. setInSSRSetupState(false);
  5867. }
  5868. };
  5869. if (isPromise(awaitable)) {
  5870. awaitable = awaitable.catch((e) => {
  5871. restore();
  5872. Promise.resolve().then(() => Promise.resolve().then(cleanup));
  5873. throw e;
  5874. });
  5875. }
  5876. return [
  5877. awaitable,
  5878. () => {
  5879. restore();
  5880. Promise.resolve().then(cleanup);
  5881. }
  5882. ];
  5883. }
  5884. function createDuplicateChecker() {
  5885. const cache = /* @__PURE__ */ Object.create(null);
  5886. return (type, key) => {
  5887. if (cache[key]) {
  5888. warn$1(`${type} property "${key}" is already defined in ${cache[key]}.`);
  5889. } else {
  5890. cache[key] = type;
  5891. }
  5892. };
  5893. }
  5894. let shouldCacheAccess = true;
  5895. function applyOptions(instance) {
  5896. const options = resolveMergedOptions(instance);
  5897. const publicThis = instance.proxy;
  5898. const ctx = instance.ctx;
  5899. shouldCacheAccess = false;
  5900. if (options.beforeCreate) {
  5901. callHook$1(options.beforeCreate, instance, "bc");
  5902. }
  5903. const {
  5904. // state
  5905. data: dataOptions,
  5906. computed: computedOptions,
  5907. methods,
  5908. watch: watchOptions,
  5909. provide: provideOptions,
  5910. inject: injectOptions,
  5911. // lifecycle
  5912. created,
  5913. beforeMount,
  5914. mounted,
  5915. beforeUpdate,
  5916. updated,
  5917. activated,
  5918. deactivated,
  5919. beforeDestroy,
  5920. beforeUnmount,
  5921. destroyed,
  5922. unmounted,
  5923. render,
  5924. renderTracked,
  5925. renderTriggered,
  5926. errorCaptured,
  5927. serverPrefetch,
  5928. // public API
  5929. expose,
  5930. inheritAttrs,
  5931. // assets
  5932. components,
  5933. directives,
  5934. filters
  5935. } = options;
  5936. const checkDuplicateProperties = createDuplicateChecker() ;
  5937. {
  5938. const [propsOptions] = instance.propsOptions;
  5939. if (propsOptions) {
  5940. for (const key in propsOptions) {
  5941. checkDuplicateProperties("Props" /* PROPS */, key);
  5942. }
  5943. }
  5944. }
  5945. if (injectOptions) {
  5946. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  5947. }
  5948. if (methods) {
  5949. for (const key in methods) {
  5950. const methodHandler = methods[key];
  5951. if (isFunction(methodHandler)) {
  5952. {
  5953. Object.defineProperty(ctx, key, {
  5954. value: methodHandler.bind(publicThis),
  5955. configurable: true,
  5956. enumerable: true,
  5957. writable: true
  5958. });
  5959. }
  5960. {
  5961. checkDuplicateProperties("Methods" /* METHODS */, key);
  5962. }
  5963. } else {
  5964. warn$1(
  5965. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  5966. );
  5967. }
  5968. }
  5969. }
  5970. if (dataOptions) {
  5971. if (!isFunction(dataOptions)) {
  5972. warn$1(
  5973. `The data option must be a function. Plain object usage is no longer supported.`
  5974. );
  5975. }
  5976. const data = dataOptions.call(publicThis, publicThis);
  5977. if (isPromise(data)) {
  5978. warn$1(
  5979. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  5980. );
  5981. }
  5982. if (!isObject(data)) {
  5983. warn$1(`data() should return an object.`);
  5984. } else {
  5985. instance.data = reactive(data);
  5986. {
  5987. for (const key in data) {
  5988. checkDuplicateProperties("Data" /* DATA */, key);
  5989. if (!isReservedPrefix(key[0])) {
  5990. Object.defineProperty(ctx, key, {
  5991. configurable: true,
  5992. enumerable: true,
  5993. get: () => data[key],
  5994. set: NOOP
  5995. });
  5996. }
  5997. }
  5998. }
  5999. }
  6000. }
  6001. shouldCacheAccess = true;
  6002. if (computedOptions) {
  6003. for (const key in computedOptions) {
  6004. const opt = computedOptions[key];
  6005. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  6006. if (get === NOOP) {
  6007. warn$1(`Computed property "${key}" has no getter.`);
  6008. }
  6009. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  6010. warn$1(
  6011. `Write operation failed: computed property "${key}" is readonly.`
  6012. );
  6013. } ;
  6014. const c = computed({
  6015. get,
  6016. set
  6017. });
  6018. Object.defineProperty(ctx, key, {
  6019. enumerable: true,
  6020. configurable: true,
  6021. get: () => c.value,
  6022. set: (v) => c.value = v
  6023. });
  6024. {
  6025. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  6026. }
  6027. }
  6028. }
  6029. if (watchOptions) {
  6030. for (const key in watchOptions) {
  6031. createWatcher(watchOptions[key], ctx, publicThis, key);
  6032. }
  6033. }
  6034. if (provideOptions) {
  6035. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  6036. Reflect.ownKeys(provides).forEach((key) => {
  6037. provide(key, provides[key]);
  6038. });
  6039. }
  6040. if (created) {
  6041. callHook$1(created, instance, "c");
  6042. }
  6043. function registerLifecycleHook(register, hook) {
  6044. if (isArray(hook)) {
  6045. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  6046. } else if (hook) {
  6047. register(hook.bind(publicThis));
  6048. }
  6049. }
  6050. registerLifecycleHook(onBeforeMount, beforeMount);
  6051. registerLifecycleHook(onMounted, mounted);
  6052. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  6053. registerLifecycleHook(onUpdated, updated);
  6054. registerLifecycleHook(onActivated, activated);
  6055. registerLifecycleHook(onDeactivated, deactivated);
  6056. registerLifecycleHook(onErrorCaptured, errorCaptured);
  6057. registerLifecycleHook(onRenderTracked, renderTracked);
  6058. registerLifecycleHook(onRenderTriggered, renderTriggered);
  6059. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  6060. registerLifecycleHook(onUnmounted, unmounted);
  6061. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  6062. if (isArray(expose)) {
  6063. if (expose.length) {
  6064. const exposed = instance.exposed || (instance.exposed = {});
  6065. expose.forEach((key) => {
  6066. Object.defineProperty(exposed, key, {
  6067. get: () => publicThis[key],
  6068. set: (val) => publicThis[key] = val,
  6069. enumerable: true
  6070. });
  6071. });
  6072. } else if (!instance.exposed) {
  6073. instance.exposed = {};
  6074. }
  6075. }
  6076. if (render && instance.render === NOOP) {
  6077. instance.render = render;
  6078. }
  6079. if (inheritAttrs != null) {
  6080. instance.inheritAttrs = inheritAttrs;
  6081. }
  6082. if (components) instance.components = components;
  6083. if (directives) instance.directives = directives;
  6084. if (serverPrefetch) {
  6085. markAsyncBoundary(instance);
  6086. }
  6087. }
  6088. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  6089. if (isArray(injectOptions)) {
  6090. injectOptions = normalizeInject(injectOptions);
  6091. }
  6092. for (const key in injectOptions) {
  6093. const opt = injectOptions[key];
  6094. let injected;
  6095. if (isObject(opt)) {
  6096. if ("default" in opt) {
  6097. injected = inject(
  6098. opt.from || key,
  6099. opt.default,
  6100. true
  6101. );
  6102. } else {
  6103. injected = inject(opt.from || key);
  6104. }
  6105. } else {
  6106. injected = inject(opt);
  6107. }
  6108. if (isRef(injected)) {
  6109. Object.defineProperty(ctx, key, {
  6110. enumerable: true,
  6111. configurable: true,
  6112. get: () => injected.value,
  6113. set: (v) => injected.value = v
  6114. });
  6115. } else {
  6116. ctx[key] = injected;
  6117. }
  6118. {
  6119. checkDuplicateProperties("Inject" /* INJECT */, key);
  6120. }
  6121. }
  6122. }
  6123. function callHook$1(hook, instance, type) {
  6124. callWithAsyncErrorHandling(
  6125. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  6126. instance,
  6127. type
  6128. );
  6129. }
  6130. function createWatcher(raw, ctx, publicThis, key) {
  6131. let getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  6132. if (isString(raw)) {
  6133. const handler = ctx[raw];
  6134. if (isFunction(handler)) {
  6135. {
  6136. watch(getter, handler);
  6137. }
  6138. } else {
  6139. warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
  6140. }
  6141. } else if (isFunction(raw)) {
  6142. {
  6143. watch(getter, raw.bind(publicThis));
  6144. }
  6145. } else if (isObject(raw)) {
  6146. if (isArray(raw)) {
  6147. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  6148. } else {
  6149. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  6150. if (isFunction(handler)) {
  6151. watch(getter, handler, raw);
  6152. } else {
  6153. warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  6154. }
  6155. }
  6156. } else {
  6157. warn$1(`Invalid watch option: "${key}"`, raw);
  6158. }
  6159. }
  6160. function resolveMergedOptions(instance) {
  6161. const base = instance.type;
  6162. const { mixins, extends: extendsOptions } = base;
  6163. const {
  6164. mixins: globalMixins,
  6165. optionsCache: cache,
  6166. config: { optionMergeStrategies }
  6167. } = instance.appContext;
  6168. const cached = cache.get(base);
  6169. let resolved;
  6170. if (cached) {
  6171. resolved = cached;
  6172. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  6173. {
  6174. resolved = base;
  6175. }
  6176. } else {
  6177. resolved = {};
  6178. if (globalMixins.length) {
  6179. globalMixins.forEach(
  6180. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  6181. );
  6182. }
  6183. mergeOptions(resolved, base, optionMergeStrategies);
  6184. }
  6185. if (isObject(base)) {
  6186. cache.set(base, resolved);
  6187. }
  6188. return resolved;
  6189. }
  6190. function mergeOptions(to, from, strats, asMixin = false) {
  6191. const { mixins, extends: extendsOptions } = from;
  6192. if (extendsOptions) {
  6193. mergeOptions(to, extendsOptions, strats, true);
  6194. }
  6195. if (mixins) {
  6196. mixins.forEach(
  6197. (m) => mergeOptions(to, m, strats, true)
  6198. );
  6199. }
  6200. for (const key in from) {
  6201. if (asMixin && key === "expose") {
  6202. warn$1(
  6203. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  6204. );
  6205. } else {
  6206. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  6207. to[key] = strat ? strat(to[key], from[key]) : from[key];
  6208. }
  6209. }
  6210. return to;
  6211. }
  6212. const internalOptionMergeStrats = {
  6213. data: mergeDataFn,
  6214. props: mergeEmitsOrPropsOptions,
  6215. emits: mergeEmitsOrPropsOptions,
  6216. // objects
  6217. methods: mergeObjectOptions,
  6218. computed: mergeObjectOptions,
  6219. // lifecycle
  6220. beforeCreate: mergeAsArray,
  6221. created: mergeAsArray,
  6222. beforeMount: mergeAsArray,
  6223. mounted: mergeAsArray,
  6224. beforeUpdate: mergeAsArray,
  6225. updated: mergeAsArray,
  6226. beforeDestroy: mergeAsArray,
  6227. beforeUnmount: mergeAsArray,
  6228. destroyed: mergeAsArray,
  6229. unmounted: mergeAsArray,
  6230. activated: mergeAsArray,
  6231. deactivated: mergeAsArray,
  6232. errorCaptured: mergeAsArray,
  6233. serverPrefetch: mergeAsArray,
  6234. // assets
  6235. components: mergeObjectOptions,
  6236. directives: mergeObjectOptions,
  6237. // watch
  6238. watch: mergeWatchOptions,
  6239. // provide / inject
  6240. provide: mergeDataFn,
  6241. inject: mergeInject
  6242. };
  6243. function mergeDataFn(to, from) {
  6244. if (!from) {
  6245. return to;
  6246. }
  6247. if (!to) {
  6248. return from;
  6249. }
  6250. return function mergedDataFn() {
  6251. return (extend)(
  6252. isFunction(to) ? to.call(this, this) : to,
  6253. isFunction(from) ? from.call(this, this) : from
  6254. );
  6255. };
  6256. }
  6257. function mergeInject(to, from) {
  6258. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  6259. }
  6260. function normalizeInject(raw) {
  6261. if (isArray(raw)) {
  6262. const res = {};
  6263. for (let i = 0; i < raw.length; i++) {
  6264. res[raw[i]] = raw[i];
  6265. }
  6266. return res;
  6267. }
  6268. return raw;
  6269. }
  6270. function mergeAsArray(to, from) {
  6271. return to ? [...new Set([].concat(to, from))] : from;
  6272. }
  6273. function mergeObjectOptions(to, from) {
  6274. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  6275. }
  6276. function mergeEmitsOrPropsOptions(to, from) {
  6277. if (to) {
  6278. if (isArray(to) && isArray(from)) {
  6279. return [.../* @__PURE__ */ new Set([...to, ...from])];
  6280. }
  6281. return extend(
  6282. /* @__PURE__ */ Object.create(null),
  6283. normalizePropsOrEmits(to),
  6284. normalizePropsOrEmits(from != null ? from : {})
  6285. );
  6286. } else {
  6287. return from;
  6288. }
  6289. }
  6290. function mergeWatchOptions(to, from) {
  6291. if (!to) return from;
  6292. if (!from) return to;
  6293. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  6294. for (const key in from) {
  6295. merged[key] = mergeAsArray(to[key], from[key]);
  6296. }
  6297. return merged;
  6298. }
  6299. function createAppContext() {
  6300. return {
  6301. app: null,
  6302. config: {
  6303. isNativeTag: NO,
  6304. performance: false,
  6305. globalProperties: {},
  6306. optionMergeStrategies: {},
  6307. errorHandler: void 0,
  6308. warnHandler: void 0,
  6309. compilerOptions: {}
  6310. },
  6311. mixins: [],
  6312. components: {},
  6313. directives: {},
  6314. provides: /* @__PURE__ */ Object.create(null),
  6315. optionsCache: /* @__PURE__ */ new WeakMap(),
  6316. propsCache: /* @__PURE__ */ new WeakMap(),
  6317. emitsCache: /* @__PURE__ */ new WeakMap()
  6318. };
  6319. }
  6320. let uid$1 = 0;
  6321. function createAppAPI(render, hydrate) {
  6322. return function createApp(rootComponent, rootProps = null) {
  6323. if (!isFunction(rootComponent)) {
  6324. rootComponent = extend({}, rootComponent);
  6325. }
  6326. if (rootProps != null && !isObject(rootProps)) {
  6327. warn$1(`root props passed to app.mount() must be an object.`);
  6328. rootProps = null;
  6329. }
  6330. const context = createAppContext();
  6331. const installedPlugins = /* @__PURE__ */ new WeakSet();
  6332. const pluginCleanupFns = [];
  6333. let isMounted = false;
  6334. const app = context.app = {
  6335. _uid: uid$1++,
  6336. _component: rootComponent,
  6337. _props: rootProps,
  6338. _container: null,
  6339. _context: context,
  6340. _instance: null,
  6341. version,
  6342. get config() {
  6343. return context.config;
  6344. },
  6345. set config(v) {
  6346. {
  6347. warn$1(
  6348. `app.config cannot be replaced. Modify individual options instead.`
  6349. );
  6350. }
  6351. },
  6352. use(plugin, ...options) {
  6353. if (installedPlugins.has(plugin)) {
  6354. warn$1(`Plugin has already been applied to target app.`);
  6355. } else if (plugin && isFunction(plugin.install)) {
  6356. installedPlugins.add(plugin);
  6357. plugin.install(app, ...options);
  6358. } else if (isFunction(plugin)) {
  6359. installedPlugins.add(plugin);
  6360. plugin(app, ...options);
  6361. } else {
  6362. warn$1(
  6363. `A plugin must either be a function or an object with an "install" function.`
  6364. );
  6365. }
  6366. return app;
  6367. },
  6368. mixin(mixin) {
  6369. {
  6370. if (!context.mixins.includes(mixin)) {
  6371. context.mixins.push(mixin);
  6372. } else {
  6373. warn$1(
  6374. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  6375. );
  6376. }
  6377. }
  6378. return app;
  6379. },
  6380. component(name, component) {
  6381. {
  6382. validateComponentName(name, context.config);
  6383. }
  6384. if (!component) {
  6385. return context.components[name];
  6386. }
  6387. if (context.components[name]) {
  6388. warn$1(`Component "${name}" has already been registered in target app.`);
  6389. }
  6390. context.components[name] = component;
  6391. return app;
  6392. },
  6393. directive(name, directive) {
  6394. {
  6395. validateDirectiveName(name);
  6396. }
  6397. if (!directive) {
  6398. return context.directives[name];
  6399. }
  6400. if (context.directives[name]) {
  6401. warn$1(`Directive "${name}" has already been registered in target app.`);
  6402. }
  6403. context.directives[name] = directive;
  6404. return app;
  6405. },
  6406. mount(rootContainer, isHydrate, namespace) {
  6407. if (!isMounted) {
  6408. if (rootContainer.__vue_app__) {
  6409. warn$1(
  6410. `There is already an app instance mounted on the host container.
  6411. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  6412. );
  6413. }
  6414. const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
  6415. vnode.appContext = context;
  6416. if (namespace === true) {
  6417. namespace = "svg";
  6418. } else if (namespace === false) {
  6419. namespace = void 0;
  6420. }
  6421. {
  6422. context.reload = () => {
  6423. const cloned = cloneVNode(vnode);
  6424. cloned.el = null;
  6425. render(cloned, rootContainer, namespace);
  6426. };
  6427. }
  6428. if (isHydrate && hydrate) {
  6429. hydrate(vnode, rootContainer);
  6430. } else {
  6431. render(vnode, rootContainer, namespace);
  6432. }
  6433. isMounted = true;
  6434. app._container = rootContainer;
  6435. rootContainer.__vue_app__ = app;
  6436. {
  6437. app._instance = vnode.component;
  6438. devtoolsInitApp(app, version);
  6439. }
  6440. return getComponentPublicInstance(vnode.component);
  6441. } else {
  6442. warn$1(
  6443. `App has already been mounted.
  6444. 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)\``
  6445. );
  6446. }
  6447. },
  6448. onUnmount(cleanupFn) {
  6449. if (typeof cleanupFn !== "function") {
  6450. warn$1(
  6451. `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
  6452. );
  6453. }
  6454. pluginCleanupFns.push(cleanupFn);
  6455. },
  6456. unmount() {
  6457. if (isMounted) {
  6458. callWithAsyncErrorHandling(
  6459. pluginCleanupFns,
  6460. app._instance,
  6461. 16
  6462. );
  6463. render(null, app._container);
  6464. {
  6465. app._instance = null;
  6466. devtoolsUnmountApp(app);
  6467. }
  6468. delete app._container.__vue_app__;
  6469. } else {
  6470. warn$1(`Cannot unmount an app that is not mounted.`);
  6471. }
  6472. },
  6473. provide(key, value) {
  6474. if (key in context.provides) {
  6475. if (hasOwn(context.provides, key)) {
  6476. warn$1(
  6477. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  6478. );
  6479. } else {
  6480. warn$1(
  6481. `App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`
  6482. );
  6483. }
  6484. }
  6485. context.provides[key] = value;
  6486. return app;
  6487. },
  6488. runWithContext(fn) {
  6489. const lastApp = currentApp;
  6490. currentApp = app;
  6491. try {
  6492. return fn();
  6493. } finally {
  6494. currentApp = lastApp;
  6495. }
  6496. }
  6497. };
  6498. return app;
  6499. };
  6500. }
  6501. let currentApp = null;
  6502. function useModel(props, name, options = EMPTY_OBJ) {
  6503. const i = getCurrentInstance();
  6504. if (!i) {
  6505. warn$1(`useModel() called without active instance.`);
  6506. return ref();
  6507. }
  6508. const camelizedName = camelize(name);
  6509. if (!i.propsOptions[0][camelizedName]) {
  6510. warn$1(`useModel() called with prop "${name}" which is not declared.`);
  6511. return ref();
  6512. }
  6513. const hyphenatedName = hyphenate(name);
  6514. const modifiers = getModelModifiers(props, camelizedName);
  6515. const res = customRef((track, trigger) => {
  6516. let localValue;
  6517. let prevSetValue = EMPTY_OBJ;
  6518. let prevEmittedValue;
  6519. watchSyncEffect(() => {
  6520. const propValue = props[camelizedName];
  6521. if (hasChanged(localValue, propValue)) {
  6522. localValue = propValue;
  6523. trigger();
  6524. }
  6525. });
  6526. return {
  6527. get() {
  6528. track();
  6529. return options.get ? options.get(localValue) : localValue;
  6530. },
  6531. set(value) {
  6532. const emittedValue = options.set ? options.set(value) : value;
  6533. if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
  6534. return;
  6535. }
  6536. const rawProps = i.vnode.props;
  6537. if (!(rawProps && // check if parent has passed v-model
  6538. (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
  6539. localValue = value;
  6540. trigger();
  6541. }
  6542. i.emit(`update:${name}`, emittedValue);
  6543. if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
  6544. trigger();
  6545. }
  6546. prevSetValue = value;
  6547. prevEmittedValue = emittedValue;
  6548. }
  6549. };
  6550. });
  6551. res[Symbol.iterator] = () => {
  6552. let i2 = 0;
  6553. return {
  6554. next() {
  6555. if (i2 < 2) {
  6556. return { value: i2++ ? modifiers || EMPTY_OBJ : res, done: false };
  6557. } else {
  6558. return { done: true };
  6559. }
  6560. }
  6561. };
  6562. };
  6563. return res;
  6564. }
  6565. const getModelModifiers = (props, modelName) => {
  6566. return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${camelize(modelName)}Modifiers`] || props[`${hyphenate(modelName)}Modifiers`];
  6567. };
  6568. function emit(instance, event, ...rawArgs) {
  6569. if (instance.isUnmounted) return;
  6570. const props = instance.vnode.props || EMPTY_OBJ;
  6571. {
  6572. const {
  6573. emitsOptions,
  6574. propsOptions: [propsOptions]
  6575. } = instance;
  6576. if (emitsOptions) {
  6577. if (!(event in emitsOptions) && true) {
  6578. if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
  6579. warn$1(
  6580. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
  6581. );
  6582. }
  6583. } else {
  6584. const validator = emitsOptions[event];
  6585. if (isFunction(validator)) {
  6586. const isValid = validator(...rawArgs);
  6587. if (!isValid) {
  6588. warn$1(
  6589. `Invalid event arguments: event validation failed for event "${event}".`
  6590. );
  6591. }
  6592. }
  6593. }
  6594. }
  6595. }
  6596. let args = rawArgs;
  6597. const isModelListener = event.startsWith("update:");
  6598. const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
  6599. if (modifiers) {
  6600. if (modifiers.trim) {
  6601. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  6602. }
  6603. if (modifiers.number) {
  6604. args = rawArgs.map(looseToNumber);
  6605. }
  6606. }
  6607. {
  6608. devtoolsComponentEmit(instance, event, args);
  6609. }
  6610. {
  6611. const lowerCaseEvent = event.toLowerCase();
  6612. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  6613. warn$1(
  6614. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  6615. instance,
  6616. instance.type
  6617. )} 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(
  6618. event
  6619. )}" instead of "${event}".`
  6620. );
  6621. }
  6622. }
  6623. let handlerName;
  6624. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  6625. props[handlerName = toHandlerKey(camelize(event))];
  6626. if (!handler && isModelListener) {
  6627. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  6628. }
  6629. if (handler) {
  6630. callWithAsyncErrorHandling(
  6631. handler,
  6632. instance,
  6633. 6,
  6634. args
  6635. );
  6636. }
  6637. const onceHandler = props[handlerName + `Once`];
  6638. if (onceHandler) {
  6639. if (!instance.emitted) {
  6640. instance.emitted = {};
  6641. } else if (instance.emitted[handlerName]) {
  6642. return;
  6643. }
  6644. instance.emitted[handlerName] = true;
  6645. callWithAsyncErrorHandling(
  6646. onceHandler,
  6647. instance,
  6648. 6,
  6649. args
  6650. );
  6651. }
  6652. }
  6653. const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
  6654. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  6655. const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
  6656. const cached = cache.get(comp);
  6657. if (cached !== void 0) {
  6658. return cached;
  6659. }
  6660. const raw = comp.emits;
  6661. let normalized = {};
  6662. let hasExtends = false;
  6663. if (!isFunction(comp)) {
  6664. const extendEmits = (raw2) => {
  6665. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  6666. if (normalizedFromExtend) {
  6667. hasExtends = true;
  6668. extend(normalized, normalizedFromExtend);
  6669. }
  6670. };
  6671. if (!asMixin && appContext.mixins.length) {
  6672. appContext.mixins.forEach(extendEmits);
  6673. }
  6674. if (comp.extends) {
  6675. extendEmits(comp.extends);
  6676. }
  6677. if (comp.mixins) {
  6678. comp.mixins.forEach(extendEmits);
  6679. }
  6680. }
  6681. if (!raw && !hasExtends) {
  6682. if (isObject(comp)) {
  6683. cache.set(comp, null);
  6684. }
  6685. return null;
  6686. }
  6687. if (isArray(raw)) {
  6688. raw.forEach((key) => normalized[key] = null);
  6689. } else {
  6690. extend(normalized, raw);
  6691. }
  6692. if (isObject(comp)) {
  6693. cache.set(comp, normalized);
  6694. }
  6695. return normalized;
  6696. }
  6697. function isEmitListener(options, key) {
  6698. if (!options || !isOn(key)) {
  6699. return false;
  6700. }
  6701. key = key.slice(2).replace(/Once$/, "");
  6702. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  6703. }
  6704. let accessedAttrs = false;
  6705. function markAttrsAccessed() {
  6706. accessedAttrs = true;
  6707. }
  6708. function renderComponentRoot(instance) {
  6709. const {
  6710. type: Component,
  6711. vnode,
  6712. proxy,
  6713. withProxy,
  6714. propsOptions: [propsOptions],
  6715. slots,
  6716. attrs,
  6717. emit,
  6718. render,
  6719. renderCache,
  6720. props,
  6721. data,
  6722. setupState,
  6723. ctx,
  6724. inheritAttrs
  6725. } = instance;
  6726. const prev = setCurrentRenderingInstance(instance);
  6727. let result;
  6728. let fallthroughAttrs;
  6729. {
  6730. accessedAttrs = false;
  6731. }
  6732. try {
  6733. if (vnode.shapeFlag & 4) {
  6734. const proxyToUse = withProxy || proxy;
  6735. const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
  6736. get(target, key, receiver) {
  6737. warn$1(
  6738. `Property '${String(
  6739. key
  6740. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  6741. );
  6742. return Reflect.get(target, key, receiver);
  6743. }
  6744. }) : proxyToUse;
  6745. result = normalizeVNode(
  6746. render.call(
  6747. thisProxy,
  6748. proxyToUse,
  6749. renderCache,
  6750. true ? shallowReadonly(props) : props,
  6751. setupState,
  6752. data,
  6753. ctx
  6754. )
  6755. );
  6756. fallthroughAttrs = attrs;
  6757. } else {
  6758. const render2 = Component;
  6759. if (attrs === props) {
  6760. markAttrsAccessed();
  6761. }
  6762. result = normalizeVNode(
  6763. render2.length > 1 ? render2(
  6764. true ? shallowReadonly(props) : props,
  6765. true ? {
  6766. get attrs() {
  6767. markAttrsAccessed();
  6768. return shallowReadonly(attrs);
  6769. },
  6770. slots,
  6771. emit
  6772. } : { attrs, slots, emit }
  6773. ) : render2(
  6774. true ? shallowReadonly(props) : props,
  6775. null
  6776. )
  6777. );
  6778. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  6779. }
  6780. } catch (err) {
  6781. blockStack.length = 0;
  6782. handleError(err, instance, 1);
  6783. result = createVNode(Comment);
  6784. }
  6785. let root = result;
  6786. let setRoot = void 0;
  6787. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  6788. [root, setRoot] = getChildRoot(result);
  6789. }
  6790. if (fallthroughAttrs && inheritAttrs !== false) {
  6791. const keys = Object.keys(fallthroughAttrs);
  6792. const { shapeFlag } = root;
  6793. if (keys.length) {
  6794. if (shapeFlag & (1 | 6)) {
  6795. if (propsOptions && keys.some(isModelListener)) {
  6796. fallthroughAttrs = filterModelListeners(
  6797. fallthroughAttrs,
  6798. propsOptions
  6799. );
  6800. }
  6801. root = cloneVNode(root, fallthroughAttrs, false, true);
  6802. } else if (!accessedAttrs && root.type !== Comment) {
  6803. const allAttrs = Object.keys(attrs);
  6804. const eventAttrs = [];
  6805. const extraAttrs = [];
  6806. for (let i = 0, l = allAttrs.length; i < l; i++) {
  6807. const key = allAttrs[i];
  6808. if (isOn(key)) {
  6809. if (!isModelListener(key)) {
  6810. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  6811. }
  6812. } else {
  6813. extraAttrs.push(key);
  6814. }
  6815. }
  6816. if (extraAttrs.length) {
  6817. warn$1(
  6818. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
  6819. );
  6820. }
  6821. if (eventAttrs.length) {
  6822. warn$1(
  6823. `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.`
  6824. );
  6825. }
  6826. }
  6827. }
  6828. }
  6829. if (vnode.dirs) {
  6830. if (!isElementRoot(root)) {
  6831. warn$1(
  6832. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  6833. );
  6834. }
  6835. root = cloneVNode(root, null, false, true);
  6836. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  6837. }
  6838. if (vnode.transition) {
  6839. if (!isElementRoot(root)) {
  6840. warn$1(
  6841. `Component inside <Transition> renders non-element root node that cannot be animated.`
  6842. );
  6843. }
  6844. setTransitionHooks(root, vnode.transition);
  6845. }
  6846. if (setRoot) {
  6847. setRoot(root);
  6848. } else {
  6849. result = root;
  6850. }
  6851. setCurrentRenderingInstance(prev);
  6852. return result;
  6853. }
  6854. const getChildRoot = (vnode) => {
  6855. const rawChildren = vnode.children;
  6856. const dynamicChildren = vnode.dynamicChildren;
  6857. const childRoot = filterSingleRoot(rawChildren, false);
  6858. if (!childRoot) {
  6859. return [vnode, void 0];
  6860. } else if (childRoot.patchFlag > 0 && childRoot.patchFlag & 2048) {
  6861. return getChildRoot(childRoot);
  6862. }
  6863. const index = rawChildren.indexOf(childRoot);
  6864. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  6865. const setRoot = (updatedRoot) => {
  6866. rawChildren[index] = updatedRoot;
  6867. if (dynamicChildren) {
  6868. if (dynamicIndex > -1) {
  6869. dynamicChildren[dynamicIndex] = updatedRoot;
  6870. } else if (updatedRoot.patchFlag > 0) {
  6871. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  6872. }
  6873. }
  6874. };
  6875. return [normalizeVNode(childRoot), setRoot];
  6876. };
  6877. function filterSingleRoot(children, recurse = true) {
  6878. let singleRoot;
  6879. for (let i = 0; i < children.length; i++) {
  6880. const child = children[i];
  6881. if (isVNode(child)) {
  6882. if (child.type !== Comment || child.children === "v-if") {
  6883. if (singleRoot) {
  6884. return;
  6885. } else {
  6886. singleRoot = child;
  6887. if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) {
  6888. return filterSingleRoot(singleRoot.children);
  6889. }
  6890. }
  6891. }
  6892. } else {
  6893. return;
  6894. }
  6895. }
  6896. return singleRoot;
  6897. }
  6898. const getFunctionalFallthrough = (attrs) => {
  6899. let res;
  6900. for (const key in attrs) {
  6901. if (key === "class" || key === "style" || isOn(key)) {
  6902. (res || (res = {}))[key] = attrs[key];
  6903. }
  6904. }
  6905. return res;
  6906. };
  6907. const filterModelListeners = (attrs, props) => {
  6908. const res = {};
  6909. for (const key in attrs) {
  6910. if (!isModelListener(key) || !(key.slice(9) in props)) {
  6911. res[key] = attrs[key];
  6912. }
  6913. }
  6914. return res;
  6915. };
  6916. const isElementRoot = (vnode) => {
  6917. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  6918. };
  6919. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  6920. const { props: prevProps, children: prevChildren, component } = prevVNode;
  6921. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  6922. const emits = component.emitsOptions;
  6923. if ((prevChildren || nextChildren) && isHmrUpdating) {
  6924. return true;
  6925. }
  6926. if (nextVNode.dirs || nextVNode.transition) {
  6927. return true;
  6928. }
  6929. if (optimized && patchFlag >= 0) {
  6930. if (patchFlag & 1024) {
  6931. return true;
  6932. }
  6933. if (patchFlag & 16) {
  6934. if (!prevProps) {
  6935. return !!nextProps;
  6936. }
  6937. return hasPropsChanged(prevProps, nextProps, emits);
  6938. } else if (patchFlag & 8) {
  6939. const dynamicProps = nextVNode.dynamicProps;
  6940. for (let i = 0; i < dynamicProps.length; i++) {
  6941. const key = dynamicProps[i];
  6942. if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emits, key)) {
  6943. return true;
  6944. }
  6945. }
  6946. }
  6947. } else {
  6948. if (prevChildren || nextChildren) {
  6949. if (!nextChildren || !nextChildren.$stable) {
  6950. return true;
  6951. }
  6952. }
  6953. if (prevProps === nextProps) {
  6954. return false;
  6955. }
  6956. if (!prevProps) {
  6957. return !!nextProps;
  6958. }
  6959. if (!nextProps) {
  6960. return true;
  6961. }
  6962. return hasPropsChanged(prevProps, nextProps, emits);
  6963. }
  6964. return false;
  6965. }
  6966. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  6967. const nextKeys = Object.keys(nextProps);
  6968. if (nextKeys.length !== Object.keys(prevProps).length) {
  6969. return true;
  6970. }
  6971. for (let i = 0; i < nextKeys.length; i++) {
  6972. const key = nextKeys[i];
  6973. if (hasPropValueChanged(nextProps, prevProps, key) && !isEmitListener(emitsOptions, key)) {
  6974. return true;
  6975. }
  6976. }
  6977. return false;
  6978. }
  6979. function hasPropValueChanged(nextProps, prevProps, key) {
  6980. const nextProp = nextProps[key];
  6981. const prevProp = prevProps[key];
  6982. if (key === "style" && isObject(nextProp) && isObject(prevProp)) {
  6983. return !looseEqual(nextProp, prevProp);
  6984. }
  6985. return nextProp !== prevProp;
  6986. }
  6987. function updateHOCHostEl({ vnode, parent, suspense }, el) {
  6988. while (parent) {
  6989. const root = parent.subTree;
  6990. if (root.suspense && root.suspense.activeBranch === vnode) {
  6991. root.suspense.vnode.el = root.el = el;
  6992. vnode = root;
  6993. }
  6994. if (root === vnode) {
  6995. (vnode = parent.vnode).el = el;
  6996. parent = parent.parent;
  6997. } else {
  6998. break;
  6999. }
  7000. }
  7001. if (suspense && suspense.activeBranch === vnode) {
  7002. suspense.vnode.el = el;
  7003. }
  7004. }
  7005. const internalObjectProto = {};
  7006. const createInternalObject = () => Object.create(internalObjectProto);
  7007. const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
  7008. function initProps(instance, rawProps, isStateful, isSSR = false) {
  7009. const props = {};
  7010. const attrs = createInternalObject();
  7011. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  7012. setFullProps(instance, rawProps, props, attrs);
  7013. for (const key in instance.propsOptions[0]) {
  7014. if (!(key in props)) {
  7015. props[key] = void 0;
  7016. }
  7017. }
  7018. {
  7019. validateProps(rawProps || {}, props, instance);
  7020. }
  7021. if (isStateful) {
  7022. instance.props = isSSR ? props : shallowReactive(props);
  7023. } else {
  7024. if (!instance.type.props) {
  7025. instance.props = attrs;
  7026. } else {
  7027. instance.props = props;
  7028. }
  7029. }
  7030. instance.attrs = attrs;
  7031. }
  7032. function isInHmrContext(instance) {
  7033. while (instance) {
  7034. if (instance.type.__hmrId) return true;
  7035. instance = instance.parent;
  7036. }
  7037. }
  7038. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  7039. const {
  7040. props,
  7041. attrs,
  7042. vnode: { patchFlag }
  7043. } = instance;
  7044. const rawCurrentProps = toRaw(props);
  7045. const [options] = instance.propsOptions;
  7046. let hasAttrsChanged = false;
  7047. if (
  7048. // always force full diff in dev
  7049. // - #1942 if hmr is enabled with sfc component
  7050. // - vite#872 non-sfc component used by sfc component
  7051. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  7052. ) {
  7053. if (patchFlag & 8) {
  7054. const propsToUpdate = instance.vnode.dynamicProps;
  7055. for (let i = 0; i < propsToUpdate.length; i++) {
  7056. let key = propsToUpdate[i];
  7057. if (isEmitListener(instance.emitsOptions, key)) {
  7058. continue;
  7059. }
  7060. const value = rawProps[key];
  7061. if (options) {
  7062. if (hasOwn(attrs, key)) {
  7063. if (value !== attrs[key]) {
  7064. attrs[key] = value;
  7065. hasAttrsChanged = true;
  7066. }
  7067. } else {
  7068. const camelizedKey = camelize(key);
  7069. props[camelizedKey] = resolvePropValue(
  7070. options,
  7071. rawCurrentProps,
  7072. camelizedKey,
  7073. value,
  7074. instance,
  7075. false
  7076. );
  7077. }
  7078. } else {
  7079. if (value !== attrs[key]) {
  7080. attrs[key] = value;
  7081. hasAttrsChanged = true;
  7082. }
  7083. }
  7084. }
  7085. }
  7086. } else {
  7087. if (setFullProps(instance, rawProps, props, attrs)) {
  7088. hasAttrsChanged = true;
  7089. }
  7090. let kebabKey;
  7091. for (const key in rawCurrentProps) {
  7092. if (!rawProps || // for camelCase
  7093. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  7094. // and converted to camelCase (#955)
  7095. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  7096. if (options) {
  7097. if (rawPrevProps && // for camelCase
  7098. (rawPrevProps[key] !== void 0 || // for kebab-case
  7099. rawPrevProps[kebabKey] !== void 0)) {
  7100. props[key] = resolvePropValue(
  7101. options,
  7102. rawCurrentProps,
  7103. key,
  7104. void 0,
  7105. instance,
  7106. true
  7107. );
  7108. }
  7109. } else {
  7110. delete props[key];
  7111. }
  7112. }
  7113. }
  7114. if (attrs !== rawCurrentProps) {
  7115. for (const key in attrs) {
  7116. if (!rawProps || !hasOwn(rawProps, key) && true) {
  7117. delete attrs[key];
  7118. hasAttrsChanged = true;
  7119. }
  7120. }
  7121. }
  7122. }
  7123. if (hasAttrsChanged) {
  7124. trigger(instance.attrs, "set", "");
  7125. }
  7126. {
  7127. validateProps(rawProps || {}, props, instance);
  7128. }
  7129. }
  7130. function setFullProps(instance, rawProps, props, attrs) {
  7131. const [options, needCastKeys] = instance.propsOptions;
  7132. let hasAttrsChanged = false;
  7133. let rawCastValues;
  7134. if (rawProps) {
  7135. for (let key in rawProps) {
  7136. if (isReservedProp(key)) {
  7137. continue;
  7138. }
  7139. const value = rawProps[key];
  7140. let camelKey;
  7141. if (options && hasOwn(options, camelKey = camelize(key))) {
  7142. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  7143. props[camelKey] = value;
  7144. } else {
  7145. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  7146. }
  7147. } else if (!isEmitListener(instance.emitsOptions, key)) {
  7148. if (!(key in attrs) || value !== attrs[key]) {
  7149. attrs[key] = value;
  7150. hasAttrsChanged = true;
  7151. }
  7152. }
  7153. }
  7154. }
  7155. if (needCastKeys) {
  7156. const rawCurrentProps = toRaw(props);
  7157. const castValues = rawCastValues || EMPTY_OBJ;
  7158. for (let i = 0; i < needCastKeys.length; i++) {
  7159. const key = needCastKeys[i];
  7160. props[key] = resolvePropValue(
  7161. options,
  7162. rawCurrentProps,
  7163. key,
  7164. castValues[key],
  7165. instance,
  7166. !hasOwn(castValues, key)
  7167. );
  7168. }
  7169. }
  7170. return hasAttrsChanged;
  7171. }
  7172. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  7173. const opt = options[key];
  7174. if (opt != null) {
  7175. const hasDefault = hasOwn(opt, "default");
  7176. if (hasDefault && value === void 0) {
  7177. const defaultValue = opt.default;
  7178. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  7179. const { propsDefaults } = instance;
  7180. if (key in propsDefaults) {
  7181. value = propsDefaults[key];
  7182. } else {
  7183. const reset = setCurrentInstance(instance);
  7184. value = propsDefaults[key] = defaultValue.call(
  7185. null,
  7186. props
  7187. );
  7188. reset();
  7189. }
  7190. } else {
  7191. value = defaultValue;
  7192. }
  7193. if (instance.ce) {
  7194. instance.ce._setProp(key, value);
  7195. }
  7196. }
  7197. if (opt[0 /* shouldCast */]) {
  7198. if (isAbsent && !hasDefault) {
  7199. value = false;
  7200. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  7201. value = true;
  7202. }
  7203. }
  7204. }
  7205. return value;
  7206. }
  7207. const mixinPropsCache = /* @__PURE__ */ new WeakMap();
  7208. function normalizePropsOptions(comp, appContext, asMixin = false) {
  7209. const cache = asMixin ? mixinPropsCache : appContext.propsCache;
  7210. const cached = cache.get(comp);
  7211. if (cached) {
  7212. return cached;
  7213. }
  7214. const raw = comp.props;
  7215. const normalized = {};
  7216. const needCastKeys = [];
  7217. let hasExtends = false;
  7218. if (!isFunction(comp)) {
  7219. const extendProps = (raw2) => {
  7220. hasExtends = true;
  7221. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  7222. extend(normalized, props);
  7223. if (keys) needCastKeys.push(...keys);
  7224. };
  7225. if (!asMixin && appContext.mixins.length) {
  7226. appContext.mixins.forEach(extendProps);
  7227. }
  7228. if (comp.extends) {
  7229. extendProps(comp.extends);
  7230. }
  7231. if (comp.mixins) {
  7232. comp.mixins.forEach(extendProps);
  7233. }
  7234. }
  7235. if (!raw && !hasExtends) {
  7236. if (isObject(comp)) {
  7237. cache.set(comp, EMPTY_ARR);
  7238. }
  7239. return EMPTY_ARR;
  7240. }
  7241. if (isArray(raw)) {
  7242. for (let i = 0; i < raw.length; i++) {
  7243. if (!isString(raw[i])) {
  7244. warn$1(`props must be strings when using array syntax.`, raw[i]);
  7245. }
  7246. const normalizedKey = camelize(raw[i]);
  7247. if (validatePropName(normalizedKey)) {
  7248. normalized[normalizedKey] = EMPTY_OBJ;
  7249. }
  7250. }
  7251. } else if (raw) {
  7252. if (!isObject(raw)) {
  7253. warn$1(`invalid props options`, raw);
  7254. }
  7255. for (const key in raw) {
  7256. const normalizedKey = camelize(key);
  7257. if (validatePropName(normalizedKey)) {
  7258. const opt = raw[key];
  7259. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  7260. const propType = prop.type;
  7261. let shouldCast = false;
  7262. let shouldCastTrue = true;
  7263. if (isArray(propType)) {
  7264. for (let index = 0; index < propType.length; ++index) {
  7265. const type = propType[index];
  7266. const typeName = isFunction(type) && type.name;
  7267. if (typeName === "Boolean") {
  7268. shouldCast = true;
  7269. break;
  7270. } else if (typeName === "String") {
  7271. shouldCastTrue = false;
  7272. }
  7273. }
  7274. } else {
  7275. shouldCast = isFunction(propType) && propType.name === "Boolean";
  7276. }
  7277. prop[0 /* shouldCast */] = shouldCast;
  7278. prop[1 /* shouldCastTrue */] = shouldCastTrue;
  7279. if (shouldCast || hasOwn(prop, "default")) {
  7280. needCastKeys.push(normalizedKey);
  7281. }
  7282. }
  7283. }
  7284. }
  7285. const res = [normalized, needCastKeys];
  7286. if (isObject(comp)) {
  7287. cache.set(comp, res);
  7288. }
  7289. return res;
  7290. }
  7291. function validatePropName(key) {
  7292. if (key[0] !== "$" && !isReservedProp(key)) {
  7293. return true;
  7294. } else {
  7295. warn$1(`Invalid prop name: "${key}" is a reserved property.`);
  7296. }
  7297. return false;
  7298. }
  7299. function getType(ctor) {
  7300. if (ctor === null) {
  7301. return "null";
  7302. }
  7303. if (typeof ctor === "function") {
  7304. return ctor.name || "";
  7305. } else if (typeof ctor === "object") {
  7306. const name = ctor.constructor && ctor.constructor.name;
  7307. return name || "";
  7308. }
  7309. return "";
  7310. }
  7311. function validateProps(rawProps, props, instance) {
  7312. const resolvedValues = toRaw(props);
  7313. const options = instance.propsOptions[0];
  7314. const camelizePropsKey = Object.keys(rawProps).map((key) => camelize(key));
  7315. for (const key in options) {
  7316. let opt = options[key];
  7317. if (opt == null) continue;
  7318. validateProp(
  7319. key,
  7320. resolvedValues[key],
  7321. opt,
  7322. shallowReadonly(resolvedValues) ,
  7323. !camelizePropsKey.includes(key)
  7324. );
  7325. }
  7326. }
  7327. function validateProp(name, value, prop, props, isAbsent) {
  7328. const { type, required, validator, skipCheck } = prop;
  7329. if (required && isAbsent) {
  7330. warn$1('Missing required prop: "' + name + '"');
  7331. return;
  7332. }
  7333. if (value == null && !required) {
  7334. return;
  7335. }
  7336. if (type != null && type !== true && !skipCheck) {
  7337. let isValid = false;
  7338. const types = isArray(type) ? type : [type];
  7339. const expectedTypes = [];
  7340. for (let i = 0; i < types.length && !isValid; i++) {
  7341. const { valid, expectedType } = assertType(value, types[i]);
  7342. expectedTypes.push(expectedType || "");
  7343. isValid = valid;
  7344. }
  7345. if (!isValid) {
  7346. warn$1(getInvalidTypeMessage(name, value, expectedTypes));
  7347. return;
  7348. }
  7349. }
  7350. if (validator && !validator(value, props)) {
  7351. warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
  7352. }
  7353. }
  7354. const isSimpleType = /* @__PURE__ */ makeMap(
  7355. "String,Number,Boolean,Function,Symbol,BigInt"
  7356. );
  7357. function assertType(value, type) {
  7358. let valid;
  7359. const expectedType = getType(type);
  7360. if (expectedType === "null") {
  7361. valid = value === null;
  7362. } else if (isSimpleType(expectedType)) {
  7363. const t = typeof value;
  7364. valid = t === expectedType.toLowerCase();
  7365. if (!valid && t === "object") {
  7366. valid = value instanceof type;
  7367. }
  7368. } else if (expectedType === "Object") {
  7369. valid = isObject(value);
  7370. } else if (expectedType === "Array") {
  7371. valid = isArray(value);
  7372. } else {
  7373. valid = value instanceof type;
  7374. }
  7375. return {
  7376. valid,
  7377. expectedType
  7378. };
  7379. }
  7380. function getInvalidTypeMessage(name, value, expectedTypes) {
  7381. if (expectedTypes.length === 0) {
  7382. return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
  7383. }
  7384. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  7385. const expectedType = expectedTypes[0];
  7386. const receivedType = toRawType(value);
  7387. const expectedValue = styleValue(value, expectedType);
  7388. const receivedValue = styleValue(value, receivedType);
  7389. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  7390. message += ` with value ${expectedValue}`;
  7391. }
  7392. message += `, got ${receivedType} `;
  7393. if (isExplicable(receivedType)) {
  7394. message += `with value ${receivedValue}.`;
  7395. }
  7396. return message;
  7397. }
  7398. function styleValue(value, type) {
  7399. if (type === "String") {
  7400. return `"${value}"`;
  7401. } else if (type === "Number") {
  7402. return `${Number(value)}`;
  7403. } else {
  7404. return `${value}`;
  7405. }
  7406. }
  7407. function isExplicable(type) {
  7408. const explicitTypes = ["string", "number", "boolean"];
  7409. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  7410. }
  7411. function isBoolean(...args) {
  7412. return args.some((elem) => elem.toLowerCase() === "boolean");
  7413. }
  7414. const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
  7415. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  7416. const normalizeSlot = (key, rawSlot, ctx) => {
  7417. if (rawSlot._n) {
  7418. return rawSlot;
  7419. }
  7420. const normalized = withCtx((...args) => {
  7421. if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
  7422. warn$1(
  7423. `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.`
  7424. );
  7425. }
  7426. return normalizeSlotValue(rawSlot(...args));
  7427. }, ctx);
  7428. normalized._c = false;
  7429. return normalized;
  7430. };
  7431. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  7432. const ctx = rawSlots._ctx;
  7433. for (const key in rawSlots) {
  7434. if (isInternalKey(key)) continue;
  7435. const value = rawSlots[key];
  7436. if (isFunction(value)) {
  7437. slots[key] = normalizeSlot(key, value, ctx);
  7438. } else if (value != null) {
  7439. {
  7440. warn$1(
  7441. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  7442. );
  7443. }
  7444. const normalized = normalizeSlotValue(value);
  7445. slots[key] = () => normalized;
  7446. }
  7447. }
  7448. };
  7449. const normalizeVNodeSlots = (instance, children) => {
  7450. if (!isKeepAlive(instance.vnode) && true) {
  7451. warn$1(
  7452. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  7453. );
  7454. }
  7455. const normalized = normalizeSlotValue(children);
  7456. instance.slots.default = () => normalized;
  7457. };
  7458. const assignSlots = (slots, children, optimized) => {
  7459. for (const key in children) {
  7460. if (optimized || !isInternalKey(key)) {
  7461. slots[key] = children[key];
  7462. }
  7463. }
  7464. };
  7465. const initSlots = (instance, children, optimized) => {
  7466. const slots = instance.slots = createInternalObject();
  7467. if (instance.vnode.shapeFlag & 32) {
  7468. const type = children._;
  7469. if (type) {
  7470. assignSlots(slots, children, optimized);
  7471. if (optimized) {
  7472. def(slots, "_", type, true);
  7473. }
  7474. } else {
  7475. normalizeObjectSlots(children, slots);
  7476. }
  7477. } else if (children) {
  7478. normalizeVNodeSlots(instance, children);
  7479. }
  7480. };
  7481. const updateSlots = (instance, children, optimized) => {
  7482. const { vnode, slots } = instance;
  7483. let needDeletionCheck = true;
  7484. let deletionComparisonTarget = EMPTY_OBJ;
  7485. if (vnode.shapeFlag & 32) {
  7486. const type = children._;
  7487. if (type) {
  7488. if (isHmrUpdating) {
  7489. assignSlots(slots, children, optimized);
  7490. trigger(instance, "set", "$slots");
  7491. } else if (optimized && type === 1) {
  7492. needDeletionCheck = false;
  7493. } else {
  7494. assignSlots(slots, children, optimized);
  7495. }
  7496. } else {
  7497. needDeletionCheck = !children.$stable;
  7498. normalizeObjectSlots(children, slots);
  7499. }
  7500. deletionComparisonTarget = children;
  7501. } else if (children) {
  7502. normalizeVNodeSlots(instance, children);
  7503. deletionComparisonTarget = { default: 1 };
  7504. }
  7505. if (needDeletionCheck) {
  7506. for (const key in slots) {
  7507. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  7508. delete slots[key];
  7509. }
  7510. }
  7511. }
  7512. };
  7513. let supported;
  7514. let perf;
  7515. function startMeasure(instance, type) {
  7516. if (instance.appContext.config.performance && isSupported()) {
  7517. perf.mark(`vue-${type}-${instance.uid}`);
  7518. }
  7519. {
  7520. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  7521. }
  7522. }
  7523. function endMeasure(instance, type) {
  7524. if (instance.appContext.config.performance && isSupported()) {
  7525. const startTag = `vue-${type}-${instance.uid}`;
  7526. const endTag = startTag + `:end`;
  7527. const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
  7528. perf.mark(endTag);
  7529. perf.measure(measureName, startTag, endTag);
  7530. perf.clearMeasures(measureName);
  7531. perf.clearMarks(startTag);
  7532. perf.clearMarks(endTag);
  7533. }
  7534. {
  7535. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  7536. }
  7537. }
  7538. function isSupported() {
  7539. if (supported !== void 0) {
  7540. return supported;
  7541. }
  7542. if (typeof window !== "undefined" && window.performance) {
  7543. supported = true;
  7544. perf = window.performance;
  7545. } else {
  7546. supported = false;
  7547. }
  7548. return supported;
  7549. }
  7550. const queuePostRenderEffect = queueEffectWithSuspense ;
  7551. function createRenderer(options) {
  7552. return baseCreateRenderer(options);
  7553. }
  7554. function createHydrationRenderer(options) {
  7555. return baseCreateRenderer(options, createHydrationFunctions);
  7556. }
  7557. function baseCreateRenderer(options, createHydrationFns) {
  7558. const target = getGlobalThis();
  7559. target.__VUE__ = true;
  7560. {
  7561. setDevtoolsHook$1(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  7562. }
  7563. const {
  7564. insert: hostInsert,
  7565. remove: hostRemove,
  7566. patchProp: hostPatchProp,
  7567. createElement: hostCreateElement,
  7568. createText: hostCreateText,
  7569. createComment: hostCreateComment,
  7570. setText: hostSetText,
  7571. setElementText: hostSetElementText,
  7572. parentNode: hostParentNode,
  7573. nextSibling: hostNextSibling,
  7574. setScopeId: hostSetScopeId = NOOP,
  7575. insertStaticContent: hostInsertStaticContent
  7576. } = options;
  7577. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  7578. if (n1 === n2) {
  7579. return;
  7580. }
  7581. if (n1 && !isSameVNodeType(n1, n2)) {
  7582. anchor = getNextHostNode(n1);
  7583. unmount(n1, parentComponent, parentSuspense, true);
  7584. n1 = null;
  7585. }
  7586. if (n2.patchFlag === -2) {
  7587. optimized = false;
  7588. n2.dynamicChildren = null;
  7589. }
  7590. const { type, ref, shapeFlag } = n2;
  7591. switch (type) {
  7592. case Text:
  7593. processText(n1, n2, container, anchor);
  7594. break;
  7595. case Comment:
  7596. processCommentNode(n1, n2, container, anchor);
  7597. break;
  7598. case Static:
  7599. if (n1 == null) {
  7600. mountStaticNode(n2, container, anchor, namespace);
  7601. } else {
  7602. patchStaticNode(n1, n2, container, namespace);
  7603. }
  7604. break;
  7605. case Fragment:
  7606. processFragment(
  7607. n1,
  7608. n2,
  7609. container,
  7610. anchor,
  7611. parentComponent,
  7612. parentSuspense,
  7613. namespace,
  7614. slotScopeIds,
  7615. optimized
  7616. );
  7617. break;
  7618. default:
  7619. if (shapeFlag & 1) {
  7620. processElement(
  7621. n1,
  7622. n2,
  7623. container,
  7624. anchor,
  7625. parentComponent,
  7626. parentSuspense,
  7627. namespace,
  7628. slotScopeIds,
  7629. optimized
  7630. );
  7631. } else if (shapeFlag & 6) {
  7632. processComponent(
  7633. n1,
  7634. n2,
  7635. container,
  7636. anchor,
  7637. parentComponent,
  7638. parentSuspense,
  7639. namespace,
  7640. slotScopeIds,
  7641. optimized
  7642. );
  7643. } else if (shapeFlag & 64) {
  7644. type.process(
  7645. n1,
  7646. n2,
  7647. container,
  7648. anchor,
  7649. parentComponent,
  7650. parentSuspense,
  7651. namespace,
  7652. slotScopeIds,
  7653. optimized,
  7654. internals
  7655. );
  7656. } else if (shapeFlag & 128) {
  7657. type.process(
  7658. n1,
  7659. n2,
  7660. container,
  7661. anchor,
  7662. parentComponent,
  7663. parentSuspense,
  7664. namespace,
  7665. slotScopeIds,
  7666. optimized,
  7667. internals
  7668. );
  7669. } else {
  7670. warn$1("Invalid VNode type:", type, `(${typeof type})`);
  7671. }
  7672. }
  7673. if (ref != null && parentComponent) {
  7674. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  7675. } else if (ref == null && n1 && n1.ref != null) {
  7676. setRef(n1.ref, null, parentSuspense, n1, true);
  7677. }
  7678. };
  7679. const processText = (n1, n2, container, anchor) => {
  7680. if (n1 == null) {
  7681. hostInsert(
  7682. n2.el = hostCreateText(n2.children),
  7683. container,
  7684. anchor
  7685. );
  7686. } else {
  7687. const el = n2.el = n1.el;
  7688. if (n2.children !== n1.children) {
  7689. hostSetText(el, n2.children);
  7690. }
  7691. }
  7692. };
  7693. const processCommentNode = (n1, n2, container, anchor) => {
  7694. if (n1 == null) {
  7695. hostInsert(
  7696. n2.el = hostCreateComment(n2.children || ""),
  7697. container,
  7698. anchor
  7699. );
  7700. } else {
  7701. n2.el = n1.el;
  7702. }
  7703. };
  7704. const mountStaticNode = (n2, container, anchor, namespace) => {
  7705. [n2.el, n2.anchor] = hostInsertStaticContent(
  7706. n2.children,
  7707. container,
  7708. anchor,
  7709. namespace,
  7710. n2.el,
  7711. n2.anchor
  7712. );
  7713. };
  7714. const patchStaticNode = (n1, n2, container, namespace) => {
  7715. if (n2.children !== n1.children) {
  7716. const anchor = hostNextSibling(n1.anchor);
  7717. removeStaticNode(n1);
  7718. [n2.el, n2.anchor] = hostInsertStaticContent(
  7719. n2.children,
  7720. container,
  7721. anchor,
  7722. namespace
  7723. );
  7724. } else {
  7725. n2.el = n1.el;
  7726. n2.anchor = n1.anchor;
  7727. }
  7728. };
  7729. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  7730. let next;
  7731. while (el && el !== anchor) {
  7732. next = hostNextSibling(el);
  7733. hostInsert(el, container, nextSibling);
  7734. el = next;
  7735. }
  7736. hostInsert(anchor, container, nextSibling);
  7737. };
  7738. const removeStaticNode = ({ el, anchor }) => {
  7739. let next;
  7740. while (el && el !== anchor) {
  7741. next = hostNextSibling(el);
  7742. hostRemove(el);
  7743. el = next;
  7744. }
  7745. hostRemove(anchor);
  7746. };
  7747. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7748. if (n2.type === "svg") {
  7749. namespace = "svg";
  7750. } else if (n2.type === "math") {
  7751. namespace = "mathml";
  7752. }
  7753. if (n1 == null) {
  7754. mountElement(
  7755. n2,
  7756. container,
  7757. anchor,
  7758. parentComponent,
  7759. parentSuspense,
  7760. namespace,
  7761. slotScopeIds,
  7762. optimized
  7763. );
  7764. } else {
  7765. const customElement = n1.el && n1.el._isVueCE ? n1.el : null;
  7766. try {
  7767. if (customElement) {
  7768. customElement._beginPatch();
  7769. }
  7770. patchElement(
  7771. n1,
  7772. n2,
  7773. parentComponent,
  7774. parentSuspense,
  7775. namespace,
  7776. slotScopeIds,
  7777. optimized
  7778. );
  7779. } finally {
  7780. if (customElement) {
  7781. customElement._endPatch();
  7782. }
  7783. }
  7784. }
  7785. };
  7786. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7787. let el;
  7788. let vnodeHook;
  7789. const { props, shapeFlag, transition, dirs } = vnode;
  7790. el = vnode.el = hostCreateElement(
  7791. vnode.type,
  7792. namespace,
  7793. props && props.is,
  7794. props
  7795. );
  7796. if (shapeFlag & 8) {
  7797. hostSetElementText(el, vnode.children);
  7798. } else if (shapeFlag & 16) {
  7799. mountChildren(
  7800. vnode.children,
  7801. el,
  7802. null,
  7803. parentComponent,
  7804. parentSuspense,
  7805. resolveChildrenNamespace(vnode, namespace),
  7806. slotScopeIds,
  7807. optimized
  7808. );
  7809. }
  7810. if (dirs) {
  7811. invokeDirectiveHook(vnode, null, parentComponent, "created");
  7812. }
  7813. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  7814. if (props) {
  7815. for (const key in props) {
  7816. if (key !== "value" && !isReservedProp(key)) {
  7817. hostPatchProp(el, key, null, props[key], namespace, parentComponent);
  7818. }
  7819. }
  7820. if ("value" in props) {
  7821. hostPatchProp(el, "value", null, props.value, namespace);
  7822. }
  7823. if (vnodeHook = props.onVnodeBeforeMount) {
  7824. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7825. }
  7826. }
  7827. {
  7828. def(el, "__vnode", vnode, true);
  7829. def(el, "__vueParentComponent", parentComponent, true);
  7830. }
  7831. if (dirs) {
  7832. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  7833. }
  7834. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  7835. if (needCallTransitionHooks) {
  7836. transition.beforeEnter(el);
  7837. }
  7838. hostInsert(el, container, anchor);
  7839. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  7840. const isHmr = isHmrUpdating;
  7841. queuePostRenderEffect(() => {
  7842. let prev;
  7843. prev = setHmrUpdating(isHmr);
  7844. try {
  7845. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7846. needCallTransitionHooks && transition.enter(el);
  7847. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  7848. } finally {
  7849. setHmrUpdating(prev);
  7850. }
  7851. }, parentSuspense);
  7852. }
  7853. };
  7854. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  7855. if (scopeId) {
  7856. hostSetScopeId(el, scopeId);
  7857. }
  7858. if (slotScopeIds) {
  7859. for (let i = 0; i < slotScopeIds.length; i++) {
  7860. hostSetScopeId(el, slotScopeIds[i]);
  7861. }
  7862. }
  7863. if (parentComponent) {
  7864. let subTree = parentComponent.subTree;
  7865. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  7866. subTree = filterSingleRoot(subTree.children) || subTree;
  7867. }
  7868. if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
  7869. const parentVNode = parentComponent.vnode;
  7870. setScopeId(
  7871. el,
  7872. parentVNode,
  7873. parentVNode.scopeId,
  7874. parentVNode.slotScopeIds,
  7875. parentComponent.parent
  7876. );
  7877. }
  7878. }
  7879. };
  7880. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
  7881. for (let i = start; i < children.length; i++) {
  7882. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  7883. patch(
  7884. null,
  7885. child,
  7886. container,
  7887. anchor,
  7888. parentComponent,
  7889. parentSuspense,
  7890. namespace,
  7891. slotScopeIds,
  7892. optimized
  7893. );
  7894. }
  7895. };
  7896. const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  7897. const el = n2.el = n1.el;
  7898. {
  7899. el.__vnode = n2;
  7900. }
  7901. let { patchFlag, dynamicChildren, dirs } = n2;
  7902. patchFlag |= n1.patchFlag & 16;
  7903. const oldProps = n1.props || EMPTY_OBJ;
  7904. const newProps = n2.props || EMPTY_OBJ;
  7905. let vnodeHook;
  7906. parentComponent && toggleRecurse(parentComponent, false);
  7907. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  7908. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7909. }
  7910. if (dirs) {
  7911. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  7912. }
  7913. parentComponent && toggleRecurse(parentComponent, true);
  7914. if (isHmrUpdating) {
  7915. patchFlag = 0;
  7916. optimized = false;
  7917. dynamicChildren = null;
  7918. }
  7919. if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
  7920. hostSetElementText(el, "");
  7921. }
  7922. if (dynamicChildren) {
  7923. patchBlockChildren(
  7924. n1.dynamicChildren,
  7925. dynamicChildren,
  7926. el,
  7927. parentComponent,
  7928. parentSuspense,
  7929. resolveChildrenNamespace(n2, namespace),
  7930. slotScopeIds
  7931. );
  7932. {
  7933. traverseStaticChildren(n1, n2);
  7934. }
  7935. } else if (!optimized) {
  7936. patchChildren(
  7937. n1,
  7938. n2,
  7939. el,
  7940. null,
  7941. parentComponent,
  7942. parentSuspense,
  7943. resolveChildrenNamespace(n2, namespace),
  7944. slotScopeIds,
  7945. false
  7946. );
  7947. }
  7948. if (patchFlag > 0) {
  7949. if (patchFlag & 16) {
  7950. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7951. } else {
  7952. if (patchFlag & 2) {
  7953. if (oldProps.class !== newProps.class) {
  7954. hostPatchProp(el, "class", null, newProps.class, namespace);
  7955. }
  7956. }
  7957. if (patchFlag & 4) {
  7958. hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
  7959. }
  7960. if (patchFlag & 8) {
  7961. const propsToUpdate = n2.dynamicProps;
  7962. for (let i = 0; i < propsToUpdate.length; i++) {
  7963. const key = propsToUpdate[i];
  7964. const prev = oldProps[key];
  7965. const next = newProps[key];
  7966. if (next !== prev || key === "value") {
  7967. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  7968. }
  7969. }
  7970. }
  7971. }
  7972. if (patchFlag & 1) {
  7973. if (n1.children !== n2.children) {
  7974. hostSetElementText(el, n2.children);
  7975. }
  7976. }
  7977. } else if (!optimized && dynamicChildren == null) {
  7978. patchProps(el, oldProps, newProps, parentComponent, namespace);
  7979. }
  7980. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  7981. queuePostRenderEffect(() => {
  7982. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  7983. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  7984. }, parentSuspense);
  7985. }
  7986. };
  7987. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
  7988. for (let i = 0; i < newChildren.length; i++) {
  7989. const oldVNode = oldChildren[i];
  7990. const newVNode = newChildren[i];
  7991. const container = (
  7992. // oldVNode may be an errored async setup() component inside Suspense
  7993. // which will not have a mounted element
  7994. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  7995. // of the Fragment itself so it can move its children.
  7996. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  7997. // which also requires the correct parent container
  7998. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  7999. oldVNode.shapeFlag & (6 | 64 | 128)) ? hostParentNode(oldVNode.el) : (
  8000. // In other cases, the parent container is not actually used so we
  8001. // just pass the block element here to avoid a DOM parentNode call.
  8002. fallbackContainer
  8003. )
  8004. );
  8005. patch(
  8006. oldVNode,
  8007. newVNode,
  8008. container,
  8009. null,
  8010. parentComponent,
  8011. parentSuspense,
  8012. namespace,
  8013. slotScopeIds,
  8014. true
  8015. );
  8016. }
  8017. };
  8018. const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
  8019. if (oldProps !== newProps) {
  8020. if (oldProps !== EMPTY_OBJ) {
  8021. for (const key in oldProps) {
  8022. if (!isReservedProp(key) && !(key in newProps)) {
  8023. hostPatchProp(
  8024. el,
  8025. key,
  8026. oldProps[key],
  8027. null,
  8028. namespace,
  8029. parentComponent
  8030. );
  8031. }
  8032. }
  8033. }
  8034. for (const key in newProps) {
  8035. if (isReservedProp(key)) continue;
  8036. const next = newProps[key];
  8037. const prev = oldProps[key];
  8038. if (next !== prev && key !== "value") {
  8039. hostPatchProp(el, key, prev, next, namespace, parentComponent);
  8040. }
  8041. }
  8042. if ("value" in newProps) {
  8043. hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
  8044. }
  8045. }
  8046. };
  8047. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8048. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  8049. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  8050. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  8051. if (
  8052. // #5523 dev root fragment may inherit directives
  8053. isHmrUpdating || patchFlag & 2048
  8054. ) {
  8055. patchFlag = 0;
  8056. optimized = false;
  8057. dynamicChildren = null;
  8058. }
  8059. if (fragmentSlotScopeIds) {
  8060. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  8061. }
  8062. if (n1 == null) {
  8063. hostInsert(fragmentStartAnchor, container, anchor);
  8064. hostInsert(fragmentEndAnchor, container, anchor);
  8065. mountChildren(
  8066. // #10007
  8067. // such fragment like `<></>` will be compiled into
  8068. // a fragment which doesn't have a children.
  8069. // In this case fallback to an empty array
  8070. n2.children || [],
  8071. container,
  8072. fragmentEndAnchor,
  8073. parentComponent,
  8074. parentSuspense,
  8075. namespace,
  8076. slotScopeIds,
  8077. optimized
  8078. );
  8079. } else {
  8080. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  8081. // of renderSlot() with no valid children
  8082. n1.dynamicChildren && n1.dynamicChildren.length === dynamicChildren.length) {
  8083. patchBlockChildren(
  8084. n1.dynamicChildren,
  8085. dynamicChildren,
  8086. container,
  8087. parentComponent,
  8088. parentSuspense,
  8089. namespace,
  8090. slotScopeIds
  8091. );
  8092. {
  8093. traverseStaticChildren(n1, n2);
  8094. }
  8095. } else {
  8096. patchChildren(
  8097. n1,
  8098. n2,
  8099. container,
  8100. fragmentEndAnchor,
  8101. parentComponent,
  8102. parentSuspense,
  8103. namespace,
  8104. slotScopeIds,
  8105. optimized
  8106. );
  8107. }
  8108. }
  8109. };
  8110. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8111. n2.slotScopeIds = slotScopeIds;
  8112. if (n1 == null) {
  8113. if (n2.shapeFlag & 512) {
  8114. parentComponent.ctx.activate(
  8115. n2,
  8116. container,
  8117. anchor,
  8118. namespace,
  8119. optimized
  8120. );
  8121. } else {
  8122. mountComponent(
  8123. n2,
  8124. container,
  8125. anchor,
  8126. parentComponent,
  8127. parentSuspense,
  8128. namespace,
  8129. optimized
  8130. );
  8131. }
  8132. } else {
  8133. updateComponent(n1, n2, optimized);
  8134. }
  8135. };
  8136. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
  8137. const instance = (initialVNode.component = createComponentInstance(
  8138. initialVNode,
  8139. parentComponent,
  8140. parentSuspense
  8141. ));
  8142. if (instance.type.__hmrId) {
  8143. registerHMR(instance);
  8144. }
  8145. {
  8146. pushWarningContext(initialVNode);
  8147. startMeasure(instance, `mount`);
  8148. }
  8149. if (isKeepAlive(initialVNode)) {
  8150. instance.ctx.renderer = internals;
  8151. }
  8152. {
  8153. {
  8154. startMeasure(instance, `init`);
  8155. }
  8156. setupComponent(instance, false, optimized);
  8157. {
  8158. endMeasure(instance, `init`);
  8159. }
  8160. }
  8161. if (isHmrUpdating) initialVNode.el = null;
  8162. if (instance.asyncDep) {
  8163. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
  8164. if (!initialVNode.el) {
  8165. const placeholder = instance.subTree = createVNode(Comment);
  8166. processCommentNode(null, placeholder, container, anchor);
  8167. initialVNode.placeholder = placeholder.el;
  8168. }
  8169. } else {
  8170. setupRenderEffect(
  8171. instance,
  8172. initialVNode,
  8173. container,
  8174. anchor,
  8175. parentSuspense,
  8176. namespace,
  8177. optimized
  8178. );
  8179. }
  8180. {
  8181. popWarningContext();
  8182. endMeasure(instance, `mount`);
  8183. }
  8184. };
  8185. const updateComponent = (n1, n2, optimized) => {
  8186. const instance = n2.component = n1.component;
  8187. if (shouldUpdateComponent(n1, n2, optimized)) {
  8188. if (instance.asyncDep && !instance.asyncResolved) {
  8189. {
  8190. pushWarningContext(n2);
  8191. }
  8192. updateComponentPreRender(instance, n2, optimized);
  8193. {
  8194. popWarningContext();
  8195. }
  8196. return;
  8197. } else {
  8198. instance.next = n2;
  8199. instance.update();
  8200. }
  8201. } else {
  8202. n2.el = n1.el;
  8203. instance.vnode = n2;
  8204. }
  8205. };
  8206. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
  8207. const componentUpdateFn = () => {
  8208. if (!instance.isMounted) {
  8209. let vnodeHook;
  8210. const { el, props } = initialVNode;
  8211. const { bm, m, parent, root, type } = instance;
  8212. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  8213. toggleRecurse(instance, false);
  8214. if (bm) {
  8215. invokeArrayFns(bm);
  8216. }
  8217. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  8218. invokeVNodeHook(vnodeHook, parent, initialVNode);
  8219. }
  8220. toggleRecurse(instance, true);
  8221. if (el && hydrateNode) {
  8222. const hydrateSubTree = () => {
  8223. {
  8224. startMeasure(instance, `render`);
  8225. }
  8226. instance.subTree = renderComponentRoot(instance);
  8227. {
  8228. endMeasure(instance, `render`);
  8229. }
  8230. {
  8231. startMeasure(instance, `hydrate`);
  8232. }
  8233. hydrateNode(
  8234. el,
  8235. instance.subTree,
  8236. instance,
  8237. parentSuspense,
  8238. null
  8239. );
  8240. {
  8241. endMeasure(instance, `hydrate`);
  8242. }
  8243. };
  8244. if (isAsyncWrapperVNode && type.__asyncHydrate) {
  8245. type.__asyncHydrate(
  8246. el,
  8247. instance,
  8248. hydrateSubTree
  8249. );
  8250. } else {
  8251. hydrateSubTree();
  8252. }
  8253. } else {
  8254. if (root.ce && root.ce._hasShadowRoot()) {
  8255. root.ce._injectChildStyle(
  8256. type,
  8257. instance.parent ? instance.parent.type : void 0
  8258. );
  8259. }
  8260. {
  8261. startMeasure(instance, `render`);
  8262. }
  8263. const subTree = instance.subTree = renderComponentRoot(instance);
  8264. {
  8265. endMeasure(instance, `render`);
  8266. }
  8267. {
  8268. startMeasure(instance, `patch`);
  8269. }
  8270. patch(
  8271. null,
  8272. subTree,
  8273. container,
  8274. anchor,
  8275. instance,
  8276. parentSuspense,
  8277. namespace
  8278. );
  8279. {
  8280. endMeasure(instance, `patch`);
  8281. }
  8282. initialVNode.el = subTree.el;
  8283. }
  8284. if (m) {
  8285. queuePostRenderEffect(m, parentSuspense);
  8286. }
  8287. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  8288. const scopedInitialVNode = initialVNode;
  8289. queuePostRenderEffect(
  8290. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  8291. parentSuspense
  8292. );
  8293. }
  8294. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  8295. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  8296. }
  8297. instance.isMounted = true;
  8298. {
  8299. devtoolsComponentAdded(instance);
  8300. }
  8301. initialVNode = container = anchor = null;
  8302. } else {
  8303. let { next, bu, u, parent, vnode } = instance;
  8304. {
  8305. const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
  8306. if (nonHydratedAsyncRoot) {
  8307. if (next) {
  8308. next.el = vnode.el;
  8309. updateComponentPreRender(instance, next, optimized);
  8310. }
  8311. nonHydratedAsyncRoot.asyncDep.then(() => {
  8312. queuePostRenderEffect(() => {
  8313. if (!instance.isUnmounted) update();
  8314. }, parentSuspense);
  8315. });
  8316. return;
  8317. }
  8318. }
  8319. let originNext = next;
  8320. let vnodeHook;
  8321. {
  8322. pushWarningContext(next || instance.vnode);
  8323. }
  8324. toggleRecurse(instance, false);
  8325. if (next) {
  8326. next.el = vnode.el;
  8327. updateComponentPreRender(instance, next, optimized);
  8328. } else {
  8329. next = vnode;
  8330. }
  8331. if (bu) {
  8332. invokeArrayFns(bu);
  8333. }
  8334. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  8335. invokeVNodeHook(vnodeHook, parent, next, vnode);
  8336. }
  8337. toggleRecurse(instance, true);
  8338. {
  8339. startMeasure(instance, `render`);
  8340. }
  8341. const nextTree = renderComponentRoot(instance);
  8342. {
  8343. endMeasure(instance, `render`);
  8344. }
  8345. const prevTree = instance.subTree;
  8346. instance.subTree = nextTree;
  8347. {
  8348. startMeasure(instance, `patch`);
  8349. }
  8350. patch(
  8351. prevTree,
  8352. nextTree,
  8353. // parent may have changed if it's in a teleport
  8354. hostParentNode(prevTree.el),
  8355. // anchor may have changed if it's in a fragment
  8356. getNextHostNode(prevTree),
  8357. instance,
  8358. parentSuspense,
  8359. namespace
  8360. );
  8361. {
  8362. endMeasure(instance, `patch`);
  8363. }
  8364. next.el = nextTree.el;
  8365. if (originNext === null) {
  8366. updateHOCHostEl(instance, nextTree.el);
  8367. }
  8368. if (u) {
  8369. queuePostRenderEffect(u, parentSuspense);
  8370. }
  8371. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  8372. queuePostRenderEffect(
  8373. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  8374. parentSuspense
  8375. );
  8376. }
  8377. {
  8378. devtoolsComponentUpdated(instance);
  8379. }
  8380. {
  8381. popWarningContext();
  8382. }
  8383. }
  8384. };
  8385. instance.scope.on();
  8386. const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
  8387. instance.scope.off();
  8388. const update = instance.update = effect.run.bind(effect);
  8389. const job = instance.job = effect.runIfDirty.bind(effect);
  8390. job.i = instance;
  8391. job.id = instance.uid;
  8392. effect.scheduler = () => queueJob(job);
  8393. toggleRecurse(instance, true);
  8394. {
  8395. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  8396. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  8397. }
  8398. update();
  8399. };
  8400. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  8401. nextVNode.component = instance;
  8402. const prevProps = instance.vnode.props;
  8403. instance.vnode = nextVNode;
  8404. instance.next = null;
  8405. updateProps(instance, nextVNode.props, prevProps, optimized);
  8406. updateSlots(instance, nextVNode.children, optimized);
  8407. pauseTracking();
  8408. flushPreFlushCbs(instance);
  8409. resetTracking();
  8410. };
  8411. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
  8412. const c1 = n1 && n1.children;
  8413. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  8414. const c2 = n2.children;
  8415. const { patchFlag, shapeFlag } = n2;
  8416. if (patchFlag > 0) {
  8417. if (patchFlag & 128) {
  8418. patchKeyedChildren(
  8419. c1,
  8420. c2,
  8421. container,
  8422. anchor,
  8423. parentComponent,
  8424. parentSuspense,
  8425. namespace,
  8426. slotScopeIds,
  8427. optimized
  8428. );
  8429. return;
  8430. } else if (patchFlag & 256) {
  8431. patchUnkeyedChildren(
  8432. c1,
  8433. c2,
  8434. container,
  8435. anchor,
  8436. parentComponent,
  8437. parentSuspense,
  8438. namespace,
  8439. slotScopeIds,
  8440. optimized
  8441. );
  8442. return;
  8443. }
  8444. }
  8445. if (shapeFlag & 8) {
  8446. if (prevShapeFlag & 16) {
  8447. unmountChildren(c1, parentComponent, parentSuspense);
  8448. }
  8449. if (c2 !== c1) {
  8450. hostSetElementText(container, c2);
  8451. }
  8452. } else {
  8453. if (prevShapeFlag & 16) {
  8454. if (shapeFlag & 16) {
  8455. patchKeyedChildren(
  8456. c1,
  8457. c2,
  8458. container,
  8459. anchor,
  8460. parentComponent,
  8461. parentSuspense,
  8462. namespace,
  8463. slotScopeIds,
  8464. optimized
  8465. );
  8466. } else {
  8467. unmountChildren(c1, parentComponent, parentSuspense, true);
  8468. }
  8469. } else {
  8470. if (prevShapeFlag & 8) {
  8471. hostSetElementText(container, "");
  8472. }
  8473. if (shapeFlag & 16) {
  8474. mountChildren(
  8475. c2,
  8476. container,
  8477. anchor,
  8478. parentComponent,
  8479. parentSuspense,
  8480. namespace,
  8481. slotScopeIds,
  8482. optimized
  8483. );
  8484. }
  8485. }
  8486. }
  8487. };
  8488. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8489. c1 = c1 || EMPTY_ARR;
  8490. c2 = c2 || EMPTY_ARR;
  8491. const oldLength = c1.length;
  8492. const newLength = c2.length;
  8493. const commonLength = Math.min(oldLength, newLength);
  8494. let i;
  8495. for (i = 0; i < commonLength; i++) {
  8496. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8497. patch(
  8498. c1[i],
  8499. nextChild,
  8500. container,
  8501. null,
  8502. parentComponent,
  8503. parentSuspense,
  8504. namespace,
  8505. slotScopeIds,
  8506. optimized
  8507. );
  8508. }
  8509. if (oldLength > newLength) {
  8510. unmountChildren(
  8511. c1,
  8512. parentComponent,
  8513. parentSuspense,
  8514. true,
  8515. false,
  8516. commonLength
  8517. );
  8518. } else {
  8519. mountChildren(
  8520. c2,
  8521. container,
  8522. anchor,
  8523. parentComponent,
  8524. parentSuspense,
  8525. namespace,
  8526. slotScopeIds,
  8527. optimized,
  8528. commonLength
  8529. );
  8530. }
  8531. };
  8532. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
  8533. let i = 0;
  8534. const l2 = c2.length;
  8535. let e1 = c1.length - 1;
  8536. let e2 = l2 - 1;
  8537. while (i <= e1 && i <= e2) {
  8538. const n1 = c1[i];
  8539. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8540. if (isSameVNodeType(n1, n2)) {
  8541. patch(
  8542. n1,
  8543. n2,
  8544. container,
  8545. null,
  8546. parentComponent,
  8547. parentSuspense,
  8548. namespace,
  8549. slotScopeIds,
  8550. optimized
  8551. );
  8552. } else {
  8553. break;
  8554. }
  8555. i++;
  8556. }
  8557. while (i <= e1 && i <= e2) {
  8558. const n1 = c1[e1];
  8559. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  8560. if (isSameVNodeType(n1, n2)) {
  8561. patch(
  8562. n1,
  8563. n2,
  8564. container,
  8565. null,
  8566. parentComponent,
  8567. parentSuspense,
  8568. namespace,
  8569. slotScopeIds,
  8570. optimized
  8571. );
  8572. } else {
  8573. break;
  8574. }
  8575. e1--;
  8576. e2--;
  8577. }
  8578. if (i > e1) {
  8579. if (i <= e2) {
  8580. const nextPos = e2 + 1;
  8581. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  8582. while (i <= e2) {
  8583. patch(
  8584. null,
  8585. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  8586. container,
  8587. anchor,
  8588. parentComponent,
  8589. parentSuspense,
  8590. namespace,
  8591. slotScopeIds,
  8592. optimized
  8593. );
  8594. i++;
  8595. }
  8596. }
  8597. } else if (i > e2) {
  8598. while (i <= e1) {
  8599. unmount(c1[i], parentComponent, parentSuspense, true);
  8600. i++;
  8601. }
  8602. } else {
  8603. const s1 = i;
  8604. const s2 = i;
  8605. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  8606. for (i = s2; i <= e2; i++) {
  8607. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  8608. if (nextChild.key != null) {
  8609. if (keyToNewIndexMap.has(nextChild.key)) {
  8610. warn$1(
  8611. `Duplicate keys found during update:`,
  8612. JSON.stringify(nextChild.key),
  8613. `Make sure keys are unique.`
  8614. );
  8615. }
  8616. keyToNewIndexMap.set(nextChild.key, i);
  8617. }
  8618. }
  8619. let j;
  8620. let patched = 0;
  8621. const toBePatched = e2 - s2 + 1;
  8622. let moved = false;
  8623. let maxNewIndexSoFar = 0;
  8624. const newIndexToOldIndexMap = new Array(toBePatched);
  8625. for (i = 0; i < toBePatched; i++) newIndexToOldIndexMap[i] = 0;
  8626. for (i = s1; i <= e1; i++) {
  8627. const prevChild = c1[i];
  8628. if (patched >= toBePatched) {
  8629. unmount(prevChild, parentComponent, parentSuspense, true);
  8630. continue;
  8631. }
  8632. let newIndex;
  8633. if (prevChild.key != null) {
  8634. newIndex = keyToNewIndexMap.get(prevChild.key);
  8635. } else {
  8636. for (j = s2; j <= e2; j++) {
  8637. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  8638. newIndex = j;
  8639. break;
  8640. }
  8641. }
  8642. }
  8643. if (newIndex === void 0) {
  8644. unmount(prevChild, parentComponent, parentSuspense, true);
  8645. } else {
  8646. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  8647. if (newIndex >= maxNewIndexSoFar) {
  8648. maxNewIndexSoFar = newIndex;
  8649. } else {
  8650. moved = true;
  8651. }
  8652. patch(
  8653. prevChild,
  8654. c2[newIndex],
  8655. container,
  8656. null,
  8657. parentComponent,
  8658. parentSuspense,
  8659. namespace,
  8660. slotScopeIds,
  8661. optimized
  8662. );
  8663. patched++;
  8664. }
  8665. }
  8666. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  8667. j = increasingNewIndexSequence.length - 1;
  8668. for (i = toBePatched - 1; i >= 0; i--) {
  8669. const nextIndex = s2 + i;
  8670. const nextChild = c2[nextIndex];
  8671. const anchorVNode = c2[nextIndex + 1];
  8672. const anchor = nextIndex + 1 < l2 ? (
  8673. // #13559, #14173 fallback to el placeholder for unresolved async component
  8674. anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode)
  8675. ) : parentAnchor;
  8676. if (newIndexToOldIndexMap[i] === 0) {
  8677. patch(
  8678. null,
  8679. nextChild,
  8680. container,
  8681. anchor,
  8682. parentComponent,
  8683. parentSuspense,
  8684. namespace,
  8685. slotScopeIds,
  8686. optimized
  8687. );
  8688. } else if (moved) {
  8689. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  8690. move(nextChild, container, anchor, 2);
  8691. } else {
  8692. j--;
  8693. }
  8694. }
  8695. }
  8696. }
  8697. };
  8698. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  8699. const { el, type, transition, children, shapeFlag } = vnode;
  8700. if (shapeFlag & 6) {
  8701. move(vnode.component.subTree, container, anchor, moveType);
  8702. return;
  8703. }
  8704. if (shapeFlag & 128) {
  8705. vnode.suspense.move(container, anchor, moveType);
  8706. return;
  8707. }
  8708. if (shapeFlag & 64) {
  8709. type.move(vnode, container, anchor, internals);
  8710. return;
  8711. }
  8712. if (type === Fragment) {
  8713. hostInsert(el, container, anchor);
  8714. for (let i = 0; i < children.length; i++) {
  8715. move(children[i], container, anchor, moveType);
  8716. }
  8717. hostInsert(vnode.anchor, container, anchor);
  8718. return;
  8719. }
  8720. if (type === Static) {
  8721. moveStaticNode(vnode, container, anchor);
  8722. return;
  8723. }
  8724. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  8725. if (needTransition2) {
  8726. if (moveType === 0) {
  8727. transition.beforeEnter(el);
  8728. hostInsert(el, container, anchor);
  8729. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  8730. } else {
  8731. const { leave, delayLeave, afterLeave } = transition;
  8732. const remove2 = () => {
  8733. if (vnode.ctx.isUnmounted) {
  8734. hostRemove(el);
  8735. } else {
  8736. hostInsert(el, container, anchor);
  8737. }
  8738. };
  8739. const performLeave = () => {
  8740. if (el._isLeaving) {
  8741. el[leaveCbKey](
  8742. true
  8743. /* cancelled */
  8744. );
  8745. }
  8746. leave(el, () => {
  8747. remove2();
  8748. afterLeave && afterLeave();
  8749. });
  8750. };
  8751. if (delayLeave) {
  8752. delayLeave(el, remove2, performLeave);
  8753. } else {
  8754. performLeave();
  8755. }
  8756. }
  8757. } else {
  8758. hostInsert(el, container, anchor);
  8759. }
  8760. };
  8761. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  8762. const {
  8763. type,
  8764. props,
  8765. ref,
  8766. children,
  8767. dynamicChildren,
  8768. shapeFlag,
  8769. patchFlag,
  8770. dirs,
  8771. cacheIndex,
  8772. memo
  8773. } = vnode;
  8774. if (patchFlag === -2) {
  8775. optimized = false;
  8776. }
  8777. if (ref != null) {
  8778. pauseTracking();
  8779. setRef(ref, null, parentSuspense, vnode, true);
  8780. resetTracking();
  8781. }
  8782. if (cacheIndex != null) {
  8783. parentComponent.renderCache[cacheIndex] = void 0;
  8784. }
  8785. if (shapeFlag & 256) {
  8786. parentComponent.ctx.deactivate(vnode);
  8787. return;
  8788. }
  8789. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  8790. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  8791. let vnodeHook;
  8792. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  8793. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8794. }
  8795. if (shapeFlag & 6) {
  8796. unmountComponent(vnode.component, parentSuspense, doRemove);
  8797. } else {
  8798. if (shapeFlag & 128) {
  8799. vnode.suspense.unmount(parentSuspense, doRemove);
  8800. return;
  8801. }
  8802. if (shouldInvokeDirs) {
  8803. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  8804. }
  8805. if (shapeFlag & 64) {
  8806. vnode.type.remove(
  8807. vnode,
  8808. parentComponent,
  8809. parentSuspense,
  8810. internals,
  8811. doRemove
  8812. );
  8813. } else if (dynamicChildren && // #5154
  8814. // when v-once is used inside a block, setBlockTracking(-1) marks the
  8815. // parent block with hasOnce: true
  8816. // so that it doesn't take the fast path during unmount - otherwise
  8817. // components nested in v-once are never unmounted.
  8818. !dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
  8819. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  8820. unmountChildren(
  8821. dynamicChildren,
  8822. parentComponent,
  8823. parentSuspense,
  8824. false,
  8825. true
  8826. );
  8827. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  8828. unmountChildren(children, parentComponent, parentSuspense);
  8829. }
  8830. if (doRemove) {
  8831. remove(vnode);
  8832. }
  8833. }
  8834. const shouldInvalidateMemo = memo != null && cacheIndex == null;
  8835. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) {
  8836. queuePostRenderEffect(() => {
  8837. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  8838. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  8839. if (shouldInvalidateMemo) {
  8840. vnode.el = null;
  8841. }
  8842. }, parentSuspense);
  8843. }
  8844. };
  8845. const remove = (vnode) => {
  8846. const { type, el, anchor, transition } = vnode;
  8847. if (type === Fragment) {
  8848. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  8849. vnode.children.forEach((child) => {
  8850. if (child.type === Comment) {
  8851. hostRemove(child.el);
  8852. } else {
  8853. remove(child);
  8854. }
  8855. });
  8856. } else {
  8857. removeFragment(el, anchor);
  8858. }
  8859. return;
  8860. }
  8861. if (type === Static) {
  8862. removeStaticNode(vnode);
  8863. return;
  8864. }
  8865. const performRemove = () => {
  8866. hostRemove(el);
  8867. if (transition && !transition.persisted && transition.afterLeave) {
  8868. transition.afterLeave();
  8869. }
  8870. };
  8871. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  8872. const { leave, delayLeave } = transition;
  8873. const performLeave = () => leave(el, performRemove);
  8874. if (delayLeave) {
  8875. delayLeave(vnode.el, performRemove, performLeave);
  8876. } else {
  8877. performLeave();
  8878. }
  8879. } else {
  8880. performRemove();
  8881. }
  8882. };
  8883. const removeFragment = (cur, end) => {
  8884. let next;
  8885. while (cur !== end) {
  8886. next = hostNextSibling(cur);
  8887. hostRemove(cur);
  8888. cur = next;
  8889. }
  8890. hostRemove(end);
  8891. };
  8892. const unmountComponent = (instance, parentSuspense, doRemove) => {
  8893. if (instance.type.__hmrId) {
  8894. unregisterHMR(instance);
  8895. }
  8896. const { bum, scope, job, subTree, um, m, a } = instance;
  8897. invalidateMount(m);
  8898. invalidateMount(a);
  8899. if (bum) {
  8900. invokeArrayFns(bum);
  8901. }
  8902. scope.stop();
  8903. if (job) {
  8904. job.flags |= 8;
  8905. unmount(subTree, instance, parentSuspense, doRemove);
  8906. }
  8907. if (um) {
  8908. queuePostRenderEffect(um, parentSuspense);
  8909. }
  8910. queuePostRenderEffect(() => {
  8911. instance.isUnmounted = true;
  8912. }, parentSuspense);
  8913. {
  8914. devtoolsComponentRemoved(instance);
  8915. }
  8916. };
  8917. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  8918. for (let i = start; i < children.length; i++) {
  8919. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  8920. }
  8921. };
  8922. const getNextHostNode = (vnode) => {
  8923. if (vnode.shapeFlag & 6) {
  8924. return getNextHostNode(vnode.component.subTree);
  8925. }
  8926. if (vnode.shapeFlag & 128) {
  8927. return vnode.suspense.next();
  8928. }
  8929. const el = hostNextSibling(vnode.anchor || vnode.el);
  8930. const teleportEnd = el && el[TeleportEndKey];
  8931. return teleportEnd ? hostNextSibling(teleportEnd) : el;
  8932. };
  8933. let isFlushing = false;
  8934. const render = (vnode, container, namespace) => {
  8935. let instance;
  8936. if (vnode == null) {
  8937. if (container._vnode) {
  8938. unmount(container._vnode, null, null, true);
  8939. instance = container._vnode.component;
  8940. }
  8941. } else {
  8942. patch(
  8943. container._vnode || null,
  8944. vnode,
  8945. container,
  8946. null,
  8947. null,
  8948. null,
  8949. namespace
  8950. );
  8951. }
  8952. container._vnode = vnode;
  8953. if (!isFlushing) {
  8954. isFlushing = true;
  8955. flushPreFlushCbs(instance);
  8956. flushPostFlushCbs();
  8957. isFlushing = false;
  8958. }
  8959. };
  8960. const internals = {
  8961. p: patch,
  8962. um: unmount,
  8963. m: move,
  8964. r: remove,
  8965. mt: mountComponent,
  8966. mc: mountChildren,
  8967. pc: patchChildren,
  8968. pbc: patchBlockChildren,
  8969. n: getNextHostNode,
  8970. o: options
  8971. };
  8972. let hydrate;
  8973. let hydrateNode;
  8974. if (createHydrationFns) {
  8975. [hydrate, hydrateNode] = createHydrationFns(
  8976. internals
  8977. );
  8978. }
  8979. return {
  8980. render,
  8981. hydrate,
  8982. createApp: createAppAPI(render, hydrate)
  8983. };
  8984. }
  8985. function resolveChildrenNamespace({ type, props }, currentNamespace) {
  8986. return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
  8987. }
  8988. function toggleRecurse({ effect, job }, allowed) {
  8989. if (allowed) {
  8990. effect.flags |= 32;
  8991. job.flags |= 4;
  8992. } else {
  8993. effect.flags &= -33;
  8994. job.flags &= -5;
  8995. }
  8996. }
  8997. function needTransition(parentSuspense, transition) {
  8998. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  8999. }
  9000. function traverseStaticChildren(n1, n2, shallow = false) {
  9001. const ch1 = n1.children;
  9002. const ch2 = n2.children;
  9003. if (isArray(ch1) && isArray(ch2)) {
  9004. for (let i = 0; i < ch1.length; i++) {
  9005. const c1 = ch1[i];
  9006. let c2 = ch2[i];
  9007. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  9008. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  9009. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  9010. c2.el = c1.el;
  9011. }
  9012. if (!shallow && c2.patchFlag !== -2)
  9013. traverseStaticChildren(c1, c2);
  9014. }
  9015. if (c2.type === Text) {
  9016. if (c2.patchFlag === -1) {
  9017. c2 = ch2[i] = cloneIfMounted(c2);
  9018. }
  9019. c2.el = c1.el;
  9020. }
  9021. if (c2.type === Comment && !c2.el) {
  9022. c2.el = c1.el;
  9023. }
  9024. {
  9025. c2.el && (c2.el.__vnode = c2);
  9026. }
  9027. }
  9028. }
  9029. }
  9030. function getSequence(arr) {
  9031. const p = arr.slice();
  9032. const result = [0];
  9033. let i, j, u, v, c;
  9034. const len = arr.length;
  9035. for (i = 0; i < len; i++) {
  9036. const arrI = arr[i];
  9037. if (arrI !== 0) {
  9038. j = result[result.length - 1];
  9039. if (arr[j] < arrI) {
  9040. p[i] = j;
  9041. result.push(i);
  9042. continue;
  9043. }
  9044. u = 0;
  9045. v = result.length - 1;
  9046. while (u < v) {
  9047. c = u + v >> 1;
  9048. if (arr[result[c]] < arrI) {
  9049. u = c + 1;
  9050. } else {
  9051. v = c;
  9052. }
  9053. }
  9054. if (arrI < arr[result[u]]) {
  9055. if (u > 0) {
  9056. p[i] = result[u - 1];
  9057. }
  9058. result[u] = i;
  9059. }
  9060. }
  9061. }
  9062. u = result.length;
  9063. v = result[u - 1];
  9064. while (u-- > 0) {
  9065. result[u] = v;
  9066. v = p[v];
  9067. }
  9068. return result;
  9069. }
  9070. function locateNonHydratedAsyncRoot(instance) {
  9071. const subComponent = instance.subTree.component;
  9072. if (subComponent) {
  9073. if (subComponent.asyncDep && !subComponent.asyncResolved) {
  9074. return subComponent;
  9075. } else {
  9076. return locateNonHydratedAsyncRoot(subComponent);
  9077. }
  9078. }
  9079. }
  9080. function invalidateMount(hooks) {
  9081. if (hooks) {
  9082. for (let i = 0; i < hooks.length; i++)
  9083. hooks[i].flags |= 8;
  9084. }
  9085. }
  9086. function resolveAsyncComponentPlaceholder(anchorVnode) {
  9087. if (anchorVnode.placeholder) {
  9088. return anchorVnode.placeholder;
  9089. }
  9090. const instance = anchorVnode.component;
  9091. if (instance) {
  9092. return resolveAsyncComponentPlaceholder(instance.subTree);
  9093. }
  9094. return null;
  9095. }
  9096. const isSuspense = (type) => type.__isSuspense;
  9097. let suspenseId = 0;
  9098. const SuspenseImpl = {
  9099. name: "Suspense",
  9100. // In order to make Suspense tree-shakable, we need to avoid importing it
  9101. // directly in the renderer. The renderer checks for the __isSuspense flag
  9102. // on a vnode's type and calls the `process` method, passing in renderer
  9103. // internals.
  9104. __isSuspense: true,
  9105. process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  9106. if (n1 == null) {
  9107. mountSuspense(
  9108. n2,
  9109. container,
  9110. anchor,
  9111. parentComponent,
  9112. parentSuspense,
  9113. namespace,
  9114. slotScopeIds,
  9115. optimized,
  9116. rendererInternals
  9117. );
  9118. } else {
  9119. if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
  9120. n2.suspense = n1.suspense;
  9121. n2.suspense.vnode = n2;
  9122. n2.el = n1.el;
  9123. return;
  9124. }
  9125. patchSuspense(
  9126. n1,
  9127. n2,
  9128. container,
  9129. anchor,
  9130. parentComponent,
  9131. namespace,
  9132. slotScopeIds,
  9133. optimized,
  9134. rendererInternals
  9135. );
  9136. }
  9137. },
  9138. hydrate: hydrateSuspense,
  9139. normalize: normalizeSuspenseChildren
  9140. };
  9141. const Suspense = SuspenseImpl ;
  9142. function triggerEvent(vnode, name) {
  9143. const eventListener = vnode.props && vnode.props[name];
  9144. if (isFunction(eventListener)) {
  9145. eventListener();
  9146. }
  9147. }
  9148. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
  9149. const {
  9150. p: patch,
  9151. o: { createElement }
  9152. } = rendererInternals;
  9153. const hiddenContainer = createElement("div");
  9154. const suspense = vnode.suspense = createSuspenseBoundary(
  9155. vnode,
  9156. parentSuspense,
  9157. parentComponent,
  9158. container,
  9159. hiddenContainer,
  9160. anchor,
  9161. namespace,
  9162. slotScopeIds,
  9163. optimized,
  9164. rendererInternals
  9165. );
  9166. patch(
  9167. null,
  9168. suspense.pendingBranch = vnode.ssContent,
  9169. hiddenContainer,
  9170. null,
  9171. parentComponent,
  9172. suspense,
  9173. namespace,
  9174. slotScopeIds
  9175. );
  9176. if (suspense.deps > 0) {
  9177. triggerEvent(vnode, "onPending");
  9178. triggerEvent(vnode, "onFallback");
  9179. patch(
  9180. null,
  9181. vnode.ssFallback,
  9182. container,
  9183. anchor,
  9184. parentComponent,
  9185. null,
  9186. // fallback tree will not have suspense context
  9187. namespace,
  9188. slotScopeIds
  9189. );
  9190. setActiveBranch(suspense, vnode.ssFallback);
  9191. } else {
  9192. suspense.resolve(false, true);
  9193. }
  9194. }
  9195. function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  9196. const suspense = n2.suspense = n1.suspense;
  9197. suspense.vnode = n2;
  9198. n2.el = n1.el;
  9199. const newBranch = n2.ssContent;
  9200. const newFallback = n2.ssFallback;
  9201. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  9202. if (pendingBranch) {
  9203. suspense.pendingBranch = newBranch;
  9204. if (isSameVNodeType(pendingBranch, newBranch)) {
  9205. patch(
  9206. pendingBranch,
  9207. newBranch,
  9208. suspense.hiddenContainer,
  9209. null,
  9210. parentComponent,
  9211. suspense,
  9212. namespace,
  9213. slotScopeIds,
  9214. optimized
  9215. );
  9216. if (suspense.deps <= 0) {
  9217. suspense.resolve();
  9218. } else if (isInFallback) {
  9219. if (!isHydrating) {
  9220. patch(
  9221. activeBranch,
  9222. newFallback,
  9223. container,
  9224. anchor,
  9225. parentComponent,
  9226. null,
  9227. // fallback tree will not have suspense context
  9228. namespace,
  9229. slotScopeIds,
  9230. optimized
  9231. );
  9232. setActiveBranch(suspense, newFallback);
  9233. }
  9234. }
  9235. } else {
  9236. suspense.pendingId = suspenseId++;
  9237. if (isHydrating) {
  9238. suspense.isHydrating = false;
  9239. suspense.activeBranch = pendingBranch;
  9240. } else {
  9241. unmount(pendingBranch, parentComponent, suspense);
  9242. }
  9243. suspense.deps = 0;
  9244. suspense.effects.length = 0;
  9245. suspense.hiddenContainer = createElement("div");
  9246. if (isInFallback) {
  9247. patch(
  9248. null,
  9249. newBranch,
  9250. suspense.hiddenContainer,
  9251. null,
  9252. parentComponent,
  9253. suspense,
  9254. namespace,
  9255. slotScopeIds,
  9256. optimized
  9257. );
  9258. if (suspense.deps <= 0) {
  9259. suspense.resolve();
  9260. } else {
  9261. patch(
  9262. activeBranch,
  9263. newFallback,
  9264. container,
  9265. anchor,
  9266. parentComponent,
  9267. null,
  9268. // fallback tree will not have suspense context
  9269. namespace,
  9270. slotScopeIds,
  9271. optimized
  9272. );
  9273. setActiveBranch(suspense, newFallback);
  9274. }
  9275. } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9276. patch(
  9277. activeBranch,
  9278. newBranch,
  9279. container,
  9280. anchor,
  9281. parentComponent,
  9282. suspense,
  9283. namespace,
  9284. slotScopeIds,
  9285. optimized
  9286. );
  9287. suspense.resolve(true);
  9288. } else {
  9289. patch(
  9290. null,
  9291. newBranch,
  9292. suspense.hiddenContainer,
  9293. null,
  9294. parentComponent,
  9295. suspense,
  9296. namespace,
  9297. slotScopeIds,
  9298. optimized
  9299. );
  9300. if (suspense.deps <= 0) {
  9301. suspense.resolve();
  9302. }
  9303. }
  9304. }
  9305. } else {
  9306. if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
  9307. patch(
  9308. activeBranch,
  9309. newBranch,
  9310. container,
  9311. anchor,
  9312. parentComponent,
  9313. suspense,
  9314. namespace,
  9315. slotScopeIds,
  9316. optimized
  9317. );
  9318. setActiveBranch(suspense, newBranch);
  9319. } else {
  9320. triggerEvent(n2, "onPending");
  9321. suspense.pendingBranch = newBranch;
  9322. if (newBranch.shapeFlag & 512) {
  9323. suspense.pendingId = newBranch.component.suspenseId;
  9324. } else {
  9325. suspense.pendingId = suspenseId++;
  9326. }
  9327. patch(
  9328. null,
  9329. newBranch,
  9330. suspense.hiddenContainer,
  9331. null,
  9332. parentComponent,
  9333. suspense,
  9334. namespace,
  9335. slotScopeIds,
  9336. optimized
  9337. );
  9338. if (suspense.deps <= 0) {
  9339. suspense.resolve();
  9340. } else {
  9341. const { timeout, pendingId } = suspense;
  9342. if (timeout > 0) {
  9343. setTimeout(() => {
  9344. if (suspense.pendingId === pendingId) {
  9345. suspense.fallback(newFallback);
  9346. }
  9347. }, timeout);
  9348. } else if (timeout === 0) {
  9349. suspense.fallback(newFallback);
  9350. }
  9351. }
  9352. }
  9353. }
  9354. }
  9355. let hasWarned = false;
  9356. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  9357. if (!hasWarned) {
  9358. hasWarned = true;
  9359. console[console.info ? "info" : "log"](
  9360. `<Suspense> is an experimental feature and its API will likely change.`
  9361. );
  9362. }
  9363. const {
  9364. p: patch,
  9365. m: move,
  9366. um: unmount,
  9367. n: next,
  9368. o: { parentNode, remove }
  9369. } = rendererInternals;
  9370. let parentSuspenseId;
  9371. const isSuspensible = isVNodeSuspensible(vnode);
  9372. if (isSuspensible) {
  9373. if (parentSuspense && parentSuspense.pendingBranch) {
  9374. parentSuspenseId = parentSuspense.pendingId;
  9375. parentSuspense.deps++;
  9376. }
  9377. }
  9378. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  9379. {
  9380. assertNumber(timeout, `Suspense timeout`);
  9381. }
  9382. const initialAnchor = anchor;
  9383. const suspense = {
  9384. vnode,
  9385. parent: parentSuspense,
  9386. parentComponent,
  9387. namespace,
  9388. container,
  9389. hiddenContainer,
  9390. deps: 0,
  9391. pendingId: suspenseId++,
  9392. timeout: typeof timeout === "number" ? timeout : -1,
  9393. activeBranch: null,
  9394. isFallbackMountPending: false,
  9395. pendingBranch: null,
  9396. isInFallback: !isHydrating,
  9397. isHydrating,
  9398. isUnmounted: false,
  9399. effects: [],
  9400. resolve(resume = false, sync = false) {
  9401. {
  9402. if (!resume && !suspense.pendingBranch) {
  9403. throw new Error(
  9404. `suspense.resolve() is called without a pending branch.`
  9405. );
  9406. }
  9407. if (suspense.isUnmounted) {
  9408. throw new Error(
  9409. `suspense.resolve() is called on an already unmounted suspense boundary.`
  9410. );
  9411. }
  9412. }
  9413. const {
  9414. vnode: vnode2,
  9415. activeBranch,
  9416. pendingBranch,
  9417. pendingId,
  9418. effects,
  9419. parentComponent: parentComponent2,
  9420. container: container2,
  9421. isInFallback
  9422. } = suspense;
  9423. let delayEnter = false;
  9424. if (suspense.isHydrating) {
  9425. suspense.isHydrating = false;
  9426. } else if (!resume) {
  9427. delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  9428. if (delayEnter) {
  9429. activeBranch.transition.afterLeave = () => {
  9430. if (pendingId === suspense.pendingId) {
  9431. move(
  9432. pendingBranch,
  9433. container2,
  9434. anchor === initialAnchor ? next(activeBranch) : anchor,
  9435. 0
  9436. );
  9437. queuePostFlushCb(effects);
  9438. if (isInFallback && vnode2.ssFallback) {
  9439. vnode2.ssFallback.el = null;
  9440. }
  9441. }
  9442. };
  9443. }
  9444. if (activeBranch && !suspense.isFallbackMountPending) {
  9445. if (parentNode(activeBranch.el) === container2) {
  9446. anchor = next(activeBranch);
  9447. }
  9448. unmount(activeBranch, parentComponent2, suspense, true);
  9449. if (!delayEnter && isInFallback && vnode2.ssFallback) {
  9450. queuePostRenderEffect(() => vnode2.ssFallback.el = null, suspense);
  9451. }
  9452. }
  9453. if (!delayEnter) {
  9454. move(pendingBranch, container2, anchor, 0);
  9455. }
  9456. }
  9457. suspense.isFallbackMountPending = false;
  9458. setActiveBranch(suspense, pendingBranch);
  9459. suspense.pendingBranch = null;
  9460. suspense.isInFallback = false;
  9461. let parent = suspense.parent;
  9462. let hasUnresolvedAncestor = false;
  9463. while (parent) {
  9464. if (parent.pendingBranch) {
  9465. parent.effects.push(...effects);
  9466. hasUnresolvedAncestor = true;
  9467. break;
  9468. }
  9469. parent = parent.parent;
  9470. }
  9471. if (!hasUnresolvedAncestor && !delayEnter) {
  9472. queuePostFlushCb(effects);
  9473. }
  9474. suspense.effects = [];
  9475. if (isSuspensible) {
  9476. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  9477. parentSuspense.deps--;
  9478. if (parentSuspense.deps === 0 && !sync) {
  9479. parentSuspense.resolve();
  9480. }
  9481. }
  9482. }
  9483. triggerEvent(vnode2, "onResolve");
  9484. },
  9485. fallback(fallbackVNode) {
  9486. if (!suspense.pendingBranch) {
  9487. return;
  9488. }
  9489. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
  9490. triggerEvent(vnode2, "onFallback");
  9491. const anchor2 = next(activeBranch);
  9492. const mountFallback = () => {
  9493. suspense.isFallbackMountPending = false;
  9494. if (!suspense.isInFallback) {
  9495. return;
  9496. }
  9497. patch(
  9498. null,
  9499. fallbackVNode,
  9500. container2,
  9501. anchor2,
  9502. parentComponent2,
  9503. null,
  9504. // fallback tree will not have suspense context
  9505. namespace2,
  9506. slotScopeIds,
  9507. optimized
  9508. );
  9509. setActiveBranch(suspense, fallbackVNode);
  9510. };
  9511. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  9512. if (delayEnter) {
  9513. suspense.isFallbackMountPending = true;
  9514. activeBranch.transition.afterLeave = mountFallback;
  9515. }
  9516. suspense.isInFallback = true;
  9517. unmount(
  9518. activeBranch,
  9519. parentComponent2,
  9520. null,
  9521. // no suspense so unmount hooks fire now
  9522. true
  9523. // shouldRemove
  9524. );
  9525. if (!delayEnter) {
  9526. mountFallback();
  9527. }
  9528. },
  9529. move(container2, anchor2, type) {
  9530. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  9531. suspense.container = container2;
  9532. },
  9533. next() {
  9534. return suspense.activeBranch && next(suspense.activeBranch);
  9535. },
  9536. registerDep(instance, setupRenderEffect, optimized2) {
  9537. const isInPendingSuspense = !!suspense.pendingBranch;
  9538. if (isInPendingSuspense) {
  9539. suspense.deps++;
  9540. }
  9541. const hydratedEl = instance.vnode.el;
  9542. instance.asyncDep.catch((err) => {
  9543. handleError(err, instance, 0);
  9544. }).then((asyncSetupResult) => {
  9545. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  9546. return;
  9547. }
  9548. unsetCurrentInstance();
  9549. instance.asyncResolved = true;
  9550. const { vnode: vnode2 } = instance;
  9551. {
  9552. pushWarningContext(vnode2);
  9553. }
  9554. handleSetupResult(instance, asyncSetupResult, false);
  9555. if (hydratedEl) {
  9556. vnode2.el = hydratedEl;
  9557. }
  9558. const placeholder = !hydratedEl && instance.subTree.el;
  9559. setupRenderEffect(
  9560. instance,
  9561. vnode2,
  9562. // component may have been moved before resolve.
  9563. // if this is not a hydration, instance.subTree will be the comment
  9564. // placeholder.
  9565. parentNode(hydratedEl || instance.subTree.el),
  9566. // anchor will not be used if this is hydration, so only need to
  9567. // consider the comment placeholder case.
  9568. hydratedEl ? null : next(instance.subTree),
  9569. suspense,
  9570. namespace,
  9571. optimized2
  9572. );
  9573. if (placeholder) {
  9574. vnode2.placeholder = null;
  9575. remove(placeholder);
  9576. }
  9577. updateHOCHostEl(instance, vnode2.el);
  9578. {
  9579. popWarningContext();
  9580. }
  9581. if (isInPendingSuspense && --suspense.deps === 0) {
  9582. suspense.resolve();
  9583. }
  9584. });
  9585. },
  9586. unmount(parentSuspense2, doRemove) {
  9587. suspense.isUnmounted = true;
  9588. if (suspense.activeBranch) {
  9589. unmount(
  9590. suspense.activeBranch,
  9591. parentComponent,
  9592. parentSuspense2,
  9593. doRemove
  9594. );
  9595. }
  9596. if (suspense.pendingBranch) {
  9597. unmount(
  9598. suspense.pendingBranch,
  9599. parentComponent,
  9600. parentSuspense2,
  9601. doRemove
  9602. );
  9603. }
  9604. }
  9605. };
  9606. return suspense;
  9607. }
  9608. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  9609. const suspense = vnode.suspense = createSuspenseBoundary(
  9610. vnode,
  9611. parentSuspense,
  9612. parentComponent,
  9613. node.parentNode,
  9614. // eslint-disable-next-line no-restricted-globals
  9615. document.createElement("div"),
  9616. null,
  9617. namespace,
  9618. slotScopeIds,
  9619. optimized,
  9620. rendererInternals,
  9621. true
  9622. );
  9623. const result = hydrateNode(
  9624. node,
  9625. suspense.pendingBranch = vnode.ssContent,
  9626. parentComponent,
  9627. suspense,
  9628. slotScopeIds,
  9629. optimized
  9630. );
  9631. if (suspense.deps === 0) {
  9632. suspense.resolve(false, true);
  9633. }
  9634. return result;
  9635. }
  9636. function normalizeSuspenseChildren(vnode) {
  9637. const { shapeFlag, children } = vnode;
  9638. const isSlotChildren = shapeFlag & 32;
  9639. vnode.ssContent = normalizeSuspenseSlot(
  9640. isSlotChildren ? children.default : children
  9641. );
  9642. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  9643. }
  9644. function normalizeSuspenseSlot(s) {
  9645. let block;
  9646. if (isFunction(s)) {
  9647. const trackBlock = isBlockTreeEnabled && s._c;
  9648. if (trackBlock) {
  9649. s._d = false;
  9650. openBlock();
  9651. }
  9652. s = s();
  9653. if (trackBlock) {
  9654. s._d = true;
  9655. block = currentBlock;
  9656. closeBlock();
  9657. }
  9658. }
  9659. if (isArray(s)) {
  9660. const singleChild = filterSingleRoot(s);
  9661. if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
  9662. warn$1(`<Suspense> slots expect a single root node.`);
  9663. }
  9664. s = singleChild;
  9665. }
  9666. s = normalizeVNode(s);
  9667. if (block && !s.dynamicChildren) {
  9668. s.dynamicChildren = block.filter((c) => c !== s);
  9669. }
  9670. return s;
  9671. }
  9672. function queueEffectWithSuspense(fn, suspense) {
  9673. if (suspense && suspense.pendingBranch) {
  9674. if (isArray(fn)) {
  9675. suspense.effects.push(...fn);
  9676. } else {
  9677. suspense.effects.push(fn);
  9678. }
  9679. } else {
  9680. queuePostFlushCb(fn);
  9681. }
  9682. }
  9683. function setActiveBranch(suspense, branch) {
  9684. suspense.activeBranch = branch;
  9685. const { vnode, parentComponent } = suspense;
  9686. let el = branch.el;
  9687. while (!el && branch.component) {
  9688. branch = branch.component.subTree;
  9689. el = branch.el;
  9690. }
  9691. vnode.el = el;
  9692. if (parentComponent && parentComponent.subTree === vnode) {
  9693. parentComponent.vnode.el = el;
  9694. updateHOCHostEl(parentComponent, el);
  9695. }
  9696. }
  9697. function isVNodeSuspensible(vnode) {
  9698. const suspensible = vnode.props && vnode.props.suspensible;
  9699. return suspensible != null && suspensible !== false;
  9700. }
  9701. const Fragment = /* @__PURE__ */ Symbol.for("v-fgt");
  9702. const Text = /* @__PURE__ */ Symbol.for("v-txt");
  9703. const Comment = /* @__PURE__ */ Symbol.for("v-cmt");
  9704. const Static = /* @__PURE__ */ Symbol.for("v-stc");
  9705. const blockStack = [];
  9706. let currentBlock = null;
  9707. function openBlock(disableTracking = false) {
  9708. blockStack.push(currentBlock = disableTracking ? null : []);
  9709. }
  9710. function closeBlock() {
  9711. blockStack.pop();
  9712. currentBlock = blockStack[blockStack.length - 1] || null;
  9713. }
  9714. let isBlockTreeEnabled = 1;
  9715. function setBlockTracking(value, inVOnce = false) {
  9716. isBlockTreeEnabled += value;
  9717. if (value < 0 && currentBlock && inVOnce) {
  9718. currentBlock.hasOnce = true;
  9719. }
  9720. }
  9721. function setupBlock(vnode) {
  9722. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  9723. closeBlock();
  9724. if (isBlockTreeEnabled > 0 && currentBlock) {
  9725. currentBlock.push(vnode);
  9726. }
  9727. return vnode;
  9728. }
  9729. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  9730. return setupBlock(
  9731. createBaseVNode(
  9732. type,
  9733. props,
  9734. children,
  9735. patchFlag,
  9736. dynamicProps,
  9737. shapeFlag,
  9738. true
  9739. )
  9740. );
  9741. }
  9742. function createBlock(type, props, children, patchFlag, dynamicProps) {
  9743. return setupBlock(
  9744. createVNode(
  9745. type,
  9746. props,
  9747. children,
  9748. patchFlag,
  9749. dynamicProps,
  9750. true
  9751. )
  9752. );
  9753. }
  9754. function isVNode(value) {
  9755. return value ? value.__v_isVNode === true : false;
  9756. }
  9757. function isSameVNodeType(n1, n2) {
  9758. if (n2.shapeFlag & 6 && n1.component) {
  9759. const dirtyInstances = hmrDirtyComponents.get(n2.type);
  9760. if (dirtyInstances && dirtyInstances.has(n1.component)) {
  9761. n1.shapeFlag &= -257;
  9762. n2.shapeFlag &= -513;
  9763. return false;
  9764. }
  9765. }
  9766. return n1.type === n2.type && n1.key === n2.key;
  9767. }
  9768. let vnodeArgsTransformer;
  9769. function transformVNodeArgs(transformer) {
  9770. vnodeArgsTransformer = transformer;
  9771. }
  9772. const createVNodeWithArgsTransform = (...args) => {
  9773. return _createVNode(
  9774. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  9775. );
  9776. };
  9777. const normalizeKey = ({ key }) => key != null ? key : null;
  9778. const normalizeRef = ({
  9779. ref,
  9780. ref_key,
  9781. ref_for
  9782. }) => {
  9783. if (typeof ref === "number") {
  9784. ref = "" + ref;
  9785. }
  9786. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  9787. };
  9788. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  9789. const vnode = {
  9790. __v_isVNode: true,
  9791. __v_skip: true,
  9792. type,
  9793. props,
  9794. key: props && normalizeKey(props),
  9795. ref: props && normalizeRef(props),
  9796. scopeId: currentScopeId,
  9797. slotScopeIds: null,
  9798. children,
  9799. component: null,
  9800. suspense: null,
  9801. ssContent: null,
  9802. ssFallback: null,
  9803. dirs: null,
  9804. transition: null,
  9805. el: null,
  9806. anchor: null,
  9807. target: null,
  9808. targetStart: null,
  9809. targetAnchor: null,
  9810. staticCount: 0,
  9811. shapeFlag,
  9812. patchFlag,
  9813. dynamicProps,
  9814. dynamicChildren: null,
  9815. appContext: null,
  9816. ctx: currentRenderingInstance
  9817. };
  9818. if (needFullChildrenNormalization) {
  9819. normalizeChildren(vnode, children);
  9820. if (shapeFlag & 128) {
  9821. type.normalize(vnode);
  9822. }
  9823. } else if (children) {
  9824. vnode.shapeFlag |= isString(children) ? 8 : 16;
  9825. }
  9826. if (vnode.key !== vnode.key) {
  9827. warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  9828. }
  9829. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  9830. !isBlockNode && // has current parent block
  9831. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  9832. // component nodes also should always be patched, because even if the
  9833. // component doesn't need to update, it needs to persist the instance on to
  9834. // the next vnode so that it can be properly unmounted later.
  9835. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  9836. // vnode should not be considered dynamic due to handler caching.
  9837. vnode.patchFlag !== 32) {
  9838. currentBlock.push(vnode);
  9839. }
  9840. return vnode;
  9841. }
  9842. const createVNode = createVNodeWithArgsTransform ;
  9843. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  9844. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  9845. if (!type) {
  9846. warn$1(`Invalid vnode type when creating vnode: ${type}.`);
  9847. }
  9848. type = Comment;
  9849. }
  9850. if (isVNode(type)) {
  9851. const cloned = cloneVNode(
  9852. type,
  9853. props,
  9854. true
  9855. /* mergeRef: true */
  9856. );
  9857. if (children) {
  9858. normalizeChildren(cloned, children);
  9859. }
  9860. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  9861. if (cloned.shapeFlag & 6) {
  9862. currentBlock[currentBlock.indexOf(type)] = cloned;
  9863. } else {
  9864. currentBlock.push(cloned);
  9865. }
  9866. }
  9867. cloned.patchFlag = -2;
  9868. return cloned;
  9869. }
  9870. if (isClassComponent(type)) {
  9871. type = type.__vccOpts;
  9872. }
  9873. if (props) {
  9874. props = guardReactiveProps(props);
  9875. let { class: klass, style } = props;
  9876. if (klass && !isString(klass)) {
  9877. props.class = normalizeClass(klass);
  9878. }
  9879. if (isObject(style)) {
  9880. if (isProxy(style) && !isArray(style)) {
  9881. style = extend({}, style);
  9882. }
  9883. props.style = normalizeStyle(style);
  9884. }
  9885. }
  9886. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  9887. if (shapeFlag & 4 && isProxy(type)) {
  9888. type = toRaw(type);
  9889. warn$1(
  9890. `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
  9891. `
  9892. Component that was made reactive: `,
  9893. type
  9894. );
  9895. }
  9896. return createBaseVNode(
  9897. type,
  9898. props,
  9899. children,
  9900. patchFlag,
  9901. dynamicProps,
  9902. shapeFlag,
  9903. isBlockNode,
  9904. true
  9905. );
  9906. }
  9907. function guardReactiveProps(props) {
  9908. if (!props) return null;
  9909. return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
  9910. }
  9911. function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
  9912. const { props, ref, patchFlag, children, transition } = vnode;
  9913. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  9914. const cloned = {
  9915. __v_isVNode: true,
  9916. __v_skip: true,
  9917. type: vnode.type,
  9918. props: mergedProps,
  9919. key: mergedProps && normalizeKey(mergedProps),
  9920. ref: extraProps && extraProps.ref ? (
  9921. // #2078 in the case of <component :is="vnode" ref="extra"/>
  9922. // if the vnode itself already has a ref, cloneVNode will need to merge
  9923. // the refs so the single vnode can be set on multiple refs
  9924. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  9925. ) : ref,
  9926. scopeId: vnode.scopeId,
  9927. slotScopeIds: vnode.slotScopeIds,
  9928. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  9929. target: vnode.target,
  9930. targetStart: vnode.targetStart,
  9931. targetAnchor: vnode.targetAnchor,
  9932. staticCount: vnode.staticCount,
  9933. shapeFlag: vnode.shapeFlag,
  9934. // if the vnode is cloned with extra props, we can no longer assume its
  9935. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  9936. // note: preserve flag for fragments since they use the flag for children
  9937. // fast paths only.
  9938. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  9939. dynamicProps: vnode.dynamicProps,
  9940. dynamicChildren: vnode.dynamicChildren,
  9941. appContext: vnode.appContext,
  9942. dirs: vnode.dirs,
  9943. transition,
  9944. // These should technically only be non-null on mounted VNodes. However,
  9945. // they *should* be copied for kept-alive vnodes. So we just always copy
  9946. // them since them being non-null during a mount doesn't affect the logic as
  9947. // they will simply be overwritten.
  9948. component: vnode.component,
  9949. suspense: vnode.suspense,
  9950. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  9951. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  9952. placeholder: vnode.placeholder,
  9953. el: vnode.el,
  9954. anchor: vnode.anchor,
  9955. ctx: vnode.ctx,
  9956. ce: vnode.ce
  9957. };
  9958. if (transition && cloneTransition) {
  9959. setTransitionHooks(
  9960. cloned,
  9961. transition.clone(cloned)
  9962. );
  9963. }
  9964. return cloned;
  9965. }
  9966. function deepCloneVNode(vnode) {
  9967. const cloned = cloneVNode(vnode);
  9968. if (isArray(vnode.children)) {
  9969. cloned.children = vnode.children.map(deepCloneVNode);
  9970. }
  9971. return cloned;
  9972. }
  9973. function createTextVNode(text = " ", flag = 0) {
  9974. return createVNode(Text, null, text, flag);
  9975. }
  9976. function createStaticVNode(content, numberOfNodes) {
  9977. const vnode = createVNode(Static, null, content);
  9978. vnode.staticCount = numberOfNodes;
  9979. return vnode;
  9980. }
  9981. function createCommentVNode(text = "", asBlock = false) {
  9982. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  9983. }
  9984. function normalizeVNode(child) {
  9985. if (child == null || typeof child === "boolean") {
  9986. return createVNode(Comment);
  9987. } else if (isArray(child)) {
  9988. return createVNode(
  9989. Fragment,
  9990. null,
  9991. // #3666, avoid reference pollution when reusing vnode
  9992. child.slice()
  9993. );
  9994. } else if (isVNode(child)) {
  9995. return cloneIfMounted(child);
  9996. } else {
  9997. return createVNode(Text, null, String(child));
  9998. }
  9999. }
  10000. function cloneIfMounted(child) {
  10001. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  10002. }
  10003. function normalizeChildren(vnode, children) {
  10004. let type = 0;
  10005. const { shapeFlag } = vnode;
  10006. if (children == null) {
  10007. children = null;
  10008. } else if (isArray(children)) {
  10009. type = 16;
  10010. } else if (typeof children === "object") {
  10011. if (shapeFlag & (1 | 64)) {
  10012. const slot = children.default;
  10013. if (slot) {
  10014. slot._c && (slot._d = false);
  10015. normalizeChildren(vnode, slot());
  10016. slot._c && (slot._d = true);
  10017. }
  10018. return;
  10019. } else {
  10020. type = 32;
  10021. const slotFlag = children._;
  10022. if (!slotFlag && !isInternalObject(children)) {
  10023. children._ctx = currentRenderingInstance;
  10024. } else if (slotFlag === 3 && currentRenderingInstance) {
  10025. if (currentRenderingInstance.slots._ === 1) {
  10026. children._ = 1;
  10027. } else {
  10028. children._ = 2;
  10029. vnode.patchFlag |= 1024;
  10030. }
  10031. }
  10032. }
  10033. } else if (isFunction(children)) {
  10034. children = { default: children, _ctx: currentRenderingInstance };
  10035. type = 32;
  10036. } else {
  10037. children = String(children);
  10038. if (shapeFlag & 64) {
  10039. type = 16;
  10040. children = [createTextVNode(children)];
  10041. } else {
  10042. type = 8;
  10043. }
  10044. }
  10045. vnode.children = children;
  10046. vnode.shapeFlag |= type;
  10047. }
  10048. function mergeProps(...args) {
  10049. const ret = {};
  10050. for (let i = 0; i < args.length; i++) {
  10051. const toMerge = args[i];
  10052. for (const key in toMerge) {
  10053. if (key === "class") {
  10054. if (ret.class !== toMerge.class) {
  10055. ret.class = normalizeClass([ret.class, toMerge.class]);
  10056. }
  10057. } else if (key === "style") {
  10058. ret.style = normalizeStyle([ret.style, toMerge.style]);
  10059. } else if (isOn(key)) {
  10060. const existing = ret[key];
  10061. const incoming = toMerge[key];
  10062. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  10063. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  10064. } else if (incoming == null && existing == null && // mergeProps({ 'onUpdate:modelValue': undefined }) should not retain
  10065. // the model listener.
  10066. !isModelListener(key)) {
  10067. ret[key] = incoming;
  10068. }
  10069. } else if (key !== "") {
  10070. ret[key] = toMerge[key];
  10071. }
  10072. }
  10073. }
  10074. return ret;
  10075. }
  10076. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  10077. callWithAsyncErrorHandling(hook, instance, 7, [
  10078. vnode,
  10079. prevVNode
  10080. ]);
  10081. }
  10082. const emptyAppContext = createAppContext();
  10083. let uid = 0;
  10084. function createComponentInstance(vnode, parent, suspense) {
  10085. const type = vnode.type;
  10086. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  10087. const instance = {
  10088. uid: uid++,
  10089. vnode,
  10090. type,
  10091. parent,
  10092. appContext,
  10093. root: null,
  10094. // to be immediately set
  10095. next: null,
  10096. subTree: null,
  10097. // will be set synchronously right after creation
  10098. effect: null,
  10099. update: null,
  10100. // will be set synchronously right after creation
  10101. job: null,
  10102. scope: new EffectScope(
  10103. true
  10104. /* detached */
  10105. ),
  10106. render: null,
  10107. proxy: null,
  10108. exposed: null,
  10109. exposeProxy: null,
  10110. withProxy: null,
  10111. provides: parent ? parent.provides : Object.create(appContext.provides),
  10112. ids: parent ? parent.ids : ["", 0, 0],
  10113. accessCache: null,
  10114. renderCache: [],
  10115. // local resolved assets
  10116. components: null,
  10117. directives: null,
  10118. // resolved props and emits options
  10119. propsOptions: normalizePropsOptions(type, appContext),
  10120. emitsOptions: normalizeEmitsOptions(type, appContext),
  10121. // emit
  10122. emit: null,
  10123. // to be set immediately
  10124. emitted: null,
  10125. // props default value
  10126. propsDefaults: EMPTY_OBJ,
  10127. // inheritAttrs
  10128. inheritAttrs: type.inheritAttrs,
  10129. // state
  10130. ctx: EMPTY_OBJ,
  10131. data: EMPTY_OBJ,
  10132. props: EMPTY_OBJ,
  10133. attrs: EMPTY_OBJ,
  10134. slots: EMPTY_OBJ,
  10135. refs: EMPTY_OBJ,
  10136. setupState: EMPTY_OBJ,
  10137. setupContext: null,
  10138. // suspense related
  10139. suspense,
  10140. suspenseId: suspense ? suspense.pendingId : 0,
  10141. asyncDep: null,
  10142. asyncResolved: false,
  10143. // lifecycle hooks
  10144. // not using enums here because it results in computed properties
  10145. isMounted: false,
  10146. isUnmounted: false,
  10147. isDeactivated: false,
  10148. bc: null,
  10149. c: null,
  10150. bm: null,
  10151. m: null,
  10152. bu: null,
  10153. u: null,
  10154. um: null,
  10155. bum: null,
  10156. da: null,
  10157. a: null,
  10158. rtg: null,
  10159. rtc: null,
  10160. ec: null,
  10161. sp: null
  10162. };
  10163. {
  10164. instance.ctx = createDevRenderContext(instance);
  10165. }
  10166. instance.root = parent ? parent.root : instance;
  10167. instance.emit = emit.bind(null, instance);
  10168. if (vnode.ce) {
  10169. vnode.ce(instance);
  10170. }
  10171. return instance;
  10172. }
  10173. let currentInstance = null;
  10174. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  10175. let internalSetCurrentInstance;
  10176. let setInSSRSetupState;
  10177. {
  10178. const g = getGlobalThis();
  10179. const registerGlobalSetter = (key, setter) => {
  10180. let setters;
  10181. if (!(setters = g[key])) setters = g[key] = [];
  10182. setters.push(setter);
  10183. return (v) => {
  10184. if (setters.length > 1) setters.forEach((set) => set(v));
  10185. else setters[0](v);
  10186. };
  10187. };
  10188. internalSetCurrentInstance = registerGlobalSetter(
  10189. `__VUE_INSTANCE_SETTERS__`,
  10190. (v) => currentInstance = v
  10191. );
  10192. setInSSRSetupState = registerGlobalSetter(
  10193. `__VUE_SSR_SETTERS__`,
  10194. (v) => isInSSRComponentSetup = v
  10195. );
  10196. }
  10197. const setCurrentInstance = (instance) => {
  10198. const prev = currentInstance;
  10199. internalSetCurrentInstance(instance);
  10200. instance.scope.on();
  10201. return () => {
  10202. instance.scope.off();
  10203. internalSetCurrentInstance(prev);
  10204. };
  10205. };
  10206. const unsetCurrentInstance = () => {
  10207. currentInstance && currentInstance.scope.off();
  10208. internalSetCurrentInstance(null);
  10209. };
  10210. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  10211. function validateComponentName(name, { isNativeTag }) {
  10212. if (isBuiltInTag(name) || isNativeTag(name)) {
  10213. warn$1(
  10214. "Do not use built-in or reserved HTML elements as component id: " + name
  10215. );
  10216. }
  10217. }
  10218. function isStatefulComponent(instance) {
  10219. return instance.vnode.shapeFlag & 4;
  10220. }
  10221. let isInSSRComponentSetup = false;
  10222. function setupComponent(instance, isSSR = false, optimized = false) {
  10223. isSSR && setInSSRSetupState(isSSR);
  10224. const { props, children } = instance.vnode;
  10225. const isStateful = isStatefulComponent(instance);
  10226. initProps(instance, props, isStateful, isSSR);
  10227. initSlots(instance, children, optimized || isSSR);
  10228. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  10229. isSSR && setInSSRSetupState(false);
  10230. return setupResult;
  10231. }
  10232. function setupStatefulComponent(instance, isSSR) {
  10233. const Component = instance.type;
  10234. {
  10235. if (Component.name) {
  10236. validateComponentName(Component.name, instance.appContext.config);
  10237. }
  10238. if (Component.components) {
  10239. const names = Object.keys(Component.components);
  10240. for (let i = 0; i < names.length; i++) {
  10241. validateComponentName(names[i], instance.appContext.config);
  10242. }
  10243. }
  10244. if (Component.directives) {
  10245. const names = Object.keys(Component.directives);
  10246. for (let i = 0; i < names.length; i++) {
  10247. validateDirectiveName(names[i]);
  10248. }
  10249. }
  10250. if (Component.compilerOptions && isRuntimeOnly()) {
  10251. warn$1(
  10252. `"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.`
  10253. );
  10254. }
  10255. }
  10256. instance.accessCache = /* @__PURE__ */ Object.create(null);
  10257. instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
  10258. {
  10259. exposePropsOnRenderContext(instance);
  10260. }
  10261. const { setup } = Component;
  10262. if (setup) {
  10263. pauseTracking();
  10264. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  10265. const reset = setCurrentInstance(instance);
  10266. const setupResult = callWithErrorHandling(
  10267. setup,
  10268. instance,
  10269. 0,
  10270. [
  10271. shallowReadonly(instance.props) ,
  10272. setupContext
  10273. ]
  10274. );
  10275. const isAsyncSetup = isPromise(setupResult);
  10276. resetTracking();
  10277. reset();
  10278. if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
  10279. markAsyncBoundary(instance);
  10280. }
  10281. if (isAsyncSetup) {
  10282. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  10283. if (isSSR) {
  10284. return setupResult.then((resolvedResult) => {
  10285. handleSetupResult(instance, resolvedResult, isSSR);
  10286. }).catch((e) => {
  10287. handleError(e, instance, 0);
  10288. });
  10289. } else {
  10290. instance.asyncDep = setupResult;
  10291. if (!instance.suspense) {
  10292. const name = formatComponentName(instance, Component);
  10293. warn$1(
  10294. `Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
  10295. );
  10296. }
  10297. }
  10298. } else {
  10299. handleSetupResult(instance, setupResult, isSSR);
  10300. }
  10301. } else {
  10302. finishComponentSetup(instance, isSSR);
  10303. }
  10304. }
  10305. function handleSetupResult(instance, setupResult, isSSR) {
  10306. if (isFunction(setupResult)) {
  10307. if (instance.type.__ssrInlineRender) {
  10308. instance.ssrRender = setupResult;
  10309. } else {
  10310. instance.render = setupResult;
  10311. }
  10312. } else if (isObject(setupResult)) {
  10313. if (isVNode(setupResult)) {
  10314. warn$1(
  10315. `setup() should not return VNodes directly - return a render function instead.`
  10316. );
  10317. }
  10318. {
  10319. instance.devtoolsRawSetupState = setupResult;
  10320. }
  10321. instance.setupState = proxyRefs(setupResult);
  10322. {
  10323. exposeSetupStateOnRenderContext(instance);
  10324. }
  10325. } else if (setupResult !== void 0) {
  10326. warn$1(
  10327. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  10328. );
  10329. }
  10330. finishComponentSetup(instance, isSSR);
  10331. }
  10332. let compile;
  10333. let installWithProxy;
  10334. function registerRuntimeCompiler(_compile) {
  10335. compile = _compile;
  10336. installWithProxy = (i) => {
  10337. if (i.render._rc) {
  10338. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  10339. }
  10340. };
  10341. }
  10342. const isRuntimeOnly = () => !compile;
  10343. function finishComponentSetup(instance, isSSR, skipOptions) {
  10344. const Component = instance.type;
  10345. if (!instance.render) {
  10346. if (!isSSR && compile && !Component.render) {
  10347. const template = Component.template || resolveMergedOptions(instance).template;
  10348. if (template) {
  10349. {
  10350. startMeasure(instance, `compile`);
  10351. }
  10352. const { isCustomElement, compilerOptions } = instance.appContext.config;
  10353. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  10354. const finalCompilerOptions = extend(
  10355. extend(
  10356. {
  10357. isCustomElement,
  10358. delimiters
  10359. },
  10360. compilerOptions
  10361. ),
  10362. componentCompilerOptions
  10363. );
  10364. Component.render = compile(template, finalCompilerOptions);
  10365. {
  10366. endMeasure(instance, `compile`);
  10367. }
  10368. }
  10369. }
  10370. instance.render = Component.render || NOOP;
  10371. if (installWithProxy) {
  10372. installWithProxy(instance);
  10373. }
  10374. }
  10375. {
  10376. const reset = setCurrentInstance(instance);
  10377. pauseTracking();
  10378. try {
  10379. applyOptions(instance);
  10380. } finally {
  10381. resetTracking();
  10382. reset();
  10383. }
  10384. }
  10385. if (!Component.render && instance.render === NOOP && !isSSR) {
  10386. if (!compile && Component.template) {
  10387. warn$1(
  10388. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  10389. );
  10390. } else {
  10391. warn$1(`Component is missing template or render function: `, Component);
  10392. }
  10393. }
  10394. }
  10395. const attrsProxyHandlers = {
  10396. get(target, key) {
  10397. markAttrsAccessed();
  10398. track(target, "get", "");
  10399. return target[key];
  10400. },
  10401. set() {
  10402. warn$1(`setupContext.attrs is readonly.`);
  10403. return false;
  10404. },
  10405. deleteProperty() {
  10406. warn$1(`setupContext.attrs is readonly.`);
  10407. return false;
  10408. }
  10409. } ;
  10410. function getSlotsProxy(instance) {
  10411. return new Proxy(instance.slots, {
  10412. get(target, key) {
  10413. track(instance, "get", "$slots");
  10414. return target[key];
  10415. }
  10416. });
  10417. }
  10418. function createSetupContext(instance) {
  10419. const expose = (exposed) => {
  10420. {
  10421. if (instance.exposed) {
  10422. warn$1(`expose() should be called only once per setup().`);
  10423. }
  10424. if (exposed != null) {
  10425. let exposedType = typeof exposed;
  10426. if (exposedType === "object") {
  10427. if (isArray(exposed)) {
  10428. exposedType = "array";
  10429. } else if (isRef(exposed)) {
  10430. exposedType = "ref";
  10431. }
  10432. }
  10433. if (exposedType !== "object") {
  10434. warn$1(
  10435. `expose() should be passed a plain object, received ${exposedType}.`
  10436. );
  10437. }
  10438. }
  10439. }
  10440. instance.exposed = exposed || {};
  10441. };
  10442. {
  10443. let attrsProxy;
  10444. let slotsProxy;
  10445. return Object.freeze({
  10446. get attrs() {
  10447. return attrsProxy || (attrsProxy = new Proxy(instance.attrs, attrsProxyHandlers));
  10448. },
  10449. get slots() {
  10450. return slotsProxy || (slotsProxy = getSlotsProxy(instance));
  10451. },
  10452. get emit() {
  10453. return (event, ...args) => instance.emit(event, ...args);
  10454. },
  10455. expose
  10456. });
  10457. }
  10458. }
  10459. function getComponentPublicInstance(instance) {
  10460. if (instance.exposed) {
  10461. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  10462. get(target, key) {
  10463. if (key in target) {
  10464. return target[key];
  10465. } else if (key in publicPropertiesMap) {
  10466. return publicPropertiesMap[key](instance);
  10467. }
  10468. },
  10469. has(target, key) {
  10470. return key in target || key in publicPropertiesMap;
  10471. }
  10472. }));
  10473. } else {
  10474. return instance.proxy;
  10475. }
  10476. }
  10477. const classifyRE = /(?:^|[-_])\w/g;
  10478. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  10479. function getComponentName(Component, includeInferred = true) {
  10480. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  10481. }
  10482. function formatComponentName(instance, Component, isRoot = false) {
  10483. let name = getComponentName(Component);
  10484. if (!name && Component.__file) {
  10485. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  10486. if (match) {
  10487. name = match[1];
  10488. }
  10489. }
  10490. if (!name && instance) {
  10491. const inferFromRegistry = (registry) => {
  10492. for (const key in registry) {
  10493. if (registry[key] === Component) {
  10494. return key;
  10495. }
  10496. }
  10497. };
  10498. name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
  10499. instance.parent.type.components
  10500. ) || inferFromRegistry(instance.appContext.components);
  10501. }
  10502. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  10503. }
  10504. function isClassComponent(value) {
  10505. return isFunction(value) && "__vccOpts" in value;
  10506. }
  10507. const computed = (getterOrOptions, debugOptions) => {
  10508. const c = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  10509. {
  10510. const i = getCurrentInstance();
  10511. if (i && i.appContext.config.warnRecursiveComputed) {
  10512. c._warnRecursive = true;
  10513. }
  10514. }
  10515. return c;
  10516. };
  10517. function h(type, propsOrChildren, children) {
  10518. try {
  10519. setBlockTracking(-1);
  10520. const l = arguments.length;
  10521. if (l === 2) {
  10522. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  10523. if (isVNode(propsOrChildren)) {
  10524. return createVNode(type, null, [propsOrChildren]);
  10525. }
  10526. return createVNode(type, propsOrChildren);
  10527. } else {
  10528. return createVNode(type, null, propsOrChildren);
  10529. }
  10530. } else {
  10531. if (l > 3) {
  10532. children = Array.prototype.slice.call(arguments, 2);
  10533. } else if (l === 3 && isVNode(children)) {
  10534. children = [children];
  10535. }
  10536. return createVNode(type, propsOrChildren, children);
  10537. }
  10538. } finally {
  10539. setBlockTracking(1);
  10540. }
  10541. }
  10542. function initCustomFormatter() {
  10543. if (typeof window === "undefined") {
  10544. return;
  10545. }
  10546. const vueStyle = { style: "color:#3ba776" };
  10547. const numberStyle = { style: "color:#1677ff" };
  10548. const stringStyle = { style: "color:#f5222d" };
  10549. const keywordStyle = { style: "color:#eb2f96" };
  10550. const formatter = {
  10551. __vue_custom_formatter: true,
  10552. header(obj) {
  10553. if (!isObject(obj)) {
  10554. return null;
  10555. }
  10556. if (obj.__isVue) {
  10557. return ["div", vueStyle, `VueInstance`];
  10558. } else if (isRef(obj)) {
  10559. pauseTracking();
  10560. const value = obj.value;
  10561. resetTracking();
  10562. return [
  10563. "div",
  10564. {},
  10565. ["span", vueStyle, genRefFlag(obj)],
  10566. "<",
  10567. formatValue(value),
  10568. `>`
  10569. ];
  10570. } else if (isReactive(obj)) {
  10571. return [
  10572. "div",
  10573. {},
  10574. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  10575. "<",
  10576. formatValue(obj),
  10577. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  10578. ];
  10579. } else if (isReadonly(obj)) {
  10580. return [
  10581. "div",
  10582. {},
  10583. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  10584. "<",
  10585. formatValue(obj),
  10586. ">"
  10587. ];
  10588. }
  10589. return null;
  10590. },
  10591. hasBody(obj) {
  10592. return obj && obj.__isVue;
  10593. },
  10594. body(obj) {
  10595. if (obj && obj.__isVue) {
  10596. return [
  10597. "div",
  10598. {},
  10599. ...formatInstance(obj.$)
  10600. ];
  10601. }
  10602. }
  10603. };
  10604. function formatInstance(instance) {
  10605. const blocks = [];
  10606. if (instance.type.props && instance.props) {
  10607. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  10608. }
  10609. if (instance.setupState !== EMPTY_OBJ) {
  10610. blocks.push(createInstanceBlock("setup", instance.setupState));
  10611. }
  10612. if (instance.data !== EMPTY_OBJ) {
  10613. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  10614. }
  10615. const computed = extractKeys(instance, "computed");
  10616. if (computed) {
  10617. blocks.push(createInstanceBlock("computed", computed));
  10618. }
  10619. const injected = extractKeys(instance, "inject");
  10620. if (injected) {
  10621. blocks.push(createInstanceBlock("injected", injected));
  10622. }
  10623. blocks.push([
  10624. "div",
  10625. {},
  10626. [
  10627. "span",
  10628. {
  10629. style: keywordStyle.style + ";opacity:0.66"
  10630. },
  10631. "$ (internal): "
  10632. ],
  10633. ["object", { object: instance }]
  10634. ]);
  10635. return blocks;
  10636. }
  10637. function createInstanceBlock(type, target) {
  10638. target = extend({}, target);
  10639. if (!Object.keys(target).length) {
  10640. return ["span", {}];
  10641. }
  10642. return [
  10643. "div",
  10644. { style: "line-height:1.25em;margin-bottom:0.6em" },
  10645. [
  10646. "div",
  10647. {
  10648. style: "color:#476582"
  10649. },
  10650. type
  10651. ],
  10652. [
  10653. "div",
  10654. {
  10655. style: "padding-left:1.25em"
  10656. },
  10657. ...Object.keys(target).map((key) => {
  10658. return [
  10659. "div",
  10660. {},
  10661. ["span", keywordStyle, key + ": "],
  10662. formatValue(target[key], false)
  10663. ];
  10664. })
  10665. ]
  10666. ];
  10667. }
  10668. function formatValue(v, asRaw = true) {
  10669. if (typeof v === "number") {
  10670. return ["span", numberStyle, v];
  10671. } else if (typeof v === "string") {
  10672. return ["span", stringStyle, JSON.stringify(v)];
  10673. } else if (typeof v === "boolean") {
  10674. return ["span", keywordStyle, v];
  10675. } else if (isObject(v)) {
  10676. return ["object", { object: asRaw ? toRaw(v) : v }];
  10677. } else {
  10678. return ["span", stringStyle, String(v)];
  10679. }
  10680. }
  10681. function extractKeys(instance, type) {
  10682. const Comp = instance.type;
  10683. if (isFunction(Comp)) {
  10684. return;
  10685. }
  10686. const extracted = {};
  10687. for (const key in instance.ctx) {
  10688. if (isKeyOfType(Comp, key, type)) {
  10689. extracted[key] = instance.ctx[key];
  10690. }
  10691. }
  10692. return extracted;
  10693. }
  10694. function isKeyOfType(Comp, key, type) {
  10695. const opts = Comp[type];
  10696. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  10697. return true;
  10698. }
  10699. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  10700. return true;
  10701. }
  10702. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  10703. return true;
  10704. }
  10705. }
  10706. function genRefFlag(v) {
  10707. if (isShallow(v)) {
  10708. return `ShallowRef`;
  10709. }
  10710. if (v.effect) {
  10711. return `ComputedRef`;
  10712. }
  10713. return `Ref`;
  10714. }
  10715. if (window.devtoolsFormatters) {
  10716. window.devtoolsFormatters.push(formatter);
  10717. } else {
  10718. window.devtoolsFormatters = [formatter];
  10719. }
  10720. }
  10721. function withMemo(memo, render, cache, index) {
  10722. const cached = cache[index];
  10723. if (cached && isMemoSame(cached, memo)) {
  10724. return cached;
  10725. }
  10726. const ret = render();
  10727. ret.memo = memo.slice();
  10728. ret.cacheIndex = index;
  10729. return cache[index] = ret;
  10730. }
  10731. function isMemoSame(cached, memo) {
  10732. const prev = cached.memo;
  10733. if (prev.length != memo.length) {
  10734. return false;
  10735. }
  10736. for (let i = 0; i < prev.length; i++) {
  10737. if (hasChanged(prev[i], memo[i])) {
  10738. return false;
  10739. }
  10740. }
  10741. if (isBlockTreeEnabled > 0 && currentBlock) {
  10742. currentBlock.push(cached);
  10743. }
  10744. return true;
  10745. }
  10746. const version = "3.5.33";
  10747. const warn = warn$1 ;
  10748. const ErrorTypeStrings = ErrorTypeStrings$1 ;
  10749. const devtools = devtools$1 ;
  10750. const setDevtoolsHook = setDevtoolsHook$1 ;
  10751. const _ssrUtils = {
  10752. createComponentInstance,
  10753. setupComponent,
  10754. renderComponentRoot,
  10755. setCurrentRenderingInstance,
  10756. isVNode: isVNode,
  10757. normalizeVNode,
  10758. getComponentPublicInstance,
  10759. ensureValidVNode,
  10760. pushWarningContext,
  10761. popWarningContext
  10762. };
  10763. const ssrUtils = _ssrUtils ;
  10764. const resolveFilter = null;
  10765. const compatUtils = null;
  10766. const DeprecationTypes = null;
  10767. let policy = void 0;
  10768. const tt = typeof window !== "undefined" && window.trustedTypes;
  10769. if (tt) {
  10770. try {
  10771. policy = /* @__PURE__ */ tt.createPolicy("vue", {
  10772. createHTML: (val) => val
  10773. });
  10774. } catch (e) {
  10775. warn(`Error creating trusted types policy: ${e}`);
  10776. }
  10777. }
  10778. const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
  10779. const svgNS = "http://www.w3.org/2000/svg";
  10780. const mathmlNS = "http://www.w3.org/1998/Math/MathML";
  10781. const doc = typeof document !== "undefined" ? document : null;
  10782. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  10783. const nodeOps = {
  10784. insert: (child, parent, anchor) => {
  10785. parent.insertBefore(child, anchor || null);
  10786. },
  10787. remove: (child) => {
  10788. const parent = child.parentNode;
  10789. if (parent) {
  10790. parent.removeChild(child);
  10791. }
  10792. },
  10793. createElement: (tag, namespace, is, props) => {
  10794. const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
  10795. if (tag === "select" && props && props.multiple != null) {
  10796. el.setAttribute("multiple", props.multiple);
  10797. }
  10798. return el;
  10799. },
  10800. createText: (text) => doc.createTextNode(text),
  10801. createComment: (text) => doc.createComment(text),
  10802. setText: (node, text) => {
  10803. node.nodeValue = text;
  10804. },
  10805. setElementText: (el, text) => {
  10806. el.textContent = text;
  10807. },
  10808. parentNode: (node) => node.parentNode,
  10809. nextSibling: (node) => node.nextSibling,
  10810. querySelector: (selector) => doc.querySelector(selector),
  10811. setScopeId(el, id) {
  10812. el.setAttribute(id, "");
  10813. },
  10814. // __UNSAFE__
  10815. // Reason: innerHTML.
  10816. // Static content here can only come from compiled templates.
  10817. // As long as the user only uses trusted templates, this is safe.
  10818. insertStaticContent(content, parent, anchor, namespace, start, end) {
  10819. const before = anchor ? anchor.previousSibling : parent.lastChild;
  10820. if (start && (start === end || start.nextSibling)) {
  10821. while (true) {
  10822. parent.insertBefore(start.cloneNode(true), anchor);
  10823. if (start === end || !(start = start.nextSibling)) break;
  10824. }
  10825. } else {
  10826. templateContainer.innerHTML = unsafeToTrustedHTML(
  10827. namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
  10828. );
  10829. const template = templateContainer.content;
  10830. if (namespace === "svg" || namespace === "mathml") {
  10831. const wrapper = template.firstChild;
  10832. while (wrapper.firstChild) {
  10833. template.appendChild(wrapper.firstChild);
  10834. }
  10835. template.removeChild(wrapper);
  10836. }
  10837. parent.insertBefore(template, anchor);
  10838. }
  10839. return [
  10840. // first
  10841. before ? before.nextSibling : parent.firstChild,
  10842. // last
  10843. anchor ? anchor.previousSibling : parent.lastChild
  10844. ];
  10845. }
  10846. };
  10847. const TRANSITION = "transition";
  10848. const ANIMATION = "animation";
  10849. const vtcKey = /* @__PURE__ */ Symbol("_vtc");
  10850. const DOMTransitionPropsValidators = {
  10851. name: String,
  10852. type: String,
  10853. css: {
  10854. type: Boolean,
  10855. default: true
  10856. },
  10857. duration: [String, Number, Object],
  10858. enterFromClass: String,
  10859. enterActiveClass: String,
  10860. enterToClass: String,
  10861. appearFromClass: String,
  10862. appearActiveClass: String,
  10863. appearToClass: String,
  10864. leaveFromClass: String,
  10865. leaveActiveClass: String,
  10866. leaveToClass: String
  10867. };
  10868. const TransitionPropsValidators = /* @__PURE__ */ extend(
  10869. {},
  10870. BaseTransitionPropsValidators,
  10871. DOMTransitionPropsValidators
  10872. );
  10873. const decorate$1 = (t) => {
  10874. t.displayName = "Transition";
  10875. t.props = TransitionPropsValidators;
  10876. return t;
  10877. };
  10878. const Transition = /* @__PURE__ */ decorate$1(
  10879. (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
  10880. );
  10881. const callHook = (hook, args = []) => {
  10882. if (isArray(hook)) {
  10883. hook.forEach((h2) => h2(...args));
  10884. } else if (hook) {
  10885. hook(...args);
  10886. }
  10887. };
  10888. const hasExplicitCallback = (hook) => {
  10889. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  10890. };
  10891. function resolveTransitionProps(rawProps) {
  10892. const baseProps = {};
  10893. for (const key in rawProps) {
  10894. if (!(key in DOMTransitionPropsValidators)) {
  10895. baseProps[key] = rawProps[key];
  10896. }
  10897. }
  10898. if (rawProps.css === false) {
  10899. return baseProps;
  10900. }
  10901. const {
  10902. name = "v",
  10903. type,
  10904. duration,
  10905. enterFromClass = `${name}-enter-from`,
  10906. enterActiveClass = `${name}-enter-active`,
  10907. enterToClass = `${name}-enter-to`,
  10908. appearFromClass = enterFromClass,
  10909. appearActiveClass = enterActiveClass,
  10910. appearToClass = enterToClass,
  10911. leaveFromClass = `${name}-leave-from`,
  10912. leaveActiveClass = `${name}-leave-active`,
  10913. leaveToClass = `${name}-leave-to`
  10914. } = rawProps;
  10915. const durations = normalizeDuration(duration);
  10916. const enterDuration = durations && durations[0];
  10917. const leaveDuration = durations && durations[1];
  10918. const {
  10919. onBeforeEnter,
  10920. onEnter,
  10921. onEnterCancelled,
  10922. onLeave,
  10923. onLeaveCancelled,
  10924. onBeforeAppear = onBeforeEnter,
  10925. onAppear = onEnter,
  10926. onAppearCancelled = onEnterCancelled
  10927. } = baseProps;
  10928. const finishEnter = (el, isAppear, done, isCancelled) => {
  10929. el._enterCancelled = isCancelled;
  10930. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10931. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  10932. done && done();
  10933. };
  10934. const finishLeave = (el, done) => {
  10935. el._isLeaving = false;
  10936. removeTransitionClass(el, leaveFromClass);
  10937. removeTransitionClass(el, leaveToClass);
  10938. removeTransitionClass(el, leaveActiveClass);
  10939. done && done();
  10940. };
  10941. const makeEnterHook = (isAppear) => {
  10942. return (el, done) => {
  10943. const hook = isAppear ? onAppear : onEnter;
  10944. const resolve = () => finishEnter(el, isAppear, done);
  10945. callHook(hook, [el, resolve]);
  10946. nextFrame(() => {
  10947. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  10948. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  10949. if (!hasExplicitCallback(hook)) {
  10950. whenTransitionEnds(el, type, enterDuration, resolve);
  10951. }
  10952. });
  10953. };
  10954. };
  10955. return extend(baseProps, {
  10956. onBeforeEnter(el) {
  10957. callHook(onBeforeEnter, [el]);
  10958. addTransitionClass(el, enterFromClass);
  10959. addTransitionClass(el, enterActiveClass);
  10960. },
  10961. onBeforeAppear(el) {
  10962. callHook(onBeforeAppear, [el]);
  10963. addTransitionClass(el, appearFromClass);
  10964. addTransitionClass(el, appearActiveClass);
  10965. },
  10966. onEnter: makeEnterHook(false),
  10967. onAppear: makeEnterHook(true),
  10968. onLeave(el, done) {
  10969. el._isLeaving = true;
  10970. const resolve = () => finishLeave(el, done);
  10971. addTransitionClass(el, leaveFromClass);
  10972. if (!el._enterCancelled) {
  10973. forceReflow(el);
  10974. addTransitionClass(el, leaveActiveClass);
  10975. } else {
  10976. addTransitionClass(el, leaveActiveClass);
  10977. forceReflow(el);
  10978. }
  10979. nextFrame(() => {
  10980. if (!el._isLeaving) {
  10981. return;
  10982. }
  10983. removeTransitionClass(el, leaveFromClass);
  10984. addTransitionClass(el, leaveToClass);
  10985. if (!hasExplicitCallback(onLeave)) {
  10986. whenTransitionEnds(el, type, leaveDuration, resolve);
  10987. }
  10988. });
  10989. callHook(onLeave, [el, resolve]);
  10990. },
  10991. onEnterCancelled(el) {
  10992. finishEnter(el, false, void 0, true);
  10993. callHook(onEnterCancelled, [el]);
  10994. },
  10995. onAppearCancelled(el) {
  10996. finishEnter(el, true, void 0, true);
  10997. callHook(onAppearCancelled, [el]);
  10998. },
  10999. onLeaveCancelled(el) {
  11000. finishLeave(el);
  11001. callHook(onLeaveCancelled, [el]);
  11002. }
  11003. });
  11004. }
  11005. function normalizeDuration(duration) {
  11006. if (duration == null) {
  11007. return null;
  11008. } else if (isObject(duration)) {
  11009. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  11010. } else {
  11011. const n = NumberOf(duration);
  11012. return [n, n];
  11013. }
  11014. }
  11015. function NumberOf(val) {
  11016. const res = toNumber(val);
  11017. {
  11018. assertNumber(res, "<transition> explicit duration");
  11019. }
  11020. return res;
  11021. }
  11022. function addTransitionClass(el, cls) {
  11023. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  11024. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  11025. }
  11026. function removeTransitionClass(el, cls) {
  11027. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  11028. const _vtc = el[vtcKey];
  11029. if (_vtc) {
  11030. _vtc.delete(cls);
  11031. if (!_vtc.size) {
  11032. el[vtcKey] = void 0;
  11033. }
  11034. }
  11035. }
  11036. function nextFrame(cb) {
  11037. requestAnimationFrame(() => {
  11038. requestAnimationFrame(cb);
  11039. });
  11040. }
  11041. let endId = 0;
  11042. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  11043. const id = el._endId = ++endId;
  11044. const resolveIfNotStale = () => {
  11045. if (id === el._endId) {
  11046. resolve();
  11047. }
  11048. };
  11049. if (explicitTimeout != null) {
  11050. return setTimeout(resolveIfNotStale, explicitTimeout);
  11051. }
  11052. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  11053. if (!type) {
  11054. return resolve();
  11055. }
  11056. const endEvent = type + "end";
  11057. let ended = 0;
  11058. const end = () => {
  11059. el.removeEventListener(endEvent, onEnd);
  11060. resolveIfNotStale();
  11061. };
  11062. const onEnd = (e) => {
  11063. if (e.target === el && ++ended >= propCount) {
  11064. end();
  11065. }
  11066. };
  11067. setTimeout(() => {
  11068. if (ended < propCount) {
  11069. end();
  11070. }
  11071. }, timeout + 1);
  11072. el.addEventListener(endEvent, onEnd);
  11073. }
  11074. function getTransitionInfo(el, expectedType) {
  11075. const styles = window.getComputedStyle(el);
  11076. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  11077. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  11078. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  11079. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  11080. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  11081. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  11082. const animationTimeout = getTimeout(animationDelays, animationDurations);
  11083. let type = null;
  11084. let timeout = 0;
  11085. let propCount = 0;
  11086. if (expectedType === TRANSITION) {
  11087. if (transitionTimeout > 0) {
  11088. type = TRANSITION;
  11089. timeout = transitionTimeout;
  11090. propCount = transitionDurations.length;
  11091. }
  11092. } else if (expectedType === ANIMATION) {
  11093. if (animationTimeout > 0) {
  11094. type = ANIMATION;
  11095. timeout = animationTimeout;
  11096. propCount = animationDurations.length;
  11097. }
  11098. } else {
  11099. timeout = Math.max(transitionTimeout, animationTimeout);
  11100. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  11101. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  11102. }
  11103. const hasTransform = type === TRANSITION && /\b(?:transform|all)(?:,|$)/.test(
  11104. getStyleProperties(`${TRANSITION}Property`).toString()
  11105. );
  11106. return {
  11107. type,
  11108. timeout,
  11109. propCount,
  11110. hasTransform
  11111. };
  11112. }
  11113. function getTimeout(delays, durations) {
  11114. while (delays.length < durations.length) {
  11115. delays = delays.concat(delays);
  11116. }
  11117. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  11118. }
  11119. function toMs(s) {
  11120. if (s === "auto") return 0;
  11121. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  11122. }
  11123. function forceReflow(el) {
  11124. const targetDocument = el ? el.ownerDocument : document;
  11125. return targetDocument.body.offsetHeight;
  11126. }
  11127. function patchClass(el, value, isSVG) {
  11128. const transitionClasses = el[vtcKey];
  11129. if (transitionClasses) {
  11130. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  11131. }
  11132. if (value == null) {
  11133. el.removeAttribute("class");
  11134. } else if (isSVG) {
  11135. el.setAttribute("class", value);
  11136. } else {
  11137. el.className = value;
  11138. }
  11139. }
  11140. const vShowOriginalDisplay = /* @__PURE__ */ Symbol("_vod");
  11141. const vShowHidden = /* @__PURE__ */ Symbol("_vsh");
  11142. const vShow = {
  11143. // used for prop mismatch check during hydration
  11144. name: "show",
  11145. beforeMount(el, { value }, { transition }) {
  11146. el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
  11147. if (transition && value) {
  11148. transition.beforeEnter(el);
  11149. } else {
  11150. setDisplay(el, value);
  11151. }
  11152. },
  11153. mounted(el, { value }, { transition }) {
  11154. if (transition && value) {
  11155. transition.enter(el);
  11156. }
  11157. },
  11158. updated(el, { value, oldValue }, { transition }) {
  11159. if (!value === !oldValue) return;
  11160. if (transition) {
  11161. if (value) {
  11162. transition.beforeEnter(el);
  11163. setDisplay(el, true);
  11164. transition.enter(el);
  11165. } else {
  11166. transition.leave(el, () => {
  11167. setDisplay(el, false);
  11168. });
  11169. }
  11170. } else {
  11171. setDisplay(el, value);
  11172. }
  11173. },
  11174. beforeUnmount(el, { value }) {
  11175. setDisplay(el, value);
  11176. }
  11177. };
  11178. function setDisplay(el, value) {
  11179. el.style.display = value ? el[vShowOriginalDisplay] : "none";
  11180. el[vShowHidden] = !value;
  11181. }
  11182. function initVShowForSSR() {
  11183. vShow.getSSRProps = ({ value }) => {
  11184. if (!value) {
  11185. return { style: { display: "none" } };
  11186. }
  11187. };
  11188. }
  11189. const CSS_VAR_TEXT = /* @__PURE__ */ Symbol("CSS_VAR_TEXT" );
  11190. function useCssVars(getter) {
  11191. const instance = getCurrentInstance();
  11192. if (!instance) {
  11193. warn(`useCssVars is called without current active component instance.`);
  11194. return;
  11195. }
  11196. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  11197. Array.from(
  11198. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  11199. ).forEach((node) => setVarsOnNode(node, vars));
  11200. };
  11201. {
  11202. instance.getCssVars = () => getter(instance.proxy);
  11203. }
  11204. const setVars = () => {
  11205. const vars = getter(instance.proxy);
  11206. if (instance.ce) {
  11207. setVarsOnNode(instance.ce, vars);
  11208. } else {
  11209. setVarsOnVNode(instance.subTree, vars);
  11210. }
  11211. updateTeleports(vars);
  11212. };
  11213. onBeforeUpdate(() => {
  11214. queuePostFlushCb(setVars);
  11215. });
  11216. onMounted(() => {
  11217. watch(setVars, NOOP, { flush: "post" });
  11218. const ob = new MutationObserver(setVars);
  11219. ob.observe(instance.subTree.el.parentNode, { childList: true });
  11220. onUnmounted(() => ob.disconnect());
  11221. });
  11222. }
  11223. function setVarsOnVNode(vnode, vars) {
  11224. if (vnode.shapeFlag & 128) {
  11225. const suspense = vnode.suspense;
  11226. vnode = suspense.activeBranch;
  11227. if (suspense.pendingBranch && !suspense.isHydrating) {
  11228. suspense.effects.push(() => {
  11229. setVarsOnVNode(suspense.activeBranch, vars);
  11230. });
  11231. }
  11232. }
  11233. while (vnode.component) {
  11234. vnode = vnode.component.subTree;
  11235. }
  11236. if (vnode.shapeFlag & 1 && vnode.el) {
  11237. setVarsOnNode(vnode.el, vars);
  11238. } else if (vnode.type === Fragment) {
  11239. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  11240. } else if (vnode.type === Static) {
  11241. let { el, anchor } = vnode;
  11242. while (el) {
  11243. setVarsOnNode(el, vars);
  11244. if (el === anchor) break;
  11245. el = el.nextSibling;
  11246. }
  11247. }
  11248. }
  11249. function setVarsOnNode(el, vars) {
  11250. if (el.nodeType === 1) {
  11251. const style = el.style;
  11252. let cssText = "";
  11253. for (const key in vars) {
  11254. const value = normalizeCssVarValue(vars[key]);
  11255. style.setProperty(`--${key}`, value);
  11256. cssText += `--${key}: ${value};`;
  11257. }
  11258. style[CSS_VAR_TEXT] = cssText;
  11259. }
  11260. }
  11261. const displayRE = /(?:^|;)\s*display\s*:/;
  11262. function patchStyle(el, prev, next) {
  11263. const style = el.style;
  11264. const isCssString = isString(next);
  11265. let hasControlledDisplay = false;
  11266. if (next && !isCssString) {
  11267. if (prev) {
  11268. if (!isString(prev)) {
  11269. for (const key in prev) {
  11270. if (next[key] == null) {
  11271. setStyle(style, key, "");
  11272. }
  11273. }
  11274. } else {
  11275. for (const prevStyle of prev.split(";")) {
  11276. const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
  11277. if (next[key] == null) {
  11278. setStyle(style, key, "");
  11279. }
  11280. }
  11281. }
  11282. }
  11283. for (const key in next) {
  11284. if (key === "display") {
  11285. hasControlledDisplay = true;
  11286. }
  11287. const value = next[key];
  11288. if (value != null) {
  11289. if (!shouldPreserveTextareaResizeStyle(
  11290. el,
  11291. key,
  11292. !isString(prev) && prev ? prev[key] : void 0,
  11293. value
  11294. )) {
  11295. setStyle(style, key, value);
  11296. }
  11297. } else {
  11298. setStyle(style, key, "");
  11299. }
  11300. }
  11301. } else {
  11302. if (isCssString) {
  11303. if (prev !== next) {
  11304. const cssVarText = style[CSS_VAR_TEXT];
  11305. if (cssVarText) {
  11306. next += ";" + cssVarText;
  11307. }
  11308. style.cssText = next;
  11309. hasControlledDisplay = displayRE.test(next);
  11310. }
  11311. } else if (prev) {
  11312. el.removeAttribute("style");
  11313. }
  11314. }
  11315. if (vShowOriginalDisplay in el) {
  11316. el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
  11317. if (el[vShowHidden]) {
  11318. style.display = "none";
  11319. }
  11320. }
  11321. }
  11322. const semicolonRE = /[^\\];\s*$/;
  11323. const importantRE = /\s*!important$/;
  11324. function setStyle(style, name, val) {
  11325. if (isArray(val)) {
  11326. val.forEach((v) => setStyle(style, name, v));
  11327. } else {
  11328. if (val == null) val = "";
  11329. {
  11330. if (semicolonRE.test(val)) {
  11331. warn(
  11332. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  11333. );
  11334. }
  11335. }
  11336. if (name.startsWith("--")) {
  11337. style.setProperty(name, val);
  11338. } else {
  11339. const prefixed = autoPrefix(style, name);
  11340. if (importantRE.test(val)) {
  11341. style.setProperty(
  11342. hyphenate(prefixed),
  11343. val.replace(importantRE, ""),
  11344. "important"
  11345. );
  11346. } else {
  11347. style[prefixed] = val;
  11348. }
  11349. }
  11350. }
  11351. }
  11352. const prefixes = ["Webkit", "Moz", "ms"];
  11353. const prefixCache = {};
  11354. function autoPrefix(style, rawName) {
  11355. const cached = prefixCache[rawName];
  11356. if (cached) {
  11357. return cached;
  11358. }
  11359. let name = camelize(rawName);
  11360. if (name !== "filter" && name in style) {
  11361. return prefixCache[rawName] = name;
  11362. }
  11363. name = capitalize(name);
  11364. for (let i = 0; i < prefixes.length; i++) {
  11365. const prefixed = prefixes[i] + name;
  11366. if (prefixed in style) {
  11367. return prefixCache[rawName] = prefixed;
  11368. }
  11369. }
  11370. return rawName;
  11371. }
  11372. function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
  11373. return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
  11374. }
  11375. const xlinkNS = "http://www.w3.org/1999/xlink";
  11376. function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
  11377. if (isSVG && key.startsWith("xlink:")) {
  11378. if (value == null) {
  11379. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  11380. } else {
  11381. el.setAttributeNS(xlinkNS, key, value);
  11382. }
  11383. } else {
  11384. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  11385. el.removeAttribute(key);
  11386. } else {
  11387. el.setAttribute(
  11388. key,
  11389. isBoolean ? "" : isSymbol(value) ? String(value) : value
  11390. );
  11391. }
  11392. }
  11393. }
  11394. function patchDOMProp(el, key, value, parentComponent, attrName) {
  11395. if (key === "innerHTML" || key === "textContent") {
  11396. if (value != null) {
  11397. el[key] = key === "innerHTML" ? unsafeToTrustedHTML(value) : value;
  11398. }
  11399. return;
  11400. }
  11401. const tag = el.tagName;
  11402. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  11403. !tag.includes("-")) {
  11404. const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
  11405. const newValue = value == null ? (
  11406. // #11647: value should be set as empty string for null and undefined,
  11407. // but <input type="checkbox"> should be set as 'on'.
  11408. el.type === "checkbox" ? "on" : ""
  11409. ) : String(value);
  11410. if (oldValue !== newValue || !("_value" in el)) {
  11411. el.value = newValue;
  11412. }
  11413. if (value == null) {
  11414. el.removeAttribute(key);
  11415. }
  11416. el._value = value;
  11417. return;
  11418. }
  11419. let needRemove = false;
  11420. if (value === "" || value == null) {
  11421. const type = typeof el[key];
  11422. if (type === "boolean") {
  11423. value = includeBooleanAttr(value);
  11424. } else if (value == null && type === "string") {
  11425. value = "";
  11426. needRemove = true;
  11427. } else if (type === "number") {
  11428. value = 0;
  11429. needRemove = true;
  11430. }
  11431. }
  11432. try {
  11433. el[key] = value;
  11434. } catch (e) {
  11435. if (!needRemove) {
  11436. warn(
  11437. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  11438. e
  11439. );
  11440. }
  11441. }
  11442. needRemove && el.removeAttribute(attrName || key);
  11443. }
  11444. function addEventListener(el, event, handler, options) {
  11445. el.addEventListener(event, handler, options);
  11446. }
  11447. function removeEventListener(el, event, handler, options) {
  11448. el.removeEventListener(event, handler, options);
  11449. }
  11450. const veiKey = /* @__PURE__ */ Symbol("_vei");
  11451. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  11452. const invokers = el[veiKey] || (el[veiKey] = {});
  11453. const existingInvoker = invokers[rawName];
  11454. if (nextValue && existingInvoker) {
  11455. existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
  11456. } else {
  11457. const [name, options] = parseName(rawName);
  11458. if (nextValue) {
  11459. const invoker = invokers[rawName] = createInvoker(
  11460. sanitizeEventValue(nextValue, rawName) ,
  11461. instance
  11462. );
  11463. addEventListener(el, name, invoker, options);
  11464. } else if (existingInvoker) {
  11465. removeEventListener(el, name, existingInvoker, options);
  11466. invokers[rawName] = void 0;
  11467. }
  11468. }
  11469. }
  11470. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  11471. function parseName(name) {
  11472. let options;
  11473. if (optionsModifierRE.test(name)) {
  11474. options = {};
  11475. let m;
  11476. while (m = name.match(optionsModifierRE)) {
  11477. name = name.slice(0, name.length - m[0].length);
  11478. options[m[0].toLowerCase()] = true;
  11479. }
  11480. }
  11481. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  11482. return [event, options];
  11483. }
  11484. let cachedNow = 0;
  11485. const p = /* @__PURE__ */ Promise.resolve();
  11486. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  11487. function createInvoker(initialValue, instance) {
  11488. const invoker = (e) => {
  11489. if (!e._vts) {
  11490. e._vts = Date.now();
  11491. } else if (e._vts <= invoker.attached) {
  11492. return;
  11493. }
  11494. callWithAsyncErrorHandling(
  11495. patchStopImmediatePropagation(e, invoker.value),
  11496. instance,
  11497. 5,
  11498. [e]
  11499. );
  11500. };
  11501. invoker.value = initialValue;
  11502. invoker.attached = getNow();
  11503. return invoker;
  11504. }
  11505. function sanitizeEventValue(value, propName) {
  11506. if (isFunction(value) || isArray(value)) {
  11507. return value;
  11508. }
  11509. warn(
  11510. `Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
  11511. Expected function or array of functions, received type ${typeof value}.`
  11512. );
  11513. return NOOP;
  11514. }
  11515. function patchStopImmediatePropagation(e, value) {
  11516. if (isArray(value)) {
  11517. const originalStop = e.stopImmediatePropagation;
  11518. e.stopImmediatePropagation = () => {
  11519. originalStop.call(e);
  11520. e._stopped = true;
  11521. };
  11522. return value.map(
  11523. (fn) => (e2) => !e2._stopped && fn && fn(e2)
  11524. );
  11525. } else {
  11526. return value;
  11527. }
  11528. }
  11529. const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
  11530. key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
  11531. const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
  11532. const isSVG = namespace === "svg";
  11533. if (key === "class") {
  11534. patchClass(el, nextValue, isSVG);
  11535. } else if (key === "style") {
  11536. patchStyle(el, prevValue, nextValue);
  11537. } else if (isOn(key)) {
  11538. if (!isModelListener(key)) {
  11539. patchEvent(el, key, prevValue, nextValue, parentComponent);
  11540. }
  11541. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  11542. patchDOMProp(el, key, nextValue);
  11543. if (!el.tagName.includes("-") && (key === "value" || key === "checked" || key === "selected")) {
  11544. patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
  11545. }
  11546. } else if (
  11547. // #11081 force set props for possible async custom element
  11548. el._isVueCE && // #12408 check if it's declared prop or it's async custom element
  11549. (shouldSetAsPropForVueCE(el, key) || // @ts-expect-error _def is private
  11550. el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(nextValue)))
  11551. ) {
  11552. patchDOMProp(el, camelize(key), nextValue, parentComponent, key);
  11553. } else {
  11554. if (key === "true-value") {
  11555. el._trueValue = nextValue;
  11556. } else if (key === "false-value") {
  11557. el._falseValue = nextValue;
  11558. }
  11559. patchAttr(el, key, nextValue, isSVG);
  11560. }
  11561. };
  11562. function shouldSetAsProp(el, key, value, isSVG) {
  11563. if (isSVG) {
  11564. if (key === "innerHTML" || key === "textContent") {
  11565. return true;
  11566. }
  11567. if (key in el && isNativeOn(key) && isFunction(value)) {
  11568. return true;
  11569. }
  11570. return false;
  11571. }
  11572. if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
  11573. return false;
  11574. }
  11575. if (key === "sandbox" && el.tagName === "IFRAME") {
  11576. return false;
  11577. }
  11578. if (key === "form") {
  11579. return false;
  11580. }
  11581. if (key === "list" && el.tagName === "INPUT") {
  11582. return false;
  11583. }
  11584. if (key === "type" && el.tagName === "TEXTAREA") {
  11585. return false;
  11586. }
  11587. if (key === "width" || key === "height") {
  11588. const tag = el.tagName;
  11589. if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
  11590. return false;
  11591. }
  11592. }
  11593. if (isNativeOn(key) && isString(value)) {
  11594. return false;
  11595. }
  11596. return key in el;
  11597. }
  11598. function shouldSetAsPropForVueCE(el, key) {
  11599. const props = (
  11600. // @ts-expect-error _def is private
  11601. el._def.props
  11602. );
  11603. if (!props) {
  11604. return false;
  11605. }
  11606. const camelKey = camelize(key);
  11607. return Array.isArray(props) ? props.some((prop) => camelize(prop) === camelKey) : Object.keys(props).some((prop) => camelize(prop) === camelKey);
  11608. }
  11609. const REMOVAL = {};
  11610. // @__NO_SIDE_EFFECTS__
  11611. function defineCustomElement(options, extraOptions, _createApp) {
  11612. let Comp = defineComponent(options, extraOptions);
  11613. if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
  11614. class VueCustomElement extends VueElement {
  11615. constructor(initialProps) {
  11616. super(Comp, initialProps, _createApp);
  11617. }
  11618. }
  11619. VueCustomElement.def = Comp;
  11620. return VueCustomElement;
  11621. }
  11622. const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
  11623. return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
  11624. });
  11625. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  11626. };
  11627. class VueElement extends BaseClass {
  11628. constructor(_def, _props = {}, _createApp = createApp) {
  11629. super();
  11630. this._def = _def;
  11631. this._props = _props;
  11632. this._createApp = _createApp;
  11633. this._isVueCE = true;
  11634. /**
  11635. * @internal
  11636. */
  11637. this._instance = null;
  11638. /**
  11639. * @internal
  11640. */
  11641. this._app = null;
  11642. /**
  11643. * @internal
  11644. */
  11645. this._nonce = this._def.nonce;
  11646. this._connected = false;
  11647. this._resolved = false;
  11648. this._patching = false;
  11649. this._dirty = false;
  11650. this._numberProps = null;
  11651. this._styleChildren = /* @__PURE__ */ new WeakSet();
  11652. this._styleAnchors = /* @__PURE__ */ new WeakMap();
  11653. this._ob = null;
  11654. if (this.shadowRoot && _createApp !== createApp) {
  11655. this._root = this.shadowRoot;
  11656. } else {
  11657. if (this.shadowRoot) {
  11658. warn(
  11659. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  11660. );
  11661. }
  11662. if (_def.shadowRoot !== false) {
  11663. this.attachShadow(
  11664. extend({}, _def.shadowRootOptions, {
  11665. mode: "open"
  11666. })
  11667. );
  11668. this._root = this.shadowRoot;
  11669. } else {
  11670. this._root = this;
  11671. }
  11672. }
  11673. }
  11674. connectedCallback() {
  11675. if (!this.isConnected) return;
  11676. if (!this.shadowRoot && !this._resolved) {
  11677. this._parseSlots();
  11678. }
  11679. this._connected = true;
  11680. let parent = this;
  11681. while (parent = parent && // #12479 should check assignedSlot first to get correct parent
  11682. (parent.assignedSlot || parent.parentNode || parent.host)) {
  11683. if (parent instanceof VueElement) {
  11684. this._parent = parent;
  11685. break;
  11686. }
  11687. }
  11688. if (!this._instance) {
  11689. if (this._resolved) {
  11690. this._mount(this._def);
  11691. } else {
  11692. if (parent && parent._pendingResolve) {
  11693. this._pendingResolve = parent._pendingResolve.then(() => {
  11694. this._pendingResolve = void 0;
  11695. this._resolveDef();
  11696. });
  11697. } else {
  11698. this._resolveDef();
  11699. }
  11700. }
  11701. }
  11702. }
  11703. _setParent(parent = this._parent) {
  11704. if (parent) {
  11705. this._instance.parent = parent._instance;
  11706. this._inheritParentContext(parent);
  11707. }
  11708. }
  11709. _inheritParentContext(parent = this._parent) {
  11710. if (parent && this._app) {
  11711. Object.setPrototypeOf(
  11712. this._app._context.provides,
  11713. parent._instance.provides
  11714. );
  11715. }
  11716. }
  11717. disconnectedCallback() {
  11718. this._connected = false;
  11719. nextTick(() => {
  11720. if (!this._connected) {
  11721. if (this._ob) {
  11722. this._ob.disconnect();
  11723. this._ob = null;
  11724. }
  11725. this._app && this._app.unmount();
  11726. if (this._instance) this._instance.ce = void 0;
  11727. this._app = this._instance = null;
  11728. if (this._teleportTargets) {
  11729. this._teleportTargets.clear();
  11730. this._teleportTargets = void 0;
  11731. }
  11732. }
  11733. });
  11734. }
  11735. _processMutations(mutations) {
  11736. for (const m of mutations) {
  11737. this._setAttr(m.attributeName);
  11738. }
  11739. }
  11740. /**
  11741. * resolve inner component definition (handle possible async component)
  11742. */
  11743. _resolveDef() {
  11744. if (this._pendingResolve) {
  11745. return;
  11746. }
  11747. for (let i = 0; i < this.attributes.length; i++) {
  11748. this._setAttr(this.attributes[i].name);
  11749. }
  11750. this._ob = new MutationObserver(this._processMutations.bind(this));
  11751. this._ob.observe(this, { attributes: true });
  11752. const resolve = (def, isAsync = false) => {
  11753. this._resolved = true;
  11754. this._pendingResolve = void 0;
  11755. const { props, styles } = def;
  11756. let numberProps;
  11757. if (props && !isArray(props)) {
  11758. for (const key in props) {
  11759. const opt = props[key];
  11760. if (opt === Number || opt && opt.type === Number) {
  11761. if (key in this._props) {
  11762. this._props[key] = toNumber(this._props[key]);
  11763. }
  11764. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  11765. }
  11766. }
  11767. }
  11768. this._numberProps = numberProps;
  11769. this._resolveProps(def);
  11770. if (this.shadowRoot) {
  11771. this._applyStyles(styles);
  11772. } else if (styles) {
  11773. warn(
  11774. "Custom element style injection is not supported when using shadowRoot: false"
  11775. );
  11776. }
  11777. this._mount(def);
  11778. };
  11779. const asyncDef = this._def.__asyncLoader;
  11780. if (asyncDef) {
  11781. this._pendingResolve = asyncDef().then((def) => {
  11782. def.configureApp = this._def.configureApp;
  11783. resolve(this._def = def, true);
  11784. });
  11785. } else {
  11786. resolve(this._def);
  11787. }
  11788. }
  11789. _mount(def) {
  11790. if (!def.name) {
  11791. def.name = "VueElement";
  11792. }
  11793. this._app = this._createApp(def);
  11794. this._inheritParentContext();
  11795. if (def.configureApp) {
  11796. def.configureApp(this._app);
  11797. }
  11798. this._app._ceVNode = this._createVNode();
  11799. this._app.mount(this._root);
  11800. const exposed = this._instance && this._instance.exposed;
  11801. if (!exposed) return;
  11802. for (const key in exposed) {
  11803. if (!hasOwn(this, key)) {
  11804. Object.defineProperty(this, key, {
  11805. // unwrap ref to be consistent with public instance behavior
  11806. get: () => unref(exposed[key])
  11807. });
  11808. } else {
  11809. warn(`Exposed property "${key}" already exists on custom element.`);
  11810. }
  11811. }
  11812. }
  11813. _resolveProps(def) {
  11814. const { props } = def;
  11815. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  11816. for (const key of Object.keys(this)) {
  11817. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  11818. this._setProp(key, this[key]);
  11819. }
  11820. }
  11821. for (const key of declaredPropKeys.map(camelize)) {
  11822. Object.defineProperty(this, key, {
  11823. get() {
  11824. return this._getProp(key);
  11825. },
  11826. set(val) {
  11827. this._setProp(key, val, true, !this._patching);
  11828. }
  11829. });
  11830. }
  11831. }
  11832. _setAttr(key) {
  11833. if (key.startsWith("data-v-")) return;
  11834. const has = this.hasAttribute(key);
  11835. let value = has ? this.getAttribute(key) : REMOVAL;
  11836. const camelKey = camelize(key);
  11837. if (has && this._numberProps && this._numberProps[camelKey]) {
  11838. value = toNumber(value);
  11839. }
  11840. this._setProp(camelKey, value, false, true);
  11841. }
  11842. /**
  11843. * @internal
  11844. */
  11845. _getProp(key) {
  11846. return this._props[key];
  11847. }
  11848. /**
  11849. * @internal
  11850. */
  11851. _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
  11852. if (val !== this._props[key]) {
  11853. this._dirty = true;
  11854. if (val === REMOVAL) {
  11855. delete this._props[key];
  11856. } else {
  11857. this._props[key] = val;
  11858. if (key === "key" && this._app) {
  11859. this._app._ceVNode.key = val;
  11860. }
  11861. }
  11862. if (shouldUpdate && this._instance) {
  11863. this._update();
  11864. }
  11865. if (shouldReflect) {
  11866. const ob = this._ob;
  11867. if (ob) {
  11868. this._processMutations(ob.takeRecords());
  11869. ob.disconnect();
  11870. }
  11871. if (val === true) {
  11872. this.setAttribute(hyphenate(key), "");
  11873. } else if (typeof val === "string" || typeof val === "number") {
  11874. this.setAttribute(hyphenate(key), val + "");
  11875. } else if (!val) {
  11876. this.removeAttribute(hyphenate(key));
  11877. }
  11878. ob && ob.observe(this, { attributes: true });
  11879. }
  11880. }
  11881. }
  11882. _update() {
  11883. const vnode = this._createVNode();
  11884. if (this._app) vnode.appContext = this._app._context;
  11885. render(vnode, this._root);
  11886. }
  11887. _createVNode() {
  11888. const baseProps = {};
  11889. if (!this.shadowRoot) {
  11890. baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
  11891. }
  11892. const vnode = createVNode(this._def, extend(baseProps, this._props));
  11893. if (!this._instance) {
  11894. vnode.ce = (instance) => {
  11895. this._instance = instance;
  11896. instance.ce = this;
  11897. instance.isCE = true;
  11898. {
  11899. instance.ceReload = (newStyles) => {
  11900. if (this._styles) {
  11901. this._styles.forEach((s) => this._root.removeChild(s));
  11902. this._styles.length = 0;
  11903. }
  11904. this._styleAnchors.delete(this._def);
  11905. this._applyStyles(newStyles);
  11906. this._instance = null;
  11907. this._update();
  11908. };
  11909. }
  11910. const dispatch = (event, args) => {
  11911. this.dispatchEvent(
  11912. new CustomEvent(
  11913. event,
  11914. isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
  11915. )
  11916. );
  11917. };
  11918. instance.emit = (event, ...args) => {
  11919. dispatch(event, args);
  11920. if (hyphenate(event) !== event) {
  11921. dispatch(hyphenate(event), args);
  11922. }
  11923. };
  11924. this._setParent();
  11925. };
  11926. }
  11927. return vnode;
  11928. }
  11929. _applyStyles(styles, owner, parentComp) {
  11930. if (!styles) return;
  11931. if (owner) {
  11932. if (owner === this._def || this._styleChildren.has(owner)) {
  11933. return;
  11934. }
  11935. this._styleChildren.add(owner);
  11936. }
  11937. const nonce = this._nonce;
  11938. const root = this.shadowRoot;
  11939. const insertionAnchor = parentComp ? this._getStyleAnchor(parentComp) || this._getStyleAnchor(this._def) : this._getRootStyleInsertionAnchor(root);
  11940. let last = null;
  11941. for (let i = styles.length - 1; i >= 0; i--) {
  11942. const s = document.createElement("style");
  11943. if (nonce) s.setAttribute("nonce", nonce);
  11944. s.textContent = styles[i];
  11945. root.insertBefore(s, last || insertionAnchor);
  11946. last = s;
  11947. if (i === 0) {
  11948. if (!parentComp) this._styleAnchors.set(this._def, s);
  11949. if (owner) this._styleAnchors.set(owner, s);
  11950. }
  11951. {
  11952. if (owner) {
  11953. if (owner.__hmrId) {
  11954. if (!this._childStyles) this._childStyles = /* @__PURE__ */ new Map();
  11955. let entry = this._childStyles.get(owner.__hmrId);
  11956. if (!entry) {
  11957. this._childStyles.set(owner.__hmrId, entry = []);
  11958. }
  11959. entry.push(s);
  11960. }
  11961. } else {
  11962. (this._styles || (this._styles = [])).push(s);
  11963. }
  11964. }
  11965. }
  11966. }
  11967. _getStyleAnchor(comp) {
  11968. if (!comp) {
  11969. return null;
  11970. }
  11971. const anchor = this._styleAnchors.get(comp);
  11972. if (anchor && anchor.parentNode === this.shadowRoot) {
  11973. return anchor;
  11974. }
  11975. if (anchor) {
  11976. this._styleAnchors.delete(comp);
  11977. }
  11978. return null;
  11979. }
  11980. _getRootStyleInsertionAnchor(root) {
  11981. for (let i = 0; i < root.childNodes.length; i++) {
  11982. const node = root.childNodes[i];
  11983. if (!(node instanceof HTMLStyleElement)) {
  11984. return node;
  11985. }
  11986. }
  11987. return null;
  11988. }
  11989. /**
  11990. * Only called when shadowRoot is false
  11991. */
  11992. _parseSlots() {
  11993. const slots = this._slots = {};
  11994. let n;
  11995. while (n = this.firstChild) {
  11996. const slotName = n.nodeType === 1 && n.getAttribute("slot") || "default";
  11997. (slots[slotName] || (slots[slotName] = [])).push(n);
  11998. this.removeChild(n);
  11999. }
  12000. }
  12001. /**
  12002. * Only called when shadowRoot is false
  12003. */
  12004. _renderSlots() {
  12005. const outlets = this._getSlots();
  12006. const scopeId = this._instance.type.__scopeId;
  12007. for (let i = 0; i < outlets.length; i++) {
  12008. const o = outlets[i];
  12009. const slotName = o.getAttribute("name") || "default";
  12010. const content = this._slots[slotName];
  12011. const parent = o.parentNode;
  12012. if (content) {
  12013. for (const n of content) {
  12014. if (scopeId && n.nodeType === 1) {
  12015. const id = scopeId + "-s";
  12016. const walker = document.createTreeWalker(n, 1);
  12017. n.setAttribute(id, "");
  12018. let child;
  12019. while (child = walker.nextNode()) {
  12020. child.setAttribute(id, "");
  12021. }
  12022. }
  12023. parent.insertBefore(n, o);
  12024. }
  12025. } else {
  12026. while (o.firstChild) parent.insertBefore(o.firstChild, o);
  12027. }
  12028. parent.removeChild(o);
  12029. }
  12030. }
  12031. /**
  12032. * @internal
  12033. */
  12034. _getSlots() {
  12035. const roots = [this];
  12036. if (this._teleportTargets) {
  12037. roots.push(...this._teleportTargets);
  12038. }
  12039. const slots = /* @__PURE__ */ new Set();
  12040. for (const root of roots) {
  12041. const found = root.querySelectorAll("slot");
  12042. for (let i = 0; i < found.length; i++) {
  12043. slots.add(found[i]);
  12044. }
  12045. }
  12046. return Array.from(slots);
  12047. }
  12048. /**
  12049. * @internal
  12050. */
  12051. _injectChildStyle(comp, parentComp) {
  12052. this._applyStyles(comp.styles, comp, parentComp);
  12053. }
  12054. /**
  12055. * @internal
  12056. */
  12057. _beginPatch() {
  12058. this._patching = true;
  12059. this._dirty = false;
  12060. }
  12061. /**
  12062. * @internal
  12063. */
  12064. _endPatch() {
  12065. this._patching = false;
  12066. if (this._dirty && this._instance) {
  12067. this._update();
  12068. }
  12069. }
  12070. /**
  12071. * @internal
  12072. */
  12073. _hasShadowRoot() {
  12074. return this._def.shadowRoot !== false;
  12075. }
  12076. /**
  12077. * @internal
  12078. */
  12079. _removeChildStyle(comp) {
  12080. {
  12081. this._styleChildren.delete(comp);
  12082. this._styleAnchors.delete(comp);
  12083. if (this._childStyles && comp.__hmrId) {
  12084. const oldStyles = this._childStyles.get(comp.__hmrId);
  12085. if (oldStyles) {
  12086. oldStyles.forEach((s) => this._root.removeChild(s));
  12087. oldStyles.length = 0;
  12088. }
  12089. }
  12090. }
  12091. }
  12092. }
  12093. function useHost(caller) {
  12094. const instance = getCurrentInstance();
  12095. const el = instance && instance.ce;
  12096. if (el) {
  12097. return el;
  12098. } else {
  12099. if (!instance) {
  12100. warn(
  12101. `${caller || "useHost"} called without an active component instance.`
  12102. );
  12103. } else {
  12104. warn(
  12105. `${caller || "useHost"} can only be used in components defined via defineCustomElement.`
  12106. );
  12107. }
  12108. }
  12109. return null;
  12110. }
  12111. function useShadowRoot() {
  12112. const el = useHost("useShadowRoot") ;
  12113. return el && el.shadowRoot;
  12114. }
  12115. function useCssModule(name = "$style") {
  12116. {
  12117. const instance = getCurrentInstance();
  12118. if (!instance) {
  12119. warn(`useCssModule must be called inside setup()`);
  12120. return EMPTY_OBJ;
  12121. }
  12122. const modules = instance.type.__cssModules;
  12123. if (!modules) {
  12124. warn(`Current instance does not have CSS modules injected.`);
  12125. return EMPTY_OBJ;
  12126. }
  12127. const mod = modules[name];
  12128. if (!mod) {
  12129. warn(`Current instance does not have CSS module named "${name}".`);
  12130. return EMPTY_OBJ;
  12131. }
  12132. return mod;
  12133. }
  12134. }
  12135. const positionMap = /* @__PURE__ */ new WeakMap();
  12136. const newPositionMap = /* @__PURE__ */ new WeakMap();
  12137. const moveCbKey = /* @__PURE__ */ Symbol("_moveCb");
  12138. const enterCbKey = /* @__PURE__ */ Symbol("_enterCb");
  12139. const decorate = (t) => {
  12140. delete t.props.mode;
  12141. return t;
  12142. };
  12143. const TransitionGroupImpl = /* @__PURE__ */ decorate({
  12144. name: "TransitionGroup",
  12145. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  12146. tag: String,
  12147. moveClass: String
  12148. }),
  12149. setup(props, { slots }) {
  12150. const instance = getCurrentInstance();
  12151. const state = useTransitionState();
  12152. let prevChildren;
  12153. let children;
  12154. onUpdated(() => {
  12155. if (!prevChildren.length) {
  12156. return;
  12157. }
  12158. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  12159. if (!hasCSSTransform(
  12160. prevChildren[0].el,
  12161. instance.vnode.el,
  12162. moveClass
  12163. )) {
  12164. prevChildren = [];
  12165. return;
  12166. }
  12167. prevChildren.forEach(callPendingCbs);
  12168. prevChildren.forEach(recordPosition);
  12169. const movedChildren = prevChildren.filter(applyTranslation);
  12170. forceReflow(instance.vnode.el);
  12171. movedChildren.forEach((c) => {
  12172. const el = c.el;
  12173. const style = el.style;
  12174. addTransitionClass(el, moveClass);
  12175. style.transform = style.webkitTransform = style.transitionDuration = "";
  12176. const cb = el[moveCbKey] = (e) => {
  12177. if (e && e.target !== el) {
  12178. return;
  12179. }
  12180. if (!e || e.propertyName.endsWith("transform")) {
  12181. el.removeEventListener("transitionend", cb);
  12182. el[moveCbKey] = null;
  12183. removeTransitionClass(el, moveClass);
  12184. }
  12185. };
  12186. el.addEventListener("transitionend", cb);
  12187. });
  12188. prevChildren = [];
  12189. });
  12190. return () => {
  12191. const rawProps = toRaw(props);
  12192. const cssTransitionProps = resolveTransitionProps(rawProps);
  12193. let tag = rawProps.tag || Fragment;
  12194. prevChildren = [];
  12195. if (children) {
  12196. for (let i = 0; i < children.length; i++) {
  12197. const child = children[i];
  12198. if (child.el && child.el instanceof Element) {
  12199. prevChildren.push(child);
  12200. setTransitionHooks(
  12201. child,
  12202. resolveTransitionHooks(
  12203. child,
  12204. cssTransitionProps,
  12205. state,
  12206. instance
  12207. )
  12208. );
  12209. positionMap.set(child, getPosition(child.el));
  12210. }
  12211. }
  12212. }
  12213. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  12214. for (let i = 0; i < children.length; i++) {
  12215. const child = children[i];
  12216. if (child.key != null) {
  12217. setTransitionHooks(
  12218. child,
  12219. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  12220. );
  12221. } else if (child.type !== Text) {
  12222. warn(`<TransitionGroup> children must be keyed.`);
  12223. }
  12224. }
  12225. return createVNode(tag, null, children);
  12226. };
  12227. }
  12228. });
  12229. const TransitionGroup = TransitionGroupImpl;
  12230. function callPendingCbs(c) {
  12231. const el = c.el;
  12232. if (el[moveCbKey]) {
  12233. el[moveCbKey]();
  12234. }
  12235. if (el[enterCbKey]) {
  12236. el[enterCbKey]();
  12237. }
  12238. }
  12239. function recordPosition(c) {
  12240. newPositionMap.set(c, getPosition(c.el));
  12241. }
  12242. function applyTranslation(c) {
  12243. const oldPos = positionMap.get(c);
  12244. const newPos = newPositionMap.get(c);
  12245. const dx = oldPos.left - newPos.left;
  12246. const dy = oldPos.top - newPos.top;
  12247. if (dx || dy) {
  12248. const el = c.el;
  12249. const s = el.style;
  12250. const rect = el.getBoundingClientRect();
  12251. let scaleX = 1;
  12252. let scaleY = 1;
  12253. if (el.offsetWidth) scaleX = rect.width / el.offsetWidth;
  12254. if (el.offsetHeight) scaleY = rect.height / el.offsetHeight;
  12255. if (!Number.isFinite(scaleX) || scaleX === 0) scaleX = 1;
  12256. if (!Number.isFinite(scaleY) || scaleY === 0) scaleY = 1;
  12257. if (Math.abs(scaleX - 1) < 0.01) scaleX = 1;
  12258. if (Math.abs(scaleY - 1) < 0.01) scaleY = 1;
  12259. s.transform = s.webkitTransform = `translate(${dx / scaleX}px,${dy / scaleY}px)`;
  12260. s.transitionDuration = "0s";
  12261. return c;
  12262. }
  12263. }
  12264. function getPosition(el) {
  12265. const rect = el.getBoundingClientRect();
  12266. return {
  12267. left: rect.left,
  12268. top: rect.top
  12269. };
  12270. }
  12271. function hasCSSTransform(el, root, moveClass) {
  12272. const clone = el.cloneNode();
  12273. const _vtc = el[vtcKey];
  12274. if (_vtc) {
  12275. _vtc.forEach((cls) => {
  12276. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  12277. });
  12278. }
  12279. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  12280. clone.style.display = "none";
  12281. const container = root.nodeType === 1 ? root : root.parentNode;
  12282. container.appendChild(clone);
  12283. const { hasTransform } = getTransitionInfo(clone);
  12284. container.removeChild(clone);
  12285. return hasTransform;
  12286. }
  12287. const getModelAssigner = (vnode) => {
  12288. const fn = vnode.props["onUpdate:modelValue"] || false;
  12289. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  12290. };
  12291. function onCompositionStart(e) {
  12292. e.target.composing = true;
  12293. }
  12294. function onCompositionEnd(e) {
  12295. const target = e.target;
  12296. if (target.composing) {
  12297. target.composing = false;
  12298. target.dispatchEvent(new Event("input"));
  12299. }
  12300. }
  12301. const assignKey = /* @__PURE__ */ Symbol("_assign");
  12302. function castValue(value, trim, number) {
  12303. if (trim) value = value.trim();
  12304. if (number) value = looseToNumber(value);
  12305. return value;
  12306. }
  12307. const vModelText = {
  12308. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  12309. el[assignKey] = getModelAssigner(vnode);
  12310. const castToNumber = number || vnode.props && vnode.props.type === "number";
  12311. addEventListener(el, lazy ? "change" : "input", (e) => {
  12312. if (e.target.composing) return;
  12313. el[assignKey](castValue(el.value, trim, castToNumber));
  12314. });
  12315. if (trim || castToNumber) {
  12316. addEventListener(el, "change", () => {
  12317. el.value = castValue(el.value, trim, castToNumber);
  12318. });
  12319. }
  12320. if (!lazy) {
  12321. addEventListener(el, "compositionstart", onCompositionStart);
  12322. addEventListener(el, "compositionend", onCompositionEnd);
  12323. addEventListener(el, "change", onCompositionEnd);
  12324. }
  12325. },
  12326. // set value on mounted so it's after min/max for type="range"
  12327. mounted(el, { value }) {
  12328. el.value = value == null ? "" : value;
  12329. },
  12330. beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
  12331. el[assignKey] = getModelAssigner(vnode);
  12332. if (el.composing) return;
  12333. const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
  12334. const newValue = value == null ? "" : value;
  12335. if (elValue === newValue) {
  12336. return;
  12337. }
  12338. const rootNode = el.getRootNode();
  12339. if ((rootNode instanceof Document || rootNode instanceof ShadowRoot) && rootNode.activeElement === el && el.type !== "range") {
  12340. if (lazy && value === oldValue) {
  12341. return;
  12342. }
  12343. if (trim && el.value.trim() === newValue) {
  12344. return;
  12345. }
  12346. }
  12347. el.value = newValue;
  12348. }
  12349. };
  12350. const vModelCheckbox = {
  12351. // #4096 array checkboxes need to be deep traversed
  12352. deep: true,
  12353. created(el, _, vnode) {
  12354. el[assignKey] = getModelAssigner(vnode);
  12355. addEventListener(el, "change", () => {
  12356. const modelValue = el._modelValue;
  12357. const elementValue = getValue(el);
  12358. const checked = el.checked;
  12359. const assign = el[assignKey];
  12360. if (isArray(modelValue)) {
  12361. const index = looseIndexOf(modelValue, elementValue);
  12362. const found = index !== -1;
  12363. if (checked && !found) {
  12364. assign(modelValue.concat(elementValue));
  12365. } else if (!checked && found) {
  12366. const filtered = [...modelValue];
  12367. filtered.splice(index, 1);
  12368. assign(filtered);
  12369. }
  12370. } else if (isSet(modelValue)) {
  12371. const cloned = new Set(modelValue);
  12372. if (checked) {
  12373. cloned.add(elementValue);
  12374. } else {
  12375. cloned.delete(elementValue);
  12376. }
  12377. assign(cloned);
  12378. } else {
  12379. assign(getCheckboxValue(el, checked));
  12380. }
  12381. });
  12382. },
  12383. // set initial checked on mount to wait for true-value/false-value
  12384. mounted: setChecked,
  12385. beforeUpdate(el, binding, vnode) {
  12386. el[assignKey] = getModelAssigner(vnode);
  12387. setChecked(el, binding, vnode);
  12388. }
  12389. };
  12390. function setChecked(el, { value, oldValue }, vnode) {
  12391. el._modelValue = value;
  12392. let checked;
  12393. if (isArray(value)) {
  12394. checked = looseIndexOf(value, vnode.props.value) > -1;
  12395. } else if (isSet(value)) {
  12396. checked = value.has(vnode.props.value);
  12397. } else {
  12398. if (value === oldValue) return;
  12399. checked = looseEqual(value, getCheckboxValue(el, true));
  12400. }
  12401. if (el.checked !== checked) {
  12402. el.checked = checked;
  12403. }
  12404. }
  12405. const vModelRadio = {
  12406. created(el, { value }, vnode) {
  12407. el.checked = looseEqual(value, vnode.props.value);
  12408. el[assignKey] = getModelAssigner(vnode);
  12409. addEventListener(el, "change", () => {
  12410. el[assignKey](getValue(el));
  12411. });
  12412. },
  12413. beforeUpdate(el, { value, oldValue }, vnode) {
  12414. el[assignKey] = getModelAssigner(vnode);
  12415. if (value !== oldValue) {
  12416. el.checked = looseEqual(value, vnode.props.value);
  12417. }
  12418. }
  12419. };
  12420. const vModelSelect = {
  12421. // <select multiple> value need to be deep traversed
  12422. deep: true,
  12423. created(el, { value, modifiers: { number } }, vnode) {
  12424. const isSetModel = isSet(value);
  12425. addEventListener(el, "change", () => {
  12426. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  12427. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  12428. );
  12429. el[assignKey](
  12430. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  12431. );
  12432. el._assigning = true;
  12433. nextTick(() => {
  12434. el._assigning = false;
  12435. });
  12436. });
  12437. el[assignKey] = getModelAssigner(vnode);
  12438. },
  12439. // set value in mounted & updated because <select> relies on its children
  12440. // <option>s.
  12441. mounted(el, { value }) {
  12442. setSelected(el, value);
  12443. },
  12444. beforeUpdate(el, _binding, vnode) {
  12445. el[assignKey] = getModelAssigner(vnode);
  12446. },
  12447. updated(el, { value }) {
  12448. if (!el._assigning) {
  12449. setSelected(el, value);
  12450. }
  12451. }
  12452. };
  12453. function setSelected(el, value) {
  12454. const isMultiple = el.multiple;
  12455. const isArrayValue = isArray(value);
  12456. if (isMultiple && !isArrayValue && !isSet(value)) {
  12457. warn(
  12458. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  12459. );
  12460. return;
  12461. }
  12462. for (let i = 0, l = el.options.length; i < l; i++) {
  12463. const option = el.options[i];
  12464. const optionValue = getValue(option);
  12465. if (isMultiple) {
  12466. if (isArrayValue) {
  12467. const optionType = typeof optionValue;
  12468. if (optionType === "string" || optionType === "number") {
  12469. option.selected = value.some((v) => String(v) === String(optionValue));
  12470. } else {
  12471. option.selected = looseIndexOf(value, optionValue) > -1;
  12472. }
  12473. } else {
  12474. option.selected = value.has(optionValue);
  12475. }
  12476. } else if (looseEqual(getValue(option), value)) {
  12477. if (el.selectedIndex !== i) el.selectedIndex = i;
  12478. return;
  12479. }
  12480. }
  12481. if (!isMultiple && el.selectedIndex !== -1) {
  12482. el.selectedIndex = -1;
  12483. }
  12484. }
  12485. function getValue(el) {
  12486. return "_value" in el ? el._value : el.value;
  12487. }
  12488. function getCheckboxValue(el, checked) {
  12489. const key = checked ? "_trueValue" : "_falseValue";
  12490. return key in el ? el[key] : checked;
  12491. }
  12492. const vModelDynamic = {
  12493. created(el, binding, vnode) {
  12494. callModelHook(el, binding, vnode, null, "created");
  12495. },
  12496. mounted(el, binding, vnode) {
  12497. callModelHook(el, binding, vnode, null, "mounted");
  12498. },
  12499. beforeUpdate(el, binding, vnode, prevVNode) {
  12500. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  12501. },
  12502. updated(el, binding, vnode, prevVNode) {
  12503. callModelHook(el, binding, vnode, prevVNode, "updated");
  12504. }
  12505. };
  12506. function resolveDynamicModel(tagName, type) {
  12507. switch (tagName) {
  12508. case "SELECT":
  12509. return vModelSelect;
  12510. case "TEXTAREA":
  12511. return vModelText;
  12512. default:
  12513. switch (type) {
  12514. case "checkbox":
  12515. return vModelCheckbox;
  12516. case "radio":
  12517. return vModelRadio;
  12518. default:
  12519. return vModelText;
  12520. }
  12521. }
  12522. }
  12523. function callModelHook(el, binding, vnode, prevVNode, hook) {
  12524. const modelToUse = resolveDynamicModel(
  12525. el.tagName,
  12526. vnode.props && vnode.props.type
  12527. );
  12528. const fn = modelToUse[hook];
  12529. fn && fn(el, binding, vnode, prevVNode);
  12530. }
  12531. function initVModelForSSR() {
  12532. vModelText.getSSRProps = ({ value }) => ({ value });
  12533. vModelRadio.getSSRProps = ({ value }, vnode) => {
  12534. if (vnode.props && looseEqual(vnode.props.value, value)) {
  12535. return { checked: true };
  12536. }
  12537. };
  12538. vModelCheckbox.getSSRProps = ({ value }, vnode) => {
  12539. if (isArray(value)) {
  12540. if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
  12541. return { checked: true };
  12542. }
  12543. } else if (isSet(value)) {
  12544. if (vnode.props && value.has(vnode.props.value)) {
  12545. return { checked: true };
  12546. }
  12547. } else if (value) {
  12548. return { checked: true };
  12549. }
  12550. };
  12551. vModelDynamic.getSSRProps = (binding, vnode) => {
  12552. if (typeof vnode.type !== "string") {
  12553. return;
  12554. }
  12555. const modelToUse = resolveDynamicModel(
  12556. // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase
  12557. vnode.type.toUpperCase(),
  12558. vnode.props && vnode.props.type
  12559. );
  12560. if (modelToUse.getSSRProps) {
  12561. return modelToUse.getSSRProps(binding, vnode);
  12562. }
  12563. };
  12564. }
  12565. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  12566. const modifierGuards = {
  12567. stop: (e) => e.stopPropagation(),
  12568. prevent: (e) => e.preventDefault(),
  12569. self: (e) => e.target !== e.currentTarget,
  12570. ctrl: (e) => !e.ctrlKey,
  12571. shift: (e) => !e.shiftKey,
  12572. alt: (e) => !e.altKey,
  12573. meta: (e) => !e.metaKey,
  12574. left: (e) => "button" in e && e.button !== 0,
  12575. middle: (e) => "button" in e && e.button !== 1,
  12576. right: (e) => "button" in e && e.button !== 2,
  12577. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  12578. };
  12579. const withModifiers = (fn, modifiers) => {
  12580. if (!fn) return fn;
  12581. const cache = fn._withMods || (fn._withMods = {});
  12582. const cacheKey = modifiers.join(".");
  12583. return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
  12584. for (let i = 0; i < modifiers.length; i++) {
  12585. const guard = modifierGuards[modifiers[i]];
  12586. if (guard && guard(event, modifiers)) return;
  12587. }
  12588. return fn(event, ...args);
  12589. }));
  12590. };
  12591. const keyNames = {
  12592. esc: "escape",
  12593. space: " ",
  12594. up: "arrow-up",
  12595. left: "arrow-left",
  12596. right: "arrow-right",
  12597. down: "arrow-down",
  12598. delete: "backspace"
  12599. };
  12600. const withKeys = (fn, modifiers) => {
  12601. const cache = fn._withKeys || (fn._withKeys = {});
  12602. const cacheKey = modifiers.join(".");
  12603. return cache[cacheKey] || (cache[cacheKey] = ((event) => {
  12604. if (!("key" in event)) {
  12605. return;
  12606. }
  12607. const eventKey = hyphenate(event.key);
  12608. if (modifiers.some(
  12609. (k) => k === eventKey || keyNames[k] === eventKey
  12610. )) {
  12611. return fn(event);
  12612. }
  12613. }));
  12614. };
  12615. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  12616. let renderer;
  12617. let enabledHydration = false;
  12618. function ensureRenderer() {
  12619. return renderer || (renderer = createRenderer(rendererOptions));
  12620. }
  12621. function ensureHydrationRenderer() {
  12622. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  12623. enabledHydration = true;
  12624. return renderer;
  12625. }
  12626. const render = ((...args) => {
  12627. ensureRenderer().render(...args);
  12628. });
  12629. const hydrate = ((...args) => {
  12630. ensureHydrationRenderer().hydrate(...args);
  12631. });
  12632. const createApp = ((...args) => {
  12633. const app = ensureRenderer().createApp(...args);
  12634. {
  12635. injectNativeTagCheck(app);
  12636. injectCompilerOptionsCheck(app);
  12637. }
  12638. const { mount } = app;
  12639. app.mount = (containerOrSelector) => {
  12640. const container = normalizeContainer(containerOrSelector);
  12641. if (!container) return;
  12642. const component = app._component;
  12643. if (!isFunction(component) && !component.render && !component.template) {
  12644. component.template = container.innerHTML;
  12645. }
  12646. if (container.nodeType === 1) {
  12647. container.textContent = "";
  12648. }
  12649. const proxy = mount(container, false, resolveRootNamespace(container));
  12650. if (container instanceof Element) {
  12651. container.removeAttribute("v-cloak");
  12652. container.setAttribute("data-v-app", "");
  12653. }
  12654. return proxy;
  12655. };
  12656. return app;
  12657. });
  12658. const createSSRApp = ((...args) => {
  12659. const app = ensureHydrationRenderer().createApp(...args);
  12660. {
  12661. injectNativeTagCheck(app);
  12662. injectCompilerOptionsCheck(app);
  12663. }
  12664. const { mount } = app;
  12665. app.mount = (containerOrSelector) => {
  12666. const container = normalizeContainer(containerOrSelector);
  12667. if (container) {
  12668. return mount(container, true, resolveRootNamespace(container));
  12669. }
  12670. };
  12671. return app;
  12672. });
  12673. function resolveRootNamespace(container) {
  12674. if (container instanceof SVGElement) {
  12675. return "svg";
  12676. }
  12677. if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
  12678. return "mathml";
  12679. }
  12680. }
  12681. function injectNativeTagCheck(app) {
  12682. Object.defineProperty(app.config, "isNativeTag", {
  12683. value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
  12684. writable: false
  12685. });
  12686. }
  12687. function injectCompilerOptionsCheck(app) {
  12688. if (isRuntimeOnly()) {
  12689. const isCustomElement = app.config.isCustomElement;
  12690. Object.defineProperty(app.config, "isCustomElement", {
  12691. get() {
  12692. return isCustomElement;
  12693. },
  12694. set() {
  12695. warn(
  12696. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  12697. );
  12698. }
  12699. });
  12700. const compilerOptions = app.config.compilerOptions;
  12701. const msg = `The \`compilerOptions\` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, \`compilerOptions\` must be passed to \`@vue/compiler-dom\` in the build setup instead.
  12702. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  12703. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  12704. - For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc`;
  12705. Object.defineProperty(app.config, "compilerOptions", {
  12706. get() {
  12707. warn(msg);
  12708. return compilerOptions;
  12709. },
  12710. set() {
  12711. warn(msg);
  12712. }
  12713. });
  12714. }
  12715. }
  12716. function normalizeContainer(container) {
  12717. if (isString(container)) {
  12718. const res = document.querySelector(container);
  12719. if (!res) {
  12720. warn(
  12721. `Failed to mount app: mount target selector "${container}" returned null.`
  12722. );
  12723. }
  12724. return res;
  12725. }
  12726. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  12727. warn(
  12728. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  12729. );
  12730. }
  12731. return container;
  12732. }
  12733. let ssrDirectiveInitialized = false;
  12734. const initDirectivesForSSR = () => {
  12735. if (!ssrDirectiveInitialized) {
  12736. ssrDirectiveInitialized = true;
  12737. initVModelForSSR();
  12738. initVShowForSSR();
  12739. }
  12740. } ;
  12741. export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, TrackOpTypes, Transition, TransitionGroup, TriggerOpTypes, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getCurrentWatcher, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, nodeOps, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, patchProp, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useHost, useId, useModel, useSSRContext, useShadowRoot, useSlots, useTemplateRef, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };