server-renderer.esm-browser.js 216 KB

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