server-renderer.esm-browser.js 243 KB

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