runtime-dom.esm-browser.js 297 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499
  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 isRegExp = (val) => toTypeString(val) === "[object RegExp]";
  31. const isFunction = (val) => typeof val === "function";
  32. const isString = (val) => typeof val === "string";
  33. const isSymbol = (val) => typeof val === "symbol";
  34. const isObject = (val) => val !== null && typeof val === "object";
  35. const isPromise = (val) => {
  36. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  37. };
  38. const objectToString = Object.prototype.toString;
  39. const toTypeString = (value) => objectToString.call(value);
  40. const toRawType = (value) => {
  41. return toTypeString(value).slice(8, -1);
  42. };
  43. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  44. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  45. const isReservedProp = /* @__PURE__ */ makeMap(
  46. // the leading comma is intentional so empty string "" is also included
  47. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  48. );
  49. const isBuiltInDirective = /* @__PURE__ */ makeMap(
  50. "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
  51. );
  52. const cacheStringFunction = (fn) => {
  53. const cache = /* @__PURE__ */ Object.create(null);
  54. return (str) => {
  55. const hit = cache[str];
  56. return hit || (cache[str] = fn(str));
  57. };
  58. };
  59. const camelizeRE = /-(\w)/g;
  60. const camelize = cacheStringFunction((str) => {
  61. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  62. });
  63. const hyphenateRE = /\B([A-Z])/g;
  64. const hyphenate = cacheStringFunction(
  65. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  66. );
  67. const capitalize = cacheStringFunction(
  68. (str) => str.charAt(0).toUpperCase() + str.slice(1)
  69. );
  70. const toHandlerKey = cacheStringFunction(
  71. (str) => str ? `on${capitalize(str)}` : ``
  72. );
  73. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  74. const invokeArrayFns = (fns, arg) => {
  75. for (let i = 0; i < fns.length; i++) {
  76. fns[i](arg);
  77. }
  78. };
  79. const def = (obj, key, value) => {
  80. Object.defineProperty(obj, key, {
  81. configurable: true,
  82. enumerable: false,
  83. value
  84. });
  85. };
  86. const looseToNumber = (val) => {
  87. const n = parseFloat(val);
  88. return isNaN(n) ? val : n;
  89. };
  90. const toNumber = (val) => {
  91. const n = isString(val) ? Number(val) : NaN;
  92. return isNaN(n) ? val : n;
  93. };
  94. let _globalThis;
  95. const getGlobalThis = () => {
  96. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  97. };
  98. const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
  99. const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
  100. function normalizeStyle(value) {
  101. if (isArray(value)) {
  102. const res = {};
  103. for (let i = 0; i < value.length; i++) {
  104. const item = value[i];
  105. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  106. if (normalized) {
  107. for (const key in normalized) {
  108. res[key] = normalized[key];
  109. }
  110. }
  111. }
  112. return res;
  113. } else if (isString(value)) {
  114. return value;
  115. } else if (isObject(value)) {
  116. return value;
  117. }
  118. }
  119. const listDelimiterRE = /;(?![^(]*\))/g;
  120. const propertyDelimiterRE = /:([^]+)/;
  121. const styleCommentRE = /\/\*[^]*?\*\//g;
  122. function parseStringStyle(cssText) {
  123. const ret = {};
  124. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  125. if (item) {
  126. const tmp = item.split(propertyDelimiterRE);
  127. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  128. }
  129. });
  130. return ret;
  131. }
  132. function normalizeClass(value) {
  133. let res = "";
  134. if (isString(value)) {
  135. res = value;
  136. } else if (isArray(value)) {
  137. for (let i = 0; i < value.length; i++) {
  138. const normalized = normalizeClass(value[i]);
  139. if (normalized) {
  140. res += normalized + " ";
  141. }
  142. }
  143. } else if (isObject(value)) {
  144. for (const name in value) {
  145. if (value[name]) {
  146. res += name + " ";
  147. }
  148. }
  149. }
  150. return res.trim();
  151. }
  152. function normalizeProps(props) {
  153. if (!props)
  154. return null;
  155. let { class: klass, style } = props;
  156. if (klass && !isString(klass)) {
  157. props.class = normalizeClass(klass);
  158. }
  159. if (style) {
  160. props.style = normalizeStyle(style);
  161. }
  162. return props;
  163. }
  164. 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";
  165. 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";
  166. const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
  167. const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
  168. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  169. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  170. function includeBooleanAttr(value) {
  171. return !!value || value === "";
  172. }
  173. function looseCompareArrays(a, b) {
  174. if (a.length !== b.length)
  175. return false;
  176. let equal = true;
  177. for (let i = 0; equal && i < a.length; i++) {
  178. equal = looseEqual(a[i], b[i]);
  179. }
  180. return equal;
  181. }
  182. function looseEqual(a, b) {
  183. if (a === b)
  184. return true;
  185. let aValidType = isDate(a);
  186. let bValidType = isDate(b);
  187. if (aValidType || bValidType) {
  188. return aValidType && bValidType ? a.getTime() === b.getTime() : false;
  189. }
  190. aValidType = isSymbol(a);
  191. bValidType = isSymbol(b);
  192. if (aValidType || bValidType) {
  193. return a === b;
  194. }
  195. aValidType = isArray(a);
  196. bValidType = isArray(b);
  197. if (aValidType || bValidType) {
  198. return aValidType && bValidType ? looseCompareArrays(a, b) : false;
  199. }
  200. aValidType = isObject(a);
  201. bValidType = isObject(b);
  202. if (aValidType || bValidType) {
  203. if (!aValidType || !bValidType) {
  204. return false;
  205. }
  206. const aKeysCount = Object.keys(a).length;
  207. const bKeysCount = Object.keys(b).length;
  208. if (aKeysCount !== bKeysCount) {
  209. return false;
  210. }
  211. for (const key in a) {
  212. const aHasKey = a.hasOwnProperty(key);
  213. const bHasKey = b.hasOwnProperty(key);
  214. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
  215. return false;
  216. }
  217. }
  218. }
  219. return String(a) === String(b);
  220. }
  221. function looseIndexOf(arr, val) {
  222. return arr.findIndex((item) => looseEqual(item, val));
  223. }
  224. const toDisplayString = (val) => {
  225. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  226. };
  227. const replacer = (_key, val) => {
  228. if (val && val.__v_isRef) {
  229. return replacer(_key, val.value);
  230. } else if (isMap(val)) {
  231. return {
  232. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  233. entries[`${key} =>`] = val2;
  234. return entries;
  235. }, {})
  236. };
  237. } else if (isSet(val)) {
  238. return {
  239. [`Set(${val.size})`]: [...val.values()]
  240. };
  241. } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
  242. return String(val);
  243. }
  244. return val;
  245. };
  246. function warn$1(msg, ...args) {
  247. console.warn(`[Vue warn] ${msg}`, ...args);
  248. }
  249. let activeEffectScope;
  250. class EffectScope {
  251. constructor(detached = false) {
  252. this.detached = detached;
  253. /**
  254. * @internal
  255. */
  256. this._active = true;
  257. /**
  258. * @internal
  259. */
  260. this.effects = [];
  261. /**
  262. * @internal
  263. */
  264. this.cleanups = [];
  265. this.parent = activeEffectScope;
  266. if (!detached && activeEffectScope) {
  267. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  268. this
  269. ) - 1;
  270. }
  271. }
  272. get active() {
  273. return this._active;
  274. }
  275. run(fn) {
  276. if (this._active) {
  277. const currentEffectScope = activeEffectScope;
  278. try {
  279. activeEffectScope = this;
  280. return fn();
  281. } finally {
  282. activeEffectScope = currentEffectScope;
  283. }
  284. } else {
  285. warn$1(`cannot run an inactive effect scope.`);
  286. }
  287. }
  288. /**
  289. * This should only be called on non-detached scopes
  290. * @internal
  291. */
  292. on() {
  293. activeEffectScope = this;
  294. }
  295. /**
  296. * This should only be called on non-detached scopes
  297. * @internal
  298. */
  299. off() {
  300. activeEffectScope = this.parent;
  301. }
  302. stop(fromParent) {
  303. if (this._active) {
  304. let i, l;
  305. for (i = 0, l = this.effects.length; i < l; i++) {
  306. this.effects[i].stop();
  307. }
  308. for (i = 0, l = this.cleanups.length; i < l; i++) {
  309. this.cleanups[i]();
  310. }
  311. if (this.scopes) {
  312. for (i = 0, l = this.scopes.length; i < l; i++) {
  313. this.scopes[i].stop(true);
  314. }
  315. }
  316. if (!this.detached && this.parent && !fromParent) {
  317. const last = this.parent.scopes.pop();
  318. if (last && last !== this) {
  319. this.parent.scopes[this.index] = last;
  320. last.index = this.index;
  321. }
  322. }
  323. this.parent = void 0;
  324. this._active = false;
  325. }
  326. }
  327. }
  328. function effectScope(detached) {
  329. return new EffectScope(detached);
  330. }
  331. function recordEffectScope(effect, scope = activeEffectScope) {
  332. if (scope && scope.active) {
  333. scope.effects.push(effect);
  334. }
  335. }
  336. function getCurrentScope() {
  337. return activeEffectScope;
  338. }
  339. function onScopeDispose(fn) {
  340. if (activeEffectScope) {
  341. activeEffectScope.cleanups.push(fn);
  342. } else {
  343. warn$1(
  344. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  345. );
  346. }
  347. }
  348. const createDep = (effects) => {
  349. const dep = new Set(effects);
  350. dep.w = 0;
  351. dep.n = 0;
  352. return dep;
  353. };
  354. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  355. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  356. const initDepMarkers = ({ deps }) => {
  357. if (deps.length) {
  358. for (let i = 0; i < deps.length; i++) {
  359. deps[i].w |= trackOpBit;
  360. }
  361. }
  362. };
  363. const finalizeDepMarkers = (effect) => {
  364. const { deps } = effect;
  365. if (deps.length) {
  366. let ptr = 0;
  367. for (let i = 0; i < deps.length; i++) {
  368. const dep = deps[i];
  369. if (wasTracked(dep) && !newTracked(dep)) {
  370. dep.delete(effect);
  371. } else {
  372. deps[ptr++] = dep;
  373. }
  374. dep.w &= ~trackOpBit;
  375. dep.n &= ~trackOpBit;
  376. }
  377. deps.length = ptr;
  378. }
  379. };
  380. const targetMap = /* @__PURE__ */ new WeakMap();
  381. let effectTrackDepth = 0;
  382. let trackOpBit = 1;
  383. const maxMarkerBits = 30;
  384. let activeEffect;
  385. const ITERATE_KEY = Symbol("iterate" );
  386. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
  387. class ReactiveEffect {
  388. constructor(fn, scheduler = null, scope) {
  389. this.fn = fn;
  390. this.scheduler = scheduler;
  391. this.active = true;
  392. this.deps = [];
  393. this.parent = void 0;
  394. recordEffectScope(this, scope);
  395. }
  396. run() {
  397. if (!this.active) {
  398. return this.fn();
  399. }
  400. let parent = activeEffect;
  401. let lastShouldTrack = shouldTrack;
  402. while (parent) {
  403. if (parent === this) {
  404. return;
  405. }
  406. parent = parent.parent;
  407. }
  408. try {
  409. this.parent = activeEffect;
  410. activeEffect = this;
  411. shouldTrack = true;
  412. trackOpBit = 1 << ++effectTrackDepth;
  413. if (effectTrackDepth <= maxMarkerBits) {
  414. initDepMarkers(this);
  415. } else {
  416. cleanupEffect(this);
  417. }
  418. return this.fn();
  419. } finally {
  420. if (effectTrackDepth <= maxMarkerBits) {
  421. finalizeDepMarkers(this);
  422. }
  423. trackOpBit = 1 << --effectTrackDepth;
  424. activeEffect = this.parent;
  425. shouldTrack = lastShouldTrack;
  426. this.parent = void 0;
  427. if (this.deferStop) {
  428. this.stop();
  429. }
  430. }
  431. }
  432. stop() {
  433. if (activeEffect === this) {
  434. this.deferStop = true;
  435. } else if (this.active) {
  436. cleanupEffect(this);
  437. if (this.onStop) {
  438. this.onStop();
  439. }
  440. this.active = false;
  441. }
  442. }
  443. }
  444. function cleanupEffect(effect2) {
  445. const { deps } = effect2;
  446. if (deps.length) {
  447. for (let i = 0; i < deps.length; i++) {
  448. deps[i].delete(effect2);
  449. }
  450. deps.length = 0;
  451. }
  452. }
  453. function effect(fn, options) {
  454. if (fn.effect) {
  455. fn = fn.effect.fn;
  456. }
  457. const _effect = new ReactiveEffect(fn);
  458. if (options) {
  459. extend(_effect, options);
  460. if (options.scope)
  461. recordEffectScope(_effect, options.scope);
  462. }
  463. if (!options || !options.lazy) {
  464. _effect.run();
  465. }
  466. const runner = _effect.run.bind(_effect);
  467. runner.effect = _effect;
  468. return runner;
  469. }
  470. function stop(runner) {
  471. runner.effect.stop();
  472. }
  473. let shouldTrack = true;
  474. const trackStack = [];
  475. function pauseTracking() {
  476. trackStack.push(shouldTrack);
  477. shouldTrack = false;
  478. }
  479. function resetTracking() {
  480. const last = trackStack.pop();
  481. shouldTrack = last === void 0 ? true : last;
  482. }
  483. function track(target, type, key) {
  484. if (shouldTrack && activeEffect) {
  485. let depsMap = targetMap.get(target);
  486. if (!depsMap) {
  487. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  488. }
  489. let dep = depsMap.get(key);
  490. if (!dep) {
  491. depsMap.set(key, dep = createDep());
  492. }
  493. const eventInfo = { effect: activeEffect, target, type, key } ;
  494. trackEffects(dep, eventInfo);
  495. }
  496. }
  497. function trackEffects(dep, debuggerEventExtraInfo) {
  498. let shouldTrack2 = false;
  499. if (effectTrackDepth <= maxMarkerBits) {
  500. if (!newTracked(dep)) {
  501. dep.n |= trackOpBit;
  502. shouldTrack2 = !wasTracked(dep);
  503. }
  504. } else {
  505. shouldTrack2 = !dep.has(activeEffect);
  506. }
  507. if (shouldTrack2) {
  508. dep.add(activeEffect);
  509. activeEffect.deps.push(dep);
  510. if (activeEffect.onTrack) {
  511. activeEffect.onTrack(
  512. extend(
  513. {
  514. effect: activeEffect
  515. },
  516. debuggerEventExtraInfo
  517. )
  518. );
  519. }
  520. }
  521. }
  522. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  523. const depsMap = targetMap.get(target);
  524. if (!depsMap) {
  525. return;
  526. }
  527. let deps = [];
  528. if (type === "clear") {
  529. deps = [...depsMap.values()];
  530. } else if (key === "length" && isArray(target)) {
  531. const newLength = Number(newValue);
  532. depsMap.forEach((dep, key2) => {
  533. if (key2 === "length" || key2 >= newLength) {
  534. deps.push(dep);
  535. }
  536. });
  537. } else {
  538. if (key !== void 0) {
  539. deps.push(depsMap.get(key));
  540. }
  541. switch (type) {
  542. case "add":
  543. if (!isArray(target)) {
  544. deps.push(depsMap.get(ITERATE_KEY));
  545. if (isMap(target)) {
  546. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  547. }
  548. } else if (isIntegerKey(key)) {
  549. deps.push(depsMap.get("length"));
  550. }
  551. break;
  552. case "delete":
  553. if (!isArray(target)) {
  554. deps.push(depsMap.get(ITERATE_KEY));
  555. if (isMap(target)) {
  556. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  557. }
  558. }
  559. break;
  560. case "set":
  561. if (isMap(target)) {
  562. deps.push(depsMap.get(ITERATE_KEY));
  563. }
  564. break;
  565. }
  566. }
  567. const eventInfo = { target, type, key, newValue, oldValue, oldTarget } ;
  568. if (deps.length === 1) {
  569. if (deps[0]) {
  570. {
  571. triggerEffects(deps[0], eventInfo);
  572. }
  573. }
  574. } else {
  575. const effects = [];
  576. for (const dep of deps) {
  577. if (dep) {
  578. effects.push(...dep);
  579. }
  580. }
  581. {
  582. triggerEffects(createDep(effects), eventInfo);
  583. }
  584. }
  585. }
  586. function triggerEffects(dep, debuggerEventExtraInfo) {
  587. const effects = isArray(dep) ? dep : [...dep];
  588. for (const effect2 of effects) {
  589. if (effect2.computed) {
  590. triggerEffect(effect2, debuggerEventExtraInfo);
  591. }
  592. }
  593. for (const effect2 of effects) {
  594. if (!effect2.computed) {
  595. triggerEffect(effect2, debuggerEventExtraInfo);
  596. }
  597. }
  598. }
  599. function triggerEffect(effect2, debuggerEventExtraInfo) {
  600. if (effect2 !== activeEffect || effect2.allowRecurse) {
  601. if (effect2.onTrigger) {
  602. effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
  603. }
  604. if (effect2.scheduler) {
  605. effect2.scheduler();
  606. } else {
  607. effect2.run();
  608. }
  609. }
  610. }
  611. function getDepFromReactive(object, key) {
  612. var _a;
  613. return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
  614. }
  615. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  616. const builtInSymbols = new Set(
  617. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  618. );
  619. const get$1 = /* @__PURE__ */ createGetter();
  620. const shallowGet = /* @__PURE__ */ createGetter(false, true);
  621. const readonlyGet = /* @__PURE__ */ createGetter(true);
  622. const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
  623. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  624. function createArrayInstrumentations() {
  625. const instrumentations = {};
  626. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  627. instrumentations[key] = function(...args) {
  628. const arr = toRaw(this);
  629. for (let i = 0, l = this.length; i < l; i++) {
  630. track(arr, "get", i + "");
  631. }
  632. const res = arr[key](...args);
  633. if (res === -1 || res === false) {
  634. return arr[key](...args.map(toRaw));
  635. } else {
  636. return res;
  637. }
  638. };
  639. });
  640. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  641. instrumentations[key] = function(...args) {
  642. pauseTracking();
  643. const res = toRaw(this)[key].apply(this, args);
  644. resetTracking();
  645. return res;
  646. };
  647. });
  648. return instrumentations;
  649. }
  650. function hasOwnProperty(key) {
  651. const obj = toRaw(this);
  652. track(obj, "has", key);
  653. return obj.hasOwnProperty(key);
  654. }
  655. function createGetter(isReadonly2 = false, shallow = false) {
  656. return function get2(target, key, receiver) {
  657. if (key === "__v_isReactive") {
  658. return !isReadonly2;
  659. } else if (key === "__v_isReadonly") {
  660. return isReadonly2;
  661. } else if (key === "__v_isShallow") {
  662. return shallow;
  663. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  664. return target;
  665. }
  666. const targetIsArray = isArray(target);
  667. if (!isReadonly2) {
  668. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  669. return Reflect.get(arrayInstrumentations, key, receiver);
  670. }
  671. if (key === "hasOwnProperty") {
  672. return hasOwnProperty;
  673. }
  674. }
  675. const res = Reflect.get(target, key, receiver);
  676. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  677. return res;
  678. }
  679. if (!isReadonly2) {
  680. track(target, "get", key);
  681. }
  682. if (shallow) {
  683. return res;
  684. }
  685. if (isRef(res)) {
  686. return targetIsArray && isIntegerKey(key) ? res : res.value;
  687. }
  688. if (isObject(res)) {
  689. return isReadonly2 ? readonly(res) : reactive(res);
  690. }
  691. return res;
  692. };
  693. }
  694. const set$1 = /* @__PURE__ */ createSetter();
  695. const shallowSet = /* @__PURE__ */ createSetter(true);
  696. function createSetter(shallow = false) {
  697. return function set2(target, key, value, receiver) {
  698. let oldValue = target[key];
  699. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  700. return false;
  701. }
  702. if (!shallow) {
  703. if (!isShallow(value) && !isReadonly(value)) {
  704. oldValue = toRaw(oldValue);
  705. value = toRaw(value);
  706. }
  707. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  708. oldValue.value = value;
  709. return true;
  710. }
  711. }
  712. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  713. const result = Reflect.set(target, key, value, receiver);
  714. if (target === toRaw(receiver)) {
  715. if (!hadKey) {
  716. trigger(target, "add", key, value);
  717. } else if (hasChanged(value, oldValue)) {
  718. trigger(target, "set", key, value, oldValue);
  719. }
  720. }
  721. return result;
  722. };
  723. }
  724. function deleteProperty(target, key) {
  725. const hadKey = hasOwn(target, key);
  726. const oldValue = target[key];
  727. const result = Reflect.deleteProperty(target, key);
  728. if (result && hadKey) {
  729. trigger(target, "delete", key, void 0, oldValue);
  730. }
  731. return result;
  732. }
  733. function has$1(target, key) {
  734. const result = Reflect.has(target, key);
  735. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  736. track(target, "has", key);
  737. }
  738. return result;
  739. }
  740. function ownKeys(target) {
  741. track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
  742. return Reflect.ownKeys(target);
  743. }
  744. const mutableHandlers = {
  745. get: get$1,
  746. set: set$1,
  747. deleteProperty,
  748. has: has$1,
  749. ownKeys
  750. };
  751. const readonlyHandlers = {
  752. get: readonlyGet,
  753. set(target, key) {
  754. {
  755. warn$1(
  756. `Set operation on key "${String(key)}" failed: target is readonly.`,
  757. target
  758. );
  759. }
  760. return true;
  761. },
  762. deleteProperty(target, key) {
  763. {
  764. warn$1(
  765. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  766. target
  767. );
  768. }
  769. return true;
  770. }
  771. };
  772. const shallowReactiveHandlers = /* @__PURE__ */ extend(
  773. {},
  774. mutableHandlers,
  775. {
  776. get: shallowGet,
  777. set: shallowSet
  778. }
  779. );
  780. const shallowReadonlyHandlers = /* @__PURE__ */ extend(
  781. {},
  782. readonlyHandlers,
  783. {
  784. get: shallowReadonlyGet
  785. }
  786. );
  787. const toShallow = (value) => value;
  788. const getProto = (v) => Reflect.getPrototypeOf(v);
  789. function get(target, key, isReadonly = false, isShallow = false) {
  790. target = target["__v_raw"];
  791. const rawTarget = toRaw(target);
  792. const rawKey = toRaw(key);
  793. if (!isReadonly) {
  794. if (key !== rawKey) {
  795. track(rawTarget, "get", key);
  796. }
  797. track(rawTarget, "get", rawKey);
  798. }
  799. const { has: has2 } = getProto(rawTarget);
  800. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  801. if (has2.call(rawTarget, key)) {
  802. return wrap(target.get(key));
  803. } else if (has2.call(rawTarget, rawKey)) {
  804. return wrap(target.get(rawKey));
  805. } else if (target !== rawTarget) {
  806. target.get(key);
  807. }
  808. }
  809. function has(key, isReadonly = false) {
  810. const target = this["__v_raw"];
  811. const rawTarget = toRaw(target);
  812. const rawKey = toRaw(key);
  813. if (!isReadonly) {
  814. if (key !== rawKey) {
  815. track(rawTarget, "has", key);
  816. }
  817. track(rawTarget, "has", rawKey);
  818. }
  819. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  820. }
  821. function size(target, isReadonly = false) {
  822. target = target["__v_raw"];
  823. !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
  824. return Reflect.get(target, "size", target);
  825. }
  826. function add(value) {
  827. value = toRaw(value);
  828. const target = toRaw(this);
  829. const proto = getProto(target);
  830. const hadKey = proto.has.call(target, value);
  831. if (!hadKey) {
  832. target.add(value);
  833. trigger(target, "add", value, value);
  834. }
  835. return this;
  836. }
  837. function set(key, value) {
  838. value = toRaw(value);
  839. const target = toRaw(this);
  840. const { has: has2, get: get2 } = getProto(target);
  841. let hadKey = has2.call(target, key);
  842. if (!hadKey) {
  843. key = toRaw(key);
  844. hadKey = has2.call(target, key);
  845. } else {
  846. checkIdentityKeys(target, has2, key);
  847. }
  848. const oldValue = get2.call(target, key);
  849. target.set(key, value);
  850. if (!hadKey) {
  851. trigger(target, "add", key, value);
  852. } else if (hasChanged(value, oldValue)) {
  853. trigger(target, "set", key, value, oldValue);
  854. }
  855. return this;
  856. }
  857. function deleteEntry(key) {
  858. const target = toRaw(this);
  859. const { has: has2, get: get2 } = getProto(target);
  860. let hadKey = has2.call(target, key);
  861. if (!hadKey) {
  862. key = toRaw(key);
  863. hadKey = has2.call(target, key);
  864. } else {
  865. checkIdentityKeys(target, has2, key);
  866. }
  867. const oldValue = get2 ? get2.call(target, key) : void 0;
  868. const result = target.delete(key);
  869. if (hadKey) {
  870. trigger(target, "delete", key, void 0, oldValue);
  871. }
  872. return result;
  873. }
  874. function clear() {
  875. const target = toRaw(this);
  876. const hadItems = target.size !== 0;
  877. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  878. const result = target.clear();
  879. if (hadItems) {
  880. trigger(target, "clear", void 0, void 0, oldTarget);
  881. }
  882. return result;
  883. }
  884. function createForEach(isReadonly, isShallow) {
  885. return function forEach(callback, thisArg) {
  886. const observed = this;
  887. const target = observed["__v_raw"];
  888. const rawTarget = toRaw(target);
  889. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  890. !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
  891. return target.forEach((value, key) => {
  892. return callback.call(thisArg, wrap(value), wrap(key), observed);
  893. });
  894. };
  895. }
  896. function createIterableMethod(method, isReadonly, isShallow) {
  897. return function(...args) {
  898. const target = this["__v_raw"];
  899. const rawTarget = toRaw(target);
  900. const targetIsMap = isMap(rawTarget);
  901. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  902. const isKeyOnly = method === "keys" && targetIsMap;
  903. const innerIterator = target[method](...args);
  904. const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
  905. !isReadonly && track(
  906. rawTarget,
  907. "iterate",
  908. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  909. );
  910. return {
  911. // iterator protocol
  912. next() {
  913. const { value, done } = innerIterator.next();
  914. return done ? { value, done } : {
  915. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  916. done
  917. };
  918. },
  919. // iterable protocol
  920. [Symbol.iterator]() {
  921. return this;
  922. }
  923. };
  924. };
  925. }
  926. function createReadonlyMethod(type) {
  927. return function(...args) {
  928. {
  929. const key = args[0] ? `on key "${args[0]}" ` : ``;
  930. console.warn(
  931. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  932. toRaw(this)
  933. );
  934. }
  935. return type === "delete" ? false : this;
  936. };
  937. }
  938. function createInstrumentations() {
  939. const mutableInstrumentations2 = {
  940. get(key) {
  941. return get(this, key);
  942. },
  943. get size() {
  944. return size(this);
  945. },
  946. has,
  947. add,
  948. set,
  949. delete: deleteEntry,
  950. clear,
  951. forEach: createForEach(false, false)
  952. };
  953. const shallowInstrumentations2 = {
  954. get(key) {
  955. return get(this, key, false, true);
  956. },
  957. get size() {
  958. return size(this);
  959. },
  960. has,
  961. add,
  962. set,
  963. delete: deleteEntry,
  964. clear,
  965. forEach: createForEach(false, true)
  966. };
  967. const readonlyInstrumentations2 = {
  968. get(key) {
  969. return get(this, key, true);
  970. },
  971. get size() {
  972. return size(this, true);
  973. },
  974. has(key) {
  975. return has.call(this, key, true);
  976. },
  977. add: createReadonlyMethod("add"),
  978. set: createReadonlyMethod("set"),
  979. delete: createReadonlyMethod("delete"),
  980. clear: createReadonlyMethod("clear"),
  981. forEach: createForEach(true, false)
  982. };
  983. const shallowReadonlyInstrumentations2 = {
  984. get(key) {
  985. return get(this, key, true, true);
  986. },
  987. get size() {
  988. return size(this, true);
  989. },
  990. has(key) {
  991. return has.call(this, key, true);
  992. },
  993. add: createReadonlyMethod("add"),
  994. set: createReadonlyMethod("set"),
  995. delete: createReadonlyMethod("delete"),
  996. clear: createReadonlyMethod("clear"),
  997. forEach: createForEach(true, true)
  998. };
  999. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  1000. iteratorMethods.forEach((method) => {
  1001. mutableInstrumentations2[method] = createIterableMethod(
  1002. method,
  1003. false,
  1004. false
  1005. );
  1006. readonlyInstrumentations2[method] = createIterableMethod(
  1007. method,
  1008. true,
  1009. false
  1010. );
  1011. shallowInstrumentations2[method] = createIterableMethod(
  1012. method,
  1013. false,
  1014. true
  1015. );
  1016. shallowReadonlyInstrumentations2[method] = createIterableMethod(
  1017. method,
  1018. true,
  1019. true
  1020. );
  1021. });
  1022. return [
  1023. mutableInstrumentations2,
  1024. readonlyInstrumentations2,
  1025. shallowInstrumentations2,
  1026. shallowReadonlyInstrumentations2
  1027. ];
  1028. }
  1029. const [
  1030. mutableInstrumentations,
  1031. readonlyInstrumentations,
  1032. shallowInstrumentations,
  1033. shallowReadonlyInstrumentations
  1034. ] = /* @__PURE__ */ createInstrumentations();
  1035. function createInstrumentationGetter(isReadonly, shallow) {
  1036. const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
  1037. return (target, key, receiver) => {
  1038. if (key === "__v_isReactive") {
  1039. return !isReadonly;
  1040. } else if (key === "__v_isReadonly") {
  1041. return isReadonly;
  1042. } else if (key === "__v_raw") {
  1043. return target;
  1044. }
  1045. return Reflect.get(
  1046. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1047. key,
  1048. receiver
  1049. );
  1050. };
  1051. }
  1052. const mutableCollectionHandlers = {
  1053. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1054. };
  1055. const shallowCollectionHandlers = {
  1056. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1057. };
  1058. const readonlyCollectionHandlers = {
  1059. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1060. };
  1061. const shallowReadonlyCollectionHandlers = {
  1062. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1063. };
  1064. function checkIdentityKeys(target, has2, key) {
  1065. const rawKey = toRaw(key);
  1066. if (rawKey !== key && has2.call(target, rawKey)) {
  1067. const type = toRawType(target);
  1068. console.warn(
  1069. `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.`
  1070. );
  1071. }
  1072. }
  1073. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1074. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1075. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1076. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1077. function targetTypeMap(rawType) {
  1078. switch (rawType) {
  1079. case "Object":
  1080. case "Array":
  1081. return 1 /* COMMON */;
  1082. case "Map":
  1083. case "Set":
  1084. case "WeakMap":
  1085. case "WeakSet":
  1086. return 2 /* COLLECTION */;
  1087. default:
  1088. return 0 /* INVALID */;
  1089. }
  1090. }
  1091. function getTargetType(value) {
  1092. return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
  1093. }
  1094. function reactive(target) {
  1095. if (isReadonly(target)) {
  1096. return target;
  1097. }
  1098. return createReactiveObject(
  1099. target,
  1100. false,
  1101. mutableHandlers,
  1102. mutableCollectionHandlers,
  1103. reactiveMap
  1104. );
  1105. }
  1106. function shallowReactive(target) {
  1107. return createReactiveObject(
  1108. target,
  1109. false,
  1110. shallowReactiveHandlers,
  1111. shallowCollectionHandlers,
  1112. shallowReactiveMap
  1113. );
  1114. }
  1115. function readonly(target) {
  1116. return createReactiveObject(
  1117. target,
  1118. true,
  1119. readonlyHandlers,
  1120. readonlyCollectionHandlers,
  1121. readonlyMap
  1122. );
  1123. }
  1124. function shallowReadonly(target) {
  1125. return createReactiveObject(
  1126. target,
  1127. true,
  1128. shallowReadonlyHandlers,
  1129. shallowReadonlyCollectionHandlers,
  1130. shallowReadonlyMap
  1131. );
  1132. }
  1133. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1134. if (!isObject(target)) {
  1135. {
  1136. console.warn(`value cannot be made reactive: ${String(target)}`);
  1137. }
  1138. return target;
  1139. }
  1140. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1141. return target;
  1142. }
  1143. const existingProxy = proxyMap.get(target);
  1144. if (existingProxy) {
  1145. return existingProxy;
  1146. }
  1147. const targetType = getTargetType(target);
  1148. if (targetType === 0 /* INVALID */) {
  1149. return target;
  1150. }
  1151. const proxy = new Proxy(
  1152. target,
  1153. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1154. );
  1155. proxyMap.set(target, proxy);
  1156. return proxy;
  1157. }
  1158. function isReactive(value) {
  1159. if (isReadonly(value)) {
  1160. return isReactive(value["__v_raw"]);
  1161. }
  1162. return !!(value && value["__v_isReactive"]);
  1163. }
  1164. function isReadonly(value) {
  1165. return !!(value && value["__v_isReadonly"]);
  1166. }
  1167. function isShallow(value) {
  1168. return !!(value && value["__v_isShallow"]);
  1169. }
  1170. function isProxy(value) {
  1171. return isReactive(value) || isReadonly(value);
  1172. }
  1173. function toRaw(observed) {
  1174. const raw = observed && observed["__v_raw"];
  1175. return raw ? toRaw(raw) : observed;
  1176. }
  1177. function markRaw(value) {
  1178. def(value, "__v_skip", true);
  1179. return value;
  1180. }
  1181. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  1182. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  1183. function trackRefValue(ref2) {
  1184. if (shouldTrack && activeEffect) {
  1185. ref2 = toRaw(ref2);
  1186. {
  1187. trackEffects(ref2.dep || (ref2.dep = createDep()), {
  1188. target: ref2,
  1189. type: "get",
  1190. key: "value"
  1191. });
  1192. }
  1193. }
  1194. }
  1195. function triggerRefValue(ref2, newVal) {
  1196. ref2 = toRaw(ref2);
  1197. const dep = ref2.dep;
  1198. if (dep) {
  1199. {
  1200. triggerEffects(dep, {
  1201. target: ref2,
  1202. type: "set",
  1203. key: "value",
  1204. newValue: newVal
  1205. });
  1206. }
  1207. }
  1208. }
  1209. function isRef(r) {
  1210. return !!(r && r.__v_isRef === true);
  1211. }
  1212. function ref(value) {
  1213. return createRef(value, false);
  1214. }
  1215. function shallowRef(value) {
  1216. return createRef(value, true);
  1217. }
  1218. function createRef(rawValue, shallow) {
  1219. if (isRef(rawValue)) {
  1220. return rawValue;
  1221. }
  1222. return new RefImpl(rawValue, shallow);
  1223. }
  1224. class RefImpl {
  1225. constructor(value, __v_isShallow) {
  1226. this.__v_isShallow = __v_isShallow;
  1227. this.dep = void 0;
  1228. this.__v_isRef = true;
  1229. this._rawValue = __v_isShallow ? value : toRaw(value);
  1230. this._value = __v_isShallow ? value : toReactive(value);
  1231. }
  1232. get value() {
  1233. trackRefValue(this);
  1234. return this._value;
  1235. }
  1236. set value(newVal) {
  1237. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1238. newVal = useDirectValue ? newVal : toRaw(newVal);
  1239. if (hasChanged(newVal, this._rawValue)) {
  1240. this._rawValue = newVal;
  1241. this._value = useDirectValue ? newVal : toReactive(newVal);
  1242. triggerRefValue(this, newVal);
  1243. }
  1244. }
  1245. }
  1246. function triggerRef(ref2) {
  1247. triggerRefValue(ref2, ref2.value );
  1248. }
  1249. function unref(ref2) {
  1250. return isRef(ref2) ? ref2.value : ref2;
  1251. }
  1252. function toValue(source) {
  1253. return isFunction(source) ? source() : unref(source);
  1254. }
  1255. const shallowUnwrapHandlers = {
  1256. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1257. set: (target, key, value, receiver) => {
  1258. const oldValue = target[key];
  1259. if (isRef(oldValue) && !isRef(value)) {
  1260. oldValue.value = value;
  1261. return true;
  1262. } else {
  1263. return Reflect.set(target, key, value, receiver);
  1264. }
  1265. }
  1266. };
  1267. function proxyRefs(objectWithRefs) {
  1268. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1269. }
  1270. class CustomRefImpl {
  1271. constructor(factory) {
  1272. this.dep = void 0;
  1273. this.__v_isRef = true;
  1274. const { get, set } = factory(
  1275. () => trackRefValue(this),
  1276. () => triggerRefValue(this)
  1277. );
  1278. this._get = get;
  1279. this._set = set;
  1280. }
  1281. get value() {
  1282. return this._get();
  1283. }
  1284. set value(newVal) {
  1285. this._set(newVal);
  1286. }
  1287. }
  1288. function customRef(factory) {
  1289. return new CustomRefImpl(factory);
  1290. }
  1291. function toRefs(object) {
  1292. if (!isProxy(object)) {
  1293. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  1294. }
  1295. const ret = isArray(object) ? new Array(object.length) : {};
  1296. for (const key in object) {
  1297. ret[key] = propertyToRef(object, key);
  1298. }
  1299. return ret;
  1300. }
  1301. class ObjectRefImpl {
  1302. constructor(_object, _key, _defaultValue) {
  1303. this._object = _object;
  1304. this._key = _key;
  1305. this._defaultValue = _defaultValue;
  1306. this.__v_isRef = true;
  1307. }
  1308. get value() {
  1309. const val = this._object[this._key];
  1310. return val === void 0 ? this._defaultValue : val;
  1311. }
  1312. set value(newVal) {
  1313. this._object[this._key] = newVal;
  1314. }
  1315. get dep() {
  1316. return getDepFromReactive(toRaw(this._object), this._key);
  1317. }
  1318. }
  1319. class GetterRefImpl {
  1320. constructor(_getter) {
  1321. this._getter = _getter;
  1322. this.__v_isRef = true;
  1323. this.__v_isReadonly = true;
  1324. }
  1325. get value() {
  1326. return this._getter();
  1327. }
  1328. }
  1329. function toRef(source, key, defaultValue) {
  1330. if (isRef(source)) {
  1331. return source;
  1332. } else if (isFunction(source)) {
  1333. return new GetterRefImpl(source);
  1334. } else if (isObject(source) && arguments.length > 1) {
  1335. return propertyToRef(source, key, defaultValue);
  1336. } else {
  1337. return ref(source);
  1338. }
  1339. }
  1340. function propertyToRef(source, key, defaultValue) {
  1341. const val = source[key];
  1342. return isRef(val) ? val : new ObjectRefImpl(
  1343. source,
  1344. key,
  1345. defaultValue
  1346. );
  1347. }
  1348. class ComputedRefImpl {
  1349. constructor(getter, _setter, isReadonly, isSSR) {
  1350. this._setter = _setter;
  1351. this.dep = void 0;
  1352. this.__v_isRef = true;
  1353. this["__v_isReadonly"] = false;
  1354. this._dirty = true;
  1355. this.effect = new ReactiveEffect(getter, () => {
  1356. if (!this._dirty) {
  1357. this._dirty = true;
  1358. triggerRefValue(this);
  1359. }
  1360. });
  1361. this.effect.computed = this;
  1362. this.effect.active = this._cacheable = !isSSR;
  1363. this["__v_isReadonly"] = isReadonly;
  1364. }
  1365. get value() {
  1366. const self = toRaw(this);
  1367. trackRefValue(self);
  1368. if (self._dirty || !self._cacheable) {
  1369. self._dirty = false;
  1370. self._value = self.effect.run();
  1371. }
  1372. return self._value;
  1373. }
  1374. set value(newValue) {
  1375. this._setter(newValue);
  1376. }
  1377. }
  1378. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1379. let getter;
  1380. let setter;
  1381. const onlyGetter = isFunction(getterOrOptions);
  1382. if (onlyGetter) {
  1383. getter = getterOrOptions;
  1384. setter = () => {
  1385. console.warn("Write operation failed: computed value is readonly");
  1386. } ;
  1387. } else {
  1388. getter = getterOrOptions.get;
  1389. setter = getterOrOptions.set;
  1390. }
  1391. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1392. if (debugOptions && !isSSR) {
  1393. cRef.effect.onTrack = debugOptions.onTrack;
  1394. cRef.effect.onTrigger = debugOptions.onTrigger;
  1395. }
  1396. return cRef;
  1397. }
  1398. const stack = [];
  1399. function pushWarningContext(vnode) {
  1400. stack.push(vnode);
  1401. }
  1402. function popWarningContext() {
  1403. stack.pop();
  1404. }
  1405. function warn(msg, ...args) {
  1406. pauseTracking();
  1407. const instance = stack.length ? stack[stack.length - 1].component : null;
  1408. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  1409. const trace = getComponentTrace();
  1410. if (appWarnHandler) {
  1411. callWithErrorHandling(
  1412. appWarnHandler,
  1413. instance,
  1414. 11,
  1415. [
  1416. msg + args.join(""),
  1417. instance && instance.proxy,
  1418. trace.map(
  1419. ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
  1420. ).join("\n"),
  1421. trace
  1422. ]
  1423. );
  1424. } else {
  1425. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  1426. if (trace.length && // avoid spamming console during tests
  1427. true) {
  1428. warnArgs.push(`
  1429. `, ...formatTrace(trace));
  1430. }
  1431. console.warn(...warnArgs);
  1432. }
  1433. resetTracking();
  1434. }
  1435. function getComponentTrace() {
  1436. let currentVNode = stack[stack.length - 1];
  1437. if (!currentVNode) {
  1438. return [];
  1439. }
  1440. const normalizedStack = [];
  1441. while (currentVNode) {
  1442. const last = normalizedStack[0];
  1443. if (last && last.vnode === currentVNode) {
  1444. last.recurseCount++;
  1445. } else {
  1446. normalizedStack.push({
  1447. vnode: currentVNode,
  1448. recurseCount: 0
  1449. });
  1450. }
  1451. const parentInstance = currentVNode.component && currentVNode.component.parent;
  1452. currentVNode = parentInstance && parentInstance.vnode;
  1453. }
  1454. return normalizedStack;
  1455. }
  1456. function formatTrace(trace) {
  1457. const logs = [];
  1458. trace.forEach((entry, i) => {
  1459. logs.push(...i === 0 ? [] : [`
  1460. `], ...formatTraceEntry(entry));
  1461. });
  1462. return logs;
  1463. }
  1464. function formatTraceEntry({ vnode, recurseCount }) {
  1465. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  1466. const isRoot = vnode.component ? vnode.component.parent == null : false;
  1467. const open = ` at <${formatComponentName(
  1468. vnode.component,
  1469. vnode.type,
  1470. isRoot
  1471. )}`;
  1472. const close = `>` + postfix;
  1473. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  1474. }
  1475. function formatProps(props) {
  1476. const res = [];
  1477. const keys = Object.keys(props);
  1478. keys.slice(0, 3).forEach((key) => {
  1479. res.push(...formatProp(key, props[key]));
  1480. });
  1481. if (keys.length > 3) {
  1482. res.push(` ...`);
  1483. }
  1484. return res;
  1485. }
  1486. function formatProp(key, value, raw) {
  1487. if (isString(value)) {
  1488. value = JSON.stringify(value);
  1489. return raw ? value : [`${key}=${value}`];
  1490. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  1491. return raw ? value : [`${key}=${value}`];
  1492. } else if (isRef(value)) {
  1493. value = formatProp(key, toRaw(value.value), true);
  1494. return raw ? value : [`${key}=Ref<`, value, `>`];
  1495. } else if (isFunction(value)) {
  1496. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  1497. } else {
  1498. value = toRaw(value);
  1499. return raw ? value : [`${key}=`, value];
  1500. }
  1501. }
  1502. function assertNumber(val, type) {
  1503. if (val === void 0) {
  1504. return;
  1505. } else if (typeof val !== "number") {
  1506. warn(`${type} is not a valid number - got ${JSON.stringify(val)}.`);
  1507. } else if (isNaN(val)) {
  1508. warn(`${type} is NaN - the duration expression might be incorrect.`);
  1509. }
  1510. }
  1511. const ErrorTypeStrings = {
  1512. ["sp"]: "serverPrefetch hook",
  1513. ["bc"]: "beforeCreate hook",
  1514. ["c"]: "created hook",
  1515. ["bm"]: "beforeMount hook",
  1516. ["m"]: "mounted hook",
  1517. ["bu"]: "beforeUpdate hook",
  1518. ["u"]: "updated",
  1519. ["bum"]: "beforeUnmount hook",
  1520. ["um"]: "unmounted hook",
  1521. ["a"]: "activated hook",
  1522. ["da"]: "deactivated hook",
  1523. ["ec"]: "errorCaptured hook",
  1524. ["rtc"]: "renderTracked hook",
  1525. ["rtg"]: "renderTriggered hook",
  1526. [0]: "setup function",
  1527. [1]: "render function",
  1528. [2]: "watcher getter",
  1529. [3]: "watcher callback",
  1530. [4]: "watcher cleanup function",
  1531. [5]: "native event handler",
  1532. [6]: "component event handler",
  1533. [7]: "vnode hook",
  1534. [8]: "directive hook",
  1535. [9]: "transition hook",
  1536. [10]: "app errorHandler",
  1537. [11]: "app warnHandler",
  1538. [12]: "ref function",
  1539. [13]: "async component loader",
  1540. [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
  1541. };
  1542. function callWithErrorHandling(fn, instance, type, args) {
  1543. let res;
  1544. try {
  1545. res = args ? fn(...args) : fn();
  1546. } catch (err) {
  1547. handleError(err, instance, type);
  1548. }
  1549. return res;
  1550. }
  1551. function callWithAsyncErrorHandling(fn, instance, type, args) {
  1552. if (isFunction(fn)) {
  1553. const res = callWithErrorHandling(fn, instance, type, args);
  1554. if (res && isPromise(res)) {
  1555. res.catch((err) => {
  1556. handleError(err, instance, type);
  1557. });
  1558. }
  1559. return res;
  1560. }
  1561. const values = [];
  1562. for (let i = 0; i < fn.length; i++) {
  1563. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  1564. }
  1565. return values;
  1566. }
  1567. function handleError(err, instance, type, throwInDev = true) {
  1568. const contextVNode = instance ? instance.vnode : null;
  1569. if (instance) {
  1570. let cur = instance.parent;
  1571. const exposedInstance = instance.proxy;
  1572. const errorInfo = ErrorTypeStrings[type] ;
  1573. while (cur) {
  1574. const errorCapturedHooks = cur.ec;
  1575. if (errorCapturedHooks) {
  1576. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1577. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1578. return;
  1579. }
  1580. }
  1581. }
  1582. cur = cur.parent;
  1583. }
  1584. const appErrorHandler = instance.appContext.config.errorHandler;
  1585. if (appErrorHandler) {
  1586. callWithErrorHandling(
  1587. appErrorHandler,
  1588. null,
  1589. 10,
  1590. [err, exposedInstance, errorInfo]
  1591. );
  1592. return;
  1593. }
  1594. }
  1595. logError(err, type, contextVNode, throwInDev);
  1596. }
  1597. function logError(err, type, contextVNode, throwInDev = true) {
  1598. {
  1599. const info = ErrorTypeStrings[type];
  1600. if (contextVNode) {
  1601. pushWarningContext(contextVNode);
  1602. }
  1603. warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  1604. if (contextVNode) {
  1605. popWarningContext();
  1606. }
  1607. if (throwInDev) {
  1608. throw err;
  1609. } else {
  1610. console.error(err);
  1611. }
  1612. }
  1613. }
  1614. let isFlushing = false;
  1615. let isFlushPending = false;
  1616. const queue = [];
  1617. let flushIndex = 0;
  1618. const pendingPostFlushCbs = [];
  1619. let activePostFlushCbs = null;
  1620. let postFlushIndex = 0;
  1621. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1622. let currentFlushPromise = null;
  1623. const RECURSION_LIMIT = 100;
  1624. function nextTick(fn) {
  1625. const p = currentFlushPromise || resolvedPromise;
  1626. return fn ? p.then(this ? fn.bind(this) : fn) : p;
  1627. }
  1628. function findInsertionIndex(id) {
  1629. let start = flushIndex + 1;
  1630. let end = queue.length;
  1631. while (start < end) {
  1632. const middle = start + end >>> 1;
  1633. const middleJobId = getId(queue[middle]);
  1634. middleJobId < id ? start = middle + 1 : end = middle;
  1635. }
  1636. return start;
  1637. }
  1638. function queueJob(job) {
  1639. if (!queue.length || !queue.includes(
  1640. job,
  1641. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1642. )) {
  1643. if (job.id == null) {
  1644. queue.push(job);
  1645. } else {
  1646. queue.splice(findInsertionIndex(job.id), 0, job);
  1647. }
  1648. queueFlush();
  1649. }
  1650. }
  1651. function queueFlush() {
  1652. if (!isFlushing && !isFlushPending) {
  1653. isFlushPending = true;
  1654. currentFlushPromise = resolvedPromise.then(flushJobs);
  1655. }
  1656. }
  1657. function invalidateJob(job) {
  1658. const i = queue.indexOf(job);
  1659. if (i > flushIndex) {
  1660. queue.splice(i, 1);
  1661. }
  1662. }
  1663. function queuePostFlushCb(cb) {
  1664. if (!isArray(cb)) {
  1665. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1666. cb,
  1667. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1668. )) {
  1669. pendingPostFlushCbs.push(cb);
  1670. }
  1671. } else {
  1672. pendingPostFlushCbs.push(...cb);
  1673. }
  1674. queueFlush();
  1675. }
  1676. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  1677. {
  1678. seen = seen || /* @__PURE__ */ new Map();
  1679. }
  1680. for (; i < queue.length; i++) {
  1681. const cb = queue[i];
  1682. if (cb && cb.pre) {
  1683. if (checkRecursiveUpdates(seen, cb)) {
  1684. continue;
  1685. }
  1686. queue.splice(i, 1);
  1687. i--;
  1688. cb();
  1689. }
  1690. }
  1691. }
  1692. function flushPostFlushCbs(seen) {
  1693. if (pendingPostFlushCbs.length) {
  1694. const deduped = [...new Set(pendingPostFlushCbs)];
  1695. pendingPostFlushCbs.length = 0;
  1696. if (activePostFlushCbs) {
  1697. activePostFlushCbs.push(...deduped);
  1698. return;
  1699. }
  1700. activePostFlushCbs = deduped;
  1701. {
  1702. seen = seen || /* @__PURE__ */ new Map();
  1703. }
  1704. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  1705. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1706. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  1707. continue;
  1708. }
  1709. activePostFlushCbs[postFlushIndex]();
  1710. }
  1711. activePostFlushCbs = null;
  1712. postFlushIndex = 0;
  1713. }
  1714. }
  1715. const getId = (job) => job.id == null ? Infinity : job.id;
  1716. const comparator = (a, b) => {
  1717. const diff = getId(a) - getId(b);
  1718. if (diff === 0) {
  1719. if (a.pre && !b.pre)
  1720. return -1;
  1721. if (b.pre && !a.pre)
  1722. return 1;
  1723. }
  1724. return diff;
  1725. };
  1726. function flushJobs(seen) {
  1727. isFlushPending = false;
  1728. isFlushing = true;
  1729. {
  1730. seen = seen || /* @__PURE__ */ new Map();
  1731. }
  1732. queue.sort(comparator);
  1733. const check = (job) => checkRecursiveUpdates(seen, job) ;
  1734. try {
  1735. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1736. const job = queue[flushIndex];
  1737. if (job && job.active !== false) {
  1738. if (check(job)) {
  1739. continue;
  1740. }
  1741. callWithErrorHandling(job, null, 14);
  1742. }
  1743. }
  1744. } finally {
  1745. flushIndex = 0;
  1746. queue.length = 0;
  1747. flushPostFlushCbs(seen);
  1748. isFlushing = false;
  1749. currentFlushPromise = null;
  1750. if (queue.length || pendingPostFlushCbs.length) {
  1751. flushJobs(seen);
  1752. }
  1753. }
  1754. }
  1755. function checkRecursiveUpdates(seen, fn) {
  1756. if (!seen.has(fn)) {
  1757. seen.set(fn, 1);
  1758. } else {
  1759. const count = seen.get(fn);
  1760. if (count > RECURSION_LIMIT) {
  1761. const instance = fn.ownerInstance;
  1762. const componentName = instance && getComponentName(instance.type);
  1763. warn(
  1764. `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.`
  1765. );
  1766. return true;
  1767. } else {
  1768. seen.set(fn, count + 1);
  1769. }
  1770. }
  1771. }
  1772. let isHmrUpdating = false;
  1773. const hmrDirtyComponents = /* @__PURE__ */ new Set();
  1774. {
  1775. getGlobalThis().__VUE_HMR_RUNTIME__ = {
  1776. createRecord: tryWrap(createRecord),
  1777. rerender: tryWrap(rerender),
  1778. reload: tryWrap(reload)
  1779. };
  1780. }
  1781. const map = /* @__PURE__ */ new Map();
  1782. function registerHMR(instance) {
  1783. const id = instance.type.__hmrId;
  1784. let record = map.get(id);
  1785. if (!record) {
  1786. createRecord(id, instance.type);
  1787. record = map.get(id);
  1788. }
  1789. record.instances.add(instance);
  1790. }
  1791. function unregisterHMR(instance) {
  1792. map.get(instance.type.__hmrId).instances.delete(instance);
  1793. }
  1794. function createRecord(id, initialDef) {
  1795. if (map.has(id)) {
  1796. return false;
  1797. }
  1798. map.set(id, {
  1799. initialDef: normalizeClassComponent(initialDef),
  1800. instances: /* @__PURE__ */ new Set()
  1801. });
  1802. return true;
  1803. }
  1804. function normalizeClassComponent(component) {
  1805. return isClassComponent(component) ? component.__vccOpts : component;
  1806. }
  1807. function rerender(id, newRender) {
  1808. const record = map.get(id);
  1809. if (!record) {
  1810. return;
  1811. }
  1812. record.initialDef.render = newRender;
  1813. [...record.instances].forEach((instance) => {
  1814. if (newRender) {
  1815. instance.render = newRender;
  1816. normalizeClassComponent(instance.type).render = newRender;
  1817. }
  1818. instance.renderCache = [];
  1819. isHmrUpdating = true;
  1820. instance.update();
  1821. isHmrUpdating = false;
  1822. });
  1823. }
  1824. function reload(id, newComp) {
  1825. const record = map.get(id);
  1826. if (!record)
  1827. return;
  1828. newComp = normalizeClassComponent(newComp);
  1829. updateComponentDef(record.initialDef, newComp);
  1830. const instances = [...record.instances];
  1831. for (const instance of instances) {
  1832. const oldComp = normalizeClassComponent(instance.type);
  1833. if (!hmrDirtyComponents.has(oldComp)) {
  1834. if (oldComp !== record.initialDef) {
  1835. updateComponentDef(oldComp, newComp);
  1836. }
  1837. hmrDirtyComponents.add(oldComp);
  1838. }
  1839. instance.appContext.propsCache.delete(instance.type);
  1840. instance.appContext.emitsCache.delete(instance.type);
  1841. instance.appContext.optionsCache.delete(instance.type);
  1842. if (instance.ceReload) {
  1843. hmrDirtyComponents.add(oldComp);
  1844. instance.ceReload(newComp.styles);
  1845. hmrDirtyComponents.delete(oldComp);
  1846. } else if (instance.parent) {
  1847. queueJob(instance.parent.update);
  1848. } else if (instance.appContext.reload) {
  1849. instance.appContext.reload();
  1850. } else if (typeof window !== "undefined") {
  1851. window.location.reload();
  1852. } else {
  1853. console.warn(
  1854. "[HMR] Root or manually mounted instance modified. Full reload required."
  1855. );
  1856. }
  1857. }
  1858. queuePostFlushCb(() => {
  1859. for (const instance of instances) {
  1860. hmrDirtyComponents.delete(
  1861. normalizeClassComponent(instance.type)
  1862. );
  1863. }
  1864. });
  1865. }
  1866. function updateComponentDef(oldComp, newComp) {
  1867. extend(oldComp, newComp);
  1868. for (const key in oldComp) {
  1869. if (key !== "__file" && !(key in newComp)) {
  1870. delete oldComp[key];
  1871. }
  1872. }
  1873. }
  1874. function tryWrap(fn) {
  1875. return (id, arg) => {
  1876. try {
  1877. return fn(id, arg);
  1878. } catch (e) {
  1879. console.error(e);
  1880. console.warn(
  1881. `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
  1882. );
  1883. }
  1884. };
  1885. }
  1886. let devtools;
  1887. let buffer = [];
  1888. let devtoolsNotInstalled = false;
  1889. function emit$1(event, ...args) {
  1890. if (devtools) {
  1891. devtools.emit(event, ...args);
  1892. } else if (!devtoolsNotInstalled) {
  1893. buffer.push({ event, args });
  1894. }
  1895. }
  1896. function setDevtoolsHook(hook, target) {
  1897. var _a, _b;
  1898. devtools = hook;
  1899. if (devtools) {
  1900. devtools.enabled = true;
  1901. buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
  1902. buffer = [];
  1903. } else if (
  1904. // handle late devtools injection - only do this if we are in an actual
  1905. // browser environment to avoid the timer handle stalling test runner exit
  1906. // (#4815)
  1907. typeof window !== "undefined" && // some envs mock window but not fully
  1908. window.HTMLElement && // also exclude jsdom
  1909. !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
  1910. ) {
  1911. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  1912. replay.push((newHook) => {
  1913. setDevtoolsHook(newHook, target);
  1914. });
  1915. setTimeout(() => {
  1916. if (!devtools) {
  1917. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  1918. devtoolsNotInstalled = true;
  1919. buffer = [];
  1920. }
  1921. }, 3e3);
  1922. } else {
  1923. devtoolsNotInstalled = true;
  1924. buffer = [];
  1925. }
  1926. }
  1927. function devtoolsInitApp(app, version) {
  1928. emit$1("app:init" /* APP_INIT */, app, version, {
  1929. Fragment,
  1930. Text,
  1931. Comment,
  1932. Static
  1933. });
  1934. }
  1935. function devtoolsUnmountApp(app) {
  1936. emit$1("app:unmount" /* APP_UNMOUNT */, app);
  1937. }
  1938. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  1939. "component:added" /* COMPONENT_ADDED */
  1940. );
  1941. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
  1942. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  1943. "component:removed" /* COMPONENT_REMOVED */
  1944. );
  1945. const devtoolsComponentRemoved = (component) => {
  1946. if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  1947. !devtools.cleanupBuffer(component)) {
  1948. _devtoolsComponentRemoved(component);
  1949. }
  1950. };
  1951. function createDevtoolsComponentHook(hook) {
  1952. return (component) => {
  1953. emit$1(
  1954. hook,
  1955. component.appContext.app,
  1956. component.uid,
  1957. component.parent ? component.parent.uid : void 0,
  1958. component
  1959. );
  1960. };
  1961. }
  1962. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1963. "perf:start" /* PERFORMANCE_START */
  1964. );
  1965. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  1966. "perf:end" /* PERFORMANCE_END */
  1967. );
  1968. function createDevtoolsPerformanceHook(hook) {
  1969. return (component, type, time) => {
  1970. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  1971. };
  1972. }
  1973. function devtoolsComponentEmit(component, event, params) {
  1974. emit$1(
  1975. "component:emit" /* COMPONENT_EMIT */,
  1976. component.appContext.app,
  1977. component,
  1978. event,
  1979. params
  1980. );
  1981. }
  1982. function emit(instance, event, ...rawArgs) {
  1983. if (instance.isUnmounted)
  1984. return;
  1985. const props = instance.vnode.props || EMPTY_OBJ;
  1986. {
  1987. const {
  1988. emitsOptions,
  1989. propsOptions: [propsOptions]
  1990. } = instance;
  1991. if (emitsOptions) {
  1992. if (!(event in emitsOptions) && true) {
  1993. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  1994. warn(
  1995. `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
  1996. );
  1997. }
  1998. } else {
  1999. const validator = emitsOptions[event];
  2000. if (isFunction(validator)) {
  2001. const isValid = validator(...rawArgs);
  2002. if (!isValid) {
  2003. warn(
  2004. `Invalid event arguments: event validation failed for event "${event}".`
  2005. );
  2006. }
  2007. }
  2008. }
  2009. }
  2010. }
  2011. let args = rawArgs;
  2012. const isModelListener = event.startsWith("update:");
  2013. const modelArg = isModelListener && event.slice(7);
  2014. if (modelArg && modelArg in props) {
  2015. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  2016. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  2017. if (trim) {
  2018. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  2019. }
  2020. if (number) {
  2021. args = rawArgs.map(looseToNumber);
  2022. }
  2023. }
  2024. {
  2025. devtoolsComponentEmit(instance, event, args);
  2026. }
  2027. {
  2028. const lowerCaseEvent = event.toLowerCase();
  2029. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  2030. warn(
  2031. `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
  2032. instance,
  2033. instance.type
  2034. )} 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}".`
  2035. );
  2036. }
  2037. }
  2038. let handlerName;
  2039. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  2040. props[handlerName = toHandlerKey(camelize(event))];
  2041. if (!handler && isModelListener) {
  2042. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  2043. }
  2044. if (handler) {
  2045. callWithAsyncErrorHandling(
  2046. handler,
  2047. instance,
  2048. 6,
  2049. args
  2050. );
  2051. }
  2052. const onceHandler = props[handlerName + `Once`];
  2053. if (onceHandler) {
  2054. if (!instance.emitted) {
  2055. instance.emitted = {};
  2056. } else if (instance.emitted[handlerName]) {
  2057. return;
  2058. }
  2059. instance.emitted[handlerName] = true;
  2060. callWithAsyncErrorHandling(
  2061. onceHandler,
  2062. instance,
  2063. 6,
  2064. args
  2065. );
  2066. }
  2067. }
  2068. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  2069. const cache = appContext.emitsCache;
  2070. const cached = cache.get(comp);
  2071. if (cached !== void 0) {
  2072. return cached;
  2073. }
  2074. const raw = comp.emits;
  2075. let normalized = {};
  2076. let hasExtends = false;
  2077. if (!isFunction(comp)) {
  2078. const extendEmits = (raw2) => {
  2079. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  2080. if (normalizedFromExtend) {
  2081. hasExtends = true;
  2082. extend(normalized, normalizedFromExtend);
  2083. }
  2084. };
  2085. if (!asMixin && appContext.mixins.length) {
  2086. appContext.mixins.forEach(extendEmits);
  2087. }
  2088. if (comp.extends) {
  2089. extendEmits(comp.extends);
  2090. }
  2091. if (comp.mixins) {
  2092. comp.mixins.forEach(extendEmits);
  2093. }
  2094. }
  2095. if (!raw && !hasExtends) {
  2096. if (isObject(comp)) {
  2097. cache.set(comp, null);
  2098. }
  2099. return null;
  2100. }
  2101. if (isArray(raw)) {
  2102. raw.forEach((key) => normalized[key] = null);
  2103. } else {
  2104. extend(normalized, raw);
  2105. }
  2106. if (isObject(comp)) {
  2107. cache.set(comp, normalized);
  2108. }
  2109. return normalized;
  2110. }
  2111. function isEmitListener(options, key) {
  2112. if (!options || !isOn(key)) {
  2113. return false;
  2114. }
  2115. key = key.slice(2).replace(/Once$/, "");
  2116. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  2117. }
  2118. let currentRenderingInstance = null;
  2119. let currentScopeId = null;
  2120. function setCurrentRenderingInstance(instance) {
  2121. const prev = currentRenderingInstance;
  2122. currentRenderingInstance = instance;
  2123. currentScopeId = instance && instance.type.__scopeId || null;
  2124. return prev;
  2125. }
  2126. function pushScopeId(id) {
  2127. currentScopeId = id;
  2128. }
  2129. function popScopeId() {
  2130. currentScopeId = null;
  2131. }
  2132. const withScopeId = (_id) => withCtx;
  2133. function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
  2134. if (!ctx)
  2135. return fn;
  2136. if (fn._n) {
  2137. return fn;
  2138. }
  2139. const renderFnWithContext = (...args) => {
  2140. if (renderFnWithContext._d) {
  2141. setBlockTracking(-1);
  2142. }
  2143. const prevInstance = setCurrentRenderingInstance(ctx);
  2144. let res;
  2145. try {
  2146. res = fn(...args);
  2147. } finally {
  2148. setCurrentRenderingInstance(prevInstance);
  2149. if (renderFnWithContext._d) {
  2150. setBlockTracking(1);
  2151. }
  2152. }
  2153. {
  2154. devtoolsComponentUpdated(ctx);
  2155. }
  2156. return res;
  2157. };
  2158. renderFnWithContext._n = true;
  2159. renderFnWithContext._c = true;
  2160. renderFnWithContext._d = true;
  2161. return renderFnWithContext;
  2162. }
  2163. let accessedAttrs = false;
  2164. function markAttrsAccessed() {
  2165. accessedAttrs = true;
  2166. }
  2167. function renderComponentRoot(instance) {
  2168. const {
  2169. type: Component,
  2170. vnode,
  2171. proxy,
  2172. withProxy,
  2173. props,
  2174. propsOptions: [propsOptions],
  2175. slots,
  2176. attrs,
  2177. emit,
  2178. render,
  2179. renderCache,
  2180. data,
  2181. setupState,
  2182. ctx,
  2183. inheritAttrs
  2184. } = instance;
  2185. let result;
  2186. let fallthroughAttrs;
  2187. const prev = setCurrentRenderingInstance(instance);
  2188. {
  2189. accessedAttrs = false;
  2190. }
  2191. try {
  2192. if (vnode.shapeFlag & 4) {
  2193. const proxyToUse = withProxy || proxy;
  2194. result = normalizeVNode(
  2195. render.call(
  2196. proxyToUse,
  2197. proxyToUse,
  2198. renderCache,
  2199. props,
  2200. setupState,
  2201. data,
  2202. ctx
  2203. )
  2204. );
  2205. fallthroughAttrs = attrs;
  2206. } else {
  2207. const render2 = Component;
  2208. if (attrs === props) {
  2209. markAttrsAccessed();
  2210. }
  2211. result = normalizeVNode(
  2212. render2.length > 1 ? render2(
  2213. props,
  2214. true ? {
  2215. get attrs() {
  2216. markAttrsAccessed();
  2217. return attrs;
  2218. },
  2219. slots,
  2220. emit
  2221. } : { attrs, slots, emit }
  2222. ) : render2(
  2223. props,
  2224. null
  2225. /* we know it doesn't need it */
  2226. )
  2227. );
  2228. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  2229. }
  2230. } catch (err) {
  2231. blockStack.length = 0;
  2232. handleError(err, instance, 1);
  2233. result = createVNode(Comment);
  2234. }
  2235. let root = result;
  2236. let setRoot = void 0;
  2237. if (result.patchFlag > 0 && result.patchFlag & 2048) {
  2238. [root, setRoot] = getChildRoot(result);
  2239. }
  2240. if (fallthroughAttrs && inheritAttrs !== false) {
  2241. const keys = Object.keys(fallthroughAttrs);
  2242. const { shapeFlag } = root;
  2243. if (keys.length) {
  2244. if (shapeFlag & (1 | 6)) {
  2245. if (propsOptions && keys.some(isModelListener)) {
  2246. fallthroughAttrs = filterModelListeners(
  2247. fallthroughAttrs,
  2248. propsOptions
  2249. );
  2250. }
  2251. root = cloneVNode(root, fallthroughAttrs);
  2252. } else if (!accessedAttrs && root.type !== Comment) {
  2253. const allAttrs = Object.keys(attrs);
  2254. const eventAttrs = [];
  2255. const extraAttrs = [];
  2256. for (let i = 0, l = allAttrs.length; i < l; i++) {
  2257. const key = allAttrs[i];
  2258. if (isOn(key)) {
  2259. if (!isModelListener(key)) {
  2260. eventAttrs.push(key[2].toLowerCase() + key.slice(3));
  2261. }
  2262. } else {
  2263. extraAttrs.push(key);
  2264. }
  2265. }
  2266. if (extraAttrs.length) {
  2267. warn(
  2268. `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`
  2269. );
  2270. }
  2271. if (eventAttrs.length) {
  2272. warn(
  2273. `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.`
  2274. );
  2275. }
  2276. }
  2277. }
  2278. }
  2279. if (vnode.dirs) {
  2280. if (!isElementRoot(root)) {
  2281. warn(
  2282. `Runtime directive used on component with non-element root node. The directives will not function as intended.`
  2283. );
  2284. }
  2285. root = cloneVNode(root);
  2286. root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
  2287. }
  2288. if (vnode.transition) {
  2289. if (!isElementRoot(root)) {
  2290. warn(
  2291. `Component inside <Transition> renders non-element root node that cannot be animated.`
  2292. );
  2293. }
  2294. root.transition = vnode.transition;
  2295. }
  2296. if (setRoot) {
  2297. setRoot(root);
  2298. } else {
  2299. result = root;
  2300. }
  2301. setCurrentRenderingInstance(prev);
  2302. return result;
  2303. }
  2304. const getChildRoot = (vnode) => {
  2305. const rawChildren = vnode.children;
  2306. const dynamicChildren = vnode.dynamicChildren;
  2307. const childRoot = filterSingleRoot(rawChildren);
  2308. if (!childRoot) {
  2309. return [vnode, void 0];
  2310. }
  2311. const index = rawChildren.indexOf(childRoot);
  2312. const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
  2313. const setRoot = (updatedRoot) => {
  2314. rawChildren[index] = updatedRoot;
  2315. if (dynamicChildren) {
  2316. if (dynamicIndex > -1) {
  2317. dynamicChildren[dynamicIndex] = updatedRoot;
  2318. } else if (updatedRoot.patchFlag > 0) {
  2319. vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
  2320. }
  2321. }
  2322. };
  2323. return [normalizeVNode(childRoot), setRoot];
  2324. };
  2325. function filterSingleRoot(children) {
  2326. let singleRoot;
  2327. for (let i = 0; i < children.length; i++) {
  2328. const child = children[i];
  2329. if (isVNode(child)) {
  2330. if (child.type !== Comment || child.children === "v-if") {
  2331. if (singleRoot) {
  2332. return;
  2333. } else {
  2334. singleRoot = child;
  2335. }
  2336. }
  2337. } else {
  2338. return;
  2339. }
  2340. }
  2341. return singleRoot;
  2342. }
  2343. const getFunctionalFallthrough = (attrs) => {
  2344. let res;
  2345. for (const key in attrs) {
  2346. if (key === "class" || key === "style" || isOn(key)) {
  2347. (res || (res = {}))[key] = attrs[key];
  2348. }
  2349. }
  2350. return res;
  2351. };
  2352. const filterModelListeners = (attrs, props) => {
  2353. const res = {};
  2354. for (const key in attrs) {
  2355. if (!isModelListener(key) || !(key.slice(9) in props)) {
  2356. res[key] = attrs[key];
  2357. }
  2358. }
  2359. return res;
  2360. };
  2361. const isElementRoot = (vnode) => {
  2362. return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;
  2363. };
  2364. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  2365. const { props: prevProps, children: prevChildren, component } = prevVNode;
  2366. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  2367. const emits = component.emitsOptions;
  2368. if ((prevChildren || nextChildren) && isHmrUpdating) {
  2369. return true;
  2370. }
  2371. if (nextVNode.dirs || nextVNode.transition) {
  2372. return true;
  2373. }
  2374. if (optimized && patchFlag >= 0) {
  2375. if (patchFlag & 1024) {
  2376. return true;
  2377. }
  2378. if (patchFlag & 16) {
  2379. if (!prevProps) {
  2380. return !!nextProps;
  2381. }
  2382. return hasPropsChanged(prevProps, nextProps, emits);
  2383. } else if (patchFlag & 8) {
  2384. const dynamicProps = nextVNode.dynamicProps;
  2385. for (let i = 0; i < dynamicProps.length; i++) {
  2386. const key = dynamicProps[i];
  2387. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  2388. return true;
  2389. }
  2390. }
  2391. }
  2392. } else {
  2393. if (prevChildren || nextChildren) {
  2394. if (!nextChildren || !nextChildren.$stable) {
  2395. return true;
  2396. }
  2397. }
  2398. if (prevProps === nextProps) {
  2399. return false;
  2400. }
  2401. if (!prevProps) {
  2402. return !!nextProps;
  2403. }
  2404. if (!nextProps) {
  2405. return true;
  2406. }
  2407. return hasPropsChanged(prevProps, nextProps, emits);
  2408. }
  2409. return false;
  2410. }
  2411. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  2412. const nextKeys = Object.keys(nextProps);
  2413. if (nextKeys.length !== Object.keys(prevProps).length) {
  2414. return true;
  2415. }
  2416. for (let i = 0; i < nextKeys.length; i++) {
  2417. const key = nextKeys[i];
  2418. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  2419. return true;
  2420. }
  2421. }
  2422. return false;
  2423. }
  2424. function updateHOCHostEl({ vnode, parent }, el) {
  2425. while (parent && parent.subTree === vnode) {
  2426. (vnode = parent.vnode).el = el;
  2427. parent = parent.parent;
  2428. }
  2429. }
  2430. const isSuspense = (type) => type.__isSuspense;
  2431. const SuspenseImpl = {
  2432. name: "Suspense",
  2433. // In order to make Suspense tree-shakable, we need to avoid importing it
  2434. // directly in the renderer. The renderer checks for the __isSuspense flag
  2435. // on a vnode's type and calls the `process` method, passing in renderer
  2436. // internals.
  2437. __isSuspense: true,
  2438. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2439. if (n1 == null) {
  2440. mountSuspense(
  2441. n2,
  2442. container,
  2443. anchor,
  2444. parentComponent,
  2445. parentSuspense,
  2446. isSVG,
  2447. slotScopeIds,
  2448. optimized,
  2449. rendererInternals
  2450. );
  2451. } else {
  2452. patchSuspense(
  2453. n1,
  2454. n2,
  2455. container,
  2456. anchor,
  2457. parentComponent,
  2458. isSVG,
  2459. slotScopeIds,
  2460. optimized,
  2461. rendererInternals
  2462. );
  2463. }
  2464. },
  2465. hydrate: hydrateSuspense,
  2466. create: createSuspenseBoundary,
  2467. normalize: normalizeSuspenseChildren
  2468. };
  2469. const Suspense = SuspenseImpl ;
  2470. function triggerEvent(vnode, name) {
  2471. const eventListener = vnode.props && vnode.props[name];
  2472. if (isFunction(eventListener)) {
  2473. eventListener();
  2474. }
  2475. }
  2476. function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
  2477. const {
  2478. p: patch,
  2479. o: { createElement }
  2480. } = rendererInternals;
  2481. const hiddenContainer = createElement("div");
  2482. const suspense = vnode.suspense = createSuspenseBoundary(
  2483. vnode,
  2484. parentSuspense,
  2485. parentComponent,
  2486. container,
  2487. hiddenContainer,
  2488. anchor,
  2489. isSVG,
  2490. slotScopeIds,
  2491. optimized,
  2492. rendererInternals
  2493. );
  2494. patch(
  2495. null,
  2496. suspense.pendingBranch = vnode.ssContent,
  2497. hiddenContainer,
  2498. null,
  2499. parentComponent,
  2500. suspense,
  2501. isSVG,
  2502. slotScopeIds
  2503. );
  2504. if (suspense.deps > 0) {
  2505. triggerEvent(vnode, "onPending");
  2506. triggerEvent(vnode, "onFallback");
  2507. patch(
  2508. null,
  2509. vnode.ssFallback,
  2510. container,
  2511. anchor,
  2512. parentComponent,
  2513. null,
  2514. // fallback tree will not have suspense context
  2515. isSVG,
  2516. slotScopeIds
  2517. );
  2518. setActiveBranch(suspense, vnode.ssFallback);
  2519. } else {
  2520. suspense.resolve(false, true);
  2521. }
  2522. }
  2523. function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
  2524. const suspense = n2.suspense = n1.suspense;
  2525. suspense.vnode = n2;
  2526. n2.el = n1.el;
  2527. const newBranch = n2.ssContent;
  2528. const newFallback = n2.ssFallback;
  2529. const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
  2530. if (pendingBranch) {
  2531. suspense.pendingBranch = newBranch;
  2532. if (isSameVNodeType(newBranch, pendingBranch)) {
  2533. patch(
  2534. pendingBranch,
  2535. newBranch,
  2536. suspense.hiddenContainer,
  2537. null,
  2538. parentComponent,
  2539. suspense,
  2540. isSVG,
  2541. slotScopeIds,
  2542. optimized
  2543. );
  2544. if (suspense.deps <= 0) {
  2545. suspense.resolve();
  2546. } else if (isInFallback) {
  2547. patch(
  2548. activeBranch,
  2549. newFallback,
  2550. container,
  2551. anchor,
  2552. parentComponent,
  2553. null,
  2554. // fallback tree will not have suspense context
  2555. isSVG,
  2556. slotScopeIds,
  2557. optimized
  2558. );
  2559. setActiveBranch(suspense, newFallback);
  2560. }
  2561. } else {
  2562. suspense.pendingId++;
  2563. if (isHydrating) {
  2564. suspense.isHydrating = false;
  2565. suspense.activeBranch = pendingBranch;
  2566. } else {
  2567. unmount(pendingBranch, parentComponent, suspense);
  2568. }
  2569. suspense.deps = 0;
  2570. suspense.effects.length = 0;
  2571. suspense.hiddenContainer = createElement("div");
  2572. if (isInFallback) {
  2573. patch(
  2574. null,
  2575. newBranch,
  2576. suspense.hiddenContainer,
  2577. null,
  2578. parentComponent,
  2579. suspense,
  2580. isSVG,
  2581. slotScopeIds,
  2582. optimized
  2583. );
  2584. if (suspense.deps <= 0) {
  2585. suspense.resolve();
  2586. } else {
  2587. patch(
  2588. activeBranch,
  2589. newFallback,
  2590. container,
  2591. anchor,
  2592. parentComponent,
  2593. null,
  2594. // fallback tree will not have suspense context
  2595. isSVG,
  2596. slotScopeIds,
  2597. optimized
  2598. );
  2599. setActiveBranch(suspense, newFallback);
  2600. }
  2601. } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2602. patch(
  2603. activeBranch,
  2604. newBranch,
  2605. container,
  2606. anchor,
  2607. parentComponent,
  2608. suspense,
  2609. isSVG,
  2610. slotScopeIds,
  2611. optimized
  2612. );
  2613. suspense.resolve(true);
  2614. } else {
  2615. patch(
  2616. null,
  2617. newBranch,
  2618. suspense.hiddenContainer,
  2619. null,
  2620. parentComponent,
  2621. suspense,
  2622. isSVG,
  2623. slotScopeIds,
  2624. optimized
  2625. );
  2626. if (suspense.deps <= 0) {
  2627. suspense.resolve();
  2628. }
  2629. }
  2630. }
  2631. } else {
  2632. if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
  2633. patch(
  2634. activeBranch,
  2635. newBranch,
  2636. container,
  2637. anchor,
  2638. parentComponent,
  2639. suspense,
  2640. isSVG,
  2641. slotScopeIds,
  2642. optimized
  2643. );
  2644. setActiveBranch(suspense, newBranch);
  2645. } else {
  2646. triggerEvent(n2, "onPending");
  2647. suspense.pendingBranch = newBranch;
  2648. suspense.pendingId++;
  2649. patch(
  2650. null,
  2651. newBranch,
  2652. suspense.hiddenContainer,
  2653. null,
  2654. parentComponent,
  2655. suspense,
  2656. isSVG,
  2657. slotScopeIds,
  2658. optimized
  2659. );
  2660. if (suspense.deps <= 0) {
  2661. suspense.resolve();
  2662. } else {
  2663. const { timeout, pendingId } = suspense;
  2664. if (timeout > 0) {
  2665. setTimeout(() => {
  2666. if (suspense.pendingId === pendingId) {
  2667. suspense.fallback(newFallback);
  2668. }
  2669. }, timeout);
  2670. } else if (timeout === 0) {
  2671. suspense.fallback(newFallback);
  2672. }
  2673. }
  2674. }
  2675. }
  2676. }
  2677. let hasWarned = false;
  2678. function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
  2679. if (!hasWarned) {
  2680. hasWarned = true;
  2681. console[console.info ? "info" : "log"](
  2682. `<Suspense> is an experimental feature and its API will likely change.`
  2683. );
  2684. }
  2685. const {
  2686. p: patch,
  2687. m: move,
  2688. um: unmount,
  2689. n: next,
  2690. o: { parentNode, remove }
  2691. } = rendererInternals;
  2692. let parentSuspenseId;
  2693. const isSuspensible = isVNodeSuspensible(vnode);
  2694. if (isSuspensible) {
  2695. if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
  2696. parentSuspenseId = parentSuspense.pendingId;
  2697. parentSuspense.deps++;
  2698. }
  2699. }
  2700. const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
  2701. {
  2702. assertNumber(timeout, `Suspense timeout`);
  2703. }
  2704. const suspense = {
  2705. vnode,
  2706. parent: parentSuspense,
  2707. parentComponent,
  2708. isSVG,
  2709. container,
  2710. hiddenContainer,
  2711. anchor,
  2712. deps: 0,
  2713. pendingId: 0,
  2714. timeout: typeof timeout === "number" ? timeout : -1,
  2715. activeBranch: null,
  2716. pendingBranch: null,
  2717. isInFallback: true,
  2718. isHydrating,
  2719. isUnmounted: false,
  2720. effects: [],
  2721. resolve(resume = false, sync = false) {
  2722. {
  2723. if (!resume && !suspense.pendingBranch) {
  2724. throw new Error(
  2725. `suspense.resolve() is called without a pending branch.`
  2726. );
  2727. }
  2728. if (suspense.isUnmounted) {
  2729. throw new Error(
  2730. `suspense.resolve() is called on an already unmounted suspense boundary.`
  2731. );
  2732. }
  2733. }
  2734. const {
  2735. vnode: vnode2,
  2736. activeBranch,
  2737. pendingBranch,
  2738. pendingId,
  2739. effects,
  2740. parentComponent: parentComponent2,
  2741. container: container2
  2742. } = suspense;
  2743. if (suspense.isHydrating) {
  2744. suspense.isHydrating = false;
  2745. } else if (!resume) {
  2746. const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
  2747. if (delayEnter) {
  2748. activeBranch.transition.afterLeave = () => {
  2749. if (pendingId === suspense.pendingId) {
  2750. move(pendingBranch, container2, anchor2, 0);
  2751. }
  2752. };
  2753. }
  2754. let { anchor: anchor2 } = suspense;
  2755. if (activeBranch) {
  2756. anchor2 = next(activeBranch);
  2757. unmount(activeBranch, parentComponent2, suspense, true);
  2758. }
  2759. if (!delayEnter) {
  2760. move(pendingBranch, container2, anchor2, 0);
  2761. }
  2762. }
  2763. setActiveBranch(suspense, pendingBranch);
  2764. suspense.pendingBranch = null;
  2765. suspense.isInFallback = false;
  2766. let parent = suspense.parent;
  2767. let hasUnresolvedAncestor = false;
  2768. while (parent) {
  2769. if (parent.pendingBranch) {
  2770. parent.effects.push(...effects);
  2771. hasUnresolvedAncestor = true;
  2772. break;
  2773. }
  2774. parent = parent.parent;
  2775. }
  2776. if (!hasUnresolvedAncestor) {
  2777. queuePostFlushCb(effects);
  2778. }
  2779. suspense.effects = [];
  2780. if (isSuspensible) {
  2781. if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
  2782. parentSuspense.deps--;
  2783. if (parentSuspense.deps === 0 && !sync) {
  2784. parentSuspense.resolve();
  2785. }
  2786. }
  2787. }
  2788. triggerEvent(vnode2, "onResolve");
  2789. },
  2790. fallback(fallbackVNode) {
  2791. if (!suspense.pendingBranch) {
  2792. return;
  2793. }
  2794. const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
  2795. triggerEvent(vnode2, "onFallback");
  2796. const anchor2 = next(activeBranch);
  2797. const mountFallback = () => {
  2798. if (!suspense.isInFallback) {
  2799. return;
  2800. }
  2801. patch(
  2802. null,
  2803. fallbackVNode,
  2804. container2,
  2805. anchor2,
  2806. parentComponent2,
  2807. null,
  2808. // fallback tree will not have suspense context
  2809. isSVG2,
  2810. slotScopeIds,
  2811. optimized
  2812. );
  2813. setActiveBranch(suspense, fallbackVNode);
  2814. };
  2815. const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
  2816. if (delayEnter) {
  2817. activeBranch.transition.afterLeave = mountFallback;
  2818. }
  2819. suspense.isInFallback = true;
  2820. unmount(
  2821. activeBranch,
  2822. parentComponent2,
  2823. null,
  2824. // no suspense so unmount hooks fire now
  2825. true
  2826. // shouldRemove
  2827. );
  2828. if (!delayEnter) {
  2829. mountFallback();
  2830. }
  2831. },
  2832. move(container2, anchor2, type) {
  2833. suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
  2834. suspense.container = container2;
  2835. },
  2836. next() {
  2837. return suspense.activeBranch && next(suspense.activeBranch);
  2838. },
  2839. registerDep(instance, setupRenderEffect) {
  2840. const isInPendingSuspense = !!suspense.pendingBranch;
  2841. if (isInPendingSuspense) {
  2842. suspense.deps++;
  2843. }
  2844. const hydratedEl = instance.vnode.el;
  2845. instance.asyncDep.catch((err) => {
  2846. handleError(err, instance, 0);
  2847. }).then((asyncSetupResult) => {
  2848. if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
  2849. return;
  2850. }
  2851. instance.asyncResolved = true;
  2852. const { vnode: vnode2 } = instance;
  2853. {
  2854. pushWarningContext(vnode2);
  2855. }
  2856. handleSetupResult(instance, asyncSetupResult, false);
  2857. if (hydratedEl) {
  2858. vnode2.el = hydratedEl;
  2859. }
  2860. const placeholder = !hydratedEl && instance.subTree.el;
  2861. setupRenderEffect(
  2862. instance,
  2863. vnode2,
  2864. // component may have been moved before resolve.
  2865. // if this is not a hydration, instance.subTree will be the comment
  2866. // placeholder.
  2867. parentNode(hydratedEl || instance.subTree.el),
  2868. // anchor will not be used if this is hydration, so only need to
  2869. // consider the comment placeholder case.
  2870. hydratedEl ? null : next(instance.subTree),
  2871. suspense,
  2872. isSVG,
  2873. optimized
  2874. );
  2875. if (placeholder) {
  2876. remove(placeholder);
  2877. }
  2878. updateHOCHostEl(instance, vnode2.el);
  2879. {
  2880. popWarningContext();
  2881. }
  2882. if (isInPendingSuspense && --suspense.deps === 0) {
  2883. suspense.resolve();
  2884. }
  2885. });
  2886. },
  2887. unmount(parentSuspense2, doRemove) {
  2888. suspense.isUnmounted = true;
  2889. if (suspense.activeBranch) {
  2890. unmount(
  2891. suspense.activeBranch,
  2892. parentComponent,
  2893. parentSuspense2,
  2894. doRemove
  2895. );
  2896. }
  2897. if (suspense.pendingBranch) {
  2898. unmount(
  2899. suspense.pendingBranch,
  2900. parentComponent,
  2901. parentSuspense2,
  2902. doRemove
  2903. );
  2904. }
  2905. }
  2906. };
  2907. return suspense;
  2908. }
  2909. function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
  2910. const suspense = vnode.suspense = createSuspenseBoundary(
  2911. vnode,
  2912. parentSuspense,
  2913. parentComponent,
  2914. node.parentNode,
  2915. document.createElement("div"),
  2916. null,
  2917. isSVG,
  2918. slotScopeIds,
  2919. optimized,
  2920. rendererInternals,
  2921. true
  2922. /* hydrating */
  2923. );
  2924. const result = hydrateNode(
  2925. node,
  2926. suspense.pendingBranch = vnode.ssContent,
  2927. parentComponent,
  2928. suspense,
  2929. slotScopeIds,
  2930. optimized
  2931. );
  2932. if (suspense.deps === 0) {
  2933. suspense.resolve(false, true);
  2934. }
  2935. return result;
  2936. }
  2937. function normalizeSuspenseChildren(vnode) {
  2938. const { shapeFlag, children } = vnode;
  2939. const isSlotChildren = shapeFlag & 32;
  2940. vnode.ssContent = normalizeSuspenseSlot(
  2941. isSlotChildren ? children.default : children
  2942. );
  2943. vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
  2944. }
  2945. function normalizeSuspenseSlot(s) {
  2946. let block;
  2947. if (isFunction(s)) {
  2948. const trackBlock = isBlockTreeEnabled && s._c;
  2949. if (trackBlock) {
  2950. s._d = false;
  2951. openBlock();
  2952. }
  2953. s = s();
  2954. if (trackBlock) {
  2955. s._d = true;
  2956. block = currentBlock;
  2957. closeBlock();
  2958. }
  2959. }
  2960. if (isArray(s)) {
  2961. const singleChild = filterSingleRoot(s);
  2962. if (!singleChild) {
  2963. warn(`<Suspense> slots expect a single root node.`);
  2964. }
  2965. s = singleChild;
  2966. }
  2967. s = normalizeVNode(s);
  2968. if (block && !s.dynamicChildren) {
  2969. s.dynamicChildren = block.filter((c) => c !== s);
  2970. }
  2971. return s;
  2972. }
  2973. function queueEffectWithSuspense(fn, suspense) {
  2974. if (suspense && suspense.pendingBranch) {
  2975. if (isArray(fn)) {
  2976. suspense.effects.push(...fn);
  2977. } else {
  2978. suspense.effects.push(fn);
  2979. }
  2980. } else {
  2981. queuePostFlushCb(fn);
  2982. }
  2983. }
  2984. function setActiveBranch(suspense, branch) {
  2985. suspense.activeBranch = branch;
  2986. const { vnode, parentComponent } = suspense;
  2987. const el = vnode.el = branch.el;
  2988. if (parentComponent && parentComponent.subTree === vnode) {
  2989. parentComponent.vnode.el = el;
  2990. updateHOCHostEl(parentComponent, el);
  2991. }
  2992. }
  2993. function isVNodeSuspensible(vnode) {
  2994. var _a;
  2995. return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
  2996. }
  2997. function watchEffect(effect, options) {
  2998. return doWatch(effect, null, options);
  2999. }
  3000. function watchPostEffect(effect, options) {
  3001. return doWatch(
  3002. effect,
  3003. null,
  3004. extend({}, options, { flush: "post" })
  3005. );
  3006. }
  3007. function watchSyncEffect(effect, options) {
  3008. return doWatch(
  3009. effect,
  3010. null,
  3011. extend({}, options, { flush: "sync" })
  3012. );
  3013. }
  3014. const INITIAL_WATCHER_VALUE = {};
  3015. function watch(source, cb, options) {
  3016. if (!isFunction(cb)) {
  3017. warn(
  3018. `\`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.`
  3019. );
  3020. }
  3021. return doWatch(source, cb, options);
  3022. }
  3023. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
  3024. var _a;
  3025. if (!cb) {
  3026. if (immediate !== void 0) {
  3027. warn(
  3028. `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`
  3029. );
  3030. }
  3031. if (deep !== void 0) {
  3032. warn(
  3033. `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
  3034. );
  3035. }
  3036. }
  3037. const warnInvalidSource = (s) => {
  3038. warn(
  3039. `Invalid watch source: `,
  3040. s,
  3041. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  3042. );
  3043. };
  3044. const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;
  3045. let getter;
  3046. let forceTrigger = false;
  3047. let isMultiSource = false;
  3048. if (isRef(source)) {
  3049. getter = () => source.value;
  3050. forceTrigger = isShallow(source);
  3051. } else if (isReactive(source)) {
  3052. getter = () => source;
  3053. deep = true;
  3054. } else if (isArray(source)) {
  3055. isMultiSource = true;
  3056. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  3057. getter = () => source.map((s) => {
  3058. if (isRef(s)) {
  3059. return s.value;
  3060. } else if (isReactive(s)) {
  3061. return traverse(s);
  3062. } else if (isFunction(s)) {
  3063. return callWithErrorHandling(s, instance, 2);
  3064. } else {
  3065. warnInvalidSource(s);
  3066. }
  3067. });
  3068. } else if (isFunction(source)) {
  3069. if (cb) {
  3070. getter = () => callWithErrorHandling(source, instance, 2);
  3071. } else {
  3072. getter = () => {
  3073. if (instance && instance.isUnmounted) {
  3074. return;
  3075. }
  3076. if (cleanup) {
  3077. cleanup();
  3078. }
  3079. return callWithAsyncErrorHandling(
  3080. source,
  3081. instance,
  3082. 3,
  3083. [onCleanup]
  3084. );
  3085. };
  3086. }
  3087. } else {
  3088. getter = NOOP;
  3089. warnInvalidSource(source);
  3090. }
  3091. if (cb && deep) {
  3092. const baseGetter = getter;
  3093. getter = () => traverse(baseGetter());
  3094. }
  3095. let cleanup;
  3096. let onCleanup = (fn) => {
  3097. cleanup = effect.onStop = () => {
  3098. callWithErrorHandling(fn, instance, 4);
  3099. };
  3100. };
  3101. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3102. const job = () => {
  3103. if (!effect.active) {
  3104. return;
  3105. }
  3106. if (cb) {
  3107. const newValue = effect.run();
  3108. if (deep || forceTrigger || (isMultiSource ? newValue.some(
  3109. (v, i) => hasChanged(v, oldValue[i])
  3110. ) : hasChanged(newValue, oldValue)) || false) {
  3111. if (cleanup) {
  3112. cleanup();
  3113. }
  3114. callWithAsyncErrorHandling(cb, instance, 3, [
  3115. newValue,
  3116. // pass undefined as the old value when it's changed for the first time
  3117. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3118. onCleanup
  3119. ]);
  3120. oldValue = newValue;
  3121. }
  3122. } else {
  3123. effect.run();
  3124. }
  3125. };
  3126. job.allowRecurse = !!cb;
  3127. let scheduler;
  3128. if (flush === "sync") {
  3129. scheduler = job;
  3130. } else if (flush === "post") {
  3131. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  3132. } else {
  3133. job.pre = true;
  3134. if (instance)
  3135. job.id = instance.uid;
  3136. scheduler = () => queueJob(job);
  3137. }
  3138. const effect = new ReactiveEffect(getter, scheduler);
  3139. {
  3140. effect.onTrack = onTrack;
  3141. effect.onTrigger = onTrigger;
  3142. }
  3143. if (cb) {
  3144. if (immediate) {
  3145. job();
  3146. } else {
  3147. oldValue = effect.run();
  3148. }
  3149. } else if (flush === "post") {
  3150. queuePostRenderEffect(
  3151. effect.run.bind(effect),
  3152. instance && instance.suspense
  3153. );
  3154. } else {
  3155. effect.run();
  3156. }
  3157. const unwatch = () => {
  3158. effect.stop();
  3159. if (instance && instance.scope) {
  3160. remove(instance.scope.effects, effect);
  3161. }
  3162. };
  3163. return unwatch;
  3164. }
  3165. function instanceWatch(source, value, options) {
  3166. const publicThis = this.proxy;
  3167. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3168. let cb;
  3169. if (isFunction(value)) {
  3170. cb = value;
  3171. } else {
  3172. cb = value.handler;
  3173. options = value;
  3174. }
  3175. const cur = currentInstance;
  3176. setCurrentInstance(this);
  3177. const res = doWatch(getter, cb.bind(publicThis), options);
  3178. if (cur) {
  3179. setCurrentInstance(cur);
  3180. } else {
  3181. unsetCurrentInstance();
  3182. }
  3183. return res;
  3184. }
  3185. function createPathGetter(ctx, path) {
  3186. const segments = path.split(".");
  3187. return () => {
  3188. let cur = ctx;
  3189. for (let i = 0; i < segments.length && cur; i++) {
  3190. cur = cur[segments[i]];
  3191. }
  3192. return cur;
  3193. };
  3194. }
  3195. function traverse(value, seen) {
  3196. if (!isObject(value) || value["__v_skip"]) {
  3197. return value;
  3198. }
  3199. seen = seen || /* @__PURE__ */ new Set();
  3200. if (seen.has(value)) {
  3201. return value;
  3202. }
  3203. seen.add(value);
  3204. if (isRef(value)) {
  3205. traverse(value.value, seen);
  3206. } else if (isArray(value)) {
  3207. for (let i = 0; i < value.length; i++) {
  3208. traverse(value[i], seen);
  3209. }
  3210. } else if (isSet(value) || isMap(value)) {
  3211. value.forEach((v) => {
  3212. traverse(v, seen);
  3213. });
  3214. } else if (isPlainObject(value)) {
  3215. for (const key in value) {
  3216. traverse(value[key], seen);
  3217. }
  3218. }
  3219. return value;
  3220. }
  3221. function validateDirectiveName(name) {
  3222. if (isBuiltInDirective(name)) {
  3223. warn("Do not use built-in directive ids as custom directive id: " + name);
  3224. }
  3225. }
  3226. function withDirectives(vnode, directives) {
  3227. const internalInstance = currentRenderingInstance;
  3228. if (internalInstance === null) {
  3229. warn(`withDirectives can only be used inside render functions.`);
  3230. return vnode;
  3231. }
  3232. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  3233. const bindings = vnode.dirs || (vnode.dirs = []);
  3234. for (let i = 0; i < directives.length; i++) {
  3235. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  3236. if (dir) {
  3237. if (isFunction(dir)) {
  3238. dir = {
  3239. mounted: dir,
  3240. updated: dir
  3241. };
  3242. }
  3243. if (dir.deep) {
  3244. traverse(value);
  3245. }
  3246. bindings.push({
  3247. dir,
  3248. instance,
  3249. value,
  3250. oldValue: void 0,
  3251. arg,
  3252. modifiers
  3253. });
  3254. }
  3255. }
  3256. return vnode;
  3257. }
  3258. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  3259. const bindings = vnode.dirs;
  3260. const oldBindings = prevVNode && prevVNode.dirs;
  3261. for (let i = 0; i < bindings.length; i++) {
  3262. const binding = bindings[i];
  3263. if (oldBindings) {
  3264. binding.oldValue = oldBindings[i].value;
  3265. }
  3266. let hook = binding.dir[name];
  3267. if (hook) {
  3268. pauseTracking();
  3269. callWithAsyncErrorHandling(hook, instance, 8, [
  3270. vnode.el,
  3271. binding,
  3272. vnode,
  3273. prevVNode
  3274. ]);
  3275. resetTracking();
  3276. }
  3277. }
  3278. }
  3279. function useTransitionState() {
  3280. const state = {
  3281. isMounted: false,
  3282. isLeaving: false,
  3283. isUnmounting: false,
  3284. leavingVNodes: /* @__PURE__ */ new Map()
  3285. };
  3286. onMounted(() => {
  3287. state.isMounted = true;
  3288. });
  3289. onBeforeUnmount(() => {
  3290. state.isUnmounting = true;
  3291. });
  3292. return state;
  3293. }
  3294. const TransitionHookValidator = [Function, Array];
  3295. const BaseTransitionPropsValidators = {
  3296. mode: String,
  3297. appear: Boolean,
  3298. persisted: Boolean,
  3299. // enter
  3300. onBeforeEnter: TransitionHookValidator,
  3301. onEnter: TransitionHookValidator,
  3302. onAfterEnter: TransitionHookValidator,
  3303. onEnterCancelled: TransitionHookValidator,
  3304. // leave
  3305. onBeforeLeave: TransitionHookValidator,
  3306. onLeave: TransitionHookValidator,
  3307. onAfterLeave: TransitionHookValidator,
  3308. onLeaveCancelled: TransitionHookValidator,
  3309. // appear
  3310. onBeforeAppear: TransitionHookValidator,
  3311. onAppear: TransitionHookValidator,
  3312. onAfterAppear: TransitionHookValidator,
  3313. onAppearCancelled: TransitionHookValidator
  3314. };
  3315. const BaseTransitionImpl = {
  3316. name: `BaseTransition`,
  3317. props: BaseTransitionPropsValidators,
  3318. setup(props, { slots }) {
  3319. const instance = getCurrentInstance();
  3320. const state = useTransitionState();
  3321. let prevTransitionKey;
  3322. return () => {
  3323. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  3324. if (!children || !children.length) {
  3325. return;
  3326. }
  3327. let child = children[0];
  3328. if (children.length > 1) {
  3329. let hasFound = false;
  3330. for (const c of children) {
  3331. if (c.type !== Comment) {
  3332. if (hasFound) {
  3333. warn(
  3334. "<transition> can only be used on a single element or component. Use <transition-group> for lists."
  3335. );
  3336. break;
  3337. }
  3338. child = c;
  3339. hasFound = true;
  3340. }
  3341. }
  3342. }
  3343. const rawProps = toRaw(props);
  3344. const { mode } = rawProps;
  3345. if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
  3346. warn(`invalid <transition> mode: ${mode}`);
  3347. }
  3348. if (state.isLeaving) {
  3349. return emptyPlaceholder(child);
  3350. }
  3351. const innerChild = getKeepAliveChild(child);
  3352. if (!innerChild) {
  3353. return emptyPlaceholder(child);
  3354. }
  3355. const enterHooks = resolveTransitionHooks(
  3356. innerChild,
  3357. rawProps,
  3358. state,
  3359. instance
  3360. );
  3361. setTransitionHooks(innerChild, enterHooks);
  3362. const oldChild = instance.subTree;
  3363. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  3364. let transitionKeyChanged = false;
  3365. const { getTransitionKey } = innerChild.type;
  3366. if (getTransitionKey) {
  3367. const key = getTransitionKey();
  3368. if (prevTransitionKey === void 0) {
  3369. prevTransitionKey = key;
  3370. } else if (key !== prevTransitionKey) {
  3371. prevTransitionKey = key;
  3372. transitionKeyChanged = true;
  3373. }
  3374. }
  3375. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  3376. const leavingHooks = resolveTransitionHooks(
  3377. oldInnerChild,
  3378. rawProps,
  3379. state,
  3380. instance
  3381. );
  3382. setTransitionHooks(oldInnerChild, leavingHooks);
  3383. if (mode === "out-in") {
  3384. state.isLeaving = true;
  3385. leavingHooks.afterLeave = () => {
  3386. state.isLeaving = false;
  3387. if (instance.update.active !== false) {
  3388. instance.update();
  3389. }
  3390. };
  3391. return emptyPlaceholder(child);
  3392. } else if (mode === "in-out" && innerChild.type !== Comment) {
  3393. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  3394. const leavingVNodesCache = getLeavingNodesForType(
  3395. state,
  3396. oldInnerChild
  3397. );
  3398. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  3399. el._leaveCb = () => {
  3400. earlyRemove();
  3401. el._leaveCb = void 0;
  3402. delete enterHooks.delayedLeave;
  3403. };
  3404. enterHooks.delayedLeave = delayedLeave;
  3405. };
  3406. }
  3407. }
  3408. return child;
  3409. };
  3410. }
  3411. };
  3412. const BaseTransition = BaseTransitionImpl;
  3413. function getLeavingNodesForType(state, vnode) {
  3414. const { leavingVNodes } = state;
  3415. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  3416. if (!leavingVNodesCache) {
  3417. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  3418. leavingVNodes.set(vnode.type, leavingVNodesCache);
  3419. }
  3420. return leavingVNodesCache;
  3421. }
  3422. function resolveTransitionHooks(vnode, props, state, instance) {
  3423. const {
  3424. appear,
  3425. mode,
  3426. persisted = false,
  3427. onBeforeEnter,
  3428. onEnter,
  3429. onAfterEnter,
  3430. onEnterCancelled,
  3431. onBeforeLeave,
  3432. onLeave,
  3433. onAfterLeave,
  3434. onLeaveCancelled,
  3435. onBeforeAppear,
  3436. onAppear,
  3437. onAfterAppear,
  3438. onAppearCancelled
  3439. } = props;
  3440. const key = String(vnode.key);
  3441. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  3442. const callHook = (hook, args) => {
  3443. hook && callWithAsyncErrorHandling(
  3444. hook,
  3445. instance,
  3446. 9,
  3447. args
  3448. );
  3449. };
  3450. const callAsyncHook = (hook, args) => {
  3451. const done = args[1];
  3452. callHook(hook, args);
  3453. if (isArray(hook)) {
  3454. if (hook.every((hook2) => hook2.length <= 1))
  3455. done();
  3456. } else if (hook.length <= 1) {
  3457. done();
  3458. }
  3459. };
  3460. const hooks = {
  3461. mode,
  3462. persisted,
  3463. beforeEnter(el) {
  3464. let hook = onBeforeEnter;
  3465. if (!state.isMounted) {
  3466. if (appear) {
  3467. hook = onBeforeAppear || onBeforeEnter;
  3468. } else {
  3469. return;
  3470. }
  3471. }
  3472. if (el._leaveCb) {
  3473. el._leaveCb(
  3474. true
  3475. /* cancelled */
  3476. );
  3477. }
  3478. const leavingVNode = leavingVNodesCache[key];
  3479. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {
  3480. leavingVNode.el._leaveCb();
  3481. }
  3482. callHook(hook, [el]);
  3483. },
  3484. enter(el) {
  3485. let hook = onEnter;
  3486. let afterHook = onAfterEnter;
  3487. let cancelHook = onEnterCancelled;
  3488. if (!state.isMounted) {
  3489. if (appear) {
  3490. hook = onAppear || onEnter;
  3491. afterHook = onAfterAppear || onAfterEnter;
  3492. cancelHook = onAppearCancelled || onEnterCancelled;
  3493. } else {
  3494. return;
  3495. }
  3496. }
  3497. let called = false;
  3498. const done = el._enterCb = (cancelled) => {
  3499. if (called)
  3500. return;
  3501. called = true;
  3502. if (cancelled) {
  3503. callHook(cancelHook, [el]);
  3504. } else {
  3505. callHook(afterHook, [el]);
  3506. }
  3507. if (hooks.delayedLeave) {
  3508. hooks.delayedLeave();
  3509. }
  3510. el._enterCb = void 0;
  3511. };
  3512. if (hook) {
  3513. callAsyncHook(hook, [el, done]);
  3514. } else {
  3515. done();
  3516. }
  3517. },
  3518. leave(el, remove) {
  3519. const key2 = String(vnode.key);
  3520. if (el._enterCb) {
  3521. el._enterCb(
  3522. true
  3523. /* cancelled */
  3524. );
  3525. }
  3526. if (state.isUnmounting) {
  3527. return remove();
  3528. }
  3529. callHook(onBeforeLeave, [el]);
  3530. let called = false;
  3531. const done = el._leaveCb = (cancelled) => {
  3532. if (called)
  3533. return;
  3534. called = true;
  3535. remove();
  3536. if (cancelled) {
  3537. callHook(onLeaveCancelled, [el]);
  3538. } else {
  3539. callHook(onAfterLeave, [el]);
  3540. }
  3541. el._leaveCb = void 0;
  3542. if (leavingVNodesCache[key2] === vnode) {
  3543. delete leavingVNodesCache[key2];
  3544. }
  3545. };
  3546. leavingVNodesCache[key2] = vnode;
  3547. if (onLeave) {
  3548. callAsyncHook(onLeave, [el, done]);
  3549. } else {
  3550. done();
  3551. }
  3552. },
  3553. clone(vnode2) {
  3554. return resolveTransitionHooks(vnode2, props, state, instance);
  3555. }
  3556. };
  3557. return hooks;
  3558. }
  3559. function emptyPlaceholder(vnode) {
  3560. if (isKeepAlive(vnode)) {
  3561. vnode = cloneVNode(vnode);
  3562. vnode.children = null;
  3563. return vnode;
  3564. }
  3565. }
  3566. function getKeepAliveChild(vnode) {
  3567. return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
  3568. }
  3569. function setTransitionHooks(vnode, hooks) {
  3570. if (vnode.shapeFlag & 6 && vnode.component) {
  3571. setTransitionHooks(vnode.component.subTree, hooks);
  3572. } else if (vnode.shapeFlag & 128) {
  3573. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  3574. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  3575. } else {
  3576. vnode.transition = hooks;
  3577. }
  3578. }
  3579. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  3580. let ret = [];
  3581. let keyedFragmentCount = 0;
  3582. for (let i = 0; i < children.length; i++) {
  3583. let child = children[i];
  3584. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  3585. if (child.type === Fragment) {
  3586. if (child.patchFlag & 128)
  3587. keyedFragmentCount++;
  3588. ret = ret.concat(
  3589. getTransitionRawChildren(child.children, keepComment, key)
  3590. );
  3591. } else if (keepComment || child.type !== Comment) {
  3592. ret.push(key != null ? cloneVNode(child, { key }) : child);
  3593. }
  3594. }
  3595. if (keyedFragmentCount > 1) {
  3596. for (let i = 0; i < ret.length; i++) {
  3597. ret[i].patchFlag = -2;
  3598. }
  3599. }
  3600. return ret;
  3601. }
  3602. function defineComponent(options, extraOptions) {
  3603. return isFunction(options) ? (
  3604. // #8326: extend call and options.name access are considered side-effects
  3605. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  3606. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  3607. ) : options;
  3608. }
  3609. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  3610. function defineAsyncComponent(source) {
  3611. if (isFunction(source)) {
  3612. source = { loader: source };
  3613. }
  3614. const {
  3615. loader,
  3616. loadingComponent,
  3617. errorComponent,
  3618. delay = 200,
  3619. timeout,
  3620. // undefined = never times out
  3621. suspensible = true,
  3622. onError: userOnError
  3623. } = source;
  3624. let pendingRequest = null;
  3625. let resolvedComp;
  3626. let retries = 0;
  3627. const retry = () => {
  3628. retries++;
  3629. pendingRequest = null;
  3630. return load();
  3631. };
  3632. const load = () => {
  3633. let thisRequest;
  3634. return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
  3635. err = err instanceof Error ? err : new Error(String(err));
  3636. if (userOnError) {
  3637. return new Promise((resolve, reject) => {
  3638. const userRetry = () => resolve(retry());
  3639. const userFail = () => reject(err);
  3640. userOnError(err, userRetry, userFail, retries + 1);
  3641. });
  3642. } else {
  3643. throw err;
  3644. }
  3645. }).then((comp) => {
  3646. if (thisRequest !== pendingRequest && pendingRequest) {
  3647. return pendingRequest;
  3648. }
  3649. if (!comp) {
  3650. warn(
  3651. `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
  3652. );
  3653. }
  3654. if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
  3655. comp = comp.default;
  3656. }
  3657. if (comp && !isObject(comp) && !isFunction(comp)) {
  3658. throw new Error(`Invalid async component load result: ${comp}`);
  3659. }
  3660. resolvedComp = comp;
  3661. return comp;
  3662. }));
  3663. };
  3664. return defineComponent({
  3665. name: "AsyncComponentWrapper",
  3666. __asyncLoader: load,
  3667. get __asyncResolved() {
  3668. return resolvedComp;
  3669. },
  3670. setup() {
  3671. const instance = currentInstance;
  3672. if (resolvedComp) {
  3673. return () => createInnerComp(resolvedComp, instance);
  3674. }
  3675. const onError = (err) => {
  3676. pendingRequest = null;
  3677. handleError(
  3678. err,
  3679. instance,
  3680. 13,
  3681. !errorComponent
  3682. /* do not throw in dev if user provided error component */
  3683. );
  3684. };
  3685. if (suspensible && instance.suspense || false) {
  3686. return load().then((comp) => {
  3687. return () => createInnerComp(comp, instance);
  3688. }).catch((err) => {
  3689. onError(err);
  3690. return () => errorComponent ? createVNode(errorComponent, {
  3691. error: err
  3692. }) : null;
  3693. });
  3694. }
  3695. const loaded = ref(false);
  3696. const error = ref();
  3697. const delayed = ref(!!delay);
  3698. if (delay) {
  3699. setTimeout(() => {
  3700. delayed.value = false;
  3701. }, delay);
  3702. }
  3703. if (timeout != null) {
  3704. setTimeout(() => {
  3705. if (!loaded.value && !error.value) {
  3706. const err = new Error(
  3707. `Async component timed out after ${timeout}ms.`
  3708. );
  3709. onError(err);
  3710. error.value = err;
  3711. }
  3712. }, timeout);
  3713. }
  3714. load().then(() => {
  3715. loaded.value = true;
  3716. if (instance.parent && isKeepAlive(instance.parent.vnode)) {
  3717. queueJob(instance.parent.update);
  3718. }
  3719. }).catch((err) => {
  3720. onError(err);
  3721. error.value = err;
  3722. });
  3723. return () => {
  3724. if (loaded.value && resolvedComp) {
  3725. return createInnerComp(resolvedComp, instance);
  3726. } else if (error.value && errorComponent) {
  3727. return createVNode(errorComponent, {
  3728. error: error.value
  3729. });
  3730. } else if (loadingComponent && !delayed.value) {
  3731. return createVNode(loadingComponent);
  3732. }
  3733. };
  3734. }
  3735. });
  3736. }
  3737. function createInnerComp(comp, parent) {
  3738. const { ref: ref2, props, children, ce } = parent.vnode;
  3739. const vnode = createVNode(comp, props, children);
  3740. vnode.ref = ref2;
  3741. vnode.ce = ce;
  3742. delete parent.vnode.ce;
  3743. return vnode;
  3744. }
  3745. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  3746. const KeepAliveImpl = {
  3747. name: `KeepAlive`,
  3748. // Marker for special handling inside the renderer. We are not using a ===
  3749. // check directly on KeepAlive in the renderer, because importing it directly
  3750. // would prevent it from being tree-shaken.
  3751. __isKeepAlive: true,
  3752. props: {
  3753. include: [String, RegExp, Array],
  3754. exclude: [String, RegExp, Array],
  3755. max: [String, Number]
  3756. },
  3757. setup(props, { slots }) {
  3758. const instance = getCurrentInstance();
  3759. const sharedContext = instance.ctx;
  3760. const cache = /* @__PURE__ */ new Map();
  3761. const keys = /* @__PURE__ */ new Set();
  3762. let current = null;
  3763. {
  3764. instance.__v_cache = cache;
  3765. }
  3766. const parentSuspense = instance.suspense;
  3767. const {
  3768. renderer: {
  3769. p: patch,
  3770. m: move,
  3771. um: _unmount,
  3772. o: { createElement }
  3773. }
  3774. } = sharedContext;
  3775. const storageContainer = createElement("div");
  3776. sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
  3777. const instance2 = vnode.component;
  3778. move(vnode, container, anchor, 0, parentSuspense);
  3779. patch(
  3780. instance2.vnode,
  3781. vnode,
  3782. container,
  3783. anchor,
  3784. instance2,
  3785. parentSuspense,
  3786. isSVG,
  3787. vnode.slotScopeIds,
  3788. optimized
  3789. );
  3790. queuePostRenderEffect(() => {
  3791. instance2.isDeactivated = false;
  3792. if (instance2.a) {
  3793. invokeArrayFns(instance2.a);
  3794. }
  3795. const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
  3796. if (vnodeHook) {
  3797. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3798. }
  3799. }, parentSuspense);
  3800. {
  3801. devtoolsComponentAdded(instance2);
  3802. }
  3803. };
  3804. sharedContext.deactivate = (vnode) => {
  3805. const instance2 = vnode.component;
  3806. move(vnode, storageContainer, null, 1, parentSuspense);
  3807. queuePostRenderEffect(() => {
  3808. if (instance2.da) {
  3809. invokeArrayFns(instance2.da);
  3810. }
  3811. const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
  3812. if (vnodeHook) {
  3813. invokeVNodeHook(vnodeHook, instance2.parent, vnode);
  3814. }
  3815. instance2.isDeactivated = true;
  3816. }, parentSuspense);
  3817. {
  3818. devtoolsComponentAdded(instance2);
  3819. }
  3820. };
  3821. function unmount(vnode) {
  3822. resetShapeFlag(vnode);
  3823. _unmount(vnode, instance, parentSuspense, true);
  3824. }
  3825. function pruneCache(filter) {
  3826. cache.forEach((vnode, key) => {
  3827. const name = getComponentName(vnode.type);
  3828. if (name && (!filter || !filter(name))) {
  3829. pruneCacheEntry(key);
  3830. }
  3831. });
  3832. }
  3833. function pruneCacheEntry(key) {
  3834. const cached = cache.get(key);
  3835. if (!current || !isSameVNodeType(cached, current)) {
  3836. unmount(cached);
  3837. } else if (current) {
  3838. resetShapeFlag(current);
  3839. }
  3840. cache.delete(key);
  3841. keys.delete(key);
  3842. }
  3843. watch(
  3844. () => [props.include, props.exclude],
  3845. ([include, exclude]) => {
  3846. include && pruneCache((name) => matches(include, name));
  3847. exclude && pruneCache((name) => !matches(exclude, name));
  3848. },
  3849. // prune post-render after `current` has been updated
  3850. { flush: "post", deep: true }
  3851. );
  3852. let pendingCacheKey = null;
  3853. const cacheSubtree = () => {
  3854. if (pendingCacheKey != null) {
  3855. cache.set(pendingCacheKey, getInnerChild(instance.subTree));
  3856. }
  3857. };
  3858. onMounted(cacheSubtree);
  3859. onUpdated(cacheSubtree);
  3860. onBeforeUnmount(() => {
  3861. cache.forEach((cached) => {
  3862. const { subTree, suspense } = instance;
  3863. const vnode = getInnerChild(subTree);
  3864. if (cached.type === vnode.type && cached.key === vnode.key) {
  3865. resetShapeFlag(vnode);
  3866. const da = vnode.component.da;
  3867. da && queuePostRenderEffect(da, suspense);
  3868. return;
  3869. }
  3870. unmount(cached);
  3871. });
  3872. });
  3873. return () => {
  3874. pendingCacheKey = null;
  3875. if (!slots.default) {
  3876. return null;
  3877. }
  3878. const children = slots.default();
  3879. const rawVNode = children[0];
  3880. if (children.length > 1) {
  3881. {
  3882. warn(`KeepAlive should contain exactly one component child.`);
  3883. }
  3884. current = null;
  3885. return children;
  3886. } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
  3887. current = null;
  3888. return rawVNode;
  3889. }
  3890. let vnode = getInnerChild(rawVNode);
  3891. const comp = vnode.type;
  3892. const name = getComponentName(
  3893. isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
  3894. );
  3895. const { include, exclude, max } = props;
  3896. if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
  3897. current = vnode;
  3898. return rawVNode;
  3899. }
  3900. const key = vnode.key == null ? comp : vnode.key;
  3901. const cachedVNode = cache.get(key);
  3902. if (vnode.el) {
  3903. vnode = cloneVNode(vnode);
  3904. if (rawVNode.shapeFlag & 128) {
  3905. rawVNode.ssContent = vnode;
  3906. }
  3907. }
  3908. pendingCacheKey = key;
  3909. if (cachedVNode) {
  3910. vnode.el = cachedVNode.el;
  3911. vnode.component = cachedVNode.component;
  3912. if (vnode.transition) {
  3913. setTransitionHooks(vnode, vnode.transition);
  3914. }
  3915. vnode.shapeFlag |= 512;
  3916. keys.delete(key);
  3917. keys.add(key);
  3918. } else {
  3919. keys.add(key);
  3920. if (max && keys.size > parseInt(max, 10)) {
  3921. pruneCacheEntry(keys.values().next().value);
  3922. }
  3923. }
  3924. vnode.shapeFlag |= 256;
  3925. current = vnode;
  3926. return isSuspense(rawVNode.type) ? rawVNode : vnode;
  3927. };
  3928. }
  3929. };
  3930. const KeepAlive = KeepAliveImpl;
  3931. function matches(pattern, name) {
  3932. if (isArray(pattern)) {
  3933. return pattern.some((p) => matches(p, name));
  3934. } else if (isString(pattern)) {
  3935. return pattern.split(",").includes(name);
  3936. } else if (isRegExp(pattern)) {
  3937. return pattern.test(name);
  3938. }
  3939. return false;
  3940. }
  3941. function onActivated(hook, target) {
  3942. registerKeepAliveHook(hook, "a", target);
  3943. }
  3944. function onDeactivated(hook, target) {
  3945. registerKeepAliveHook(hook, "da", target);
  3946. }
  3947. function registerKeepAliveHook(hook, type, target = currentInstance) {
  3948. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3949. let current = target;
  3950. while (current) {
  3951. if (current.isDeactivated) {
  3952. return;
  3953. }
  3954. current = current.parent;
  3955. }
  3956. return hook();
  3957. });
  3958. injectHook(type, wrappedHook, target);
  3959. if (target) {
  3960. let current = target.parent;
  3961. while (current && current.parent) {
  3962. if (isKeepAlive(current.parent.vnode)) {
  3963. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3964. }
  3965. current = current.parent;
  3966. }
  3967. }
  3968. }
  3969. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3970. const injected = injectHook(
  3971. type,
  3972. hook,
  3973. keepAliveRoot,
  3974. true
  3975. /* prepend */
  3976. );
  3977. onUnmounted(() => {
  3978. remove(keepAliveRoot[type], injected);
  3979. }, target);
  3980. }
  3981. function resetShapeFlag(vnode) {
  3982. vnode.shapeFlag &= ~256;
  3983. vnode.shapeFlag &= ~512;
  3984. }
  3985. function getInnerChild(vnode) {
  3986. return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
  3987. }
  3988. function injectHook(type, hook, target = currentInstance, prepend = false) {
  3989. if (target) {
  3990. const hooks = target[type] || (target[type] = []);
  3991. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  3992. if (target.isUnmounted) {
  3993. return;
  3994. }
  3995. pauseTracking();
  3996. setCurrentInstance(target);
  3997. const res = callWithAsyncErrorHandling(hook, target, type, args);
  3998. unsetCurrentInstance();
  3999. resetTracking();
  4000. return res;
  4001. });
  4002. if (prepend) {
  4003. hooks.unshift(wrappedHook);
  4004. } else {
  4005. hooks.push(wrappedHook);
  4006. }
  4007. return wrappedHook;
  4008. } else {
  4009. const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
  4010. warn(
  4011. `${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.` )
  4012. );
  4013. }
  4014. }
  4015. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  4016. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  4017. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  4018. );
  4019. const onBeforeMount = createHook("bm");
  4020. const onMounted = createHook("m");
  4021. const onBeforeUpdate = createHook("bu");
  4022. const onUpdated = createHook("u");
  4023. const onBeforeUnmount = createHook("bum");
  4024. const onUnmounted = createHook("um");
  4025. const onServerPrefetch = createHook("sp");
  4026. const onRenderTriggered = createHook(
  4027. "rtg"
  4028. );
  4029. const onRenderTracked = createHook(
  4030. "rtc"
  4031. );
  4032. function onErrorCaptured(hook, target = currentInstance) {
  4033. injectHook("ec", hook, target);
  4034. }
  4035. const COMPONENTS = "components";
  4036. const DIRECTIVES = "directives";
  4037. function resolveComponent(name, maybeSelfReference) {
  4038. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  4039. }
  4040. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  4041. function resolveDynamicComponent(component) {
  4042. if (isString(component)) {
  4043. return resolveAsset(COMPONENTS, component, false) || component;
  4044. } else {
  4045. return component || NULL_DYNAMIC_COMPONENT;
  4046. }
  4047. }
  4048. function resolveDirective(name) {
  4049. return resolveAsset(DIRECTIVES, name);
  4050. }
  4051. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  4052. const instance = currentRenderingInstance || currentInstance;
  4053. if (instance) {
  4054. const Component = instance.type;
  4055. if (type === COMPONENTS) {
  4056. const selfName = getComponentName(
  4057. Component,
  4058. false
  4059. /* do not include inferred name to avoid breaking existing code */
  4060. );
  4061. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  4062. return Component;
  4063. }
  4064. }
  4065. const res = (
  4066. // local registration
  4067. // check instance[type] first which is resolved for options API
  4068. resolve(instance[type] || Component[type], name) || // global registration
  4069. resolve(instance.appContext[type], name)
  4070. );
  4071. if (!res && maybeSelfReference) {
  4072. return Component;
  4073. }
  4074. if (warnMissing && !res) {
  4075. const extra = type === COMPONENTS ? `
  4076. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  4077. warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  4078. }
  4079. return res;
  4080. } else {
  4081. warn(
  4082. `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
  4083. );
  4084. }
  4085. }
  4086. function resolve(registry, name) {
  4087. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  4088. }
  4089. function renderList(source, renderItem, cache, index) {
  4090. let ret;
  4091. const cached = cache && cache[index];
  4092. if (isArray(source) || isString(source)) {
  4093. ret = new Array(source.length);
  4094. for (let i = 0, l = source.length; i < l; i++) {
  4095. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  4096. }
  4097. } else if (typeof source === "number") {
  4098. if (!Number.isInteger(source)) {
  4099. warn(`The v-for range expect an integer value but got ${source}.`);
  4100. }
  4101. ret = new Array(source);
  4102. for (let i = 0; i < source; i++) {
  4103. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  4104. }
  4105. } else if (isObject(source)) {
  4106. if (source[Symbol.iterator]) {
  4107. ret = Array.from(
  4108. source,
  4109. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  4110. );
  4111. } else {
  4112. const keys = Object.keys(source);
  4113. ret = new Array(keys.length);
  4114. for (let i = 0, l = keys.length; i < l; i++) {
  4115. const key = keys[i];
  4116. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  4117. }
  4118. }
  4119. } else {
  4120. ret = [];
  4121. }
  4122. if (cache) {
  4123. cache[index] = ret;
  4124. }
  4125. return ret;
  4126. }
  4127. function createSlots(slots, dynamicSlots) {
  4128. for (let i = 0; i < dynamicSlots.length; i++) {
  4129. const slot = dynamicSlots[i];
  4130. if (isArray(slot)) {
  4131. for (let j = 0; j < slot.length; j++) {
  4132. slots[slot[j].name] = slot[j].fn;
  4133. }
  4134. } else if (slot) {
  4135. slots[slot.name] = slot.key ? (...args) => {
  4136. const res = slot.fn(...args);
  4137. if (res)
  4138. res.key = slot.key;
  4139. return res;
  4140. } : slot.fn;
  4141. }
  4142. }
  4143. return slots;
  4144. }
  4145. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  4146. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  4147. if (name !== "default")
  4148. props.name = name;
  4149. return createVNode("slot", props, fallback && fallback());
  4150. }
  4151. let slot = slots[name];
  4152. if (slot && slot.length > 1) {
  4153. warn(
  4154. `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`
  4155. );
  4156. slot = () => [];
  4157. }
  4158. if (slot && slot._c) {
  4159. slot._d = false;
  4160. }
  4161. openBlock();
  4162. const validSlotContent = slot && ensureValidVNode(slot(props));
  4163. const rendered = createBlock(
  4164. Fragment,
  4165. {
  4166. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  4167. // key attached in the `createSlots` helper, respect that
  4168. validSlotContent && validSlotContent.key || `_${name}`
  4169. },
  4170. validSlotContent || (fallback ? fallback() : []),
  4171. validSlotContent && slots._ === 1 ? 64 : -2
  4172. );
  4173. if (!noSlotted && rendered.scopeId) {
  4174. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  4175. }
  4176. if (slot && slot._c) {
  4177. slot._d = true;
  4178. }
  4179. return rendered;
  4180. }
  4181. function ensureValidVNode(vnodes) {
  4182. return vnodes.some((child) => {
  4183. if (!isVNode(child))
  4184. return true;
  4185. if (child.type === Comment)
  4186. return false;
  4187. if (child.type === Fragment && !ensureValidVNode(child.children))
  4188. return false;
  4189. return true;
  4190. }) ? vnodes : null;
  4191. }
  4192. function toHandlers(obj, preserveCaseIfNecessary) {
  4193. const ret = {};
  4194. if (!isObject(obj)) {
  4195. warn(`v-on with no argument expects an object value.`);
  4196. return ret;
  4197. }
  4198. for (const key in obj) {
  4199. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  4200. }
  4201. return ret;
  4202. }
  4203. const getPublicInstance = (i) => {
  4204. if (!i)
  4205. return null;
  4206. if (isStatefulComponent(i))
  4207. return getExposeProxy(i) || i.proxy;
  4208. return getPublicInstance(i.parent);
  4209. };
  4210. const publicPropertiesMap = (
  4211. // Move PURE marker to new line to workaround compiler discarding it
  4212. // due to type annotation
  4213. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  4214. $: (i) => i,
  4215. $el: (i) => i.vnode.el,
  4216. $data: (i) => i.data,
  4217. $props: (i) => shallowReadonly(i.props) ,
  4218. $attrs: (i) => shallowReadonly(i.attrs) ,
  4219. $slots: (i) => shallowReadonly(i.slots) ,
  4220. $refs: (i) => shallowReadonly(i.refs) ,
  4221. $parent: (i) => getPublicInstance(i.parent),
  4222. $root: (i) => getPublicInstance(i.root),
  4223. $emit: (i) => i.emit,
  4224. $options: (i) => resolveMergedOptions(i) ,
  4225. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  4226. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  4227. $watch: (i) => instanceWatch.bind(i)
  4228. })
  4229. );
  4230. const isReservedPrefix = (key) => key === "_" || key === "$";
  4231. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  4232. const PublicInstanceProxyHandlers = {
  4233. get({ _: instance }, key) {
  4234. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  4235. if (key === "__isVue") {
  4236. return true;
  4237. }
  4238. let normalizedProps;
  4239. if (key[0] !== "$") {
  4240. const n = accessCache[key];
  4241. if (n !== void 0) {
  4242. switch (n) {
  4243. case 1 /* SETUP */:
  4244. return setupState[key];
  4245. case 2 /* DATA */:
  4246. return data[key];
  4247. case 4 /* CONTEXT */:
  4248. return ctx[key];
  4249. case 3 /* PROPS */:
  4250. return props[key];
  4251. }
  4252. } else if (hasSetupBinding(setupState, key)) {
  4253. accessCache[key] = 1 /* SETUP */;
  4254. return setupState[key];
  4255. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4256. accessCache[key] = 2 /* DATA */;
  4257. return data[key];
  4258. } else if (
  4259. // only cache other properties when instance has declared (thus stable)
  4260. // props
  4261. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  4262. ) {
  4263. accessCache[key] = 3 /* PROPS */;
  4264. return props[key];
  4265. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4266. accessCache[key] = 4 /* CONTEXT */;
  4267. return ctx[key];
  4268. } else if (shouldCacheAccess) {
  4269. accessCache[key] = 0 /* OTHER */;
  4270. }
  4271. }
  4272. const publicGetter = publicPropertiesMap[key];
  4273. let cssModule, globalProperties;
  4274. if (publicGetter) {
  4275. if (key === "$attrs") {
  4276. track(instance, "get", key);
  4277. markAttrsAccessed();
  4278. } else if (key === "$slots") {
  4279. track(instance, "get", key);
  4280. }
  4281. return publicGetter(instance);
  4282. } else if (
  4283. // css module (injected by vue-loader)
  4284. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  4285. ) {
  4286. return cssModule;
  4287. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  4288. accessCache[key] = 4 /* CONTEXT */;
  4289. return ctx[key];
  4290. } else if (
  4291. // global properties
  4292. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  4293. ) {
  4294. {
  4295. return globalProperties[key];
  4296. }
  4297. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  4298. // to infinite warning loop
  4299. key.indexOf("__v") !== 0)) {
  4300. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  4301. warn(
  4302. `Property ${JSON.stringify(
  4303. key
  4304. )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`
  4305. );
  4306. } else if (instance === currentRenderingInstance) {
  4307. warn(
  4308. `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
  4309. );
  4310. }
  4311. }
  4312. },
  4313. set({ _: instance }, key, value) {
  4314. const { data, setupState, ctx } = instance;
  4315. if (hasSetupBinding(setupState, key)) {
  4316. setupState[key] = value;
  4317. return true;
  4318. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  4319. warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  4320. return false;
  4321. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  4322. data[key] = value;
  4323. return true;
  4324. } else if (hasOwn(instance.props, key)) {
  4325. warn(`Attempting to mutate prop "${key}". Props are readonly.`);
  4326. return false;
  4327. }
  4328. if (key[0] === "$" && key.slice(1) in instance) {
  4329. warn(
  4330. `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`
  4331. );
  4332. return false;
  4333. } else {
  4334. if (key in instance.appContext.config.globalProperties) {
  4335. Object.defineProperty(ctx, key, {
  4336. enumerable: true,
  4337. configurable: true,
  4338. value
  4339. });
  4340. } else {
  4341. ctx[key] = value;
  4342. }
  4343. }
  4344. return true;
  4345. },
  4346. has({
  4347. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  4348. }, key) {
  4349. let normalizedProps;
  4350. 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);
  4351. },
  4352. defineProperty(target, key, descriptor) {
  4353. if (descriptor.get != null) {
  4354. target._.accessCache[key] = 0;
  4355. } else if (hasOwn(descriptor, "value")) {
  4356. this.set(target, key, descriptor.value, null);
  4357. }
  4358. return Reflect.defineProperty(target, key, descriptor);
  4359. }
  4360. };
  4361. {
  4362. PublicInstanceProxyHandlers.ownKeys = (target) => {
  4363. warn(
  4364. `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
  4365. );
  4366. return Reflect.ownKeys(target);
  4367. };
  4368. }
  4369. const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
  4370. {},
  4371. PublicInstanceProxyHandlers,
  4372. {
  4373. get(target, key) {
  4374. if (key === Symbol.unscopables) {
  4375. return;
  4376. }
  4377. return PublicInstanceProxyHandlers.get(target, key, target);
  4378. },
  4379. has(_, key) {
  4380. const has = key[0] !== "_" && !isGloballyWhitelisted(key);
  4381. if (!has && PublicInstanceProxyHandlers.has(_, key)) {
  4382. warn(
  4383. `Property ${JSON.stringify(
  4384. key
  4385. )} should not start with _ which is a reserved prefix for Vue internals.`
  4386. );
  4387. }
  4388. return has;
  4389. }
  4390. }
  4391. );
  4392. function createDevRenderContext(instance) {
  4393. const target = {};
  4394. Object.defineProperty(target, `_`, {
  4395. configurable: true,
  4396. enumerable: false,
  4397. get: () => instance
  4398. });
  4399. Object.keys(publicPropertiesMap).forEach((key) => {
  4400. Object.defineProperty(target, key, {
  4401. configurable: true,
  4402. enumerable: false,
  4403. get: () => publicPropertiesMap[key](instance),
  4404. // intercepted by the proxy so no need for implementation,
  4405. // but needed to prevent set errors
  4406. set: NOOP
  4407. });
  4408. });
  4409. return target;
  4410. }
  4411. function exposePropsOnRenderContext(instance) {
  4412. const {
  4413. ctx,
  4414. propsOptions: [propsOptions]
  4415. } = instance;
  4416. if (propsOptions) {
  4417. Object.keys(propsOptions).forEach((key) => {
  4418. Object.defineProperty(ctx, key, {
  4419. enumerable: true,
  4420. configurable: true,
  4421. get: () => instance.props[key],
  4422. set: NOOP
  4423. });
  4424. });
  4425. }
  4426. }
  4427. function exposeSetupStateOnRenderContext(instance) {
  4428. const { ctx, setupState } = instance;
  4429. Object.keys(toRaw(setupState)).forEach((key) => {
  4430. if (!setupState.__isScriptSetup) {
  4431. if (isReservedPrefix(key[0])) {
  4432. warn(
  4433. `setup() return property ${JSON.stringify(
  4434. key
  4435. )} should not start with "$" or "_" which are reserved prefixes for Vue internals.`
  4436. );
  4437. return;
  4438. }
  4439. Object.defineProperty(ctx, key, {
  4440. enumerable: true,
  4441. configurable: true,
  4442. get: () => setupState[key],
  4443. set: NOOP
  4444. });
  4445. }
  4446. });
  4447. }
  4448. const warnRuntimeUsage = (method) => warn(
  4449. `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
  4450. );
  4451. function defineProps() {
  4452. {
  4453. warnRuntimeUsage(`defineProps`);
  4454. }
  4455. return null;
  4456. }
  4457. function defineEmits() {
  4458. {
  4459. warnRuntimeUsage(`defineEmits`);
  4460. }
  4461. return null;
  4462. }
  4463. function defineExpose(exposed) {
  4464. {
  4465. warnRuntimeUsage(`defineExpose`);
  4466. }
  4467. }
  4468. function defineOptions(options) {
  4469. {
  4470. warnRuntimeUsage(`defineOptions`);
  4471. }
  4472. }
  4473. function defineSlots() {
  4474. {
  4475. warnRuntimeUsage(`defineSlots`);
  4476. }
  4477. return null;
  4478. }
  4479. function defineModel() {
  4480. {
  4481. warnRuntimeUsage("defineModel");
  4482. }
  4483. }
  4484. function withDefaults(props, defaults) {
  4485. {
  4486. warnRuntimeUsage(`withDefaults`);
  4487. }
  4488. return null;
  4489. }
  4490. function useSlots() {
  4491. return getContext().slots;
  4492. }
  4493. function useAttrs() {
  4494. return getContext().attrs;
  4495. }
  4496. function useModel(props, name, options) {
  4497. const i = getCurrentInstance();
  4498. if (!i) {
  4499. warn(`useModel() called without active instance.`);
  4500. return ref();
  4501. }
  4502. if (!i.propsOptions[0][name]) {
  4503. warn(`useModel() called with prop "${name}" which is not declared.`);
  4504. return ref();
  4505. }
  4506. if (options && options.local) {
  4507. const proxy = ref(props[name]);
  4508. watch(
  4509. () => props[name],
  4510. (v) => proxy.value = v
  4511. );
  4512. watch(proxy, (value) => {
  4513. if (value !== props[name]) {
  4514. i.emit(`update:${name}`, value);
  4515. }
  4516. });
  4517. return proxy;
  4518. } else {
  4519. return {
  4520. __v_isRef: true,
  4521. get value() {
  4522. return props[name];
  4523. },
  4524. set value(value) {
  4525. i.emit(`update:${name}`, value);
  4526. }
  4527. };
  4528. }
  4529. }
  4530. function getContext() {
  4531. const i = getCurrentInstance();
  4532. if (!i) {
  4533. warn(`useContext() called without active instance.`);
  4534. }
  4535. return i.setupContext || (i.setupContext = createSetupContext(i));
  4536. }
  4537. function normalizePropsOrEmits(props) {
  4538. return isArray(props) ? props.reduce(
  4539. (normalized, p) => (normalized[p] = null, normalized),
  4540. {}
  4541. ) : props;
  4542. }
  4543. function mergeDefaults(raw, defaults) {
  4544. const props = normalizePropsOrEmits(raw);
  4545. for (const key in defaults) {
  4546. if (key.startsWith("__skip"))
  4547. continue;
  4548. let opt = props[key];
  4549. if (opt) {
  4550. if (isArray(opt) || isFunction(opt)) {
  4551. opt = props[key] = { type: opt, default: defaults[key] };
  4552. } else {
  4553. opt.default = defaults[key];
  4554. }
  4555. } else if (opt === null) {
  4556. opt = props[key] = { default: defaults[key] };
  4557. } else {
  4558. warn(`props default key "${key}" has no corresponding declaration.`);
  4559. }
  4560. if (opt && defaults[`__skip_${key}`]) {
  4561. opt.skipFactory = true;
  4562. }
  4563. }
  4564. return props;
  4565. }
  4566. function mergeModels(a, b) {
  4567. if (!a || !b)
  4568. return a || b;
  4569. if (isArray(a) && isArray(b))
  4570. return a.concat(b);
  4571. return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
  4572. }
  4573. function createPropsRestProxy(props, excludedKeys) {
  4574. const ret = {};
  4575. for (const key in props) {
  4576. if (!excludedKeys.includes(key)) {
  4577. Object.defineProperty(ret, key, {
  4578. enumerable: true,
  4579. get: () => props[key]
  4580. });
  4581. }
  4582. }
  4583. return ret;
  4584. }
  4585. function withAsyncContext(getAwaitable) {
  4586. const ctx = getCurrentInstance();
  4587. if (!ctx) {
  4588. warn(
  4589. `withAsyncContext called without active current instance. This is likely a bug.`
  4590. );
  4591. }
  4592. let awaitable = getAwaitable();
  4593. unsetCurrentInstance();
  4594. if (isPromise(awaitable)) {
  4595. awaitable = awaitable.catch((e) => {
  4596. setCurrentInstance(ctx);
  4597. throw e;
  4598. });
  4599. }
  4600. return [awaitable, () => setCurrentInstance(ctx)];
  4601. }
  4602. function createDuplicateChecker() {
  4603. const cache = /* @__PURE__ */ Object.create(null);
  4604. return (type, key) => {
  4605. if (cache[key]) {
  4606. warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
  4607. } else {
  4608. cache[key] = type;
  4609. }
  4610. };
  4611. }
  4612. let shouldCacheAccess = true;
  4613. function applyOptions(instance) {
  4614. const options = resolveMergedOptions(instance);
  4615. const publicThis = instance.proxy;
  4616. const ctx = instance.ctx;
  4617. shouldCacheAccess = false;
  4618. if (options.beforeCreate) {
  4619. callHook$1(options.beforeCreate, instance, "bc");
  4620. }
  4621. const {
  4622. // state
  4623. data: dataOptions,
  4624. computed: computedOptions,
  4625. methods,
  4626. watch: watchOptions,
  4627. provide: provideOptions,
  4628. inject: injectOptions,
  4629. // lifecycle
  4630. created,
  4631. beforeMount,
  4632. mounted,
  4633. beforeUpdate,
  4634. updated,
  4635. activated,
  4636. deactivated,
  4637. beforeDestroy,
  4638. beforeUnmount,
  4639. destroyed,
  4640. unmounted,
  4641. render,
  4642. renderTracked,
  4643. renderTriggered,
  4644. errorCaptured,
  4645. serverPrefetch,
  4646. // public API
  4647. expose,
  4648. inheritAttrs,
  4649. // assets
  4650. components,
  4651. directives,
  4652. filters
  4653. } = options;
  4654. const checkDuplicateProperties = createDuplicateChecker() ;
  4655. {
  4656. const [propsOptions] = instance.propsOptions;
  4657. if (propsOptions) {
  4658. for (const key in propsOptions) {
  4659. checkDuplicateProperties("Props" /* PROPS */, key);
  4660. }
  4661. }
  4662. }
  4663. if (injectOptions) {
  4664. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  4665. }
  4666. if (methods) {
  4667. for (const key in methods) {
  4668. const methodHandler = methods[key];
  4669. if (isFunction(methodHandler)) {
  4670. {
  4671. Object.defineProperty(ctx, key, {
  4672. value: methodHandler.bind(publicThis),
  4673. configurable: true,
  4674. enumerable: true,
  4675. writable: true
  4676. });
  4677. }
  4678. {
  4679. checkDuplicateProperties("Methods" /* METHODS */, key);
  4680. }
  4681. } else {
  4682. warn(
  4683. `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
  4684. );
  4685. }
  4686. }
  4687. }
  4688. if (dataOptions) {
  4689. if (!isFunction(dataOptions)) {
  4690. warn(
  4691. `The data option must be a function. Plain object usage is no longer supported.`
  4692. );
  4693. }
  4694. const data = dataOptions.call(publicThis, publicThis);
  4695. if (isPromise(data)) {
  4696. warn(
  4697. `data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`
  4698. );
  4699. }
  4700. if (!isObject(data)) {
  4701. warn(`data() should return an object.`);
  4702. } else {
  4703. instance.data = reactive(data);
  4704. {
  4705. for (const key in data) {
  4706. checkDuplicateProperties("Data" /* DATA */, key);
  4707. if (!isReservedPrefix(key[0])) {
  4708. Object.defineProperty(ctx, key, {
  4709. configurable: true,
  4710. enumerable: true,
  4711. get: () => data[key],
  4712. set: NOOP
  4713. });
  4714. }
  4715. }
  4716. }
  4717. }
  4718. }
  4719. shouldCacheAccess = true;
  4720. if (computedOptions) {
  4721. for (const key in computedOptions) {
  4722. const opt = computedOptions[key];
  4723. const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4724. if (get === NOOP) {
  4725. warn(`Computed property "${key}" has no getter.`);
  4726. }
  4727. const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4728. warn(
  4729. `Write operation failed: computed property "${key}" is readonly.`
  4730. );
  4731. } ;
  4732. const c = computed({
  4733. get,
  4734. set
  4735. });
  4736. Object.defineProperty(ctx, key, {
  4737. enumerable: true,
  4738. configurable: true,
  4739. get: () => c.value,
  4740. set: (v) => c.value = v
  4741. });
  4742. {
  4743. checkDuplicateProperties("Computed" /* COMPUTED */, key);
  4744. }
  4745. }
  4746. }
  4747. if (watchOptions) {
  4748. for (const key in watchOptions) {
  4749. createWatcher(watchOptions[key], ctx, publicThis, key);
  4750. }
  4751. }
  4752. if (provideOptions) {
  4753. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  4754. Reflect.ownKeys(provides).forEach((key) => {
  4755. provide(key, provides[key]);
  4756. });
  4757. }
  4758. if (created) {
  4759. callHook$1(created, instance, "c");
  4760. }
  4761. function registerLifecycleHook(register, hook) {
  4762. if (isArray(hook)) {
  4763. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  4764. } else if (hook) {
  4765. register(hook.bind(publicThis));
  4766. }
  4767. }
  4768. registerLifecycleHook(onBeforeMount, beforeMount);
  4769. registerLifecycleHook(onMounted, mounted);
  4770. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  4771. registerLifecycleHook(onUpdated, updated);
  4772. registerLifecycleHook(onActivated, activated);
  4773. registerLifecycleHook(onDeactivated, deactivated);
  4774. registerLifecycleHook(onErrorCaptured, errorCaptured);
  4775. registerLifecycleHook(onRenderTracked, renderTracked);
  4776. registerLifecycleHook(onRenderTriggered, renderTriggered);
  4777. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  4778. registerLifecycleHook(onUnmounted, unmounted);
  4779. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  4780. if (isArray(expose)) {
  4781. if (expose.length) {
  4782. const exposed = instance.exposed || (instance.exposed = {});
  4783. expose.forEach((key) => {
  4784. Object.defineProperty(exposed, key, {
  4785. get: () => publicThis[key],
  4786. set: (val) => publicThis[key] = val
  4787. });
  4788. });
  4789. } else if (!instance.exposed) {
  4790. instance.exposed = {};
  4791. }
  4792. }
  4793. if (render && instance.render === NOOP) {
  4794. instance.render = render;
  4795. }
  4796. if (inheritAttrs != null) {
  4797. instance.inheritAttrs = inheritAttrs;
  4798. }
  4799. if (components)
  4800. instance.components = components;
  4801. if (directives)
  4802. instance.directives = directives;
  4803. }
  4804. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  4805. if (isArray(injectOptions)) {
  4806. injectOptions = normalizeInject(injectOptions);
  4807. }
  4808. for (const key in injectOptions) {
  4809. const opt = injectOptions[key];
  4810. let injected;
  4811. if (isObject(opt)) {
  4812. if ("default" in opt) {
  4813. injected = inject(
  4814. opt.from || key,
  4815. opt.default,
  4816. true
  4817. /* treat default function as factory */
  4818. );
  4819. } else {
  4820. injected = inject(opt.from || key);
  4821. }
  4822. } else {
  4823. injected = inject(opt);
  4824. }
  4825. if (isRef(injected)) {
  4826. Object.defineProperty(ctx, key, {
  4827. enumerable: true,
  4828. configurable: true,
  4829. get: () => injected.value,
  4830. set: (v) => injected.value = v
  4831. });
  4832. } else {
  4833. ctx[key] = injected;
  4834. }
  4835. {
  4836. checkDuplicateProperties("Inject" /* INJECT */, key);
  4837. }
  4838. }
  4839. }
  4840. function callHook$1(hook, instance, type) {
  4841. callWithAsyncErrorHandling(
  4842. isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy),
  4843. instance,
  4844. type
  4845. );
  4846. }
  4847. function createWatcher(raw, ctx, publicThis, key) {
  4848. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  4849. if (isString(raw)) {
  4850. const handler = ctx[raw];
  4851. if (isFunction(handler)) {
  4852. watch(getter, handler);
  4853. } else {
  4854. warn(`Invalid watch handler specified by key "${raw}"`, handler);
  4855. }
  4856. } else if (isFunction(raw)) {
  4857. watch(getter, raw.bind(publicThis));
  4858. } else if (isObject(raw)) {
  4859. if (isArray(raw)) {
  4860. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  4861. } else {
  4862. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4863. if (isFunction(handler)) {
  4864. watch(getter, handler, raw);
  4865. } else {
  4866. warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  4867. }
  4868. }
  4869. } else {
  4870. warn(`Invalid watch option: "${key}"`, raw);
  4871. }
  4872. }
  4873. function resolveMergedOptions(instance) {
  4874. const base = instance.type;
  4875. const { mixins, extends: extendsOptions } = base;
  4876. const {
  4877. mixins: globalMixins,
  4878. optionsCache: cache,
  4879. config: { optionMergeStrategies }
  4880. } = instance.appContext;
  4881. const cached = cache.get(base);
  4882. let resolved;
  4883. if (cached) {
  4884. resolved = cached;
  4885. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4886. {
  4887. resolved = base;
  4888. }
  4889. } else {
  4890. resolved = {};
  4891. if (globalMixins.length) {
  4892. globalMixins.forEach(
  4893. (m) => mergeOptions(resolved, m, optionMergeStrategies, true)
  4894. );
  4895. }
  4896. mergeOptions(resolved, base, optionMergeStrategies);
  4897. }
  4898. if (isObject(base)) {
  4899. cache.set(base, resolved);
  4900. }
  4901. return resolved;
  4902. }
  4903. function mergeOptions(to, from, strats, asMixin = false) {
  4904. const { mixins, extends: extendsOptions } = from;
  4905. if (extendsOptions) {
  4906. mergeOptions(to, extendsOptions, strats, true);
  4907. }
  4908. if (mixins) {
  4909. mixins.forEach(
  4910. (m) => mergeOptions(to, m, strats, true)
  4911. );
  4912. }
  4913. for (const key in from) {
  4914. if (asMixin && key === "expose") {
  4915. warn(
  4916. `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
  4917. );
  4918. } else {
  4919. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  4920. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4921. }
  4922. }
  4923. return to;
  4924. }
  4925. const internalOptionMergeStrats = {
  4926. data: mergeDataFn,
  4927. props: mergeEmitsOrPropsOptions,
  4928. emits: mergeEmitsOrPropsOptions,
  4929. // objects
  4930. methods: mergeObjectOptions,
  4931. computed: mergeObjectOptions,
  4932. // lifecycle
  4933. beforeCreate: mergeAsArray,
  4934. created: mergeAsArray,
  4935. beforeMount: mergeAsArray,
  4936. mounted: mergeAsArray,
  4937. beforeUpdate: mergeAsArray,
  4938. updated: mergeAsArray,
  4939. beforeDestroy: mergeAsArray,
  4940. beforeUnmount: mergeAsArray,
  4941. destroyed: mergeAsArray,
  4942. unmounted: mergeAsArray,
  4943. activated: mergeAsArray,
  4944. deactivated: mergeAsArray,
  4945. errorCaptured: mergeAsArray,
  4946. serverPrefetch: mergeAsArray,
  4947. // assets
  4948. components: mergeObjectOptions,
  4949. directives: mergeObjectOptions,
  4950. // watch
  4951. watch: mergeWatchOptions,
  4952. // provide / inject
  4953. provide: mergeDataFn,
  4954. inject: mergeInject
  4955. };
  4956. function mergeDataFn(to, from) {
  4957. if (!from) {
  4958. return to;
  4959. }
  4960. if (!to) {
  4961. return from;
  4962. }
  4963. return function mergedDataFn() {
  4964. return (extend)(
  4965. isFunction(to) ? to.call(this, this) : to,
  4966. isFunction(from) ? from.call(this, this) : from
  4967. );
  4968. };
  4969. }
  4970. function mergeInject(to, from) {
  4971. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4972. }
  4973. function normalizeInject(raw) {
  4974. if (isArray(raw)) {
  4975. const res = {};
  4976. for (let i = 0; i < raw.length; i++) {
  4977. res[raw[i]] = raw[i];
  4978. }
  4979. return res;
  4980. }
  4981. return raw;
  4982. }
  4983. function mergeAsArray(to, from) {
  4984. return to ? [...new Set([].concat(to, from))] : from;
  4985. }
  4986. function mergeObjectOptions(to, from) {
  4987. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  4988. }
  4989. function mergeEmitsOrPropsOptions(to, from) {
  4990. if (to) {
  4991. if (isArray(to) && isArray(from)) {
  4992. return [.../* @__PURE__ */ new Set([...to, ...from])];
  4993. }
  4994. return extend(
  4995. /* @__PURE__ */ Object.create(null),
  4996. normalizePropsOrEmits(to),
  4997. normalizePropsOrEmits(from != null ? from : {})
  4998. );
  4999. } else {
  5000. return from;
  5001. }
  5002. }
  5003. function mergeWatchOptions(to, from) {
  5004. if (!to)
  5005. return from;
  5006. if (!from)
  5007. return to;
  5008. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  5009. for (const key in from) {
  5010. merged[key] = mergeAsArray(to[key], from[key]);
  5011. }
  5012. return merged;
  5013. }
  5014. function createAppContext() {
  5015. return {
  5016. app: null,
  5017. config: {
  5018. isNativeTag: NO,
  5019. performance: false,
  5020. globalProperties: {},
  5021. optionMergeStrategies: {},
  5022. errorHandler: void 0,
  5023. warnHandler: void 0,
  5024. compilerOptions: {}
  5025. },
  5026. mixins: [],
  5027. components: {},
  5028. directives: {},
  5029. provides: /* @__PURE__ */ Object.create(null),
  5030. optionsCache: /* @__PURE__ */ new WeakMap(),
  5031. propsCache: /* @__PURE__ */ new WeakMap(),
  5032. emitsCache: /* @__PURE__ */ new WeakMap()
  5033. };
  5034. }
  5035. let uid$1 = 0;
  5036. function createAppAPI(render, hydrate) {
  5037. return function createApp(rootComponent, rootProps = null) {
  5038. if (!isFunction(rootComponent)) {
  5039. rootComponent = extend({}, rootComponent);
  5040. }
  5041. if (rootProps != null && !isObject(rootProps)) {
  5042. warn(`root props passed to app.mount() must be an object.`);
  5043. rootProps = null;
  5044. }
  5045. const context = createAppContext();
  5046. {
  5047. Object.defineProperty(context.config, "unwrapInjectedRef", {
  5048. get() {
  5049. return true;
  5050. },
  5051. set() {
  5052. warn(
  5053. `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
  5054. );
  5055. }
  5056. });
  5057. }
  5058. const installedPlugins = /* @__PURE__ */ new Set();
  5059. let isMounted = false;
  5060. const app = context.app = {
  5061. _uid: uid$1++,
  5062. _component: rootComponent,
  5063. _props: rootProps,
  5064. _container: null,
  5065. _context: context,
  5066. _instance: null,
  5067. version,
  5068. get config() {
  5069. return context.config;
  5070. },
  5071. set config(v) {
  5072. {
  5073. warn(
  5074. `app.config cannot be replaced. Modify individual options instead.`
  5075. );
  5076. }
  5077. },
  5078. use(plugin, ...options) {
  5079. if (installedPlugins.has(plugin)) {
  5080. warn(`Plugin has already been applied to target app.`);
  5081. } else if (plugin && isFunction(plugin.install)) {
  5082. installedPlugins.add(plugin);
  5083. plugin.install(app, ...options);
  5084. } else if (isFunction(plugin)) {
  5085. installedPlugins.add(plugin);
  5086. plugin(app, ...options);
  5087. } else {
  5088. warn(
  5089. `A plugin must either be a function or an object with an "install" function.`
  5090. );
  5091. }
  5092. return app;
  5093. },
  5094. mixin(mixin) {
  5095. {
  5096. if (!context.mixins.includes(mixin)) {
  5097. context.mixins.push(mixin);
  5098. } else {
  5099. warn(
  5100. "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
  5101. );
  5102. }
  5103. }
  5104. return app;
  5105. },
  5106. component(name, component) {
  5107. {
  5108. validateComponentName(name, context.config);
  5109. }
  5110. if (!component) {
  5111. return context.components[name];
  5112. }
  5113. if (context.components[name]) {
  5114. warn(`Component "${name}" has already been registered in target app.`);
  5115. }
  5116. context.components[name] = component;
  5117. return app;
  5118. },
  5119. directive(name, directive) {
  5120. {
  5121. validateDirectiveName(name);
  5122. }
  5123. if (!directive) {
  5124. return context.directives[name];
  5125. }
  5126. if (context.directives[name]) {
  5127. warn(`Directive "${name}" has already been registered in target app.`);
  5128. }
  5129. context.directives[name] = directive;
  5130. return app;
  5131. },
  5132. mount(rootContainer, isHydrate, isSVG) {
  5133. if (!isMounted) {
  5134. if (rootContainer.__vue_app__) {
  5135. warn(
  5136. `There is already an app instance mounted on the host container.
  5137. If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
  5138. );
  5139. }
  5140. const vnode = createVNode(
  5141. rootComponent,
  5142. rootProps
  5143. );
  5144. vnode.appContext = context;
  5145. {
  5146. context.reload = () => {
  5147. render(cloneVNode(vnode), rootContainer, isSVG);
  5148. };
  5149. }
  5150. if (isHydrate && hydrate) {
  5151. hydrate(vnode, rootContainer);
  5152. } else {
  5153. render(vnode, rootContainer, isSVG);
  5154. }
  5155. isMounted = true;
  5156. app._container = rootContainer;
  5157. rootContainer.__vue_app__ = app;
  5158. {
  5159. app._instance = vnode.component;
  5160. devtoolsInitApp(app, version);
  5161. }
  5162. return getExposeProxy(vnode.component) || vnode.component.proxy;
  5163. } else {
  5164. warn(
  5165. `App has already been mounted.
  5166. 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)\``
  5167. );
  5168. }
  5169. },
  5170. unmount() {
  5171. if (isMounted) {
  5172. render(null, app._container);
  5173. {
  5174. app._instance = null;
  5175. devtoolsUnmountApp(app);
  5176. }
  5177. delete app._container.__vue_app__;
  5178. } else {
  5179. warn(`Cannot unmount an app that is not mounted.`);
  5180. }
  5181. },
  5182. provide(key, value) {
  5183. if (key in context.provides) {
  5184. warn(
  5185. `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
  5186. );
  5187. }
  5188. context.provides[key] = value;
  5189. return app;
  5190. },
  5191. runWithContext(fn) {
  5192. currentApp = app;
  5193. try {
  5194. return fn();
  5195. } finally {
  5196. currentApp = null;
  5197. }
  5198. }
  5199. };
  5200. return app;
  5201. };
  5202. }
  5203. let currentApp = null;
  5204. function provide(key, value) {
  5205. if (!currentInstance) {
  5206. {
  5207. warn(`provide() can only be used inside setup().`);
  5208. }
  5209. } else {
  5210. let provides = currentInstance.provides;
  5211. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  5212. if (parentProvides === provides) {
  5213. provides = currentInstance.provides = Object.create(parentProvides);
  5214. }
  5215. provides[key] = value;
  5216. }
  5217. }
  5218. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  5219. const instance = currentInstance || currentRenderingInstance;
  5220. if (instance || currentApp) {
  5221. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  5222. if (provides && key in provides) {
  5223. return provides[key];
  5224. } else if (arguments.length > 1) {
  5225. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  5226. } else {
  5227. warn(`injection "${String(key)}" not found.`);
  5228. }
  5229. } else {
  5230. warn(`inject() can only be used inside setup() or functional components.`);
  5231. }
  5232. }
  5233. function hasInjectionContext() {
  5234. return !!(currentInstance || currentRenderingInstance || currentApp);
  5235. }
  5236. function initProps(instance, rawProps, isStateful, isSSR = false) {
  5237. const props = {};
  5238. const attrs = {};
  5239. def(attrs, InternalObjectKey, 1);
  5240. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  5241. setFullProps(instance, rawProps, props, attrs);
  5242. for (const key in instance.propsOptions[0]) {
  5243. if (!(key in props)) {
  5244. props[key] = void 0;
  5245. }
  5246. }
  5247. {
  5248. validateProps(rawProps || {}, props, instance);
  5249. }
  5250. if (isStateful) {
  5251. instance.props = isSSR ? props : shallowReactive(props);
  5252. } else {
  5253. if (!instance.type.props) {
  5254. instance.props = attrs;
  5255. } else {
  5256. instance.props = props;
  5257. }
  5258. }
  5259. instance.attrs = attrs;
  5260. }
  5261. function isInHmrContext(instance) {
  5262. while (instance) {
  5263. if (instance.type.__hmrId)
  5264. return true;
  5265. instance = instance.parent;
  5266. }
  5267. }
  5268. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  5269. const {
  5270. props,
  5271. attrs,
  5272. vnode: { patchFlag }
  5273. } = instance;
  5274. const rawCurrentProps = toRaw(props);
  5275. const [options] = instance.propsOptions;
  5276. let hasAttrsChanged = false;
  5277. if (
  5278. // always force full diff in dev
  5279. // - #1942 if hmr is enabled with sfc component
  5280. // - vite#872 non-sfc component used by sfc component
  5281. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  5282. ) {
  5283. if (patchFlag & 8) {
  5284. const propsToUpdate = instance.vnode.dynamicProps;
  5285. for (let i = 0; i < propsToUpdate.length; i++) {
  5286. let key = propsToUpdate[i];
  5287. if (isEmitListener(instance.emitsOptions, key)) {
  5288. continue;
  5289. }
  5290. const value = rawProps[key];
  5291. if (options) {
  5292. if (hasOwn(attrs, key)) {
  5293. if (value !== attrs[key]) {
  5294. attrs[key] = value;
  5295. hasAttrsChanged = true;
  5296. }
  5297. } else {
  5298. const camelizedKey = camelize(key);
  5299. props[camelizedKey] = resolvePropValue(
  5300. options,
  5301. rawCurrentProps,
  5302. camelizedKey,
  5303. value,
  5304. instance,
  5305. false
  5306. /* isAbsent */
  5307. );
  5308. }
  5309. } else {
  5310. if (value !== attrs[key]) {
  5311. attrs[key] = value;
  5312. hasAttrsChanged = true;
  5313. }
  5314. }
  5315. }
  5316. }
  5317. } else {
  5318. if (setFullProps(instance, rawProps, props, attrs)) {
  5319. hasAttrsChanged = true;
  5320. }
  5321. let kebabKey;
  5322. for (const key in rawCurrentProps) {
  5323. if (!rawProps || // for camelCase
  5324. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  5325. // and converted to camelCase (#955)
  5326. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  5327. if (options) {
  5328. if (rawPrevProps && // for camelCase
  5329. (rawPrevProps[key] !== void 0 || // for kebab-case
  5330. rawPrevProps[kebabKey] !== void 0)) {
  5331. props[key] = resolvePropValue(
  5332. options,
  5333. rawCurrentProps,
  5334. key,
  5335. void 0,
  5336. instance,
  5337. true
  5338. /* isAbsent */
  5339. );
  5340. }
  5341. } else {
  5342. delete props[key];
  5343. }
  5344. }
  5345. }
  5346. if (attrs !== rawCurrentProps) {
  5347. for (const key in attrs) {
  5348. if (!rawProps || !hasOwn(rawProps, key) && true) {
  5349. delete attrs[key];
  5350. hasAttrsChanged = true;
  5351. }
  5352. }
  5353. }
  5354. }
  5355. if (hasAttrsChanged) {
  5356. trigger(instance, "set", "$attrs");
  5357. }
  5358. {
  5359. validateProps(rawProps || {}, props, instance);
  5360. }
  5361. }
  5362. function setFullProps(instance, rawProps, props, attrs) {
  5363. const [options, needCastKeys] = instance.propsOptions;
  5364. let hasAttrsChanged = false;
  5365. let rawCastValues;
  5366. if (rawProps) {
  5367. for (let key in rawProps) {
  5368. if (isReservedProp(key)) {
  5369. continue;
  5370. }
  5371. const value = rawProps[key];
  5372. let camelKey;
  5373. if (options && hasOwn(options, camelKey = camelize(key))) {
  5374. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  5375. props[camelKey] = value;
  5376. } else {
  5377. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  5378. }
  5379. } else if (!isEmitListener(instance.emitsOptions, key)) {
  5380. if (!(key in attrs) || value !== attrs[key]) {
  5381. attrs[key] = value;
  5382. hasAttrsChanged = true;
  5383. }
  5384. }
  5385. }
  5386. }
  5387. if (needCastKeys) {
  5388. const rawCurrentProps = toRaw(props);
  5389. const castValues = rawCastValues || EMPTY_OBJ;
  5390. for (let i = 0; i < needCastKeys.length; i++) {
  5391. const key = needCastKeys[i];
  5392. props[key] = resolvePropValue(
  5393. options,
  5394. rawCurrentProps,
  5395. key,
  5396. castValues[key],
  5397. instance,
  5398. !hasOwn(castValues, key)
  5399. );
  5400. }
  5401. }
  5402. return hasAttrsChanged;
  5403. }
  5404. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  5405. const opt = options[key];
  5406. if (opt != null) {
  5407. const hasDefault = hasOwn(opt, "default");
  5408. if (hasDefault && value === void 0) {
  5409. const defaultValue = opt.default;
  5410. if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
  5411. const { propsDefaults } = instance;
  5412. if (key in propsDefaults) {
  5413. value = propsDefaults[key];
  5414. } else {
  5415. setCurrentInstance(instance);
  5416. value = propsDefaults[key] = defaultValue.call(
  5417. null,
  5418. props
  5419. );
  5420. unsetCurrentInstance();
  5421. }
  5422. } else {
  5423. value = defaultValue;
  5424. }
  5425. }
  5426. if (opt[0 /* shouldCast */]) {
  5427. if (isAbsent && !hasDefault) {
  5428. value = false;
  5429. } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
  5430. value = true;
  5431. }
  5432. }
  5433. }
  5434. return value;
  5435. }
  5436. function normalizePropsOptions(comp, appContext, asMixin = false) {
  5437. const cache = appContext.propsCache;
  5438. const cached = cache.get(comp);
  5439. if (cached) {
  5440. return cached;
  5441. }
  5442. const raw = comp.props;
  5443. const normalized = {};
  5444. const needCastKeys = [];
  5445. let hasExtends = false;
  5446. if (!isFunction(comp)) {
  5447. const extendProps = (raw2) => {
  5448. hasExtends = true;
  5449. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  5450. extend(normalized, props);
  5451. if (keys)
  5452. needCastKeys.push(...keys);
  5453. };
  5454. if (!asMixin && appContext.mixins.length) {
  5455. appContext.mixins.forEach(extendProps);
  5456. }
  5457. if (comp.extends) {
  5458. extendProps(comp.extends);
  5459. }
  5460. if (comp.mixins) {
  5461. comp.mixins.forEach(extendProps);
  5462. }
  5463. }
  5464. if (!raw && !hasExtends) {
  5465. if (isObject(comp)) {
  5466. cache.set(comp, EMPTY_ARR);
  5467. }
  5468. return EMPTY_ARR;
  5469. }
  5470. if (isArray(raw)) {
  5471. for (let i = 0; i < raw.length; i++) {
  5472. if (!isString(raw[i])) {
  5473. warn(`props must be strings when using array syntax.`, raw[i]);
  5474. }
  5475. const normalizedKey = camelize(raw[i]);
  5476. if (validatePropName(normalizedKey)) {
  5477. normalized[normalizedKey] = EMPTY_OBJ;
  5478. }
  5479. }
  5480. } else if (raw) {
  5481. if (!isObject(raw)) {
  5482. warn(`invalid props options`, raw);
  5483. }
  5484. for (const key in raw) {
  5485. const normalizedKey = camelize(key);
  5486. if (validatePropName(normalizedKey)) {
  5487. const opt = raw[key];
  5488. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
  5489. if (prop) {
  5490. const booleanIndex = getTypeIndex(Boolean, prop.type);
  5491. const stringIndex = getTypeIndex(String, prop.type);
  5492. prop[0 /* shouldCast */] = booleanIndex > -1;
  5493. prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
  5494. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  5495. needCastKeys.push(normalizedKey);
  5496. }
  5497. }
  5498. }
  5499. }
  5500. }
  5501. const res = [normalized, needCastKeys];
  5502. if (isObject(comp)) {
  5503. cache.set(comp, res);
  5504. }
  5505. return res;
  5506. }
  5507. function validatePropName(key) {
  5508. if (key[0] !== "$") {
  5509. return true;
  5510. } else {
  5511. warn(`Invalid prop name: "${key}" is a reserved property.`);
  5512. }
  5513. return false;
  5514. }
  5515. function getType(ctor) {
  5516. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  5517. return match ? match[2] : ctor === null ? "null" : "";
  5518. }
  5519. function isSameType(a, b) {
  5520. return getType(a) === getType(b);
  5521. }
  5522. function getTypeIndex(type, expectedTypes) {
  5523. if (isArray(expectedTypes)) {
  5524. return expectedTypes.findIndex((t) => isSameType(t, type));
  5525. } else if (isFunction(expectedTypes)) {
  5526. return isSameType(expectedTypes, type) ? 0 : -1;
  5527. }
  5528. return -1;
  5529. }
  5530. function validateProps(rawProps, props, instance) {
  5531. const resolvedValues = toRaw(props);
  5532. const options = instance.propsOptions[0];
  5533. for (const key in options) {
  5534. let opt = options[key];
  5535. if (opt == null)
  5536. continue;
  5537. validateProp(
  5538. key,
  5539. resolvedValues[key],
  5540. opt,
  5541. !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
  5542. );
  5543. }
  5544. }
  5545. function validateProp(name, value, prop, isAbsent) {
  5546. const { type, required, validator, skipCheck } = prop;
  5547. if (required && isAbsent) {
  5548. warn('Missing required prop: "' + name + '"');
  5549. return;
  5550. }
  5551. if (value == null && !required) {
  5552. return;
  5553. }
  5554. if (type != null && type !== true && !skipCheck) {
  5555. let isValid = false;
  5556. const types = isArray(type) ? type : [type];
  5557. const expectedTypes = [];
  5558. for (let i = 0; i < types.length && !isValid; i++) {
  5559. const { valid, expectedType } = assertType(value, types[i]);
  5560. expectedTypes.push(expectedType || "");
  5561. isValid = valid;
  5562. }
  5563. if (!isValid) {
  5564. warn(getInvalidTypeMessage(name, value, expectedTypes));
  5565. return;
  5566. }
  5567. }
  5568. if (validator && !validator(value)) {
  5569. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  5570. }
  5571. }
  5572. const isSimpleType = /* @__PURE__ */ makeMap(
  5573. "String,Number,Boolean,Function,Symbol,BigInt"
  5574. );
  5575. function assertType(value, type) {
  5576. let valid;
  5577. const expectedType = getType(type);
  5578. if (isSimpleType(expectedType)) {
  5579. const t = typeof value;
  5580. valid = t === expectedType.toLowerCase();
  5581. if (!valid && t === "object") {
  5582. valid = value instanceof type;
  5583. }
  5584. } else if (expectedType === "Object") {
  5585. valid = isObject(value);
  5586. } else if (expectedType === "Array") {
  5587. valid = isArray(value);
  5588. } else if (expectedType === "null") {
  5589. valid = value === null;
  5590. } else {
  5591. valid = value instanceof type;
  5592. }
  5593. return {
  5594. valid,
  5595. expectedType
  5596. };
  5597. }
  5598. function getInvalidTypeMessage(name, value, expectedTypes) {
  5599. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  5600. const expectedType = expectedTypes[0];
  5601. const receivedType = toRawType(value);
  5602. const expectedValue = styleValue(value, expectedType);
  5603. const receivedValue = styleValue(value, receivedType);
  5604. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  5605. message += ` with value ${expectedValue}`;
  5606. }
  5607. message += `, got ${receivedType} `;
  5608. if (isExplicable(receivedType)) {
  5609. message += `with value ${receivedValue}.`;
  5610. }
  5611. return message;
  5612. }
  5613. function styleValue(value, type) {
  5614. if (type === "String") {
  5615. return `"${value}"`;
  5616. } else if (type === "Number") {
  5617. return `${Number(value)}`;
  5618. } else {
  5619. return `${value}`;
  5620. }
  5621. }
  5622. function isExplicable(type) {
  5623. const explicitTypes = ["string", "number", "boolean"];
  5624. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  5625. }
  5626. function isBoolean(...args) {
  5627. return args.some((elem) => elem.toLowerCase() === "boolean");
  5628. }
  5629. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  5630. const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  5631. const normalizeSlot = (key, rawSlot, ctx) => {
  5632. if (rawSlot._n) {
  5633. return rawSlot;
  5634. }
  5635. const normalized = withCtx((...args) => {
  5636. if (currentInstance) {
  5637. warn(
  5638. `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.`
  5639. );
  5640. }
  5641. return normalizeSlotValue(rawSlot(...args));
  5642. }, ctx);
  5643. normalized._c = false;
  5644. return normalized;
  5645. };
  5646. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  5647. const ctx = rawSlots._ctx;
  5648. for (const key in rawSlots) {
  5649. if (isInternalKey(key))
  5650. continue;
  5651. const value = rawSlots[key];
  5652. if (isFunction(value)) {
  5653. slots[key] = normalizeSlot(key, value, ctx);
  5654. } else if (value != null) {
  5655. {
  5656. warn(
  5657. `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
  5658. );
  5659. }
  5660. const normalized = normalizeSlotValue(value);
  5661. slots[key] = () => normalized;
  5662. }
  5663. }
  5664. };
  5665. const normalizeVNodeSlots = (instance, children) => {
  5666. if (!isKeepAlive(instance.vnode) && true) {
  5667. warn(
  5668. `Non-function value encountered for default slot. Prefer function slots for better performance.`
  5669. );
  5670. }
  5671. const normalized = normalizeSlotValue(children);
  5672. instance.slots.default = () => normalized;
  5673. };
  5674. const initSlots = (instance, children) => {
  5675. if (instance.vnode.shapeFlag & 32) {
  5676. const type = children._;
  5677. if (type) {
  5678. instance.slots = toRaw(children);
  5679. def(children, "_", type);
  5680. } else {
  5681. normalizeObjectSlots(
  5682. children,
  5683. instance.slots = {});
  5684. }
  5685. } else {
  5686. instance.slots = {};
  5687. if (children) {
  5688. normalizeVNodeSlots(instance, children);
  5689. }
  5690. }
  5691. def(instance.slots, InternalObjectKey, 1);
  5692. };
  5693. const updateSlots = (instance, children, optimized) => {
  5694. const { vnode, slots } = instance;
  5695. let needDeletionCheck = true;
  5696. let deletionComparisonTarget = EMPTY_OBJ;
  5697. if (vnode.shapeFlag & 32) {
  5698. const type = children._;
  5699. if (type) {
  5700. if (isHmrUpdating) {
  5701. extend(slots, children);
  5702. trigger(instance, "set", "$slots");
  5703. } else if (optimized && type === 1) {
  5704. needDeletionCheck = false;
  5705. } else {
  5706. extend(slots, children);
  5707. if (!optimized && type === 1) {
  5708. delete slots._;
  5709. }
  5710. }
  5711. } else {
  5712. needDeletionCheck = !children.$stable;
  5713. normalizeObjectSlots(children, slots);
  5714. }
  5715. deletionComparisonTarget = children;
  5716. } else if (children) {
  5717. normalizeVNodeSlots(instance, children);
  5718. deletionComparisonTarget = { default: 1 };
  5719. }
  5720. if (needDeletionCheck) {
  5721. for (const key in slots) {
  5722. if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
  5723. delete slots[key];
  5724. }
  5725. }
  5726. }
  5727. };
  5728. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  5729. if (isArray(rawRef)) {
  5730. rawRef.forEach(
  5731. (r, i) => setRef(
  5732. r,
  5733. oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
  5734. parentSuspense,
  5735. vnode,
  5736. isUnmount
  5737. )
  5738. );
  5739. return;
  5740. }
  5741. if (isAsyncWrapper(vnode) && !isUnmount) {
  5742. return;
  5743. }
  5744. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  5745. const value = isUnmount ? null : refValue;
  5746. const { i: owner, r: ref } = rawRef;
  5747. if (!owner) {
  5748. warn(
  5749. `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
  5750. );
  5751. return;
  5752. }
  5753. const oldRef = oldRawRef && oldRawRef.r;
  5754. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  5755. const setupState = owner.setupState;
  5756. if (oldRef != null && oldRef !== ref) {
  5757. if (isString(oldRef)) {
  5758. refs[oldRef] = null;
  5759. if (hasOwn(setupState, oldRef)) {
  5760. setupState[oldRef] = null;
  5761. }
  5762. } else if (isRef(oldRef)) {
  5763. oldRef.value = null;
  5764. }
  5765. }
  5766. if (isFunction(ref)) {
  5767. callWithErrorHandling(ref, owner, 12, [value, refs]);
  5768. } else {
  5769. const _isString = isString(ref);
  5770. const _isRef = isRef(ref);
  5771. if (_isString || _isRef) {
  5772. const doSet = () => {
  5773. if (rawRef.f) {
  5774. const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
  5775. if (isUnmount) {
  5776. isArray(existing) && remove(existing, refValue);
  5777. } else {
  5778. if (!isArray(existing)) {
  5779. if (_isString) {
  5780. refs[ref] = [refValue];
  5781. if (hasOwn(setupState, ref)) {
  5782. setupState[ref] = refs[ref];
  5783. }
  5784. } else {
  5785. ref.value = [refValue];
  5786. if (rawRef.k)
  5787. refs[rawRef.k] = ref.value;
  5788. }
  5789. } else if (!existing.includes(refValue)) {
  5790. existing.push(refValue);
  5791. }
  5792. }
  5793. } else if (_isString) {
  5794. refs[ref] = value;
  5795. if (hasOwn(setupState, ref)) {
  5796. setupState[ref] = value;
  5797. }
  5798. } else if (_isRef) {
  5799. ref.value = value;
  5800. if (rawRef.k)
  5801. refs[rawRef.k] = value;
  5802. } else {
  5803. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5804. }
  5805. };
  5806. if (value) {
  5807. doSet.id = -1;
  5808. queuePostRenderEffect(doSet, parentSuspense);
  5809. } else {
  5810. doSet();
  5811. }
  5812. } else {
  5813. warn("Invalid template ref type:", ref, `(${typeof ref})`);
  5814. }
  5815. }
  5816. }
  5817. let hasMismatch = false;
  5818. const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
  5819. const isComment = (node) => node.nodeType === 8 /* COMMENT */;
  5820. function createHydrationFunctions(rendererInternals) {
  5821. const {
  5822. mt: mountComponent,
  5823. p: patch,
  5824. o: {
  5825. patchProp,
  5826. createText,
  5827. nextSibling,
  5828. parentNode,
  5829. remove,
  5830. insert,
  5831. createComment
  5832. }
  5833. } = rendererInternals;
  5834. const hydrate = (vnode, container) => {
  5835. if (!container.hasChildNodes()) {
  5836. warn(
  5837. `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
  5838. );
  5839. patch(null, vnode, container);
  5840. flushPostFlushCbs();
  5841. container._vnode = vnode;
  5842. return;
  5843. }
  5844. hasMismatch = false;
  5845. hydrateNode(container.firstChild, vnode, null, null, null);
  5846. flushPostFlushCbs();
  5847. container._vnode = vnode;
  5848. if (hasMismatch && true) {
  5849. console.error(`Hydration completed but contains mismatches.`);
  5850. }
  5851. };
  5852. const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
  5853. const isFragmentStart = isComment(node) && node.data === "[";
  5854. const onMismatch = () => handleMismatch(
  5855. node,
  5856. vnode,
  5857. parentComponent,
  5858. parentSuspense,
  5859. slotScopeIds,
  5860. isFragmentStart
  5861. );
  5862. const { type, ref, shapeFlag, patchFlag } = vnode;
  5863. let domType = node.nodeType;
  5864. vnode.el = node;
  5865. if (patchFlag === -2) {
  5866. optimized = false;
  5867. vnode.dynamicChildren = null;
  5868. }
  5869. let nextNode = null;
  5870. switch (type) {
  5871. case Text:
  5872. if (domType !== 3 /* TEXT */) {
  5873. if (vnode.children === "") {
  5874. insert(vnode.el = createText(""), parentNode(node), node);
  5875. nextNode = node;
  5876. } else {
  5877. nextNode = onMismatch();
  5878. }
  5879. } else {
  5880. if (node.data !== vnode.children) {
  5881. hasMismatch = true;
  5882. warn(
  5883. `Hydration text mismatch:
  5884. - Client: ${JSON.stringify(node.data)}
  5885. - Server: ${JSON.stringify(vnode.children)}`
  5886. );
  5887. node.data = vnode.children;
  5888. }
  5889. nextNode = nextSibling(node);
  5890. }
  5891. break;
  5892. case Comment:
  5893. if (domType !== 8 /* COMMENT */ || isFragmentStart) {
  5894. nextNode = onMismatch();
  5895. } else {
  5896. nextNode = nextSibling(node);
  5897. }
  5898. break;
  5899. case Static:
  5900. if (isFragmentStart) {
  5901. node = nextSibling(node);
  5902. domType = node.nodeType;
  5903. }
  5904. if (domType === 1 /* ELEMENT */ || domType === 3 /* TEXT */) {
  5905. nextNode = node;
  5906. const needToAdoptContent = !vnode.children.length;
  5907. for (let i = 0; i < vnode.staticCount; i++) {
  5908. if (needToAdoptContent)
  5909. vnode.children += nextNode.nodeType === 1 /* ELEMENT */ ? nextNode.outerHTML : nextNode.data;
  5910. if (i === vnode.staticCount - 1) {
  5911. vnode.anchor = nextNode;
  5912. }
  5913. nextNode = nextSibling(nextNode);
  5914. }
  5915. return isFragmentStart ? nextSibling(nextNode) : nextNode;
  5916. } else {
  5917. onMismatch();
  5918. }
  5919. break;
  5920. case Fragment:
  5921. if (!isFragmentStart) {
  5922. nextNode = onMismatch();
  5923. } else {
  5924. nextNode = hydrateFragment(
  5925. node,
  5926. vnode,
  5927. parentComponent,
  5928. parentSuspense,
  5929. slotScopeIds,
  5930. optimized
  5931. );
  5932. }
  5933. break;
  5934. default:
  5935. if (shapeFlag & 1) {
  5936. if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
  5937. nextNode = onMismatch();
  5938. } else {
  5939. nextNode = hydrateElement(
  5940. node,
  5941. vnode,
  5942. parentComponent,
  5943. parentSuspense,
  5944. slotScopeIds,
  5945. optimized
  5946. );
  5947. }
  5948. } else if (shapeFlag & 6) {
  5949. vnode.slotScopeIds = slotScopeIds;
  5950. const container = parentNode(node);
  5951. mountComponent(
  5952. vnode,
  5953. container,
  5954. null,
  5955. parentComponent,
  5956. parentSuspense,
  5957. isSVGContainer(container),
  5958. optimized
  5959. );
  5960. nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
  5961. if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
  5962. nextNode = nextSibling(nextNode);
  5963. }
  5964. if (isAsyncWrapper(vnode)) {
  5965. let subTree;
  5966. if (isFragmentStart) {
  5967. subTree = createVNode(Fragment);
  5968. subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
  5969. } else {
  5970. subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
  5971. }
  5972. subTree.el = node;
  5973. vnode.component.subTree = subTree;
  5974. }
  5975. } else if (shapeFlag & 64) {
  5976. if (domType !== 8 /* COMMENT */) {
  5977. nextNode = onMismatch();
  5978. } else {
  5979. nextNode = vnode.type.hydrate(
  5980. node,
  5981. vnode,
  5982. parentComponent,
  5983. parentSuspense,
  5984. slotScopeIds,
  5985. optimized,
  5986. rendererInternals,
  5987. hydrateChildren
  5988. );
  5989. }
  5990. } else if (shapeFlag & 128) {
  5991. nextNode = vnode.type.hydrate(
  5992. node,
  5993. vnode,
  5994. parentComponent,
  5995. parentSuspense,
  5996. isSVGContainer(parentNode(node)),
  5997. slotScopeIds,
  5998. optimized,
  5999. rendererInternals,
  6000. hydrateNode
  6001. );
  6002. } else {
  6003. warn("Invalid HostVNode type:", type, `(${typeof type})`);
  6004. }
  6005. }
  6006. if (ref != null) {
  6007. setRef(ref, null, parentSuspense, vnode);
  6008. }
  6009. return nextNode;
  6010. };
  6011. const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6012. optimized = optimized || !!vnode.dynamicChildren;
  6013. const { type, props, patchFlag, shapeFlag, dirs } = vnode;
  6014. const forcePatchValue = type === "input" && dirs || type === "option";
  6015. {
  6016. if (dirs) {
  6017. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6018. }
  6019. if (props) {
  6020. if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
  6021. for (const key in props) {
  6022. if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
  6023. patchProp(
  6024. el,
  6025. key,
  6026. null,
  6027. props[key],
  6028. false,
  6029. void 0,
  6030. parentComponent
  6031. );
  6032. }
  6033. }
  6034. } else if (props.onClick) {
  6035. patchProp(
  6036. el,
  6037. "onClick",
  6038. null,
  6039. props.onClick,
  6040. false,
  6041. void 0,
  6042. parentComponent
  6043. );
  6044. }
  6045. }
  6046. let vnodeHooks;
  6047. if (vnodeHooks = props && props.onVnodeBeforeMount) {
  6048. invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6049. }
  6050. if (dirs) {
  6051. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6052. }
  6053. if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
  6054. queueEffectWithSuspense(() => {
  6055. vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
  6056. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6057. }, parentSuspense);
  6058. }
  6059. if (shapeFlag & 16 && // skip if element has innerHTML / textContent
  6060. !(props && (props.innerHTML || props.textContent))) {
  6061. let next = hydrateChildren(
  6062. el.firstChild,
  6063. vnode,
  6064. el,
  6065. parentComponent,
  6066. parentSuspense,
  6067. slotScopeIds,
  6068. optimized
  6069. );
  6070. let hasWarned = false;
  6071. while (next) {
  6072. hasMismatch = true;
  6073. if (!hasWarned) {
  6074. warn(
  6075. `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
  6076. );
  6077. hasWarned = true;
  6078. }
  6079. const cur = next;
  6080. next = next.nextSibling;
  6081. remove(cur);
  6082. }
  6083. } else if (shapeFlag & 8) {
  6084. if (el.textContent !== vnode.children) {
  6085. hasMismatch = true;
  6086. warn(
  6087. `Hydration text content mismatch in <${vnode.type}>:
  6088. - Client: ${el.textContent}
  6089. - Server: ${vnode.children}`
  6090. );
  6091. el.textContent = vnode.children;
  6092. }
  6093. }
  6094. }
  6095. return el.nextSibling;
  6096. };
  6097. const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6098. optimized = optimized || !!parentVNode.dynamicChildren;
  6099. const children = parentVNode.children;
  6100. const l = children.length;
  6101. let hasWarned = false;
  6102. for (let i = 0; i < l; i++) {
  6103. const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
  6104. if (node) {
  6105. node = hydrateNode(
  6106. node,
  6107. vnode,
  6108. parentComponent,
  6109. parentSuspense,
  6110. slotScopeIds,
  6111. optimized
  6112. );
  6113. } else if (vnode.type === Text && !vnode.children) {
  6114. continue;
  6115. } else {
  6116. hasMismatch = true;
  6117. if (!hasWarned) {
  6118. warn(
  6119. `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
  6120. );
  6121. hasWarned = true;
  6122. }
  6123. patch(
  6124. null,
  6125. vnode,
  6126. container,
  6127. null,
  6128. parentComponent,
  6129. parentSuspense,
  6130. isSVGContainer(container),
  6131. slotScopeIds
  6132. );
  6133. }
  6134. }
  6135. return node;
  6136. };
  6137. const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
  6138. const { slotScopeIds: fragmentSlotScopeIds } = vnode;
  6139. if (fragmentSlotScopeIds) {
  6140. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6141. }
  6142. const container = parentNode(node);
  6143. const next = hydrateChildren(
  6144. nextSibling(node),
  6145. vnode,
  6146. container,
  6147. parentComponent,
  6148. parentSuspense,
  6149. slotScopeIds,
  6150. optimized
  6151. );
  6152. if (next && isComment(next) && next.data === "]") {
  6153. return nextSibling(vnode.anchor = next);
  6154. } else {
  6155. hasMismatch = true;
  6156. insert(vnode.anchor = createComment(`]`), container, next);
  6157. return next;
  6158. }
  6159. };
  6160. const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
  6161. hasMismatch = true;
  6162. warn(
  6163. `Hydration node mismatch:
  6164. - Client vnode:`,
  6165. vnode.type,
  6166. `
  6167. - Server rendered DOM:`,
  6168. node,
  6169. node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
  6170. );
  6171. vnode.el = null;
  6172. if (isFragment) {
  6173. const end = locateClosingAsyncAnchor(node);
  6174. while (true) {
  6175. const next2 = nextSibling(node);
  6176. if (next2 && next2 !== end) {
  6177. remove(next2);
  6178. } else {
  6179. break;
  6180. }
  6181. }
  6182. }
  6183. const next = nextSibling(node);
  6184. const container = parentNode(node);
  6185. remove(node);
  6186. patch(
  6187. null,
  6188. vnode,
  6189. container,
  6190. next,
  6191. parentComponent,
  6192. parentSuspense,
  6193. isSVGContainer(container),
  6194. slotScopeIds
  6195. );
  6196. return next;
  6197. };
  6198. const locateClosingAsyncAnchor = (node) => {
  6199. let match = 0;
  6200. while (node) {
  6201. node = nextSibling(node);
  6202. if (node && isComment(node)) {
  6203. if (node.data === "[")
  6204. match++;
  6205. if (node.data === "]") {
  6206. if (match === 0) {
  6207. return nextSibling(node);
  6208. } else {
  6209. match--;
  6210. }
  6211. }
  6212. }
  6213. }
  6214. return node;
  6215. };
  6216. return [hydrate, hydrateNode];
  6217. }
  6218. let supported;
  6219. let perf;
  6220. function startMeasure(instance, type) {
  6221. if (instance.appContext.config.performance && isSupported()) {
  6222. perf.mark(`vue-${type}-${instance.uid}`);
  6223. }
  6224. {
  6225. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  6226. }
  6227. }
  6228. function endMeasure(instance, type) {
  6229. if (instance.appContext.config.performance && isSupported()) {
  6230. const startTag = `vue-${type}-${instance.uid}`;
  6231. const endTag = startTag + `:end`;
  6232. perf.mark(endTag);
  6233. perf.measure(
  6234. `<${formatComponentName(instance, instance.type)}> ${type}`,
  6235. startTag,
  6236. endTag
  6237. );
  6238. perf.clearMarks(startTag);
  6239. perf.clearMarks(endTag);
  6240. }
  6241. {
  6242. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  6243. }
  6244. }
  6245. function isSupported() {
  6246. if (supported !== void 0) {
  6247. return supported;
  6248. }
  6249. if (typeof window !== "undefined" && window.performance) {
  6250. supported = true;
  6251. perf = window.performance;
  6252. } else {
  6253. supported = false;
  6254. }
  6255. return supported;
  6256. }
  6257. const queuePostRenderEffect = queueEffectWithSuspense ;
  6258. function createRenderer(options) {
  6259. return baseCreateRenderer(options);
  6260. }
  6261. function createHydrationRenderer(options) {
  6262. return baseCreateRenderer(options, createHydrationFunctions);
  6263. }
  6264. function baseCreateRenderer(options, createHydrationFns) {
  6265. const target = getGlobalThis();
  6266. target.__VUE__ = true;
  6267. {
  6268. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  6269. }
  6270. const {
  6271. insert: hostInsert,
  6272. remove: hostRemove,
  6273. patchProp: hostPatchProp,
  6274. createElement: hostCreateElement,
  6275. createText: hostCreateText,
  6276. createComment: hostCreateComment,
  6277. setText: hostSetText,
  6278. setElementText: hostSetElementText,
  6279. parentNode: hostParentNode,
  6280. nextSibling: hostNextSibling,
  6281. setScopeId: hostSetScopeId = NOOP,
  6282. insertStaticContent: hostInsertStaticContent
  6283. } = options;
  6284. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
  6285. if (n1 === n2) {
  6286. return;
  6287. }
  6288. if (n1 && !isSameVNodeType(n1, n2)) {
  6289. anchor = getNextHostNode(n1);
  6290. unmount(n1, parentComponent, parentSuspense, true);
  6291. n1 = null;
  6292. }
  6293. if (n2.patchFlag === -2) {
  6294. optimized = false;
  6295. n2.dynamicChildren = null;
  6296. }
  6297. const { type, ref, shapeFlag } = n2;
  6298. switch (type) {
  6299. case Text:
  6300. processText(n1, n2, container, anchor);
  6301. break;
  6302. case Comment:
  6303. processCommentNode(n1, n2, container, anchor);
  6304. break;
  6305. case Static:
  6306. if (n1 == null) {
  6307. mountStaticNode(n2, container, anchor, isSVG);
  6308. } else {
  6309. patchStaticNode(n1, n2, container, isSVG);
  6310. }
  6311. break;
  6312. case Fragment:
  6313. processFragment(
  6314. n1,
  6315. n2,
  6316. container,
  6317. anchor,
  6318. parentComponent,
  6319. parentSuspense,
  6320. isSVG,
  6321. slotScopeIds,
  6322. optimized
  6323. );
  6324. break;
  6325. default:
  6326. if (shapeFlag & 1) {
  6327. processElement(
  6328. n1,
  6329. n2,
  6330. container,
  6331. anchor,
  6332. parentComponent,
  6333. parentSuspense,
  6334. isSVG,
  6335. slotScopeIds,
  6336. optimized
  6337. );
  6338. } else if (shapeFlag & 6) {
  6339. processComponent(
  6340. n1,
  6341. n2,
  6342. container,
  6343. anchor,
  6344. parentComponent,
  6345. parentSuspense,
  6346. isSVG,
  6347. slotScopeIds,
  6348. optimized
  6349. );
  6350. } else if (shapeFlag & 64) {
  6351. type.process(
  6352. n1,
  6353. n2,
  6354. container,
  6355. anchor,
  6356. parentComponent,
  6357. parentSuspense,
  6358. isSVG,
  6359. slotScopeIds,
  6360. optimized,
  6361. internals
  6362. );
  6363. } else if (shapeFlag & 128) {
  6364. type.process(
  6365. n1,
  6366. n2,
  6367. container,
  6368. anchor,
  6369. parentComponent,
  6370. parentSuspense,
  6371. isSVG,
  6372. slotScopeIds,
  6373. optimized,
  6374. internals
  6375. );
  6376. } else {
  6377. warn("Invalid VNode type:", type, `(${typeof type})`);
  6378. }
  6379. }
  6380. if (ref != null && parentComponent) {
  6381. setRef(ref, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  6382. }
  6383. };
  6384. const processText = (n1, n2, container, anchor) => {
  6385. if (n1 == null) {
  6386. hostInsert(
  6387. n2.el = hostCreateText(n2.children),
  6388. container,
  6389. anchor
  6390. );
  6391. } else {
  6392. const el = n2.el = n1.el;
  6393. if (n2.children !== n1.children) {
  6394. hostSetText(el, n2.children);
  6395. }
  6396. }
  6397. };
  6398. const processCommentNode = (n1, n2, container, anchor) => {
  6399. if (n1 == null) {
  6400. hostInsert(
  6401. n2.el = hostCreateComment(n2.children || ""),
  6402. container,
  6403. anchor
  6404. );
  6405. } else {
  6406. n2.el = n1.el;
  6407. }
  6408. };
  6409. const mountStaticNode = (n2, container, anchor, isSVG) => {
  6410. [n2.el, n2.anchor] = hostInsertStaticContent(
  6411. n2.children,
  6412. container,
  6413. anchor,
  6414. isSVG,
  6415. n2.el,
  6416. n2.anchor
  6417. );
  6418. };
  6419. const patchStaticNode = (n1, n2, container, isSVG) => {
  6420. if (n2.children !== n1.children) {
  6421. const anchor = hostNextSibling(n1.anchor);
  6422. removeStaticNode(n1);
  6423. [n2.el, n2.anchor] = hostInsertStaticContent(
  6424. n2.children,
  6425. container,
  6426. anchor,
  6427. isSVG
  6428. );
  6429. } else {
  6430. n2.el = n1.el;
  6431. n2.anchor = n1.anchor;
  6432. }
  6433. };
  6434. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  6435. let next;
  6436. while (el && el !== anchor) {
  6437. next = hostNextSibling(el);
  6438. hostInsert(el, container, nextSibling);
  6439. el = next;
  6440. }
  6441. hostInsert(anchor, container, nextSibling);
  6442. };
  6443. const removeStaticNode = ({ el, anchor }) => {
  6444. let next;
  6445. while (el && el !== anchor) {
  6446. next = hostNextSibling(el);
  6447. hostRemove(el);
  6448. el = next;
  6449. }
  6450. hostRemove(anchor);
  6451. };
  6452. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6453. isSVG = isSVG || n2.type === "svg";
  6454. if (n1 == null) {
  6455. mountElement(
  6456. n2,
  6457. container,
  6458. anchor,
  6459. parentComponent,
  6460. parentSuspense,
  6461. isSVG,
  6462. slotScopeIds,
  6463. optimized
  6464. );
  6465. } else {
  6466. patchElement(
  6467. n1,
  6468. n2,
  6469. parentComponent,
  6470. parentSuspense,
  6471. isSVG,
  6472. slotScopeIds,
  6473. optimized
  6474. );
  6475. }
  6476. };
  6477. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6478. let el;
  6479. let vnodeHook;
  6480. const { type, props, shapeFlag, transition, dirs } = vnode;
  6481. el = vnode.el = hostCreateElement(
  6482. vnode.type,
  6483. isSVG,
  6484. props && props.is,
  6485. props
  6486. );
  6487. if (shapeFlag & 8) {
  6488. hostSetElementText(el, vnode.children);
  6489. } else if (shapeFlag & 16) {
  6490. mountChildren(
  6491. vnode.children,
  6492. el,
  6493. null,
  6494. parentComponent,
  6495. parentSuspense,
  6496. isSVG && type !== "foreignObject",
  6497. slotScopeIds,
  6498. optimized
  6499. );
  6500. }
  6501. if (dirs) {
  6502. invokeDirectiveHook(vnode, null, parentComponent, "created");
  6503. }
  6504. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  6505. if (props) {
  6506. for (const key in props) {
  6507. if (key !== "value" && !isReservedProp(key)) {
  6508. hostPatchProp(
  6509. el,
  6510. key,
  6511. null,
  6512. props[key],
  6513. isSVG,
  6514. vnode.children,
  6515. parentComponent,
  6516. parentSuspense,
  6517. unmountChildren
  6518. );
  6519. }
  6520. }
  6521. if ("value" in props) {
  6522. hostPatchProp(el, "value", null, props.value);
  6523. }
  6524. if (vnodeHook = props.onVnodeBeforeMount) {
  6525. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6526. }
  6527. }
  6528. {
  6529. Object.defineProperty(el, "__vnode", {
  6530. value: vnode,
  6531. enumerable: false
  6532. });
  6533. Object.defineProperty(el, "__vueParentComponent", {
  6534. value: parentComponent,
  6535. enumerable: false
  6536. });
  6537. }
  6538. if (dirs) {
  6539. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  6540. }
  6541. const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  6542. if (needCallTransitionHooks) {
  6543. transition.beforeEnter(el);
  6544. }
  6545. hostInsert(el, container, anchor);
  6546. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  6547. queuePostRenderEffect(() => {
  6548. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  6549. needCallTransitionHooks && transition.enter(el);
  6550. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  6551. }, parentSuspense);
  6552. }
  6553. };
  6554. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  6555. if (scopeId) {
  6556. hostSetScopeId(el, scopeId);
  6557. }
  6558. if (slotScopeIds) {
  6559. for (let i = 0; i < slotScopeIds.length; i++) {
  6560. hostSetScopeId(el, slotScopeIds[i]);
  6561. }
  6562. }
  6563. if (parentComponent) {
  6564. let subTree = parentComponent.subTree;
  6565. if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
  6566. subTree = filterSingleRoot(subTree.children) || subTree;
  6567. }
  6568. if (vnode === subTree) {
  6569. const parentVNode = parentComponent.vnode;
  6570. setScopeId(
  6571. el,
  6572. parentVNode,
  6573. parentVNode.scopeId,
  6574. parentVNode.slotScopeIds,
  6575. parentComponent.parent
  6576. );
  6577. }
  6578. }
  6579. };
  6580. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  6581. for (let i = start; i < children.length; i++) {
  6582. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  6583. patch(
  6584. null,
  6585. child,
  6586. container,
  6587. anchor,
  6588. parentComponent,
  6589. parentSuspense,
  6590. isSVG,
  6591. slotScopeIds,
  6592. optimized
  6593. );
  6594. }
  6595. };
  6596. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6597. const el = n2.el = n1.el;
  6598. let { patchFlag, dynamicChildren, dirs } = n2;
  6599. patchFlag |= n1.patchFlag & 16;
  6600. const oldProps = n1.props || EMPTY_OBJ;
  6601. const newProps = n2.props || EMPTY_OBJ;
  6602. let vnodeHook;
  6603. parentComponent && toggleRecurse(parentComponent, false);
  6604. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  6605. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6606. }
  6607. if (dirs) {
  6608. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  6609. }
  6610. parentComponent && toggleRecurse(parentComponent, true);
  6611. if (isHmrUpdating) {
  6612. patchFlag = 0;
  6613. optimized = false;
  6614. dynamicChildren = null;
  6615. }
  6616. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  6617. if (dynamicChildren) {
  6618. patchBlockChildren(
  6619. n1.dynamicChildren,
  6620. dynamicChildren,
  6621. el,
  6622. parentComponent,
  6623. parentSuspense,
  6624. areChildrenSVG,
  6625. slotScopeIds
  6626. );
  6627. {
  6628. traverseStaticChildren(n1, n2);
  6629. }
  6630. } else if (!optimized) {
  6631. patchChildren(
  6632. n1,
  6633. n2,
  6634. el,
  6635. null,
  6636. parentComponent,
  6637. parentSuspense,
  6638. areChildrenSVG,
  6639. slotScopeIds,
  6640. false
  6641. );
  6642. }
  6643. if (patchFlag > 0) {
  6644. if (patchFlag & 16) {
  6645. patchProps(
  6646. el,
  6647. n2,
  6648. oldProps,
  6649. newProps,
  6650. parentComponent,
  6651. parentSuspense,
  6652. isSVG
  6653. );
  6654. } else {
  6655. if (patchFlag & 2) {
  6656. if (oldProps.class !== newProps.class) {
  6657. hostPatchProp(el, "class", null, newProps.class, isSVG);
  6658. }
  6659. }
  6660. if (patchFlag & 4) {
  6661. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  6662. }
  6663. if (patchFlag & 8) {
  6664. const propsToUpdate = n2.dynamicProps;
  6665. for (let i = 0; i < propsToUpdate.length; i++) {
  6666. const key = propsToUpdate[i];
  6667. const prev = oldProps[key];
  6668. const next = newProps[key];
  6669. if (next !== prev || key === "value") {
  6670. hostPatchProp(
  6671. el,
  6672. key,
  6673. prev,
  6674. next,
  6675. isSVG,
  6676. n1.children,
  6677. parentComponent,
  6678. parentSuspense,
  6679. unmountChildren
  6680. );
  6681. }
  6682. }
  6683. }
  6684. }
  6685. if (patchFlag & 1) {
  6686. if (n1.children !== n2.children) {
  6687. hostSetElementText(el, n2.children);
  6688. }
  6689. }
  6690. } else if (!optimized && dynamicChildren == null) {
  6691. patchProps(
  6692. el,
  6693. n2,
  6694. oldProps,
  6695. newProps,
  6696. parentComponent,
  6697. parentSuspense,
  6698. isSVG
  6699. );
  6700. }
  6701. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  6702. queuePostRenderEffect(() => {
  6703. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  6704. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  6705. }, parentSuspense);
  6706. }
  6707. };
  6708. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  6709. for (let i = 0; i < newChildren.length; i++) {
  6710. const oldVNode = oldChildren[i];
  6711. const newVNode = newChildren[i];
  6712. const container = (
  6713. // oldVNode may be an errored async setup() component inside Suspense
  6714. // which will not have a mounted element
  6715. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  6716. // of the Fragment itself so it can move its children.
  6717. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  6718. // which also requires the correct parent container
  6719. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  6720. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  6721. // In other cases, the parent container is not actually used so we
  6722. // just pass the block element here to avoid a DOM parentNode call.
  6723. fallbackContainer
  6724. )
  6725. );
  6726. patch(
  6727. oldVNode,
  6728. newVNode,
  6729. container,
  6730. null,
  6731. parentComponent,
  6732. parentSuspense,
  6733. isSVG,
  6734. slotScopeIds,
  6735. true
  6736. );
  6737. }
  6738. };
  6739. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  6740. if (oldProps !== newProps) {
  6741. if (oldProps !== EMPTY_OBJ) {
  6742. for (const key in oldProps) {
  6743. if (!isReservedProp(key) && !(key in newProps)) {
  6744. hostPatchProp(
  6745. el,
  6746. key,
  6747. oldProps[key],
  6748. null,
  6749. isSVG,
  6750. vnode.children,
  6751. parentComponent,
  6752. parentSuspense,
  6753. unmountChildren
  6754. );
  6755. }
  6756. }
  6757. }
  6758. for (const key in newProps) {
  6759. if (isReservedProp(key))
  6760. continue;
  6761. const next = newProps[key];
  6762. const prev = oldProps[key];
  6763. if (next !== prev && key !== "value") {
  6764. hostPatchProp(
  6765. el,
  6766. key,
  6767. prev,
  6768. next,
  6769. isSVG,
  6770. vnode.children,
  6771. parentComponent,
  6772. parentSuspense,
  6773. unmountChildren
  6774. );
  6775. }
  6776. }
  6777. if ("value" in newProps) {
  6778. hostPatchProp(el, "value", oldProps.value, newProps.value);
  6779. }
  6780. }
  6781. };
  6782. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6783. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  6784. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  6785. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  6786. if (
  6787. // #5523 dev root fragment may inherit directives
  6788. isHmrUpdating || patchFlag & 2048
  6789. ) {
  6790. patchFlag = 0;
  6791. optimized = false;
  6792. dynamicChildren = null;
  6793. }
  6794. if (fragmentSlotScopeIds) {
  6795. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  6796. }
  6797. if (n1 == null) {
  6798. hostInsert(fragmentStartAnchor, container, anchor);
  6799. hostInsert(fragmentEndAnchor, container, anchor);
  6800. mountChildren(
  6801. n2.children,
  6802. container,
  6803. fragmentEndAnchor,
  6804. parentComponent,
  6805. parentSuspense,
  6806. isSVG,
  6807. slotScopeIds,
  6808. optimized
  6809. );
  6810. } else {
  6811. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  6812. // of renderSlot() with no valid children
  6813. n1.dynamicChildren) {
  6814. patchBlockChildren(
  6815. n1.dynamicChildren,
  6816. dynamicChildren,
  6817. container,
  6818. parentComponent,
  6819. parentSuspense,
  6820. isSVG,
  6821. slotScopeIds
  6822. );
  6823. {
  6824. traverseStaticChildren(n1, n2);
  6825. }
  6826. } else {
  6827. patchChildren(
  6828. n1,
  6829. n2,
  6830. container,
  6831. fragmentEndAnchor,
  6832. parentComponent,
  6833. parentSuspense,
  6834. isSVG,
  6835. slotScopeIds,
  6836. optimized
  6837. );
  6838. }
  6839. }
  6840. };
  6841. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  6842. n2.slotScopeIds = slotScopeIds;
  6843. if (n1 == null) {
  6844. if (n2.shapeFlag & 512) {
  6845. parentComponent.ctx.activate(
  6846. n2,
  6847. container,
  6848. anchor,
  6849. isSVG,
  6850. optimized
  6851. );
  6852. } else {
  6853. mountComponent(
  6854. n2,
  6855. container,
  6856. anchor,
  6857. parentComponent,
  6858. parentSuspense,
  6859. isSVG,
  6860. optimized
  6861. );
  6862. }
  6863. } else {
  6864. updateComponent(n1, n2, optimized);
  6865. }
  6866. };
  6867. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  6868. const instance = (initialVNode.component = createComponentInstance(
  6869. initialVNode,
  6870. parentComponent,
  6871. parentSuspense
  6872. ));
  6873. if (instance.type.__hmrId) {
  6874. registerHMR(instance);
  6875. }
  6876. {
  6877. pushWarningContext(initialVNode);
  6878. startMeasure(instance, `mount`);
  6879. }
  6880. if (isKeepAlive(initialVNode)) {
  6881. instance.ctx.renderer = internals;
  6882. }
  6883. {
  6884. {
  6885. startMeasure(instance, `init`);
  6886. }
  6887. setupComponent(instance);
  6888. {
  6889. endMeasure(instance, `init`);
  6890. }
  6891. }
  6892. if (instance.asyncDep) {
  6893. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  6894. if (!initialVNode.el) {
  6895. const placeholder = instance.subTree = createVNode(Comment);
  6896. processCommentNode(null, placeholder, container, anchor);
  6897. }
  6898. return;
  6899. }
  6900. setupRenderEffect(
  6901. instance,
  6902. initialVNode,
  6903. container,
  6904. anchor,
  6905. parentSuspense,
  6906. isSVG,
  6907. optimized
  6908. );
  6909. {
  6910. popWarningContext();
  6911. endMeasure(instance, `mount`);
  6912. }
  6913. };
  6914. const updateComponent = (n1, n2, optimized) => {
  6915. const instance = n2.component = n1.component;
  6916. if (shouldUpdateComponent(n1, n2, optimized)) {
  6917. if (instance.asyncDep && !instance.asyncResolved) {
  6918. {
  6919. pushWarningContext(n2);
  6920. }
  6921. updateComponentPreRender(instance, n2, optimized);
  6922. {
  6923. popWarningContext();
  6924. }
  6925. return;
  6926. } else {
  6927. instance.next = n2;
  6928. invalidateJob(instance.update);
  6929. instance.update();
  6930. }
  6931. } else {
  6932. n2.el = n1.el;
  6933. instance.vnode = n2;
  6934. }
  6935. };
  6936. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  6937. const componentUpdateFn = () => {
  6938. if (!instance.isMounted) {
  6939. let vnodeHook;
  6940. const { el, props } = initialVNode;
  6941. const { bm, m, parent } = instance;
  6942. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  6943. toggleRecurse(instance, false);
  6944. if (bm) {
  6945. invokeArrayFns(bm);
  6946. }
  6947. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  6948. invokeVNodeHook(vnodeHook, parent, initialVNode);
  6949. }
  6950. toggleRecurse(instance, true);
  6951. if (el && hydrateNode) {
  6952. const hydrateSubTree = () => {
  6953. {
  6954. startMeasure(instance, `render`);
  6955. }
  6956. instance.subTree = renderComponentRoot(instance);
  6957. {
  6958. endMeasure(instance, `render`);
  6959. }
  6960. {
  6961. startMeasure(instance, `hydrate`);
  6962. }
  6963. hydrateNode(
  6964. el,
  6965. instance.subTree,
  6966. instance,
  6967. parentSuspense,
  6968. null
  6969. );
  6970. {
  6971. endMeasure(instance, `hydrate`);
  6972. }
  6973. };
  6974. if (isAsyncWrapperVNode) {
  6975. initialVNode.type.__asyncLoader().then(
  6976. // note: we are moving the render call into an async callback,
  6977. // which means it won't track dependencies - but it's ok because
  6978. // a server-rendered async wrapper is already in resolved state
  6979. // and it will never need to change.
  6980. () => !instance.isUnmounted && hydrateSubTree()
  6981. );
  6982. } else {
  6983. hydrateSubTree();
  6984. }
  6985. } else {
  6986. {
  6987. startMeasure(instance, `render`);
  6988. }
  6989. const subTree = instance.subTree = renderComponentRoot(instance);
  6990. {
  6991. endMeasure(instance, `render`);
  6992. }
  6993. {
  6994. startMeasure(instance, `patch`);
  6995. }
  6996. patch(
  6997. null,
  6998. subTree,
  6999. container,
  7000. anchor,
  7001. instance,
  7002. parentSuspense,
  7003. isSVG
  7004. );
  7005. {
  7006. endMeasure(instance, `patch`);
  7007. }
  7008. initialVNode.el = subTree.el;
  7009. }
  7010. if (m) {
  7011. queuePostRenderEffect(m, parentSuspense);
  7012. }
  7013. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  7014. const scopedInitialVNode = initialVNode;
  7015. queuePostRenderEffect(
  7016. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  7017. parentSuspense
  7018. );
  7019. }
  7020. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  7021. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  7022. }
  7023. instance.isMounted = true;
  7024. {
  7025. devtoolsComponentAdded(instance);
  7026. }
  7027. initialVNode = container = anchor = null;
  7028. } else {
  7029. let { next, bu, u, parent, vnode } = instance;
  7030. let originNext = next;
  7031. let vnodeHook;
  7032. {
  7033. pushWarningContext(next || instance.vnode);
  7034. }
  7035. toggleRecurse(instance, false);
  7036. if (next) {
  7037. next.el = vnode.el;
  7038. updateComponentPreRender(instance, next, optimized);
  7039. } else {
  7040. next = vnode;
  7041. }
  7042. if (bu) {
  7043. invokeArrayFns(bu);
  7044. }
  7045. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  7046. invokeVNodeHook(vnodeHook, parent, next, vnode);
  7047. }
  7048. toggleRecurse(instance, true);
  7049. {
  7050. startMeasure(instance, `render`);
  7051. }
  7052. const nextTree = renderComponentRoot(instance);
  7053. {
  7054. endMeasure(instance, `render`);
  7055. }
  7056. const prevTree = instance.subTree;
  7057. instance.subTree = nextTree;
  7058. {
  7059. startMeasure(instance, `patch`);
  7060. }
  7061. patch(
  7062. prevTree,
  7063. nextTree,
  7064. // parent may have changed if it's in a teleport
  7065. hostParentNode(prevTree.el),
  7066. // anchor may have changed if it's in a fragment
  7067. getNextHostNode(prevTree),
  7068. instance,
  7069. parentSuspense,
  7070. isSVG
  7071. );
  7072. {
  7073. endMeasure(instance, `patch`);
  7074. }
  7075. next.el = nextTree.el;
  7076. if (originNext === null) {
  7077. updateHOCHostEl(instance, nextTree.el);
  7078. }
  7079. if (u) {
  7080. queuePostRenderEffect(u, parentSuspense);
  7081. }
  7082. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  7083. queuePostRenderEffect(
  7084. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  7085. parentSuspense
  7086. );
  7087. }
  7088. {
  7089. devtoolsComponentUpdated(instance);
  7090. }
  7091. {
  7092. popWarningContext();
  7093. }
  7094. }
  7095. };
  7096. const effect = instance.effect = new ReactiveEffect(
  7097. componentUpdateFn,
  7098. () => queueJob(update),
  7099. instance.scope
  7100. // track it in component's effect scope
  7101. );
  7102. const update = instance.update = () => effect.run();
  7103. update.id = instance.uid;
  7104. toggleRecurse(instance, true);
  7105. {
  7106. effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
  7107. effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
  7108. update.ownerInstance = instance;
  7109. }
  7110. update();
  7111. };
  7112. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  7113. nextVNode.component = instance;
  7114. const prevProps = instance.vnode.props;
  7115. instance.vnode = nextVNode;
  7116. instance.next = null;
  7117. updateProps(instance, nextVNode.props, prevProps, optimized);
  7118. updateSlots(instance, nextVNode.children, optimized);
  7119. pauseTracking();
  7120. flushPreFlushCbs();
  7121. resetTracking();
  7122. };
  7123. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  7124. const c1 = n1 && n1.children;
  7125. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  7126. const c2 = n2.children;
  7127. const { patchFlag, shapeFlag } = n2;
  7128. if (patchFlag > 0) {
  7129. if (patchFlag & 128) {
  7130. patchKeyedChildren(
  7131. c1,
  7132. c2,
  7133. container,
  7134. anchor,
  7135. parentComponent,
  7136. parentSuspense,
  7137. isSVG,
  7138. slotScopeIds,
  7139. optimized
  7140. );
  7141. return;
  7142. } else if (patchFlag & 256) {
  7143. patchUnkeyedChildren(
  7144. c1,
  7145. c2,
  7146. container,
  7147. anchor,
  7148. parentComponent,
  7149. parentSuspense,
  7150. isSVG,
  7151. slotScopeIds,
  7152. optimized
  7153. );
  7154. return;
  7155. }
  7156. }
  7157. if (shapeFlag & 8) {
  7158. if (prevShapeFlag & 16) {
  7159. unmountChildren(c1, parentComponent, parentSuspense);
  7160. }
  7161. if (c2 !== c1) {
  7162. hostSetElementText(container, c2);
  7163. }
  7164. } else {
  7165. if (prevShapeFlag & 16) {
  7166. if (shapeFlag & 16) {
  7167. patchKeyedChildren(
  7168. c1,
  7169. c2,
  7170. container,
  7171. anchor,
  7172. parentComponent,
  7173. parentSuspense,
  7174. isSVG,
  7175. slotScopeIds,
  7176. optimized
  7177. );
  7178. } else {
  7179. unmountChildren(c1, parentComponent, parentSuspense, true);
  7180. }
  7181. } else {
  7182. if (prevShapeFlag & 8) {
  7183. hostSetElementText(container, "");
  7184. }
  7185. if (shapeFlag & 16) {
  7186. mountChildren(
  7187. c2,
  7188. container,
  7189. anchor,
  7190. parentComponent,
  7191. parentSuspense,
  7192. isSVG,
  7193. slotScopeIds,
  7194. optimized
  7195. );
  7196. }
  7197. }
  7198. }
  7199. };
  7200. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7201. c1 = c1 || EMPTY_ARR;
  7202. c2 = c2 || EMPTY_ARR;
  7203. const oldLength = c1.length;
  7204. const newLength = c2.length;
  7205. const commonLength = Math.min(oldLength, newLength);
  7206. let i;
  7207. for (i = 0; i < commonLength; i++) {
  7208. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7209. patch(
  7210. c1[i],
  7211. nextChild,
  7212. container,
  7213. null,
  7214. parentComponent,
  7215. parentSuspense,
  7216. isSVG,
  7217. slotScopeIds,
  7218. optimized
  7219. );
  7220. }
  7221. if (oldLength > newLength) {
  7222. unmountChildren(
  7223. c1,
  7224. parentComponent,
  7225. parentSuspense,
  7226. true,
  7227. false,
  7228. commonLength
  7229. );
  7230. } else {
  7231. mountChildren(
  7232. c2,
  7233. container,
  7234. anchor,
  7235. parentComponent,
  7236. parentSuspense,
  7237. isSVG,
  7238. slotScopeIds,
  7239. optimized,
  7240. commonLength
  7241. );
  7242. }
  7243. };
  7244. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  7245. let i = 0;
  7246. const l2 = c2.length;
  7247. let e1 = c1.length - 1;
  7248. let e2 = l2 - 1;
  7249. while (i <= e1 && i <= e2) {
  7250. const n1 = c1[i];
  7251. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7252. if (isSameVNodeType(n1, n2)) {
  7253. patch(
  7254. n1,
  7255. n2,
  7256. container,
  7257. null,
  7258. parentComponent,
  7259. parentSuspense,
  7260. isSVG,
  7261. slotScopeIds,
  7262. optimized
  7263. );
  7264. } else {
  7265. break;
  7266. }
  7267. i++;
  7268. }
  7269. while (i <= e1 && i <= e2) {
  7270. const n1 = c1[e1];
  7271. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  7272. if (isSameVNodeType(n1, n2)) {
  7273. patch(
  7274. n1,
  7275. n2,
  7276. container,
  7277. null,
  7278. parentComponent,
  7279. parentSuspense,
  7280. isSVG,
  7281. slotScopeIds,
  7282. optimized
  7283. );
  7284. } else {
  7285. break;
  7286. }
  7287. e1--;
  7288. e2--;
  7289. }
  7290. if (i > e1) {
  7291. if (i <= e2) {
  7292. const nextPos = e2 + 1;
  7293. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  7294. while (i <= e2) {
  7295. patch(
  7296. null,
  7297. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  7298. container,
  7299. anchor,
  7300. parentComponent,
  7301. parentSuspense,
  7302. isSVG,
  7303. slotScopeIds,
  7304. optimized
  7305. );
  7306. i++;
  7307. }
  7308. }
  7309. } else if (i > e2) {
  7310. while (i <= e1) {
  7311. unmount(c1[i], parentComponent, parentSuspense, true);
  7312. i++;
  7313. }
  7314. } else {
  7315. const s1 = i;
  7316. const s2 = i;
  7317. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  7318. for (i = s2; i <= e2; i++) {
  7319. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  7320. if (nextChild.key != null) {
  7321. if (keyToNewIndexMap.has(nextChild.key)) {
  7322. warn(
  7323. `Duplicate keys found during update:`,
  7324. JSON.stringify(nextChild.key),
  7325. `Make sure keys are unique.`
  7326. );
  7327. }
  7328. keyToNewIndexMap.set(nextChild.key, i);
  7329. }
  7330. }
  7331. let j;
  7332. let patched = 0;
  7333. const toBePatched = e2 - s2 + 1;
  7334. let moved = false;
  7335. let maxNewIndexSoFar = 0;
  7336. const newIndexToOldIndexMap = new Array(toBePatched);
  7337. for (i = 0; i < toBePatched; i++)
  7338. newIndexToOldIndexMap[i] = 0;
  7339. for (i = s1; i <= e1; i++) {
  7340. const prevChild = c1[i];
  7341. if (patched >= toBePatched) {
  7342. unmount(prevChild, parentComponent, parentSuspense, true);
  7343. continue;
  7344. }
  7345. let newIndex;
  7346. if (prevChild.key != null) {
  7347. newIndex = keyToNewIndexMap.get(prevChild.key);
  7348. } else {
  7349. for (j = s2; j <= e2; j++) {
  7350. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  7351. newIndex = j;
  7352. break;
  7353. }
  7354. }
  7355. }
  7356. if (newIndex === void 0) {
  7357. unmount(prevChild, parentComponent, parentSuspense, true);
  7358. } else {
  7359. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  7360. if (newIndex >= maxNewIndexSoFar) {
  7361. maxNewIndexSoFar = newIndex;
  7362. } else {
  7363. moved = true;
  7364. }
  7365. patch(
  7366. prevChild,
  7367. c2[newIndex],
  7368. container,
  7369. null,
  7370. parentComponent,
  7371. parentSuspense,
  7372. isSVG,
  7373. slotScopeIds,
  7374. optimized
  7375. );
  7376. patched++;
  7377. }
  7378. }
  7379. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  7380. j = increasingNewIndexSequence.length - 1;
  7381. for (i = toBePatched - 1; i >= 0; i--) {
  7382. const nextIndex = s2 + i;
  7383. const nextChild = c2[nextIndex];
  7384. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  7385. if (newIndexToOldIndexMap[i] === 0) {
  7386. patch(
  7387. null,
  7388. nextChild,
  7389. container,
  7390. anchor,
  7391. parentComponent,
  7392. parentSuspense,
  7393. isSVG,
  7394. slotScopeIds,
  7395. optimized
  7396. );
  7397. } else if (moved) {
  7398. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  7399. move(nextChild, container, anchor, 2);
  7400. } else {
  7401. j--;
  7402. }
  7403. }
  7404. }
  7405. }
  7406. };
  7407. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  7408. const { el, type, transition, children, shapeFlag } = vnode;
  7409. if (shapeFlag & 6) {
  7410. move(vnode.component.subTree, container, anchor, moveType);
  7411. return;
  7412. }
  7413. if (shapeFlag & 128) {
  7414. vnode.suspense.move(container, anchor, moveType);
  7415. return;
  7416. }
  7417. if (shapeFlag & 64) {
  7418. type.move(vnode, container, anchor, internals);
  7419. return;
  7420. }
  7421. if (type === Fragment) {
  7422. hostInsert(el, container, anchor);
  7423. for (let i = 0; i < children.length; i++) {
  7424. move(children[i], container, anchor, moveType);
  7425. }
  7426. hostInsert(vnode.anchor, container, anchor);
  7427. return;
  7428. }
  7429. if (type === Static) {
  7430. moveStaticNode(vnode, container, anchor);
  7431. return;
  7432. }
  7433. const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
  7434. if (needTransition) {
  7435. if (moveType === 0) {
  7436. transition.beforeEnter(el);
  7437. hostInsert(el, container, anchor);
  7438. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  7439. } else {
  7440. const { leave, delayLeave, afterLeave } = transition;
  7441. const remove2 = () => hostInsert(el, container, anchor);
  7442. const performLeave = () => {
  7443. leave(el, () => {
  7444. remove2();
  7445. afterLeave && afterLeave();
  7446. });
  7447. };
  7448. if (delayLeave) {
  7449. delayLeave(el, remove2, performLeave);
  7450. } else {
  7451. performLeave();
  7452. }
  7453. }
  7454. } else {
  7455. hostInsert(el, container, anchor);
  7456. }
  7457. };
  7458. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  7459. const {
  7460. type,
  7461. props,
  7462. ref,
  7463. children,
  7464. dynamicChildren,
  7465. shapeFlag,
  7466. patchFlag,
  7467. dirs
  7468. } = vnode;
  7469. if (ref != null) {
  7470. setRef(ref, null, parentSuspense, vnode, true);
  7471. }
  7472. if (shapeFlag & 256) {
  7473. parentComponent.ctx.deactivate(vnode);
  7474. return;
  7475. }
  7476. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  7477. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  7478. let vnodeHook;
  7479. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  7480. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7481. }
  7482. if (shapeFlag & 6) {
  7483. unmountComponent(vnode.component, parentSuspense, doRemove);
  7484. } else {
  7485. if (shapeFlag & 128) {
  7486. vnode.suspense.unmount(parentSuspense, doRemove);
  7487. return;
  7488. }
  7489. if (shouldInvokeDirs) {
  7490. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  7491. }
  7492. if (shapeFlag & 64) {
  7493. vnode.type.remove(
  7494. vnode,
  7495. parentComponent,
  7496. parentSuspense,
  7497. optimized,
  7498. internals,
  7499. doRemove
  7500. );
  7501. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  7502. (type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  7503. unmountChildren(
  7504. dynamicChildren,
  7505. parentComponent,
  7506. parentSuspense,
  7507. false,
  7508. true
  7509. );
  7510. } else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  7511. unmountChildren(children, parentComponent, parentSuspense);
  7512. }
  7513. if (doRemove) {
  7514. remove(vnode);
  7515. }
  7516. }
  7517. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  7518. queuePostRenderEffect(() => {
  7519. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  7520. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  7521. }, parentSuspense);
  7522. }
  7523. };
  7524. const remove = (vnode) => {
  7525. const { type, el, anchor, transition } = vnode;
  7526. if (type === Fragment) {
  7527. if (vnode.patchFlag > 0 && vnode.patchFlag & 2048 && transition && !transition.persisted) {
  7528. vnode.children.forEach((child) => {
  7529. if (child.type === Comment) {
  7530. hostRemove(child.el);
  7531. } else {
  7532. remove(child);
  7533. }
  7534. });
  7535. } else {
  7536. removeFragment(el, anchor);
  7537. }
  7538. return;
  7539. }
  7540. if (type === Static) {
  7541. removeStaticNode(vnode);
  7542. return;
  7543. }
  7544. const performRemove = () => {
  7545. hostRemove(el);
  7546. if (transition && !transition.persisted && transition.afterLeave) {
  7547. transition.afterLeave();
  7548. }
  7549. };
  7550. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  7551. const { leave, delayLeave } = transition;
  7552. const performLeave = () => leave(el, performRemove);
  7553. if (delayLeave) {
  7554. delayLeave(vnode.el, performRemove, performLeave);
  7555. } else {
  7556. performLeave();
  7557. }
  7558. } else {
  7559. performRemove();
  7560. }
  7561. };
  7562. const removeFragment = (cur, end) => {
  7563. let next;
  7564. while (cur !== end) {
  7565. next = hostNextSibling(cur);
  7566. hostRemove(cur);
  7567. cur = next;
  7568. }
  7569. hostRemove(end);
  7570. };
  7571. const unmountComponent = (instance, parentSuspense, doRemove) => {
  7572. if (instance.type.__hmrId) {
  7573. unregisterHMR(instance);
  7574. }
  7575. const { bum, scope, update, subTree, um } = instance;
  7576. if (bum) {
  7577. invokeArrayFns(bum);
  7578. }
  7579. scope.stop();
  7580. if (update) {
  7581. update.active = false;
  7582. unmount(subTree, instance, parentSuspense, doRemove);
  7583. }
  7584. if (um) {
  7585. queuePostRenderEffect(um, parentSuspense);
  7586. }
  7587. queuePostRenderEffect(() => {
  7588. instance.isUnmounted = true;
  7589. }, parentSuspense);
  7590. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  7591. parentSuspense.deps--;
  7592. if (parentSuspense.deps === 0) {
  7593. parentSuspense.resolve();
  7594. }
  7595. }
  7596. {
  7597. devtoolsComponentRemoved(instance);
  7598. }
  7599. };
  7600. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  7601. for (let i = start; i < children.length; i++) {
  7602. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  7603. }
  7604. };
  7605. const getNextHostNode = (vnode) => {
  7606. if (vnode.shapeFlag & 6) {
  7607. return getNextHostNode(vnode.component.subTree);
  7608. }
  7609. if (vnode.shapeFlag & 128) {
  7610. return vnode.suspense.next();
  7611. }
  7612. return hostNextSibling(vnode.anchor || vnode.el);
  7613. };
  7614. const render = (vnode, container, isSVG) => {
  7615. if (vnode == null) {
  7616. if (container._vnode) {
  7617. unmount(container._vnode, null, null, true);
  7618. }
  7619. } else {
  7620. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  7621. }
  7622. flushPreFlushCbs();
  7623. flushPostFlushCbs();
  7624. container._vnode = vnode;
  7625. };
  7626. const internals = {
  7627. p: patch,
  7628. um: unmount,
  7629. m: move,
  7630. r: remove,
  7631. mt: mountComponent,
  7632. mc: mountChildren,
  7633. pc: patchChildren,
  7634. pbc: patchBlockChildren,
  7635. n: getNextHostNode,
  7636. o: options
  7637. };
  7638. let hydrate;
  7639. let hydrateNode;
  7640. if (createHydrationFns) {
  7641. [hydrate, hydrateNode] = createHydrationFns(
  7642. internals
  7643. );
  7644. }
  7645. return {
  7646. render,
  7647. hydrate,
  7648. createApp: createAppAPI(render, hydrate)
  7649. };
  7650. }
  7651. function toggleRecurse({ effect, update }, allowed) {
  7652. effect.allowRecurse = update.allowRecurse = allowed;
  7653. }
  7654. function traverseStaticChildren(n1, n2, shallow = false) {
  7655. const ch1 = n1.children;
  7656. const ch2 = n2.children;
  7657. if (isArray(ch1) && isArray(ch2)) {
  7658. for (let i = 0; i < ch1.length; i++) {
  7659. const c1 = ch1[i];
  7660. let c2 = ch2[i];
  7661. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  7662. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  7663. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  7664. c2.el = c1.el;
  7665. }
  7666. if (!shallow)
  7667. traverseStaticChildren(c1, c2);
  7668. }
  7669. if (c2.type === Text) {
  7670. c2.el = c1.el;
  7671. }
  7672. if (c2.type === Comment && !c2.el) {
  7673. c2.el = c1.el;
  7674. }
  7675. }
  7676. }
  7677. }
  7678. function getSequence(arr) {
  7679. const p = arr.slice();
  7680. const result = [0];
  7681. let i, j, u, v, c;
  7682. const len = arr.length;
  7683. for (i = 0; i < len; i++) {
  7684. const arrI = arr[i];
  7685. if (arrI !== 0) {
  7686. j = result[result.length - 1];
  7687. if (arr[j] < arrI) {
  7688. p[i] = j;
  7689. result.push(i);
  7690. continue;
  7691. }
  7692. u = 0;
  7693. v = result.length - 1;
  7694. while (u < v) {
  7695. c = u + v >> 1;
  7696. if (arr[result[c]] < arrI) {
  7697. u = c + 1;
  7698. } else {
  7699. v = c;
  7700. }
  7701. }
  7702. if (arrI < arr[result[u]]) {
  7703. if (u > 0) {
  7704. p[i] = result[u - 1];
  7705. }
  7706. result[u] = i;
  7707. }
  7708. }
  7709. }
  7710. u = result.length;
  7711. v = result[u - 1];
  7712. while (u-- > 0) {
  7713. result[u] = v;
  7714. v = p[v];
  7715. }
  7716. return result;
  7717. }
  7718. const isTeleport = (type) => type.__isTeleport;
  7719. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  7720. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  7721. const resolveTarget = (props, select) => {
  7722. const targetSelector = props && props.to;
  7723. if (isString(targetSelector)) {
  7724. if (!select) {
  7725. warn(
  7726. `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`
  7727. );
  7728. return null;
  7729. } else {
  7730. const target = select(targetSelector);
  7731. if (!target) {
  7732. warn(
  7733. `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`
  7734. );
  7735. }
  7736. return target;
  7737. }
  7738. } else {
  7739. if (!targetSelector && !isTeleportDisabled(props)) {
  7740. warn(`Invalid Teleport target: ${targetSelector}`);
  7741. }
  7742. return targetSelector;
  7743. }
  7744. };
  7745. const TeleportImpl = {
  7746. __isTeleport: true,
  7747. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  7748. const {
  7749. mc: mountChildren,
  7750. pc: patchChildren,
  7751. pbc: patchBlockChildren,
  7752. o: { insert, querySelector, createText, createComment }
  7753. } = internals;
  7754. const disabled = isTeleportDisabled(n2.props);
  7755. let { shapeFlag, children, dynamicChildren } = n2;
  7756. if (isHmrUpdating) {
  7757. optimized = false;
  7758. dynamicChildren = null;
  7759. }
  7760. if (n1 == null) {
  7761. const placeholder = n2.el = createComment("teleport start") ;
  7762. const mainAnchor = n2.anchor = createComment("teleport end") ;
  7763. insert(placeholder, container, anchor);
  7764. insert(mainAnchor, container, anchor);
  7765. const target = n2.target = resolveTarget(n2.props, querySelector);
  7766. const targetAnchor = n2.targetAnchor = createText("");
  7767. if (target) {
  7768. insert(targetAnchor, target);
  7769. isSVG = isSVG || isTargetSVG(target);
  7770. } else if (!disabled) {
  7771. warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
  7772. }
  7773. const mount = (container2, anchor2) => {
  7774. if (shapeFlag & 16) {
  7775. mountChildren(
  7776. children,
  7777. container2,
  7778. anchor2,
  7779. parentComponent,
  7780. parentSuspense,
  7781. isSVG,
  7782. slotScopeIds,
  7783. optimized
  7784. );
  7785. }
  7786. };
  7787. if (disabled) {
  7788. mount(container, mainAnchor);
  7789. } else if (target) {
  7790. mount(target, targetAnchor);
  7791. }
  7792. } else {
  7793. n2.el = n1.el;
  7794. const mainAnchor = n2.anchor = n1.anchor;
  7795. const target = n2.target = n1.target;
  7796. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  7797. const wasDisabled = isTeleportDisabled(n1.props);
  7798. const currentContainer = wasDisabled ? container : target;
  7799. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  7800. isSVG = isSVG || isTargetSVG(target);
  7801. if (dynamicChildren) {
  7802. patchBlockChildren(
  7803. n1.dynamicChildren,
  7804. dynamicChildren,
  7805. currentContainer,
  7806. parentComponent,
  7807. parentSuspense,
  7808. isSVG,
  7809. slotScopeIds
  7810. );
  7811. traverseStaticChildren(n1, n2, true);
  7812. } else if (!optimized) {
  7813. patchChildren(
  7814. n1,
  7815. n2,
  7816. currentContainer,
  7817. currentAnchor,
  7818. parentComponent,
  7819. parentSuspense,
  7820. isSVG,
  7821. slotScopeIds,
  7822. false
  7823. );
  7824. }
  7825. if (disabled) {
  7826. if (!wasDisabled) {
  7827. moveTeleport(
  7828. n2,
  7829. container,
  7830. mainAnchor,
  7831. internals,
  7832. 1
  7833. );
  7834. }
  7835. } else {
  7836. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  7837. const nextTarget = n2.target = resolveTarget(
  7838. n2.props,
  7839. querySelector
  7840. );
  7841. if (nextTarget) {
  7842. moveTeleport(
  7843. n2,
  7844. nextTarget,
  7845. null,
  7846. internals,
  7847. 0
  7848. );
  7849. } else {
  7850. warn(
  7851. "Invalid Teleport target on update:",
  7852. target,
  7853. `(${typeof target})`
  7854. );
  7855. }
  7856. } else if (wasDisabled) {
  7857. moveTeleport(
  7858. n2,
  7859. target,
  7860. targetAnchor,
  7861. internals,
  7862. 1
  7863. );
  7864. }
  7865. }
  7866. }
  7867. updateCssVars(n2);
  7868. },
  7869. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  7870. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  7871. if (target) {
  7872. hostRemove(targetAnchor);
  7873. }
  7874. if (doRemove || !isTeleportDisabled(props)) {
  7875. hostRemove(anchor);
  7876. if (shapeFlag & 16) {
  7877. for (let i = 0; i < children.length; i++) {
  7878. const child = children[i];
  7879. unmount(
  7880. child,
  7881. parentComponent,
  7882. parentSuspense,
  7883. true,
  7884. !!child.dynamicChildren
  7885. );
  7886. }
  7887. }
  7888. }
  7889. },
  7890. move: moveTeleport,
  7891. hydrate: hydrateTeleport
  7892. };
  7893. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  7894. if (moveType === 0) {
  7895. insert(vnode.targetAnchor, container, parentAnchor);
  7896. }
  7897. const { el, anchor, shapeFlag, children, props } = vnode;
  7898. const isReorder = moveType === 2;
  7899. if (isReorder) {
  7900. insert(el, container, parentAnchor);
  7901. }
  7902. if (!isReorder || isTeleportDisabled(props)) {
  7903. if (shapeFlag & 16) {
  7904. for (let i = 0; i < children.length; i++) {
  7905. move(
  7906. children[i],
  7907. container,
  7908. parentAnchor,
  7909. 2
  7910. );
  7911. }
  7912. }
  7913. }
  7914. if (isReorder) {
  7915. insert(anchor, container, parentAnchor);
  7916. }
  7917. }
  7918. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  7919. o: { nextSibling, parentNode, querySelector }
  7920. }, hydrateChildren) {
  7921. const target = vnode.target = resolveTarget(
  7922. vnode.props,
  7923. querySelector
  7924. );
  7925. if (target) {
  7926. const targetNode = target._lpa || target.firstChild;
  7927. if (vnode.shapeFlag & 16) {
  7928. if (isTeleportDisabled(vnode.props)) {
  7929. vnode.anchor = hydrateChildren(
  7930. nextSibling(node),
  7931. vnode,
  7932. parentNode(node),
  7933. parentComponent,
  7934. parentSuspense,
  7935. slotScopeIds,
  7936. optimized
  7937. );
  7938. vnode.targetAnchor = targetNode;
  7939. } else {
  7940. vnode.anchor = nextSibling(node);
  7941. let targetAnchor = targetNode;
  7942. while (targetAnchor) {
  7943. targetAnchor = nextSibling(targetAnchor);
  7944. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  7945. vnode.targetAnchor = targetAnchor;
  7946. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  7947. break;
  7948. }
  7949. }
  7950. hydrateChildren(
  7951. targetNode,
  7952. vnode,
  7953. target,
  7954. parentComponent,
  7955. parentSuspense,
  7956. slotScopeIds,
  7957. optimized
  7958. );
  7959. }
  7960. }
  7961. updateCssVars(vnode);
  7962. }
  7963. return vnode.anchor && nextSibling(vnode.anchor);
  7964. }
  7965. const Teleport = TeleportImpl;
  7966. function updateCssVars(vnode) {
  7967. const ctx = vnode.ctx;
  7968. if (ctx && ctx.ut) {
  7969. let node = vnode.children[0].el;
  7970. while (node !== vnode.targetAnchor) {
  7971. if (node.nodeType === 1)
  7972. node.setAttribute("data-v-owner", ctx.uid);
  7973. node = node.nextSibling;
  7974. }
  7975. ctx.ut();
  7976. }
  7977. }
  7978. const Fragment = Symbol.for("v-fgt");
  7979. const Text = Symbol.for("v-txt");
  7980. const Comment = Symbol.for("v-cmt");
  7981. const Static = Symbol.for("v-stc");
  7982. const blockStack = [];
  7983. let currentBlock = null;
  7984. function openBlock(disableTracking = false) {
  7985. blockStack.push(currentBlock = disableTracking ? null : []);
  7986. }
  7987. function closeBlock() {
  7988. blockStack.pop();
  7989. currentBlock = blockStack[blockStack.length - 1] || null;
  7990. }
  7991. let isBlockTreeEnabled = 1;
  7992. function setBlockTracking(value) {
  7993. isBlockTreeEnabled += value;
  7994. }
  7995. function setupBlock(vnode) {
  7996. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  7997. closeBlock();
  7998. if (isBlockTreeEnabled > 0 && currentBlock) {
  7999. currentBlock.push(vnode);
  8000. }
  8001. return vnode;
  8002. }
  8003. function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) {
  8004. return setupBlock(
  8005. createBaseVNode(
  8006. type,
  8007. props,
  8008. children,
  8009. patchFlag,
  8010. dynamicProps,
  8011. shapeFlag,
  8012. true
  8013. /* isBlock */
  8014. )
  8015. );
  8016. }
  8017. function createBlock(type, props, children, patchFlag, dynamicProps) {
  8018. return setupBlock(
  8019. createVNode(
  8020. type,
  8021. props,
  8022. children,
  8023. patchFlag,
  8024. dynamicProps,
  8025. true
  8026. /* isBlock: prevent a block from tracking itself */
  8027. )
  8028. );
  8029. }
  8030. function isVNode(value) {
  8031. return value ? value.__v_isVNode === true : false;
  8032. }
  8033. function isSameVNodeType(n1, n2) {
  8034. if (n2.shapeFlag & 6 && hmrDirtyComponents.has(n2.type)) {
  8035. n1.shapeFlag &= ~256;
  8036. n2.shapeFlag &= ~512;
  8037. return false;
  8038. }
  8039. return n1.type === n2.type && n1.key === n2.key;
  8040. }
  8041. let vnodeArgsTransformer;
  8042. function transformVNodeArgs(transformer) {
  8043. vnodeArgsTransformer = transformer;
  8044. }
  8045. const createVNodeWithArgsTransform = (...args) => {
  8046. return _createVNode(
  8047. ...vnodeArgsTransformer ? vnodeArgsTransformer(args, currentRenderingInstance) : args
  8048. );
  8049. };
  8050. const InternalObjectKey = `__vInternal`;
  8051. const normalizeKey = ({ key }) => key != null ? key : null;
  8052. const normalizeRef = ({
  8053. ref,
  8054. ref_key,
  8055. ref_for
  8056. }) => {
  8057. if (typeof ref === "number") {
  8058. ref = "" + ref;
  8059. }
  8060. return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
  8061. };
  8062. function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  8063. const vnode = {
  8064. __v_isVNode: true,
  8065. __v_skip: true,
  8066. type,
  8067. props,
  8068. key: props && normalizeKey(props),
  8069. ref: props && normalizeRef(props),
  8070. scopeId: currentScopeId,
  8071. slotScopeIds: null,
  8072. children,
  8073. component: null,
  8074. suspense: null,
  8075. ssContent: null,
  8076. ssFallback: null,
  8077. dirs: null,
  8078. transition: null,
  8079. el: null,
  8080. anchor: null,
  8081. target: null,
  8082. targetAnchor: null,
  8083. staticCount: 0,
  8084. shapeFlag,
  8085. patchFlag,
  8086. dynamicProps,
  8087. dynamicChildren: null,
  8088. appContext: null,
  8089. ctx: currentRenderingInstance
  8090. };
  8091. if (needFullChildrenNormalization) {
  8092. normalizeChildren(vnode, children);
  8093. if (shapeFlag & 128) {
  8094. type.normalize(vnode);
  8095. }
  8096. } else if (children) {
  8097. vnode.shapeFlag |= isString(children) ? 8 : 16;
  8098. }
  8099. if (vnode.key !== vnode.key) {
  8100. warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
  8101. }
  8102. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  8103. !isBlockNode && // has current parent block
  8104. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  8105. // component nodes also should always be patched, because even if the
  8106. // component doesn't need to update, it needs to persist the instance on to
  8107. // the next vnode so that it can be properly unmounted later.
  8108. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  8109. // vnode should not be considered dynamic due to handler caching.
  8110. vnode.patchFlag !== 32) {
  8111. currentBlock.push(vnode);
  8112. }
  8113. return vnode;
  8114. }
  8115. const createVNode = createVNodeWithArgsTransform ;
  8116. function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  8117. if (!type || type === NULL_DYNAMIC_COMPONENT) {
  8118. if (!type) {
  8119. warn(`Invalid vnode type when creating vnode: ${type}.`);
  8120. }
  8121. type = Comment;
  8122. }
  8123. if (isVNode(type)) {
  8124. const cloned = cloneVNode(
  8125. type,
  8126. props,
  8127. true
  8128. /* mergeRef: true */
  8129. );
  8130. if (children) {
  8131. normalizeChildren(cloned, children);
  8132. }
  8133. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  8134. if (cloned.shapeFlag & 6) {
  8135. currentBlock[currentBlock.indexOf(type)] = cloned;
  8136. } else {
  8137. currentBlock.push(cloned);
  8138. }
  8139. }
  8140. cloned.patchFlag |= -2;
  8141. return cloned;
  8142. }
  8143. if (isClassComponent(type)) {
  8144. type = type.__vccOpts;
  8145. }
  8146. if (props) {
  8147. props = guardReactiveProps(props);
  8148. let { class: klass, style } = props;
  8149. if (klass && !isString(klass)) {
  8150. props.class = normalizeClass(klass);
  8151. }
  8152. if (isObject(style)) {
  8153. if (isProxy(style) && !isArray(style)) {
  8154. style = extend({}, style);
  8155. }
  8156. props.style = normalizeStyle(style);
  8157. }
  8158. }
  8159. const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
  8160. if (shapeFlag & 4 && isProxy(type)) {
  8161. type = toRaw(type);
  8162. warn(
  8163. `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\`.`,
  8164. `
  8165. Component that was made reactive: `,
  8166. type
  8167. );
  8168. }
  8169. return createBaseVNode(
  8170. type,
  8171. props,
  8172. children,
  8173. patchFlag,
  8174. dynamicProps,
  8175. shapeFlag,
  8176. isBlockNode,
  8177. true
  8178. );
  8179. }
  8180. function guardReactiveProps(props) {
  8181. if (!props)
  8182. return null;
  8183. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  8184. }
  8185. function cloneVNode(vnode, extraProps, mergeRef = false) {
  8186. const { props, ref, patchFlag, children } = vnode;
  8187. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  8188. const cloned = {
  8189. __v_isVNode: true,
  8190. __v_skip: true,
  8191. type: vnode.type,
  8192. props: mergedProps,
  8193. key: mergedProps && normalizeKey(mergedProps),
  8194. ref: extraProps && extraProps.ref ? (
  8195. // #2078 in the case of <component :is="vnode" ref="extra"/>
  8196. // if the vnode itself already has a ref, cloneVNode will need to merge
  8197. // the refs so the single vnode can be set on multiple refs
  8198. mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
  8199. ) : ref,
  8200. scopeId: vnode.scopeId,
  8201. slotScopeIds: vnode.slotScopeIds,
  8202. children: patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
  8203. target: vnode.target,
  8204. targetAnchor: vnode.targetAnchor,
  8205. staticCount: vnode.staticCount,
  8206. shapeFlag: vnode.shapeFlag,
  8207. // if the vnode is cloned with extra props, we can no longer assume its
  8208. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  8209. // note: preserve flag for fragments since they use the flag for children
  8210. // fast paths only.
  8211. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  8212. dynamicProps: vnode.dynamicProps,
  8213. dynamicChildren: vnode.dynamicChildren,
  8214. appContext: vnode.appContext,
  8215. dirs: vnode.dirs,
  8216. transition: vnode.transition,
  8217. // These should technically only be non-null on mounted VNodes. However,
  8218. // they *should* be copied for kept-alive vnodes. So we just always copy
  8219. // them since them being non-null during a mount doesn't affect the logic as
  8220. // they will simply be overwritten.
  8221. component: vnode.component,
  8222. suspense: vnode.suspense,
  8223. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  8224. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  8225. el: vnode.el,
  8226. anchor: vnode.anchor,
  8227. ctx: vnode.ctx,
  8228. ce: vnode.ce
  8229. };
  8230. return cloned;
  8231. }
  8232. function deepCloneVNode(vnode) {
  8233. const cloned = cloneVNode(vnode);
  8234. if (isArray(vnode.children)) {
  8235. cloned.children = vnode.children.map(deepCloneVNode);
  8236. }
  8237. return cloned;
  8238. }
  8239. function createTextVNode(text = " ", flag = 0) {
  8240. return createVNode(Text, null, text, flag);
  8241. }
  8242. function createStaticVNode(content, numberOfNodes) {
  8243. const vnode = createVNode(Static, null, content);
  8244. vnode.staticCount = numberOfNodes;
  8245. return vnode;
  8246. }
  8247. function createCommentVNode(text = "", asBlock = false) {
  8248. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  8249. }
  8250. function normalizeVNode(child) {
  8251. if (child == null || typeof child === "boolean") {
  8252. return createVNode(Comment);
  8253. } else if (isArray(child)) {
  8254. return createVNode(
  8255. Fragment,
  8256. null,
  8257. // #3666, avoid reference pollution when reusing vnode
  8258. child.slice()
  8259. );
  8260. } else if (typeof child === "object") {
  8261. return cloneIfMounted(child);
  8262. } else {
  8263. return createVNode(Text, null, String(child));
  8264. }
  8265. }
  8266. function cloneIfMounted(child) {
  8267. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  8268. }
  8269. function normalizeChildren(vnode, children) {
  8270. let type = 0;
  8271. const { shapeFlag } = vnode;
  8272. if (children == null) {
  8273. children = null;
  8274. } else if (isArray(children)) {
  8275. type = 16;
  8276. } else if (typeof children === "object") {
  8277. if (shapeFlag & (1 | 64)) {
  8278. const slot = children.default;
  8279. if (slot) {
  8280. slot._c && (slot._d = false);
  8281. normalizeChildren(vnode, slot());
  8282. slot._c && (slot._d = true);
  8283. }
  8284. return;
  8285. } else {
  8286. type = 32;
  8287. const slotFlag = children._;
  8288. if (!slotFlag && !(InternalObjectKey in children)) {
  8289. children._ctx = currentRenderingInstance;
  8290. } else if (slotFlag === 3 && currentRenderingInstance) {
  8291. if (currentRenderingInstance.slots._ === 1) {
  8292. children._ = 1;
  8293. } else {
  8294. children._ = 2;
  8295. vnode.patchFlag |= 1024;
  8296. }
  8297. }
  8298. }
  8299. } else if (isFunction(children)) {
  8300. children = { default: children, _ctx: currentRenderingInstance };
  8301. type = 32;
  8302. } else {
  8303. children = String(children);
  8304. if (shapeFlag & 64) {
  8305. type = 16;
  8306. children = [createTextVNode(children)];
  8307. } else {
  8308. type = 8;
  8309. }
  8310. }
  8311. vnode.children = children;
  8312. vnode.shapeFlag |= type;
  8313. }
  8314. function mergeProps(...args) {
  8315. const ret = {};
  8316. for (let i = 0; i < args.length; i++) {
  8317. const toMerge = args[i];
  8318. for (const key in toMerge) {
  8319. if (key === "class") {
  8320. if (ret.class !== toMerge.class) {
  8321. ret.class = normalizeClass([ret.class, toMerge.class]);
  8322. }
  8323. } else if (key === "style") {
  8324. ret.style = normalizeStyle([ret.style, toMerge.style]);
  8325. } else if (isOn(key)) {
  8326. const existing = ret[key];
  8327. const incoming = toMerge[key];
  8328. if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
  8329. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  8330. }
  8331. } else if (key !== "") {
  8332. ret[key] = toMerge[key];
  8333. }
  8334. }
  8335. }
  8336. return ret;
  8337. }
  8338. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  8339. callWithAsyncErrorHandling(hook, instance, 7, [
  8340. vnode,
  8341. prevVNode
  8342. ]);
  8343. }
  8344. const emptyAppContext = createAppContext();
  8345. let uid = 0;
  8346. function createComponentInstance(vnode, parent, suspense) {
  8347. const type = vnode.type;
  8348. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  8349. const instance = {
  8350. uid: uid++,
  8351. vnode,
  8352. type,
  8353. parent,
  8354. appContext,
  8355. root: null,
  8356. // to be immediately set
  8357. next: null,
  8358. subTree: null,
  8359. // will be set synchronously right after creation
  8360. effect: null,
  8361. update: null,
  8362. // will be set synchronously right after creation
  8363. scope: new EffectScope(
  8364. true
  8365. /* detached */
  8366. ),
  8367. render: null,
  8368. proxy: null,
  8369. exposed: null,
  8370. exposeProxy: null,
  8371. withProxy: null,
  8372. provides: parent ? parent.provides : Object.create(appContext.provides),
  8373. accessCache: null,
  8374. renderCache: [],
  8375. // local resolved assets
  8376. components: null,
  8377. directives: null,
  8378. // resolved props and emits options
  8379. propsOptions: normalizePropsOptions(type, appContext),
  8380. emitsOptions: normalizeEmitsOptions(type, appContext),
  8381. // emit
  8382. emit: null,
  8383. // to be set immediately
  8384. emitted: null,
  8385. // props default value
  8386. propsDefaults: EMPTY_OBJ,
  8387. // inheritAttrs
  8388. inheritAttrs: type.inheritAttrs,
  8389. // state
  8390. ctx: EMPTY_OBJ,
  8391. data: EMPTY_OBJ,
  8392. props: EMPTY_OBJ,
  8393. attrs: EMPTY_OBJ,
  8394. slots: EMPTY_OBJ,
  8395. refs: EMPTY_OBJ,
  8396. setupState: EMPTY_OBJ,
  8397. setupContext: null,
  8398. attrsProxy: null,
  8399. slotsProxy: null,
  8400. // suspense related
  8401. suspense,
  8402. suspenseId: suspense ? suspense.pendingId : 0,
  8403. asyncDep: null,
  8404. asyncResolved: false,
  8405. // lifecycle hooks
  8406. // not using enums here because it results in computed properties
  8407. isMounted: false,
  8408. isUnmounted: false,
  8409. isDeactivated: false,
  8410. bc: null,
  8411. c: null,
  8412. bm: null,
  8413. m: null,
  8414. bu: null,
  8415. u: null,
  8416. um: null,
  8417. bum: null,
  8418. da: null,
  8419. a: null,
  8420. rtg: null,
  8421. rtc: null,
  8422. ec: null,
  8423. sp: null
  8424. };
  8425. {
  8426. instance.ctx = createDevRenderContext(instance);
  8427. }
  8428. instance.root = parent ? parent.root : instance;
  8429. instance.emit = emit.bind(null, instance);
  8430. if (vnode.ce) {
  8431. vnode.ce(instance);
  8432. }
  8433. return instance;
  8434. }
  8435. let currentInstance = null;
  8436. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  8437. let internalSetCurrentInstance;
  8438. {
  8439. internalSetCurrentInstance = (i) => {
  8440. currentInstance = i;
  8441. };
  8442. }
  8443. const setCurrentInstance = (instance) => {
  8444. internalSetCurrentInstance(instance);
  8445. instance.scope.on();
  8446. };
  8447. const unsetCurrentInstance = () => {
  8448. currentInstance && currentInstance.scope.off();
  8449. internalSetCurrentInstance(null);
  8450. };
  8451. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  8452. function validateComponentName(name, config) {
  8453. const appIsNativeTag = config.isNativeTag || NO;
  8454. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  8455. warn(
  8456. "Do not use built-in or reserved HTML elements as component id: " + name
  8457. );
  8458. }
  8459. }
  8460. function isStatefulComponent(instance) {
  8461. return instance.vnode.shapeFlag & 4;
  8462. }
  8463. let isInSSRComponentSetup = false;
  8464. function setupComponent(instance, isSSR = false) {
  8465. isInSSRComponentSetup = isSSR;
  8466. const { props, children } = instance.vnode;
  8467. const isStateful = isStatefulComponent(instance);
  8468. initProps(instance, props, isStateful, isSSR);
  8469. initSlots(instance, children);
  8470. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  8471. isInSSRComponentSetup = false;
  8472. return setupResult;
  8473. }
  8474. function setupStatefulComponent(instance, isSSR) {
  8475. var _a;
  8476. const Component = instance.type;
  8477. {
  8478. if (Component.name) {
  8479. validateComponentName(Component.name, instance.appContext.config);
  8480. }
  8481. if (Component.components) {
  8482. const names = Object.keys(Component.components);
  8483. for (let i = 0; i < names.length; i++) {
  8484. validateComponentName(names[i], instance.appContext.config);
  8485. }
  8486. }
  8487. if (Component.directives) {
  8488. const names = Object.keys(Component.directives);
  8489. for (let i = 0; i < names.length; i++) {
  8490. validateDirectiveName(names[i]);
  8491. }
  8492. }
  8493. if (Component.compilerOptions && isRuntimeOnly()) {
  8494. warn(
  8495. `"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.`
  8496. );
  8497. }
  8498. }
  8499. instance.accessCache = /* @__PURE__ */ Object.create(null);
  8500. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  8501. {
  8502. exposePropsOnRenderContext(instance);
  8503. }
  8504. const { setup } = Component;
  8505. if (setup) {
  8506. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  8507. setCurrentInstance(instance);
  8508. pauseTracking();
  8509. const setupResult = callWithErrorHandling(
  8510. setup,
  8511. instance,
  8512. 0,
  8513. [shallowReadonly(instance.props) , setupContext]
  8514. );
  8515. resetTracking();
  8516. unsetCurrentInstance();
  8517. if (isPromise(setupResult)) {
  8518. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  8519. if (isSSR) {
  8520. return setupResult.then((resolvedResult) => {
  8521. handleSetupResult(instance, resolvedResult, isSSR);
  8522. }).catch((e) => {
  8523. handleError(e, instance, 0);
  8524. });
  8525. } else {
  8526. instance.asyncDep = setupResult;
  8527. if (!instance.suspense) {
  8528. const name = (_a = Component.name) != null ? _a : "Anonymous";
  8529. warn(
  8530. `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.`
  8531. );
  8532. }
  8533. }
  8534. } else {
  8535. handleSetupResult(instance, setupResult, isSSR);
  8536. }
  8537. } else {
  8538. finishComponentSetup(instance, isSSR);
  8539. }
  8540. }
  8541. function handleSetupResult(instance, setupResult, isSSR) {
  8542. if (isFunction(setupResult)) {
  8543. {
  8544. instance.render = setupResult;
  8545. }
  8546. } else if (isObject(setupResult)) {
  8547. if (isVNode(setupResult)) {
  8548. warn(
  8549. `setup() should not return VNodes directly - return a render function instead.`
  8550. );
  8551. }
  8552. {
  8553. instance.devtoolsRawSetupState = setupResult;
  8554. }
  8555. instance.setupState = proxyRefs(setupResult);
  8556. {
  8557. exposeSetupStateOnRenderContext(instance);
  8558. }
  8559. } else if (setupResult !== void 0) {
  8560. warn(
  8561. `setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`
  8562. );
  8563. }
  8564. finishComponentSetup(instance, isSSR);
  8565. }
  8566. let compile;
  8567. let installWithProxy;
  8568. function registerRuntimeCompiler(_compile) {
  8569. compile = _compile;
  8570. installWithProxy = (i) => {
  8571. if (i.render._rc) {
  8572. i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers);
  8573. }
  8574. };
  8575. }
  8576. const isRuntimeOnly = () => !compile;
  8577. function finishComponentSetup(instance, isSSR, skipOptions) {
  8578. const Component = instance.type;
  8579. if (!instance.render) {
  8580. if (!isSSR && compile && !Component.render) {
  8581. const template = Component.template || resolveMergedOptions(instance).template;
  8582. if (template) {
  8583. {
  8584. startMeasure(instance, `compile`);
  8585. }
  8586. const { isCustomElement, compilerOptions } = instance.appContext.config;
  8587. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  8588. const finalCompilerOptions = extend(
  8589. extend(
  8590. {
  8591. isCustomElement,
  8592. delimiters
  8593. },
  8594. compilerOptions
  8595. ),
  8596. componentCompilerOptions
  8597. );
  8598. Component.render = compile(template, finalCompilerOptions);
  8599. {
  8600. endMeasure(instance, `compile`);
  8601. }
  8602. }
  8603. }
  8604. instance.render = Component.render || NOOP;
  8605. if (installWithProxy) {
  8606. installWithProxy(instance);
  8607. }
  8608. }
  8609. {
  8610. setCurrentInstance(instance);
  8611. pauseTracking();
  8612. applyOptions(instance);
  8613. resetTracking();
  8614. unsetCurrentInstance();
  8615. }
  8616. if (!Component.render && instance.render === NOOP && !isSSR) {
  8617. if (!compile && Component.template) {
  8618. warn(
  8619. `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
  8620. /* should not happen */
  8621. );
  8622. } else {
  8623. warn(`Component is missing template or render function.`);
  8624. }
  8625. }
  8626. }
  8627. function getAttrsProxy(instance) {
  8628. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  8629. instance.attrs,
  8630. {
  8631. get(target, key) {
  8632. markAttrsAccessed();
  8633. track(instance, "get", "$attrs");
  8634. return target[key];
  8635. },
  8636. set() {
  8637. warn(`setupContext.attrs is readonly.`);
  8638. return false;
  8639. },
  8640. deleteProperty() {
  8641. warn(`setupContext.attrs is readonly.`);
  8642. return false;
  8643. }
  8644. }
  8645. ));
  8646. }
  8647. function getSlotsProxy(instance) {
  8648. return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
  8649. get(target, key) {
  8650. track(instance, "get", "$slots");
  8651. return target[key];
  8652. }
  8653. }));
  8654. }
  8655. function createSetupContext(instance) {
  8656. const expose = (exposed) => {
  8657. {
  8658. if (instance.exposed) {
  8659. warn(`expose() should be called only once per setup().`);
  8660. }
  8661. if (exposed != null) {
  8662. let exposedType = typeof exposed;
  8663. if (exposedType === "object") {
  8664. if (isArray(exposed)) {
  8665. exposedType = "array";
  8666. } else if (isRef(exposed)) {
  8667. exposedType = "ref";
  8668. }
  8669. }
  8670. if (exposedType !== "object") {
  8671. warn(
  8672. `expose() should be passed a plain object, received ${exposedType}.`
  8673. );
  8674. }
  8675. }
  8676. }
  8677. instance.exposed = exposed || {};
  8678. };
  8679. {
  8680. return Object.freeze({
  8681. get attrs() {
  8682. return getAttrsProxy(instance);
  8683. },
  8684. get slots() {
  8685. return getSlotsProxy(instance);
  8686. },
  8687. get emit() {
  8688. return (event, ...args) => instance.emit(event, ...args);
  8689. },
  8690. expose
  8691. });
  8692. }
  8693. }
  8694. function getExposeProxy(instance) {
  8695. if (instance.exposed) {
  8696. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  8697. get(target, key) {
  8698. if (key in target) {
  8699. return target[key];
  8700. } else if (key in publicPropertiesMap) {
  8701. return publicPropertiesMap[key](instance);
  8702. }
  8703. },
  8704. has(target, key) {
  8705. return key in target || key in publicPropertiesMap;
  8706. }
  8707. }));
  8708. }
  8709. }
  8710. const classifyRE = /(?:^|[-_])(\w)/g;
  8711. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  8712. function getComponentName(Component, includeInferred = true) {
  8713. return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  8714. }
  8715. function formatComponentName(instance, Component, isRoot = false) {
  8716. let name = getComponentName(Component);
  8717. if (!name && Component.__file) {
  8718. const match = Component.__file.match(/([^/\\]+)\.\w+$/);
  8719. if (match) {
  8720. name = match[1];
  8721. }
  8722. }
  8723. if (!name && instance && instance.parent) {
  8724. const inferFromRegistry = (registry) => {
  8725. for (const key in registry) {
  8726. if (registry[key] === Component) {
  8727. return key;
  8728. }
  8729. }
  8730. };
  8731. name = inferFromRegistry(
  8732. instance.components || instance.parent.type.components
  8733. ) || inferFromRegistry(instance.appContext.components);
  8734. }
  8735. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  8736. }
  8737. function isClassComponent(value) {
  8738. return isFunction(value) && "__vccOpts" in value;
  8739. }
  8740. const computed = (getterOrOptions, debugOptions) => {
  8741. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  8742. };
  8743. function h(type, propsOrChildren, children) {
  8744. const l = arguments.length;
  8745. if (l === 2) {
  8746. if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
  8747. if (isVNode(propsOrChildren)) {
  8748. return createVNode(type, null, [propsOrChildren]);
  8749. }
  8750. return createVNode(type, propsOrChildren);
  8751. } else {
  8752. return createVNode(type, null, propsOrChildren);
  8753. }
  8754. } else {
  8755. if (l > 3) {
  8756. children = Array.prototype.slice.call(arguments, 2);
  8757. } else if (l === 3 && isVNode(children)) {
  8758. children = [children];
  8759. }
  8760. return createVNode(type, propsOrChildren, children);
  8761. }
  8762. }
  8763. const ssrContextKey = Symbol.for("v-scx");
  8764. const useSSRContext = () => {
  8765. {
  8766. const ctx = inject(ssrContextKey);
  8767. if (!ctx) {
  8768. warn(
  8769. `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
  8770. );
  8771. }
  8772. return ctx;
  8773. }
  8774. };
  8775. function initCustomFormatter() {
  8776. if (typeof window === "undefined") {
  8777. return;
  8778. }
  8779. const vueStyle = { style: "color:#3ba776" };
  8780. const numberStyle = { style: "color:#0b1bc9" };
  8781. const stringStyle = { style: "color:#b62e24" };
  8782. const keywordStyle = { style: "color:#9d288c" };
  8783. const formatter = {
  8784. header(obj) {
  8785. if (!isObject(obj)) {
  8786. return null;
  8787. }
  8788. if (obj.__isVue) {
  8789. return ["div", vueStyle, `VueInstance`];
  8790. } else if (isRef(obj)) {
  8791. return [
  8792. "div",
  8793. {},
  8794. ["span", vueStyle, genRefFlag(obj)],
  8795. "<",
  8796. formatValue(obj.value),
  8797. `>`
  8798. ];
  8799. } else if (isReactive(obj)) {
  8800. return [
  8801. "div",
  8802. {},
  8803. ["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
  8804. "<",
  8805. formatValue(obj),
  8806. `>${isReadonly(obj) ? ` (readonly)` : ``}`
  8807. ];
  8808. } else if (isReadonly(obj)) {
  8809. return [
  8810. "div",
  8811. {},
  8812. ["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
  8813. "<",
  8814. formatValue(obj),
  8815. ">"
  8816. ];
  8817. }
  8818. return null;
  8819. },
  8820. hasBody(obj) {
  8821. return obj && obj.__isVue;
  8822. },
  8823. body(obj) {
  8824. if (obj && obj.__isVue) {
  8825. return [
  8826. "div",
  8827. {},
  8828. ...formatInstance(obj.$)
  8829. ];
  8830. }
  8831. }
  8832. };
  8833. function formatInstance(instance) {
  8834. const blocks = [];
  8835. if (instance.type.props && instance.props) {
  8836. blocks.push(createInstanceBlock("props", toRaw(instance.props)));
  8837. }
  8838. if (instance.setupState !== EMPTY_OBJ) {
  8839. blocks.push(createInstanceBlock("setup", instance.setupState));
  8840. }
  8841. if (instance.data !== EMPTY_OBJ) {
  8842. blocks.push(createInstanceBlock("data", toRaw(instance.data)));
  8843. }
  8844. const computed = extractKeys(instance, "computed");
  8845. if (computed) {
  8846. blocks.push(createInstanceBlock("computed", computed));
  8847. }
  8848. const injected = extractKeys(instance, "inject");
  8849. if (injected) {
  8850. blocks.push(createInstanceBlock("injected", injected));
  8851. }
  8852. blocks.push([
  8853. "div",
  8854. {},
  8855. [
  8856. "span",
  8857. {
  8858. style: keywordStyle.style + ";opacity:0.66"
  8859. },
  8860. "$ (internal): "
  8861. ],
  8862. ["object", { object: instance }]
  8863. ]);
  8864. return blocks;
  8865. }
  8866. function createInstanceBlock(type, target) {
  8867. target = extend({}, target);
  8868. if (!Object.keys(target).length) {
  8869. return ["span", {}];
  8870. }
  8871. return [
  8872. "div",
  8873. { style: "line-height:1.25em;margin-bottom:0.6em" },
  8874. [
  8875. "div",
  8876. {
  8877. style: "color:#476582"
  8878. },
  8879. type
  8880. ],
  8881. [
  8882. "div",
  8883. {
  8884. style: "padding-left:1.25em"
  8885. },
  8886. ...Object.keys(target).map((key) => {
  8887. return [
  8888. "div",
  8889. {},
  8890. ["span", keywordStyle, key + ": "],
  8891. formatValue(target[key], false)
  8892. ];
  8893. })
  8894. ]
  8895. ];
  8896. }
  8897. function formatValue(v, asRaw = true) {
  8898. if (typeof v === "number") {
  8899. return ["span", numberStyle, v];
  8900. } else if (typeof v === "string") {
  8901. return ["span", stringStyle, JSON.stringify(v)];
  8902. } else if (typeof v === "boolean") {
  8903. return ["span", keywordStyle, v];
  8904. } else if (isObject(v)) {
  8905. return ["object", { object: asRaw ? toRaw(v) : v }];
  8906. } else {
  8907. return ["span", stringStyle, String(v)];
  8908. }
  8909. }
  8910. function extractKeys(instance, type) {
  8911. const Comp = instance.type;
  8912. if (isFunction(Comp)) {
  8913. return;
  8914. }
  8915. const extracted = {};
  8916. for (const key in instance.ctx) {
  8917. if (isKeyOfType(Comp, key, type)) {
  8918. extracted[key] = instance.ctx[key];
  8919. }
  8920. }
  8921. return extracted;
  8922. }
  8923. function isKeyOfType(Comp, key, type) {
  8924. const opts = Comp[type];
  8925. if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
  8926. return true;
  8927. }
  8928. if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
  8929. return true;
  8930. }
  8931. if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
  8932. return true;
  8933. }
  8934. }
  8935. function genRefFlag(v) {
  8936. if (isShallow(v)) {
  8937. return `ShallowRef`;
  8938. }
  8939. if (v.effect) {
  8940. return `ComputedRef`;
  8941. }
  8942. return `Ref`;
  8943. }
  8944. if (window.devtoolsFormatters) {
  8945. window.devtoolsFormatters.push(formatter);
  8946. } else {
  8947. window.devtoolsFormatters = [formatter];
  8948. }
  8949. }
  8950. function withMemo(memo, render, cache, index) {
  8951. const cached = cache[index];
  8952. if (cached && isMemoSame(cached, memo)) {
  8953. return cached;
  8954. }
  8955. const ret = render();
  8956. ret.memo = memo.slice();
  8957. return cache[index] = ret;
  8958. }
  8959. function isMemoSame(cached, memo) {
  8960. const prev = cached.memo;
  8961. if (prev.length != memo.length) {
  8962. return false;
  8963. }
  8964. for (let i = 0; i < prev.length; i++) {
  8965. if (hasChanged(prev[i], memo[i])) {
  8966. return false;
  8967. }
  8968. }
  8969. if (isBlockTreeEnabled > 0 && currentBlock) {
  8970. currentBlock.push(cached);
  8971. }
  8972. return true;
  8973. }
  8974. const version = "3.3.4";
  8975. const ssrUtils = null;
  8976. const resolveFilter = null;
  8977. const compatUtils = null;
  8978. const svgNS = "http://www.w3.org/2000/svg";
  8979. const doc = typeof document !== "undefined" ? document : null;
  8980. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  8981. const nodeOps = {
  8982. insert: (child, parent, anchor) => {
  8983. parent.insertBefore(child, anchor || null);
  8984. },
  8985. remove: (child) => {
  8986. const parent = child.parentNode;
  8987. if (parent) {
  8988. parent.removeChild(child);
  8989. }
  8990. },
  8991. createElement: (tag, isSVG, is, props) => {
  8992. const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
  8993. if (tag === "select" && props && props.multiple != null) {
  8994. el.setAttribute("multiple", props.multiple);
  8995. }
  8996. return el;
  8997. },
  8998. createText: (text) => doc.createTextNode(text),
  8999. createComment: (text) => doc.createComment(text),
  9000. setText: (node, text) => {
  9001. node.nodeValue = text;
  9002. },
  9003. setElementText: (el, text) => {
  9004. el.textContent = text;
  9005. },
  9006. parentNode: (node) => node.parentNode,
  9007. nextSibling: (node) => node.nextSibling,
  9008. querySelector: (selector) => doc.querySelector(selector),
  9009. setScopeId(el, id) {
  9010. el.setAttribute(id, "");
  9011. },
  9012. // __UNSAFE__
  9013. // Reason: innerHTML.
  9014. // Static content here can only come from compiled templates.
  9015. // As long as the user only uses trusted templates, this is safe.
  9016. insertStaticContent(content, parent, anchor, isSVG, start, end) {
  9017. const before = anchor ? anchor.previousSibling : parent.lastChild;
  9018. if (start && (start === end || start.nextSibling)) {
  9019. while (true) {
  9020. parent.insertBefore(start.cloneNode(true), anchor);
  9021. if (start === end || !(start = start.nextSibling))
  9022. break;
  9023. }
  9024. } else {
  9025. templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
  9026. const template = templateContainer.content;
  9027. if (isSVG) {
  9028. const wrapper = template.firstChild;
  9029. while (wrapper.firstChild) {
  9030. template.appendChild(wrapper.firstChild);
  9031. }
  9032. template.removeChild(wrapper);
  9033. }
  9034. parent.insertBefore(template, anchor);
  9035. }
  9036. return [
  9037. // first
  9038. before ? before.nextSibling : parent.firstChild,
  9039. // last
  9040. anchor ? anchor.previousSibling : parent.lastChild
  9041. ];
  9042. }
  9043. };
  9044. function patchClass(el, value, isSVG) {
  9045. const transitionClasses = el._vtc;
  9046. if (transitionClasses) {
  9047. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  9048. }
  9049. if (value == null) {
  9050. el.removeAttribute("class");
  9051. } else if (isSVG) {
  9052. el.setAttribute("class", value);
  9053. } else {
  9054. el.className = value;
  9055. }
  9056. }
  9057. function patchStyle(el, prev, next) {
  9058. const style = el.style;
  9059. const isCssString = isString(next);
  9060. if (next && !isCssString) {
  9061. if (prev && !isString(prev)) {
  9062. for (const key in prev) {
  9063. if (next[key] == null) {
  9064. setStyle(style, key, "");
  9065. }
  9066. }
  9067. }
  9068. for (const key in next) {
  9069. setStyle(style, key, next[key]);
  9070. }
  9071. } else {
  9072. const currentDisplay = style.display;
  9073. if (isCssString) {
  9074. if (prev !== next) {
  9075. style.cssText = next;
  9076. }
  9077. } else if (prev) {
  9078. el.removeAttribute("style");
  9079. }
  9080. if ("_vod" in el) {
  9081. style.display = currentDisplay;
  9082. }
  9083. }
  9084. }
  9085. const semicolonRE = /[^\\];\s*$/;
  9086. const importantRE = /\s*!important$/;
  9087. function setStyle(style, name, val) {
  9088. if (isArray(val)) {
  9089. val.forEach((v) => setStyle(style, name, v));
  9090. } else {
  9091. if (val == null)
  9092. val = "";
  9093. {
  9094. if (semicolonRE.test(val)) {
  9095. warn(
  9096. `Unexpected semicolon at the end of '${name}' style value: '${val}'`
  9097. );
  9098. }
  9099. }
  9100. if (name.startsWith("--")) {
  9101. style.setProperty(name, val);
  9102. } else {
  9103. const prefixed = autoPrefix(style, name);
  9104. if (importantRE.test(val)) {
  9105. style.setProperty(
  9106. hyphenate(prefixed),
  9107. val.replace(importantRE, ""),
  9108. "important"
  9109. );
  9110. } else {
  9111. style[prefixed] = val;
  9112. }
  9113. }
  9114. }
  9115. }
  9116. const prefixes = ["Webkit", "Moz", "ms"];
  9117. const prefixCache = {};
  9118. function autoPrefix(style, rawName) {
  9119. const cached = prefixCache[rawName];
  9120. if (cached) {
  9121. return cached;
  9122. }
  9123. let name = camelize(rawName);
  9124. if (name !== "filter" && name in style) {
  9125. return prefixCache[rawName] = name;
  9126. }
  9127. name = capitalize(name);
  9128. for (let i = 0; i < prefixes.length; i++) {
  9129. const prefixed = prefixes[i] + name;
  9130. if (prefixed in style) {
  9131. return prefixCache[rawName] = prefixed;
  9132. }
  9133. }
  9134. return rawName;
  9135. }
  9136. const xlinkNS = "http://www.w3.org/1999/xlink";
  9137. function patchAttr(el, key, value, isSVG, instance) {
  9138. if (isSVG && key.startsWith("xlink:")) {
  9139. if (value == null) {
  9140. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  9141. } else {
  9142. el.setAttributeNS(xlinkNS, key, value);
  9143. }
  9144. } else {
  9145. const isBoolean = isSpecialBooleanAttr(key);
  9146. if (value == null || isBoolean && !includeBooleanAttr(value)) {
  9147. el.removeAttribute(key);
  9148. } else {
  9149. el.setAttribute(key, isBoolean ? "" : value);
  9150. }
  9151. }
  9152. }
  9153. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  9154. if (key === "innerHTML" || key === "textContent") {
  9155. if (prevChildren) {
  9156. unmountChildren(prevChildren, parentComponent, parentSuspense);
  9157. }
  9158. el[key] = value == null ? "" : value;
  9159. return;
  9160. }
  9161. const tag = el.tagName;
  9162. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  9163. !tag.includes("-")) {
  9164. el._value = value;
  9165. const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
  9166. const newValue = value == null ? "" : value;
  9167. if (oldValue !== newValue) {
  9168. el.value = newValue;
  9169. }
  9170. if (value == null) {
  9171. el.removeAttribute(key);
  9172. }
  9173. return;
  9174. }
  9175. let needRemove = false;
  9176. if (value === "" || value == null) {
  9177. const type = typeof el[key];
  9178. if (type === "boolean") {
  9179. value = includeBooleanAttr(value);
  9180. } else if (value == null && type === "string") {
  9181. value = "";
  9182. needRemove = true;
  9183. } else if (type === "number") {
  9184. value = 0;
  9185. needRemove = true;
  9186. }
  9187. }
  9188. try {
  9189. el[key] = value;
  9190. } catch (e) {
  9191. if (!needRemove) {
  9192. warn(
  9193. `Failed setting prop "${key}" on <${tag.toLowerCase()}>: value ${value} is invalid.`,
  9194. e
  9195. );
  9196. }
  9197. }
  9198. needRemove && el.removeAttribute(key);
  9199. }
  9200. function addEventListener(el, event, handler, options) {
  9201. el.addEventListener(event, handler, options);
  9202. }
  9203. function removeEventListener(el, event, handler, options) {
  9204. el.removeEventListener(event, handler, options);
  9205. }
  9206. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  9207. const invokers = el._vei || (el._vei = {});
  9208. const existingInvoker = invokers[rawName];
  9209. if (nextValue && existingInvoker) {
  9210. existingInvoker.value = nextValue;
  9211. } else {
  9212. const [name, options] = parseName(rawName);
  9213. if (nextValue) {
  9214. const invoker = invokers[rawName] = createInvoker(nextValue, instance);
  9215. addEventListener(el, name, invoker, options);
  9216. } else if (existingInvoker) {
  9217. removeEventListener(el, name, existingInvoker, options);
  9218. invokers[rawName] = void 0;
  9219. }
  9220. }
  9221. }
  9222. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  9223. function parseName(name) {
  9224. let options;
  9225. if (optionsModifierRE.test(name)) {
  9226. options = {};
  9227. let m;
  9228. while (m = name.match(optionsModifierRE)) {
  9229. name = name.slice(0, name.length - m[0].length);
  9230. options[m[0].toLowerCase()] = true;
  9231. }
  9232. }
  9233. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  9234. return [event, options];
  9235. }
  9236. let cachedNow = 0;
  9237. const p = /* @__PURE__ */ Promise.resolve();
  9238. const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
  9239. function createInvoker(initialValue, instance) {
  9240. const invoker = (e) => {
  9241. if (!e._vts) {
  9242. e._vts = Date.now();
  9243. } else if (e._vts <= invoker.attached) {
  9244. return;
  9245. }
  9246. callWithAsyncErrorHandling(
  9247. patchStopImmediatePropagation(e, invoker.value),
  9248. instance,
  9249. 5,
  9250. [e]
  9251. );
  9252. };
  9253. invoker.value = initialValue;
  9254. invoker.attached = getNow();
  9255. return invoker;
  9256. }
  9257. function patchStopImmediatePropagation(e, value) {
  9258. if (isArray(value)) {
  9259. const originalStop = e.stopImmediatePropagation;
  9260. e.stopImmediatePropagation = () => {
  9261. originalStop.call(e);
  9262. e._stopped = true;
  9263. };
  9264. return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2));
  9265. } else {
  9266. return value;
  9267. }
  9268. }
  9269. const nativeOnRE = /^on[a-z]/;
  9270. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  9271. if (key === "class") {
  9272. patchClass(el, nextValue, isSVG);
  9273. } else if (key === "style") {
  9274. patchStyle(el, prevValue, nextValue);
  9275. } else if (isOn(key)) {
  9276. if (!isModelListener(key)) {
  9277. patchEvent(el, key, prevValue, nextValue, parentComponent);
  9278. }
  9279. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  9280. patchDOMProp(
  9281. el,
  9282. key,
  9283. nextValue,
  9284. prevChildren,
  9285. parentComponent,
  9286. parentSuspense,
  9287. unmountChildren
  9288. );
  9289. } else {
  9290. if (key === "true-value") {
  9291. el._trueValue = nextValue;
  9292. } else if (key === "false-value") {
  9293. el._falseValue = nextValue;
  9294. }
  9295. patchAttr(el, key, nextValue, isSVG);
  9296. }
  9297. };
  9298. function shouldSetAsProp(el, key, value, isSVG) {
  9299. if (isSVG) {
  9300. if (key === "innerHTML" || key === "textContent") {
  9301. return true;
  9302. }
  9303. if (key in el && nativeOnRE.test(key) && isFunction(value)) {
  9304. return true;
  9305. }
  9306. return false;
  9307. }
  9308. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  9309. return false;
  9310. }
  9311. if (key === "form") {
  9312. return false;
  9313. }
  9314. if (key === "list" && el.tagName === "INPUT") {
  9315. return false;
  9316. }
  9317. if (key === "type" && el.tagName === "TEXTAREA") {
  9318. return false;
  9319. }
  9320. if (nativeOnRE.test(key) && isString(value)) {
  9321. return false;
  9322. }
  9323. return key in el;
  9324. }
  9325. function defineCustomElement(options, hydrate2) {
  9326. const Comp = defineComponent(options);
  9327. class VueCustomElement extends VueElement {
  9328. constructor(initialProps) {
  9329. super(Comp, initialProps, hydrate2);
  9330. }
  9331. }
  9332. VueCustomElement.def = Comp;
  9333. return VueCustomElement;
  9334. }
  9335. const defineSSRCustomElement = (options) => {
  9336. return defineCustomElement(options, hydrate);
  9337. };
  9338. const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
  9339. };
  9340. class VueElement extends BaseClass {
  9341. constructor(_def, _props = {}, hydrate2) {
  9342. super();
  9343. this._def = _def;
  9344. this._props = _props;
  9345. /**
  9346. * @internal
  9347. */
  9348. this._instance = null;
  9349. this._connected = false;
  9350. this._resolved = false;
  9351. this._numberProps = null;
  9352. if (this.shadowRoot && hydrate2) {
  9353. hydrate2(this._createVNode(), this.shadowRoot);
  9354. } else {
  9355. if (this.shadowRoot) {
  9356. warn(
  9357. `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
  9358. );
  9359. }
  9360. this.attachShadow({ mode: "open" });
  9361. if (!this._def.__asyncLoader) {
  9362. this._resolveProps(this._def);
  9363. }
  9364. }
  9365. }
  9366. connectedCallback() {
  9367. this._connected = true;
  9368. if (!this._instance) {
  9369. if (this._resolved) {
  9370. this._update();
  9371. } else {
  9372. this._resolveDef();
  9373. }
  9374. }
  9375. }
  9376. disconnectedCallback() {
  9377. this._connected = false;
  9378. nextTick(() => {
  9379. if (!this._connected) {
  9380. render(null, this.shadowRoot);
  9381. this._instance = null;
  9382. }
  9383. });
  9384. }
  9385. /**
  9386. * resolve inner component definition (handle possible async component)
  9387. */
  9388. _resolveDef() {
  9389. this._resolved = true;
  9390. for (let i = 0; i < this.attributes.length; i++) {
  9391. this._setAttr(this.attributes[i].name);
  9392. }
  9393. new MutationObserver((mutations) => {
  9394. for (const m of mutations) {
  9395. this._setAttr(m.attributeName);
  9396. }
  9397. }).observe(this, { attributes: true });
  9398. const resolve = (def, isAsync = false) => {
  9399. const { props, styles } = def;
  9400. let numberProps;
  9401. if (props && !isArray(props)) {
  9402. for (const key in props) {
  9403. const opt = props[key];
  9404. if (opt === Number || opt && opt.type === Number) {
  9405. if (key in this._props) {
  9406. this._props[key] = toNumber(this._props[key]);
  9407. }
  9408. (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true;
  9409. }
  9410. }
  9411. }
  9412. this._numberProps = numberProps;
  9413. if (isAsync) {
  9414. this._resolveProps(def);
  9415. }
  9416. this._applyStyles(styles);
  9417. this._update();
  9418. };
  9419. const asyncDef = this._def.__asyncLoader;
  9420. if (asyncDef) {
  9421. asyncDef().then((def) => resolve(def, true));
  9422. } else {
  9423. resolve(this._def);
  9424. }
  9425. }
  9426. _resolveProps(def) {
  9427. const { props } = def;
  9428. const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
  9429. for (const key of Object.keys(this)) {
  9430. if (key[0] !== "_" && declaredPropKeys.includes(key)) {
  9431. this._setProp(key, this[key], true, false);
  9432. }
  9433. }
  9434. for (const key of declaredPropKeys.map(camelize)) {
  9435. Object.defineProperty(this, key, {
  9436. get() {
  9437. return this._getProp(key);
  9438. },
  9439. set(val) {
  9440. this._setProp(key, val);
  9441. }
  9442. });
  9443. }
  9444. }
  9445. _setAttr(key) {
  9446. let value = this.getAttribute(key);
  9447. const camelKey = camelize(key);
  9448. if (this._numberProps && this._numberProps[camelKey]) {
  9449. value = toNumber(value);
  9450. }
  9451. this._setProp(camelKey, value, false);
  9452. }
  9453. /**
  9454. * @internal
  9455. */
  9456. _getProp(key) {
  9457. return this._props[key];
  9458. }
  9459. /**
  9460. * @internal
  9461. */
  9462. _setProp(key, val, shouldReflect = true, shouldUpdate = true) {
  9463. if (val !== this._props[key]) {
  9464. this._props[key] = val;
  9465. if (shouldUpdate && this._instance) {
  9466. this._update();
  9467. }
  9468. if (shouldReflect) {
  9469. if (val === true) {
  9470. this.setAttribute(hyphenate(key), "");
  9471. } else if (typeof val === "string" || typeof val === "number") {
  9472. this.setAttribute(hyphenate(key), val + "");
  9473. } else if (!val) {
  9474. this.removeAttribute(hyphenate(key));
  9475. }
  9476. }
  9477. }
  9478. }
  9479. _update() {
  9480. render(this._createVNode(), this.shadowRoot);
  9481. }
  9482. _createVNode() {
  9483. const vnode = createVNode(this._def, extend({}, this._props));
  9484. if (!this._instance) {
  9485. vnode.ce = (instance) => {
  9486. this._instance = instance;
  9487. instance.isCE = true;
  9488. {
  9489. instance.ceReload = (newStyles) => {
  9490. if (this._styles) {
  9491. this._styles.forEach((s) => this.shadowRoot.removeChild(s));
  9492. this._styles.length = 0;
  9493. }
  9494. this._applyStyles(newStyles);
  9495. this._instance = null;
  9496. this._update();
  9497. };
  9498. }
  9499. const dispatch = (event, args) => {
  9500. this.dispatchEvent(
  9501. new CustomEvent(event, {
  9502. detail: args
  9503. })
  9504. );
  9505. };
  9506. instance.emit = (event, ...args) => {
  9507. dispatch(event, args);
  9508. if (hyphenate(event) !== event) {
  9509. dispatch(hyphenate(event), args);
  9510. }
  9511. };
  9512. let parent = this;
  9513. while (parent = parent && (parent.parentNode || parent.host)) {
  9514. if (parent instanceof VueElement) {
  9515. instance.parent = parent._instance;
  9516. instance.provides = parent._instance.provides;
  9517. break;
  9518. }
  9519. }
  9520. };
  9521. }
  9522. return vnode;
  9523. }
  9524. _applyStyles(styles) {
  9525. if (styles) {
  9526. styles.forEach((css) => {
  9527. const s = document.createElement("style");
  9528. s.textContent = css;
  9529. this.shadowRoot.appendChild(s);
  9530. {
  9531. (this._styles || (this._styles = [])).push(s);
  9532. }
  9533. });
  9534. }
  9535. }
  9536. }
  9537. function useCssModule(name = "$style") {
  9538. {
  9539. const instance = getCurrentInstance();
  9540. if (!instance) {
  9541. warn(`useCssModule must be called inside setup()`);
  9542. return EMPTY_OBJ;
  9543. }
  9544. const modules = instance.type.__cssModules;
  9545. if (!modules) {
  9546. warn(`Current instance does not have CSS modules injected.`);
  9547. return EMPTY_OBJ;
  9548. }
  9549. const mod = modules[name];
  9550. if (!mod) {
  9551. warn(`Current instance does not have CSS module named "${name}".`);
  9552. return EMPTY_OBJ;
  9553. }
  9554. return mod;
  9555. }
  9556. }
  9557. function useCssVars(getter) {
  9558. const instance = getCurrentInstance();
  9559. if (!instance) {
  9560. warn(`useCssVars is called without current active component instance.`);
  9561. return;
  9562. }
  9563. const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => {
  9564. Array.from(
  9565. document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)
  9566. ).forEach((node) => setVarsOnNode(node, vars));
  9567. };
  9568. const setVars = () => {
  9569. const vars = getter(instance.proxy);
  9570. setVarsOnVNode(instance.subTree, vars);
  9571. updateTeleports(vars);
  9572. };
  9573. watchPostEffect(setVars);
  9574. onMounted(() => {
  9575. const ob = new MutationObserver(setVars);
  9576. ob.observe(instance.subTree.el.parentNode, { childList: true });
  9577. onUnmounted(() => ob.disconnect());
  9578. });
  9579. }
  9580. function setVarsOnVNode(vnode, vars) {
  9581. if (vnode.shapeFlag & 128) {
  9582. const suspense = vnode.suspense;
  9583. vnode = suspense.activeBranch;
  9584. if (suspense.pendingBranch && !suspense.isHydrating) {
  9585. suspense.effects.push(() => {
  9586. setVarsOnVNode(suspense.activeBranch, vars);
  9587. });
  9588. }
  9589. }
  9590. while (vnode.component) {
  9591. vnode = vnode.component.subTree;
  9592. }
  9593. if (vnode.shapeFlag & 1 && vnode.el) {
  9594. setVarsOnNode(vnode.el, vars);
  9595. } else if (vnode.type === Fragment) {
  9596. vnode.children.forEach((c) => setVarsOnVNode(c, vars));
  9597. } else if (vnode.type === Static) {
  9598. let { el, anchor } = vnode;
  9599. while (el) {
  9600. setVarsOnNode(el, vars);
  9601. if (el === anchor)
  9602. break;
  9603. el = el.nextSibling;
  9604. }
  9605. }
  9606. }
  9607. function setVarsOnNode(el, vars) {
  9608. if (el.nodeType === 1) {
  9609. const style = el.style;
  9610. for (const key in vars) {
  9611. style.setProperty(`--${key}`, vars[key]);
  9612. }
  9613. }
  9614. }
  9615. const TRANSITION = "transition";
  9616. const ANIMATION = "animation";
  9617. const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
  9618. Transition.displayName = "Transition";
  9619. const DOMTransitionPropsValidators = {
  9620. name: String,
  9621. type: String,
  9622. css: {
  9623. type: Boolean,
  9624. default: true
  9625. },
  9626. duration: [String, Number, Object],
  9627. enterFromClass: String,
  9628. enterActiveClass: String,
  9629. enterToClass: String,
  9630. appearFromClass: String,
  9631. appearActiveClass: String,
  9632. appearToClass: String,
  9633. leaveFromClass: String,
  9634. leaveActiveClass: String,
  9635. leaveToClass: String
  9636. };
  9637. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  9638. {},
  9639. BaseTransitionPropsValidators,
  9640. DOMTransitionPropsValidators
  9641. );
  9642. const callHook = (hook, args = []) => {
  9643. if (isArray(hook)) {
  9644. hook.forEach((h2) => h2(...args));
  9645. } else if (hook) {
  9646. hook(...args);
  9647. }
  9648. };
  9649. const hasExplicitCallback = (hook) => {
  9650. return hook ? isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  9651. };
  9652. function resolveTransitionProps(rawProps) {
  9653. const baseProps = {};
  9654. for (const key in rawProps) {
  9655. if (!(key in DOMTransitionPropsValidators)) {
  9656. baseProps[key] = rawProps[key];
  9657. }
  9658. }
  9659. if (rawProps.css === false) {
  9660. return baseProps;
  9661. }
  9662. const {
  9663. name = "v",
  9664. type,
  9665. duration,
  9666. enterFromClass = `${name}-enter-from`,
  9667. enterActiveClass = `${name}-enter-active`,
  9668. enterToClass = `${name}-enter-to`,
  9669. appearFromClass = enterFromClass,
  9670. appearActiveClass = enterActiveClass,
  9671. appearToClass = enterToClass,
  9672. leaveFromClass = `${name}-leave-from`,
  9673. leaveActiveClass = `${name}-leave-active`,
  9674. leaveToClass = `${name}-leave-to`
  9675. } = rawProps;
  9676. const durations = normalizeDuration(duration);
  9677. const enterDuration = durations && durations[0];
  9678. const leaveDuration = durations && durations[1];
  9679. const {
  9680. onBeforeEnter,
  9681. onEnter,
  9682. onEnterCancelled,
  9683. onLeave,
  9684. onLeaveCancelled,
  9685. onBeforeAppear = onBeforeEnter,
  9686. onAppear = onEnter,
  9687. onAppearCancelled = onEnterCancelled
  9688. } = baseProps;
  9689. const finishEnter = (el, isAppear, done) => {
  9690. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9691. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  9692. done && done();
  9693. };
  9694. const finishLeave = (el, done) => {
  9695. el._isLeaving = false;
  9696. removeTransitionClass(el, leaveFromClass);
  9697. removeTransitionClass(el, leaveToClass);
  9698. removeTransitionClass(el, leaveActiveClass);
  9699. done && done();
  9700. };
  9701. const makeEnterHook = (isAppear) => {
  9702. return (el, done) => {
  9703. const hook = isAppear ? onAppear : onEnter;
  9704. const resolve = () => finishEnter(el, isAppear, done);
  9705. callHook(hook, [el, resolve]);
  9706. nextFrame(() => {
  9707. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  9708. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  9709. if (!hasExplicitCallback(hook)) {
  9710. whenTransitionEnds(el, type, enterDuration, resolve);
  9711. }
  9712. });
  9713. };
  9714. };
  9715. return extend(baseProps, {
  9716. onBeforeEnter(el) {
  9717. callHook(onBeforeEnter, [el]);
  9718. addTransitionClass(el, enterFromClass);
  9719. addTransitionClass(el, enterActiveClass);
  9720. },
  9721. onBeforeAppear(el) {
  9722. callHook(onBeforeAppear, [el]);
  9723. addTransitionClass(el, appearFromClass);
  9724. addTransitionClass(el, appearActiveClass);
  9725. },
  9726. onEnter: makeEnterHook(false),
  9727. onAppear: makeEnterHook(true),
  9728. onLeave(el, done) {
  9729. el._isLeaving = true;
  9730. const resolve = () => finishLeave(el, done);
  9731. addTransitionClass(el, leaveFromClass);
  9732. forceReflow();
  9733. addTransitionClass(el, leaveActiveClass);
  9734. nextFrame(() => {
  9735. if (!el._isLeaving) {
  9736. return;
  9737. }
  9738. removeTransitionClass(el, leaveFromClass);
  9739. addTransitionClass(el, leaveToClass);
  9740. if (!hasExplicitCallback(onLeave)) {
  9741. whenTransitionEnds(el, type, leaveDuration, resolve);
  9742. }
  9743. });
  9744. callHook(onLeave, [el, resolve]);
  9745. },
  9746. onEnterCancelled(el) {
  9747. finishEnter(el, false);
  9748. callHook(onEnterCancelled, [el]);
  9749. },
  9750. onAppearCancelled(el) {
  9751. finishEnter(el, true);
  9752. callHook(onAppearCancelled, [el]);
  9753. },
  9754. onLeaveCancelled(el) {
  9755. finishLeave(el);
  9756. callHook(onLeaveCancelled, [el]);
  9757. }
  9758. });
  9759. }
  9760. function normalizeDuration(duration) {
  9761. if (duration == null) {
  9762. return null;
  9763. } else if (isObject(duration)) {
  9764. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  9765. } else {
  9766. const n = NumberOf(duration);
  9767. return [n, n];
  9768. }
  9769. }
  9770. function NumberOf(val) {
  9771. const res = toNumber(val);
  9772. {
  9773. assertNumber(res, "<transition> explicit duration");
  9774. }
  9775. return res;
  9776. }
  9777. function addTransitionClass(el, cls) {
  9778. cls.split(/\s+/).forEach((c) => c && el.classList.add(c));
  9779. (el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls);
  9780. }
  9781. function removeTransitionClass(el, cls) {
  9782. cls.split(/\s+/).forEach((c) => c && el.classList.remove(c));
  9783. const { _vtc } = el;
  9784. if (_vtc) {
  9785. _vtc.delete(cls);
  9786. if (!_vtc.size) {
  9787. el._vtc = void 0;
  9788. }
  9789. }
  9790. }
  9791. function nextFrame(cb) {
  9792. requestAnimationFrame(() => {
  9793. requestAnimationFrame(cb);
  9794. });
  9795. }
  9796. let endId = 0;
  9797. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) {
  9798. const id = el._endId = ++endId;
  9799. const resolveIfNotStale = () => {
  9800. if (id === el._endId) {
  9801. resolve();
  9802. }
  9803. };
  9804. if (explicitTimeout) {
  9805. return setTimeout(resolveIfNotStale, explicitTimeout);
  9806. }
  9807. const { type, timeout, propCount } = getTransitionInfo(el, expectedType);
  9808. if (!type) {
  9809. return resolve();
  9810. }
  9811. const endEvent = type + "end";
  9812. let ended = 0;
  9813. const end = () => {
  9814. el.removeEventListener(endEvent, onEnd);
  9815. resolveIfNotStale();
  9816. };
  9817. const onEnd = (e) => {
  9818. if (e.target === el && ++ended >= propCount) {
  9819. end();
  9820. }
  9821. };
  9822. setTimeout(() => {
  9823. if (ended < propCount) {
  9824. end();
  9825. }
  9826. }, timeout + 1);
  9827. el.addEventListener(endEvent, onEnd);
  9828. }
  9829. function getTransitionInfo(el, expectedType) {
  9830. const styles = window.getComputedStyle(el);
  9831. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  9832. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  9833. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  9834. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  9835. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  9836. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  9837. const animationTimeout = getTimeout(animationDelays, animationDurations);
  9838. let type = null;
  9839. let timeout = 0;
  9840. let propCount = 0;
  9841. if (expectedType === TRANSITION) {
  9842. if (transitionTimeout > 0) {
  9843. type = TRANSITION;
  9844. timeout = transitionTimeout;
  9845. propCount = transitionDurations.length;
  9846. }
  9847. } else if (expectedType === ANIMATION) {
  9848. if (animationTimeout > 0) {
  9849. type = ANIMATION;
  9850. timeout = animationTimeout;
  9851. propCount = animationDurations.length;
  9852. }
  9853. } else {
  9854. timeout = Math.max(transitionTimeout, animationTimeout);
  9855. type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  9856. propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  9857. }
  9858. const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test(
  9859. getStyleProperties(`${TRANSITION}Property`).toString()
  9860. );
  9861. return {
  9862. type,
  9863. timeout,
  9864. propCount,
  9865. hasTransform
  9866. };
  9867. }
  9868. function getTimeout(delays, durations) {
  9869. while (delays.length < durations.length) {
  9870. delays = delays.concat(delays);
  9871. }
  9872. return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
  9873. }
  9874. function toMs(s) {
  9875. return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
  9876. }
  9877. function forceReflow() {
  9878. return document.body.offsetHeight;
  9879. }
  9880. const positionMap = /* @__PURE__ */ new WeakMap();
  9881. const newPositionMap = /* @__PURE__ */ new WeakMap();
  9882. const TransitionGroupImpl = {
  9883. name: "TransitionGroup",
  9884. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  9885. tag: String,
  9886. moveClass: String
  9887. }),
  9888. setup(props, { slots }) {
  9889. const instance = getCurrentInstance();
  9890. const state = useTransitionState();
  9891. let prevChildren;
  9892. let children;
  9893. onUpdated(() => {
  9894. if (!prevChildren.length) {
  9895. return;
  9896. }
  9897. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  9898. if (!hasCSSTransform(
  9899. prevChildren[0].el,
  9900. instance.vnode.el,
  9901. moveClass
  9902. )) {
  9903. return;
  9904. }
  9905. prevChildren.forEach(callPendingCbs);
  9906. prevChildren.forEach(recordPosition);
  9907. const movedChildren = prevChildren.filter(applyTranslation);
  9908. forceReflow();
  9909. movedChildren.forEach((c) => {
  9910. const el = c.el;
  9911. const style = el.style;
  9912. addTransitionClass(el, moveClass);
  9913. style.transform = style.webkitTransform = style.transitionDuration = "";
  9914. const cb = el._moveCb = (e) => {
  9915. if (e && e.target !== el) {
  9916. return;
  9917. }
  9918. if (!e || /transform$/.test(e.propertyName)) {
  9919. el.removeEventListener("transitionend", cb);
  9920. el._moveCb = null;
  9921. removeTransitionClass(el, moveClass);
  9922. }
  9923. };
  9924. el.addEventListener("transitionend", cb);
  9925. });
  9926. });
  9927. return () => {
  9928. const rawProps = toRaw(props);
  9929. const cssTransitionProps = resolveTransitionProps(rawProps);
  9930. let tag = rawProps.tag || Fragment;
  9931. prevChildren = children;
  9932. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  9933. for (let i = 0; i < children.length; i++) {
  9934. const child = children[i];
  9935. if (child.key != null) {
  9936. setTransitionHooks(
  9937. child,
  9938. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  9939. );
  9940. } else {
  9941. warn(`<TransitionGroup> children must be keyed.`);
  9942. }
  9943. }
  9944. if (prevChildren) {
  9945. for (let i = 0; i < prevChildren.length; i++) {
  9946. const child = prevChildren[i];
  9947. setTransitionHooks(
  9948. child,
  9949. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  9950. );
  9951. positionMap.set(child, child.el.getBoundingClientRect());
  9952. }
  9953. }
  9954. return createVNode(tag, null, children);
  9955. };
  9956. }
  9957. };
  9958. const removeMode = (props) => delete props.mode;
  9959. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  9960. const TransitionGroup = TransitionGroupImpl;
  9961. function callPendingCbs(c) {
  9962. const el = c.el;
  9963. if (el._moveCb) {
  9964. el._moveCb();
  9965. }
  9966. if (el._enterCb) {
  9967. el._enterCb();
  9968. }
  9969. }
  9970. function recordPosition(c) {
  9971. newPositionMap.set(c, c.el.getBoundingClientRect());
  9972. }
  9973. function applyTranslation(c) {
  9974. const oldPos = positionMap.get(c);
  9975. const newPos = newPositionMap.get(c);
  9976. const dx = oldPos.left - newPos.left;
  9977. const dy = oldPos.top - newPos.top;
  9978. if (dx || dy) {
  9979. const s = c.el.style;
  9980. s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
  9981. s.transitionDuration = "0s";
  9982. return c;
  9983. }
  9984. }
  9985. function hasCSSTransform(el, root, moveClass) {
  9986. const clone = el.cloneNode();
  9987. if (el._vtc) {
  9988. el._vtc.forEach((cls) => {
  9989. cls.split(/\s+/).forEach((c) => c && clone.classList.remove(c));
  9990. });
  9991. }
  9992. moveClass.split(/\s+/).forEach((c) => c && clone.classList.add(c));
  9993. clone.style.display = "none";
  9994. const container = root.nodeType === 1 ? root : root.parentNode;
  9995. container.appendChild(clone);
  9996. const { hasTransform } = getTransitionInfo(clone);
  9997. container.removeChild(clone);
  9998. return hasTransform;
  9999. }
  10000. const getModelAssigner = (vnode) => {
  10001. const fn = vnode.props["onUpdate:modelValue"] || false;
  10002. return isArray(fn) ? (value) => invokeArrayFns(fn, value) : fn;
  10003. };
  10004. function onCompositionStart(e) {
  10005. e.target.composing = true;
  10006. }
  10007. function onCompositionEnd(e) {
  10008. const target = e.target;
  10009. if (target.composing) {
  10010. target.composing = false;
  10011. target.dispatchEvent(new Event("input"));
  10012. }
  10013. }
  10014. const vModelText = {
  10015. created(el, { modifiers: { lazy, trim, number } }, vnode) {
  10016. el._assign = getModelAssigner(vnode);
  10017. const castToNumber = number || vnode.props && vnode.props.type === "number";
  10018. addEventListener(el, lazy ? "change" : "input", (e) => {
  10019. if (e.target.composing)
  10020. return;
  10021. let domValue = el.value;
  10022. if (trim) {
  10023. domValue = domValue.trim();
  10024. }
  10025. if (castToNumber) {
  10026. domValue = looseToNumber(domValue);
  10027. }
  10028. el._assign(domValue);
  10029. });
  10030. if (trim) {
  10031. addEventListener(el, "change", () => {
  10032. el.value = el.value.trim();
  10033. });
  10034. }
  10035. if (!lazy) {
  10036. addEventListener(el, "compositionstart", onCompositionStart);
  10037. addEventListener(el, "compositionend", onCompositionEnd);
  10038. addEventListener(el, "change", onCompositionEnd);
  10039. }
  10040. },
  10041. // set value on mounted so it's after min/max for type="range"
  10042. mounted(el, { value }) {
  10043. el.value = value == null ? "" : value;
  10044. },
  10045. beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
  10046. el._assign = getModelAssigner(vnode);
  10047. if (el.composing)
  10048. return;
  10049. if (document.activeElement === el && el.type !== "range") {
  10050. if (lazy) {
  10051. return;
  10052. }
  10053. if (trim && el.value.trim() === value) {
  10054. return;
  10055. }
  10056. if ((number || el.type === "number") && looseToNumber(el.value) === value) {
  10057. return;
  10058. }
  10059. }
  10060. const newValue = value == null ? "" : value;
  10061. if (el.value !== newValue) {
  10062. el.value = newValue;
  10063. }
  10064. }
  10065. };
  10066. const vModelCheckbox = {
  10067. // #4096 array checkboxes need to be deep traversed
  10068. deep: true,
  10069. created(el, _, vnode) {
  10070. el._assign = getModelAssigner(vnode);
  10071. addEventListener(el, "change", () => {
  10072. const modelValue = el._modelValue;
  10073. const elementValue = getValue(el);
  10074. const checked = el.checked;
  10075. const assign = el._assign;
  10076. if (isArray(modelValue)) {
  10077. const index = looseIndexOf(modelValue, elementValue);
  10078. const found = index !== -1;
  10079. if (checked && !found) {
  10080. assign(modelValue.concat(elementValue));
  10081. } else if (!checked && found) {
  10082. const filtered = [...modelValue];
  10083. filtered.splice(index, 1);
  10084. assign(filtered);
  10085. }
  10086. } else if (isSet(modelValue)) {
  10087. const cloned = new Set(modelValue);
  10088. if (checked) {
  10089. cloned.add(elementValue);
  10090. } else {
  10091. cloned.delete(elementValue);
  10092. }
  10093. assign(cloned);
  10094. } else {
  10095. assign(getCheckboxValue(el, checked));
  10096. }
  10097. });
  10098. },
  10099. // set initial checked on mount to wait for true-value/false-value
  10100. mounted: setChecked,
  10101. beforeUpdate(el, binding, vnode) {
  10102. el._assign = getModelAssigner(vnode);
  10103. setChecked(el, binding, vnode);
  10104. }
  10105. };
  10106. function setChecked(el, { value, oldValue }, vnode) {
  10107. el._modelValue = value;
  10108. if (isArray(value)) {
  10109. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  10110. } else if (isSet(value)) {
  10111. el.checked = value.has(vnode.props.value);
  10112. } else if (value !== oldValue) {
  10113. el.checked = looseEqual(value, getCheckboxValue(el, true));
  10114. }
  10115. }
  10116. const vModelRadio = {
  10117. created(el, { value }, vnode) {
  10118. el.checked = looseEqual(value, vnode.props.value);
  10119. el._assign = getModelAssigner(vnode);
  10120. addEventListener(el, "change", () => {
  10121. el._assign(getValue(el));
  10122. });
  10123. },
  10124. beforeUpdate(el, { value, oldValue }, vnode) {
  10125. el._assign = getModelAssigner(vnode);
  10126. if (value !== oldValue) {
  10127. el.checked = looseEqual(value, vnode.props.value);
  10128. }
  10129. }
  10130. };
  10131. const vModelSelect = {
  10132. // <select multiple> value need to be deep traversed
  10133. deep: true,
  10134. created(el, { value, modifiers: { number } }, vnode) {
  10135. const isSetModel = isSet(value);
  10136. addEventListener(el, "change", () => {
  10137. const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
  10138. (o) => number ? looseToNumber(getValue(o)) : getValue(o)
  10139. );
  10140. el._assign(
  10141. el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]
  10142. );
  10143. });
  10144. el._assign = getModelAssigner(vnode);
  10145. },
  10146. // set value in mounted & updated because <select> relies on its children
  10147. // <option>s.
  10148. mounted(el, { value }) {
  10149. setSelected(el, value);
  10150. },
  10151. beforeUpdate(el, _binding, vnode) {
  10152. el._assign = getModelAssigner(vnode);
  10153. },
  10154. updated(el, { value }) {
  10155. setSelected(el, value);
  10156. }
  10157. };
  10158. function setSelected(el, value) {
  10159. const isMultiple = el.multiple;
  10160. if (isMultiple && !isArray(value) && !isSet(value)) {
  10161. warn(
  10162. `<select multiple v-model> expects an Array or Set value for its binding, but got ${Object.prototype.toString.call(value).slice(8, -1)}.`
  10163. );
  10164. return;
  10165. }
  10166. for (let i = 0, l = el.options.length; i < l; i++) {
  10167. const option = el.options[i];
  10168. const optionValue = getValue(option);
  10169. if (isMultiple) {
  10170. if (isArray(value)) {
  10171. option.selected = looseIndexOf(value, optionValue) > -1;
  10172. } else {
  10173. option.selected = value.has(optionValue);
  10174. }
  10175. } else {
  10176. if (looseEqual(getValue(option), value)) {
  10177. if (el.selectedIndex !== i)
  10178. el.selectedIndex = i;
  10179. return;
  10180. }
  10181. }
  10182. }
  10183. if (!isMultiple && el.selectedIndex !== -1) {
  10184. el.selectedIndex = -1;
  10185. }
  10186. }
  10187. function getValue(el) {
  10188. return "_value" in el ? el._value : el.value;
  10189. }
  10190. function getCheckboxValue(el, checked) {
  10191. const key = checked ? "_trueValue" : "_falseValue";
  10192. return key in el ? el[key] : checked;
  10193. }
  10194. const vModelDynamic = {
  10195. created(el, binding, vnode) {
  10196. callModelHook(el, binding, vnode, null, "created");
  10197. },
  10198. mounted(el, binding, vnode) {
  10199. callModelHook(el, binding, vnode, null, "mounted");
  10200. },
  10201. beforeUpdate(el, binding, vnode, prevVNode) {
  10202. callModelHook(el, binding, vnode, prevVNode, "beforeUpdate");
  10203. },
  10204. updated(el, binding, vnode, prevVNode) {
  10205. callModelHook(el, binding, vnode, prevVNode, "updated");
  10206. }
  10207. };
  10208. function resolveDynamicModel(tagName, type) {
  10209. switch (tagName) {
  10210. case "SELECT":
  10211. return vModelSelect;
  10212. case "TEXTAREA":
  10213. return vModelText;
  10214. default:
  10215. switch (type) {
  10216. case "checkbox":
  10217. return vModelCheckbox;
  10218. case "radio":
  10219. return vModelRadio;
  10220. default:
  10221. return vModelText;
  10222. }
  10223. }
  10224. }
  10225. function callModelHook(el, binding, vnode, prevVNode, hook) {
  10226. const modelToUse = resolveDynamicModel(
  10227. el.tagName,
  10228. vnode.props && vnode.props.type
  10229. );
  10230. const fn = modelToUse[hook];
  10231. fn && fn(el, binding, vnode, prevVNode);
  10232. }
  10233. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  10234. const modifierGuards = {
  10235. stop: (e) => e.stopPropagation(),
  10236. prevent: (e) => e.preventDefault(),
  10237. self: (e) => e.target !== e.currentTarget,
  10238. ctrl: (e) => !e.ctrlKey,
  10239. shift: (e) => !e.shiftKey,
  10240. alt: (e) => !e.altKey,
  10241. meta: (e) => !e.metaKey,
  10242. left: (e) => "button" in e && e.button !== 0,
  10243. middle: (e) => "button" in e && e.button !== 1,
  10244. right: (e) => "button" in e && e.button !== 2,
  10245. exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
  10246. };
  10247. const withModifiers = (fn, modifiers) => {
  10248. return (event, ...args) => {
  10249. for (let i = 0; i < modifiers.length; i++) {
  10250. const guard = modifierGuards[modifiers[i]];
  10251. if (guard && guard(event, modifiers))
  10252. return;
  10253. }
  10254. return fn(event, ...args);
  10255. };
  10256. };
  10257. const keyNames = {
  10258. esc: "escape",
  10259. space: " ",
  10260. up: "arrow-up",
  10261. left: "arrow-left",
  10262. right: "arrow-right",
  10263. down: "arrow-down",
  10264. delete: "backspace"
  10265. };
  10266. const withKeys = (fn, modifiers) => {
  10267. return (event) => {
  10268. if (!("key" in event)) {
  10269. return;
  10270. }
  10271. const eventKey = hyphenate(event.key);
  10272. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  10273. return fn(event);
  10274. }
  10275. };
  10276. };
  10277. const vShow = {
  10278. beforeMount(el, { value }, { transition }) {
  10279. el._vod = el.style.display === "none" ? "" : el.style.display;
  10280. if (transition && value) {
  10281. transition.beforeEnter(el);
  10282. } else {
  10283. setDisplay(el, value);
  10284. }
  10285. },
  10286. mounted(el, { value }, { transition }) {
  10287. if (transition && value) {
  10288. transition.enter(el);
  10289. }
  10290. },
  10291. updated(el, { value, oldValue }, { transition }) {
  10292. if (!value === !oldValue)
  10293. return;
  10294. if (transition) {
  10295. if (value) {
  10296. transition.beforeEnter(el);
  10297. setDisplay(el, true);
  10298. transition.enter(el);
  10299. } else {
  10300. transition.leave(el, () => {
  10301. setDisplay(el, false);
  10302. });
  10303. }
  10304. } else {
  10305. setDisplay(el, value);
  10306. }
  10307. },
  10308. beforeUnmount(el, { value }) {
  10309. setDisplay(el, value);
  10310. }
  10311. };
  10312. function setDisplay(el, value) {
  10313. el.style.display = value ? el._vod : "none";
  10314. }
  10315. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  10316. let renderer;
  10317. let enabledHydration = false;
  10318. function ensureRenderer() {
  10319. return renderer || (renderer = createRenderer(rendererOptions));
  10320. }
  10321. function ensureHydrationRenderer() {
  10322. renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions);
  10323. enabledHydration = true;
  10324. return renderer;
  10325. }
  10326. const render = (...args) => {
  10327. ensureRenderer().render(...args);
  10328. };
  10329. const hydrate = (...args) => {
  10330. ensureHydrationRenderer().hydrate(...args);
  10331. };
  10332. const createApp = (...args) => {
  10333. const app = ensureRenderer().createApp(...args);
  10334. {
  10335. injectNativeTagCheck(app);
  10336. injectCompilerOptionsCheck(app);
  10337. }
  10338. const { mount } = app;
  10339. app.mount = (containerOrSelector) => {
  10340. const container = normalizeContainer(containerOrSelector);
  10341. if (!container)
  10342. return;
  10343. const component = app._component;
  10344. if (!isFunction(component) && !component.render && !component.template) {
  10345. component.template = container.innerHTML;
  10346. }
  10347. container.innerHTML = "";
  10348. const proxy = mount(container, false, container instanceof SVGElement);
  10349. if (container instanceof Element) {
  10350. container.removeAttribute("v-cloak");
  10351. container.setAttribute("data-v-app", "");
  10352. }
  10353. return proxy;
  10354. };
  10355. return app;
  10356. };
  10357. const createSSRApp = (...args) => {
  10358. const app = ensureHydrationRenderer().createApp(...args);
  10359. {
  10360. injectNativeTagCheck(app);
  10361. injectCompilerOptionsCheck(app);
  10362. }
  10363. const { mount } = app;
  10364. app.mount = (containerOrSelector) => {
  10365. const container = normalizeContainer(containerOrSelector);
  10366. if (container) {
  10367. return mount(container, true, container instanceof SVGElement);
  10368. }
  10369. };
  10370. return app;
  10371. };
  10372. function injectNativeTagCheck(app) {
  10373. Object.defineProperty(app.config, "isNativeTag", {
  10374. value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
  10375. writable: false
  10376. });
  10377. }
  10378. function injectCompilerOptionsCheck(app) {
  10379. if (isRuntimeOnly()) {
  10380. const isCustomElement = app.config.isCustomElement;
  10381. Object.defineProperty(app.config, "isCustomElement", {
  10382. get() {
  10383. return isCustomElement;
  10384. },
  10385. set() {
  10386. warn(
  10387. `The \`isCustomElement\` config option is deprecated. Use \`compilerOptions.isCustomElement\` instead.`
  10388. );
  10389. }
  10390. });
  10391. const compilerOptions = app.config.compilerOptions;
  10392. 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.
  10393. - For vue-loader: pass it via vue-loader's \`compilerOptions\` loader option.
  10394. - For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader
  10395. - 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`;
  10396. Object.defineProperty(app.config, "compilerOptions", {
  10397. get() {
  10398. warn(msg);
  10399. return compilerOptions;
  10400. },
  10401. set() {
  10402. warn(msg);
  10403. }
  10404. });
  10405. }
  10406. }
  10407. function normalizeContainer(container) {
  10408. if (isString(container)) {
  10409. const res = document.querySelector(container);
  10410. if (!res) {
  10411. warn(
  10412. `Failed to mount app: mount target selector "${container}" returned null.`
  10413. );
  10414. }
  10415. return res;
  10416. }
  10417. if (window.ShadowRoot && container instanceof window.ShadowRoot && container.mode === "closed") {
  10418. warn(
  10419. `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`
  10420. );
  10421. }
  10422. return container;
  10423. }
  10424. const initDirectivesForSSR = NOOP;
  10425. export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };