convex-cms 0.0.9-alpha.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +27 -0
  2. package/admin/src/components/Header.tsx +1 -1
  3. package/admin/src/components/RouteGuard.tsx +1 -1
  4. package/admin/src/components/UploadDropzone.tsx +1 -1
  5. package/admin/src/components/cmsds/CmsFilterBar.tsx +74 -0
  6. package/admin/src/components/cmsds/CmsInput.tsx +24 -0
  7. package/admin/src/components/cmsds/CmsPagination.tsx +79 -0
  8. package/admin/src/components/cmsds/CmsSelect.tsx +59 -0
  9. package/admin/src/components/cmsds/CmsStatCard.tsx +79 -0
  10. package/admin/src/components/cmsds/CmsStatusBadge.tsx +1 -1
  11. package/admin/src/components/cmsds/index.ts +5 -0
  12. package/admin/src/components/ui/sidebar.tsx +1 -1
  13. package/admin/src/contexts/AuthContext.tsx +1 -1
  14. package/admin/src/contexts/ThemeContext.tsx +85 -17
  15. package/admin/src/embed/components/EmbedHeader.tsx +11 -9
  16. package/admin/src/embed/components/EmbedLayout.tsx +2 -6
  17. package/admin/src/embed/components/EmbedSidebar.tsx +16 -13
  18. package/admin/src/embed/contexts/ApiContext.tsx +1 -1
  19. package/admin/src/embed/index.tsx +3 -2
  20. package/admin/src/embed/types.ts +6 -0
  21. package/admin/src/hooks/usePermissions.ts +1 -1
  22. package/admin/src/index.css +432 -0
  23. package/admin/src/lib/cmsExports.ts +6 -0
  24. package/admin/src/pages/ContentPage.tsx +116 -172
  25. package/admin/src/pages/ContentTypeEntriesPage.tsx +120 -194
  26. package/admin/src/pages/ContentTypesPage.tsx +136 -139
  27. package/admin/src/pages/DashboardPage.tsx +15 -55
  28. package/admin/src/pages/MediaPage.tsx +31 -57
  29. package/admin/src/pages/SettingsPage.tsx +5 -1
  30. package/admin/src/pages/TrashPage.tsx +115 -170
  31. package/admin/src/routes/__root.tsx +1 -1
  32. package/admin-dist/nitro.json +1 -1
  33. package/admin-dist/public/assets/{CmsEmptyState-DTlpzjOI.js → CmsEmptyState-BKeL4DBB.js} +1 -1
  34. package/admin-dist/public/assets/CmsFilterBar-CEpMHd_c.js +1 -0
  35. package/admin-dist/public/assets/{CmsPageHeader-0REGRH4X.js → CmsPageHeader-CIEkTbyH.js} +1 -1
  36. package/admin-dist/public/assets/{CmsStatusBadge-D_n8u8xa.js → CmsStatusBadge-BFMOsfMW.js} +1 -1
  37. package/admin-dist/public/assets/{CmsSurface-BHmvNai4.js → CmsSurface-kqqaFKUI.js} +1 -1
  38. package/admin-dist/public/assets/CmsTable-Db53Exq0.js +1 -0
  39. package/admin-dist/public/assets/ContentEntryEditor-Ct7cHayy.js +4 -0
  40. package/admin-dist/public/assets/TaxonomyFilter-Bm1DI1A7.js +1 -0
  41. package/admin-dist/public/assets/_contentTypeId-BekeCblX.js +1 -0
  42. package/admin-dist/public/assets/{_entryId-jPXz4z9T.js → _entryId-CoZDE0l0.js} +1 -1
  43. package/admin-dist/public/assets/{alert-CG97cMfC.js → alert-CpLdsTGU.js} +1 -1
  44. package/admin-dist/public/assets/{badge-C6qt24oj.js → badge-BQAotc5B.js} +1 -1
  45. package/admin-dist/public/assets/{circle-check-big-PltpxuB1.js → circle-check-big-BF3Y5nES.js} +1 -1
  46. package/admin-dist/public/assets/{command-CJ8i86fd.js → command-lEq6f_Ee.js} +1 -1
  47. package/admin-dist/public/assets/content-DH6k0dN6.js +1 -0
  48. package/admin-dist/public/assets/content-types-DHr9tc2V.js +1 -0
  49. package/admin-dist/public/assets/index-Cf0lbl0G.js +1 -0
  50. package/admin-dist/public/assets/index-D-4wFfgU.css +1 -0
  51. package/admin-dist/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  52. package/admin-dist/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  53. package/admin-dist/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  54. package/admin-dist/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  55. package/admin-dist/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  56. package/admin-dist/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  57. package/admin-dist/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  58. package/admin-dist/public/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  59. package/admin-dist/public/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  60. package/admin-dist/public/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  61. package/admin-dist/public/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  62. package/admin-dist/public/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  63. package/admin-dist/public/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  64. package/admin-dist/public/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  65. package/admin-dist/public/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  66. package/admin-dist/public/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  67. package/admin-dist/public/assets/main-B-6700eG.js +137 -0
  68. package/admin-dist/public/assets/media-DY5zD52L.js +1 -0
  69. package/admin-dist/public/assets/{new._contentTypeId-qsvo01mH.js → new._contentTypeId-Dq_NqTQV.js} +1 -1
  70. package/admin-dist/public/assets/{pencil-gAL0R34f.js → pencil-CI_KfxSx.js} +1 -1
  71. package/admin-dist/public/assets/refresh-cw-BrXg9a2r.js +1 -0
  72. package/admin-dist/public/assets/rotate-ccw-PwzxdPxd.js +1 -0
  73. package/admin-dist/public/assets/{scroll-area-CJBhf9pf.js → scroll-area-DX_nZYp8.js} +1 -1
  74. package/admin-dist/public/assets/{search-WXp6KxDJ.js → search-DlwBH4C5.js} +1 -1
  75. package/admin-dist/public/assets/settings-2mx3_ORG.js +1 -0
  76. package/admin-dist/public/assets/{switch-Ck9ecqEX.js → switch-CjPi4DKH.js} +1 -1
  77. package/admin-dist/public/assets/{tabs-vQYu8rjC.js → tabs-B5X37GEM.js} +1 -1
  78. package/admin-dist/public/assets/tanstack-adapter-KSm-nO5L.js +1 -0
  79. package/admin-dist/public/assets/{taxonomies-DvILUNvr.js → taxonomies-CHjJKNlR.js} +1 -1
  80. package/admin-dist/public/assets/trash-Cle-tcqq.js +1 -0
  81. package/admin-dist/public/assets/{useBreadcrumbLabel-tlSh7dtO.js → useBreadcrumbLabel-yZQG_N_3.js} +1 -1
  82. package/admin-dist/public/assets/{usePermissions-BTGdTOJS.js → usePermissions-D6vsoaJf.js} +1 -1
  83. package/admin-dist/server/_libs/convex-helpers.mjs +1077 -2
  84. package/admin-dist/server/_libs/convex.mjs +222 -13
  85. package/admin-dist/server/_libs/lucide-react.mjs +57 -51
  86. package/admin-dist/server/_ssr/{CmsEmptyState-CB6e53i5.mjs → CmsEmptyState-DzzuQG0S.mjs} +1 -1
  87. package/admin-dist/server/_ssr/CmsFilterBar-C5XADS12.mjs +81 -0
  88. package/admin-dist/server/_ssr/{CmsPageHeader-COUHuECp.mjs → CmsPageHeader-DZ6h7smh.mjs} +1 -1
  89. package/admin-dist/server/_ssr/{CmsStatusBadge-kMTL6koE.mjs → CmsStatusBadge-D-YFSAa1.mjs} +3 -3
  90. package/admin-dist/server/_ssr/{CmsSurface-D1HDYjRg.mjs → CmsSurface-Cv51NBLZ.mjs} +1 -1
  91. package/admin-dist/server/_ssr/CmsTable-DG88C5nO.mjs +189 -0
  92. package/admin-dist/server/_ssr/{ContentEntryEditor-Bq8FR_uK.mjs → ContentEntryEditor-CRjwXB17.mjs} +10 -10
  93. package/admin-dist/server/_ssr/{TaxonomyFilter-bm_p4ADg.mjs → TaxonomyFilter-xGwcgtjr.mjs} +3 -3
  94. package/admin-dist/server/_ssr/{_contentTypeId-B7obLmi_.mjs → _contentTypeId-DRCfeKkm.mjs} +53 -12
  95. package/admin-dist/server/_ssr/{_entryId-B4zhQqFg.mjs → _entryId-DULm2TDy.mjs} +11 -11
  96. package/admin-dist/server/_ssr/_tanstack-start-manifest_v-iX3K33p1.mjs +4 -0
  97. package/admin-dist/server/_ssr/{badge-NOEC9bkk.mjs → badge-CbjIvhb6.mjs} +1 -1
  98. package/admin-dist/server/_ssr/{command-h4-OYNBo.mjs → command-xB2uiYps.mjs} +2 -2
  99. package/admin-dist/server/_ssr/{content-CShtLuhK.mjs → content-BfLBaJCZ.mjs} +108 -138
  100. package/admin-dist/server/_ssr/{content-types-PeyRyfbc.mjs → content-types-DZbF6O2q.mjs} +130 -119
  101. package/admin-dist/server/_ssr/{index-CplFXpGg.mjs → index-Cfe8sZv5.mjs} +65 -39
  102. package/admin-dist/server/_ssr/index.mjs +2 -2
  103. package/admin-dist/server/_ssr/{media-QAkNdX54.mjs → media-Bds2AnPC.mjs} +36 -56
  104. package/admin-dist/server/_ssr/{new._contentTypeId-DEJyMphJ.mjs → new._contentTypeId-DGvz_tlW.mjs} +10 -10
  105. package/admin-dist/server/_ssr/{router-CQXMuGMF.mjs → router-DxF7GBcO.mjs} +8804 -4995
  106. package/admin-dist/server/_ssr/{scroll-area-B7zoNyWB.mjs → scroll-area-DLDlXI07.mjs} +1 -1
  107. package/admin-dist/server/_ssr/{settings-CNaqVa4D.mjs → settings-BbaiS6z9.mjs} +13 -10
  108. package/admin-dist/server/_ssr/{switch-BKZhvryc.mjs → switch-Bl89Pfxu.mjs} +1 -1
  109. package/admin-dist/server/_ssr/{tabs-DtIIQxiD.mjs → tabs-QkbR0iir.mjs} +3 -3
  110. package/admin-dist/server/_ssr/{tanstack-adapter-CLavdbUY.mjs → tanstack-adapter-CKknPtcU.mjs} +19 -1
  111. package/admin-dist/server/_ssr/{taxonomies-vIZYICzr.mjs → taxonomies-S_Ontd0z.mjs} +9 -9
  112. package/admin-dist/server/_ssr/{trash-7yGR4-dF.mjs → trash-BzAIsbbN.mjs} +109 -132
  113. package/admin-dist/server/_ssr/{useBreadcrumbLabel-DR5FaAMf.mjs → useBreadcrumbLabel-BjiR1fM_.mjs} +1 -1
  114. package/admin-dist/server/_ssr/{usePermissions-DKkpETj_.mjs → usePermissions-CDHN95Nz.mjs} +1 -1
  115. package/admin-dist/server/index.mjs +284 -165
  116. package/package.json +3 -2
  117. package/admin/src/styles/globals.css +0 -104
  118. package/admin/src/styles/tailwind-config.css +0 -99
  119. package/admin/src/styles/theme.css +0 -261
  120. package/admin-dist/public/assets/CmsToolbar-CY6GV2L8.js +0 -1
  121. package/admin-dist/public/assets/ContentEntryEditor-CRgcRkk5.js +0 -4
  122. package/admin-dist/public/assets/TaxonomyFilter-Ohv5Jg9c.js +0 -1
  123. package/admin-dist/public/assets/_contentTypeId-C_vJq22X.js +0 -1
  124. package/admin-dist/public/assets/content-pKaIL2ru.js +0 -1
  125. package/admin-dist/public/assets/content-types-Bl_8I1Re.js +0 -1
  126. package/admin-dist/public/assets/globals-CoCRjt0K.css +0 -1
  127. package/admin-dist/public/assets/index-CtHq_P5q.js +0 -1
  128. package/admin-dist/public/assets/main-CA-4LyFT.js +0 -107
  129. package/admin-dist/public/assets/media-Bl1tBbJQ.js +0 -1
  130. package/admin-dist/public/assets/refresh-cw-sdVUGJNs.js +0 -1
  131. package/admin-dist/public/assets/rotate-ccw-6OcXCcxb.js +0 -1
  132. package/admin-dist/public/assets/settings-D8crrFCn.js +0 -1
  133. package/admin-dist/public/assets/tanstack-adapter-BRt2CUCw.js +0 -1
  134. package/admin-dist/public/assets/trash-YyYaC3L9.js +0 -1
  135. package/admin-dist/server/_ssr/CmsToolbar-NB014hsd.mjs +0 -48
  136. package/admin-dist/server/_ssr/_tanstack-start-manifest_v-DndoqCo7.mjs +0 -4
@@ -0,0 +1,137 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trash-Cle-tcqq.js","assets/tanstack-adapter-KSm-nO5L.js","assets/CmsSurface-kqqaFKUI.js","assets/badge-BQAotc5B.js","assets/CmsEmptyState-BKeL4DBB.js","assets/CmsPageHeader-CIEkTbyH.js","assets/CmsTable-Db53Exq0.js","assets/CmsFilterBar-CEpMHd_c.js","assets/search-DlwBH4C5.js","assets/alert-CpLdsTGU.js","assets/rotate-ccw-PwzxdPxd.js","assets/taxonomies-CHjJKNlR.js","assets/pencil-CI_KfxSx.js","assets/scroll-area-DX_nZYp8.js","assets/settings-2mx3_ORG.js","assets/usePermissions-D6vsoaJf.js","assets/switch-CjPi4DKH.js","assets/media-DY5zD52L.js","assets/tabs-B5X37GEM.js","assets/refresh-cw-BrXg9a2r.js","assets/TaxonomyFilter-Bm1DI1A7.js","assets/command-lEq6f_Ee.js","assets/content-types-DHr9tc2V.js","assets/content-DH6k0dN6.js","assets/circle-check-big-BF3Y5nES.js","assets/CmsStatusBadge-BFMOsfMW.js","assets/index-Cf0lbl0G.js","assets/_entryId-CoZDE0l0.js","assets/ContentEntryEditor-Ct7cHayy.js","assets/useBreadcrumbLabel-yZQG_N_3.js","assets/_contentTypeId-BekeCblX.js","assets/new._contentTypeId-Dq_NqTQV.js"])))=>i.map(i=>d[i]);
2
+ function C2(e,t){for(var n=0;n<t.length;n++){const o=t[n];if(typeof o!="string"&&!Array.isArray(o)){for(const s in o)if(s!=="default"&&!(s in e)){const c=Object.getOwnPropertyDescriptor(o,s);c&&Object.defineProperty(e,s,c.get?c:{enumerable:!0,get:()=>o[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function gE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var em={exports:{}},Tl={};var mx;function A2(){if(mx)return Tl;mx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,s,c){var u=null;if(c!==void 0&&(u=""+c),s.key!==void 0&&(u=""+s.key),"key"in s){c={};for(var f in s)f!=="key"&&(c[f]=s[f])}else c=s;return s=c.ref,{$$typeof:e,type:o,key:u,ref:s!==void 0?s:null,props:c}}return Tl.Fragment=t,Tl.jsx=n,Tl.jsxs=n,Tl}var gx;function R2(){return gx||(gx=1,em.exports=A2()),em.exports}var w=R2(),tm={exports:{}},Ae={};var yx;function N2(){if(yx)return Ae;yx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function x(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,A={};function I(z,Y,ie){this.props=z,this.context=Y,this.refs=A,this.updater=ie||C}I.prototype.isReactComponent={},I.prototype.setState=function(z,Y){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,Y,"setState")},I.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function k(){}k.prototype=I.prototype;function R(z,Y,ie){this.props=z,this.context=Y,this.refs=A,this.updater=ie||C}var N=R.prototype=new k;N.constructor=R,S(N,I.prototype),N.isPureReactComponent=!0;var j=Array.isArray;function B(){}var P={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function U(z,Y,ie){var se=ie.ref;return{$$typeof:e,type:z,key:Y,ref:se!==void 0?se:null,props:ie}}function ee(z,Y){return U(z.type,Y,z.props)}function ae(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function re(z){var Y={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(ie){return Y[ie]})}var ue=/\/+/g;function ce(z,Y){return typeof z=="object"&&z!==null&&z.key!=null?re(""+z.key):Y.toString(36)}function he(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(B,B):(z.status="pending",z.then(function(Y){z.status==="pending"&&(z.status="fulfilled",z.value=Y)},function(Y){z.status==="pending"&&(z.status="rejected",z.reason=Y)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function F(z,Y,ie,se,de){var ve=typeof z;(ve==="undefined"||ve==="boolean")&&(z=null);var J=!1;if(z===null)J=!0;else switch(ve){case"bigint":case"string":case"number":J=!0;break;case"object":switch(z.$$typeof){case e:case t:J=!0;break;case y:return J=z._init,F(J(z._payload),Y,ie,se,de)}}if(J)return de=de(z),J=se===""?"."+ce(z,0):se,j(de)?(ie="",J!=null&&(ie=J.replace(ue,"$&/")+"/"),F(de,Y,ie,"",function(Ce){return Ce})):de!=null&&(ae(de)&&(de=ee(de,ie+(de.key==null||z&&z.key===de.key?"":(""+de.key).replace(ue,"$&/")+"/")+J)),Y.push(de)),1;J=0;var _e=se===""?".":se+":";if(j(z))for(var Te=0;Te<z.length;Te++)se=z[Te],ve=_e+ce(se,Te),J+=F(se,Y,ie,ve,de);else if(Te=x(z),typeof Te=="function")for(z=Te.call(z),Te=0;!(se=z.next()).done;)se=se.value,ve=_e+ce(se,Te++),J+=F(se,Y,ie,ve,de);else if(ve==="object"){if(typeof z.then=="function")return F(he(z),Y,ie,se,de);throw Y=String(z),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return J}function X(z,Y,ie){if(z==null)return z;var se=[],de=0;return F(z,se,"","",function(ve){return Y.call(ie,ve,de++)}),se}function Z(z){if(z._status===-1){var Y=z._result;Y=Y(),Y.then(function(ie){(z._status===0||z._status===-1)&&(z._status=1,z._result=ie)},function(ie){(z._status===0||z._status===-1)&&(z._status=2,z._result=ie)}),z._status===-1&&(z._status=0,z._result=Y)}if(z._status===1)return z._result.default;throw z._result}var oe=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},be={map:X,forEach:function(z,Y,ie){X(z,function(){Y.apply(this,arguments)},ie)},count:function(z){var Y=0;return X(z,function(){Y++}),Y},toArray:function(z){return X(z,function(Y){return Y})||[]},only:function(z){if(!ae(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Ae.Activity=g,Ae.Children=be,Ae.Component=I,Ae.Fragment=n,Ae.Profiler=s,Ae.PureComponent=R,Ae.StrictMode=o,Ae.Suspense=h,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(z){return P.H.useMemoCache(z)}},Ae.cache=function(z){return function(){return z.apply(null,arguments)}},Ae.cacheSignal=function(){return null},Ae.cloneElement=function(z,Y,ie){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var se=S({},z.props),de=z.key;if(Y!=null)for(ve in Y.key!==void 0&&(de=""+Y.key),Y)!M.call(Y,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&Y.ref===void 0||(se[ve]=Y[ve]);var ve=arguments.length-2;if(ve===1)se.children=ie;else if(1<ve){for(var J=Array(ve),_e=0;_e<ve;_e++)J[_e]=arguments[_e+2];se.children=J}return U(z.type,de,se)},Ae.createContext=function(z){return z={$$typeof:u,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:c,_context:z},z},Ae.createElement=function(z,Y,ie){var se,de={},ve=null;if(Y!=null)for(se in Y.key!==void 0&&(ve=""+Y.key),Y)M.call(Y,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(de[se]=Y[se]);var J=arguments.length-2;if(J===1)de.children=ie;else if(1<J){for(var _e=Array(J),Te=0;Te<J;Te++)_e[Te]=arguments[Te+2];de.children=_e}if(z&&z.defaultProps)for(se in J=z.defaultProps,J)de[se]===void 0&&(de[se]=J[se]);return U(z,ve,de)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(z){return{$$typeof:f,render:z}},Ae.isValidElement=ae,Ae.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:Z}},Ae.memo=function(z,Y){return{$$typeof:p,type:z,compare:Y===void 0?null:Y}},Ae.startTransition=function(z){var Y=P.T,ie={};P.T=ie;try{var se=z(),de=P.S;de!==null&&de(ie,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(B,oe)}catch(ve){oe(ve)}finally{Y!==null&&ie.types!==null&&(Y.types=ie.types),P.T=Y}},Ae.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Ae.use=function(z){return P.H.use(z)},Ae.useActionState=function(z,Y,ie){return P.H.useActionState(z,Y,ie)},Ae.useCallback=function(z,Y){return P.H.useCallback(z,Y)},Ae.useContext=function(z){return P.H.useContext(z)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(z,Y){return P.H.useDeferredValue(z,Y)},Ae.useEffect=function(z,Y){return P.H.useEffect(z,Y)},Ae.useEffectEvent=function(z){return P.H.useEffectEvent(z)},Ae.useId=function(){return P.H.useId()},Ae.useImperativeHandle=function(z,Y,ie){return P.H.useImperativeHandle(z,Y,ie)},Ae.useInsertionEffect=function(z,Y){return P.H.useInsertionEffect(z,Y)},Ae.useLayoutEffect=function(z,Y){return P.H.useLayoutEffect(z,Y)},Ae.useMemo=function(z,Y){return P.H.useMemo(z,Y)},Ae.useOptimistic=function(z,Y){return P.H.useOptimistic(z,Y)},Ae.useReducer=function(z,Y,ie){return P.H.useReducer(z,Y,ie)},Ae.useRef=function(z){return P.H.useRef(z)},Ae.useState=function(z){return P.H.useState(z)},Ae.useSyncExternalStore=function(z,Y,ie){return P.H.useSyncExternalStore(z,Y,ie)},Ae.useTransition=function(){return P.H.useTransition()},Ae.version="19.2.4",Ae}var vx;function uc(){return vx||(vx=1,tm.exports=N2()),tm.exports}var _=uc();const sn=gE(_),Kd=C2({__proto__:null,default:sn},[_]);var nm={exports:{}},Cl={},rm={exports:{}},om={};var bx;function I2(){return bx||(bx=1,(function(e){function t(F,X){var Z=F.length;F.push(X);e:for(;0<Z;){var oe=Z-1>>>1,be=F[oe];if(0<s(be,X))F[oe]=X,F[Z]=be,Z=oe;else break e}}function n(F){return F.length===0?null:F[0]}function o(F){if(F.length===0)return null;var X=F[0],Z=F.pop();if(Z!==X){F[0]=Z;e:for(var oe=0,be=F.length,z=be>>>1;oe<z;){var Y=2*(oe+1)-1,ie=F[Y],se=Y+1,de=F[se];if(0>s(ie,Z))se<be&&0>s(de,ie)?(F[oe]=de,F[se]=Z,oe=se):(F[oe]=ie,F[Y]=Z,oe=Y);else if(se<be&&0>s(de,Z))F[oe]=de,F[se]=Z,oe=se;else break e}}return X}function s(F,X){var Z=F.sortIndex-X.sortIndex;return Z!==0?Z:F.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],y=1,g=null,b=3,x=!1,C=!1,S=!1,A=!1,I=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function N(F){for(var X=n(p);X!==null;){if(X.callback===null)o(p);else if(X.startTime<=F)o(p),X.sortIndex=X.expirationTime,t(h,X);else break;X=n(p)}}function j(F){if(S=!1,N(F),!C)if(n(h)!==null)C=!0,B||(B=!0,re());else{var X=n(p);X!==null&&he(j,X.startTime-F)}}var B=!1,P=-1,M=5,U=-1;function ee(){return A?!0:!(e.unstable_now()-U<M)}function ae(){if(A=!1,B){var F=e.unstable_now();U=F;var X=!0;try{e:{C=!1,S&&(S=!1,k(P),P=-1),x=!0;var Z=b;try{t:{for(N(F),g=n(h);g!==null&&!(g.expirationTime>F&&ee());){var oe=g.callback;if(typeof oe=="function"){g.callback=null,b=g.priorityLevel;var be=oe(g.expirationTime<=F);if(F=e.unstable_now(),typeof be=="function"){g.callback=be,N(F),X=!0;break t}g===n(h)&&o(h),N(F)}else o(h);g=n(h)}if(g!==null)X=!0;else{var z=n(p);z!==null&&he(j,z.startTime-F),X=!1}}break e}finally{g=null,b=Z,x=!1}X=void 0}}finally{X?re():B=!1}}}var re;if(typeof R=="function")re=function(){R(ae)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,ce=ue.port2;ue.port1.onmessage=ae,re=function(){ce.postMessage(null)}}else re=function(){I(ae,0)};function he(F,X){P=I(function(){F(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(F){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var Z=b;b=X;try{return F()}finally{b=Z}},e.unstable_requestPaint=function(){A=!0},e.unstable_runWithPriority=function(F,X){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var Z=b;b=F;try{return X()}finally{b=Z}},e.unstable_scheduleCallback=function(F,X,Z){var oe=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?oe+Z:oe):Z=oe,F){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=Z+be,F={id:y++,callback:X,priorityLevel:F,startTime:Z,expirationTime:be,sortIndex:-1},Z>oe?(F.sortIndex=Z,t(p,F),n(h)===null&&F===n(p)&&(S?(k(P),P=-1):S=!0,he(j,Z-oe))):(F.sortIndex=be,t(h,F),C||x||(C=!0,B||(B=!0,re()))),F},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(F){var X=b;return function(){var Z=b;b=X;try{return F.apply(this,arguments)}finally{b=Z}}}})(om)),om}var wx;function O2(){return wx||(wx=1,rm.exports=I2()),rm.exports}var im={exports:{}},rn={};var xx;function k2(){if(xx)return rn;xx=1;var e=uc();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var o={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function c(h,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:h,containerInfo:p,implementation:y}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return rn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,rn.createPortal=function(h,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(h,p,null,y)},rn.flushSync=function(h){var p=u.T,y=o.p;try{if(u.T=null,o.p=2,h)return h()}finally{u.T=p,o.p=y,o.d.f()}},rn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(h,p))},rn.prefetchDNS=function(h){typeof h=="string"&&o.d.D(h)},rn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,g=f(y,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:x}):y==="script"&&o.d.X(h,{crossOrigin:g,integrity:b,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},rn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=f(p.as,p.crossOrigin);o.d.M(h,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(h)},rn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=f(y,p.crossOrigin);o.d.L(h,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},rn.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=f(p.as,p.crossOrigin);o.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(h)},rn.requestFormReset=function(h){o.d.r(h)},rn.unstable_batchedUpdates=function(h,p){return h(p)},rn.useFormState=function(h,p,y){return u.H.useFormState(h,p,y)},rn.useFormStatus=function(){return u.H.useHostTransitionStatus()},rn.version="19.2.4",rn}var Sx;function yE(){if(Sx)return im.exports;Sx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),im.exports=k2(),im.exports}var _x;function M2(){if(_x)return Cl;_x=1;var e=O2(),t=uc(),n=yE();function o(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var i=r,l=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(l=i.return),r=i.return;while(r)}return i.tag===3?l:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function h(r){if(c(r)!==r)throw Error(o(188))}function p(r){var i=r.alternate;if(!i){if(i=c(r),i===null)throw Error(o(188));return i!==r?null:r}for(var l=r,d=i;;){var m=l.return;if(m===null)break;var v=m.alternate;if(v===null){if(d=m.return,d!==null){l=d;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===l)return h(m),r;if(v===d)return h(m),i;v=v.sibling}throw Error(o(188))}if(l.return!==d.return)l=m,d=v;else{for(var E=!1,O=m.child;O;){if(O===l){E=!0,l=m,d=v;break}if(O===d){E=!0,d=m,l=v;break}O=O.sibling}if(!E){for(O=v.child;O;){if(O===l){E=!0,l=v,d=m;break}if(O===d){E=!0,d=v,l=m;break}O=O.sibling}if(!E)throw Error(o(189))}}if(l.alternate!==d)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?r:i}function y(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=y(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),R=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),ee=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function re(r){return r===null||typeof r!="object"?null:(r=ae&&r[ae]||r["@@iterator"],typeof r=="function"?r:null)}var ue=Symbol.for("react.client.reference");function ce(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ue?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case S:return"Fragment";case I:return"Profiler";case A:return"StrictMode";case j:return"Suspense";case B:return"SuspenseList";case U:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case C:return"Portal";case R:return r.displayName||"Context";case k:return(r._context.displayName||"Context")+".Consumer";case N:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case P:return i=r.displayName||null,i!==null?i:ce(r.type)||"Memo";case M:i=r._payload,r=r._init;try{return ce(r(i))}catch{}}return null}var he=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},oe=[],be=-1;function z(r){return{current:r}}function Y(r){0>be||(r.current=oe[be],oe[be]=null,be--)}function ie(r,i){be++,oe[be]=r.current,r.current=i}var se=z(null),de=z(null),ve=z(null),J=z(null);function _e(r,i){switch(ie(ve,i),ie(de,r),ie(se,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?P0(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=P0(i),r=$0(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Y(se),ie(se,r)}function Te(){Y(se),Y(de),Y(ve)}function Ce(r){r.memoizedState!==null&&ie(J,r);var i=se.current,l=$0(i,r.type);i!==l&&(ie(de,r),ie(se,l))}function Ie(r){de.current===r&&(Y(se),Y(de)),J.current===r&&(Y(J),xl._currentValue=Z)}var je,gt;function Lt(r){if(je===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);je=i&&i[1]||"",gt=-1<l.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+je+r+gt}var In=!1;function Hn(r,i){if(!r||In)return"";In=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(G){var Q=G}Reflect.construct(r,[],ne)}else{try{ne.call()}catch(G){Q=G}r.call(ne.prototype)}}else{try{throw Error()}catch(G){Q=G}(ne=r())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(G){if(G&&Q&&typeof G.stack=="string")return[G.stack,Q.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),E=v[0],O=v[1];if(E&&O){var L=E.split(`
5
+ `),H=O.split(`
6
+ `);for(m=d=0;d<L.length&&!L[d].includes("DetermineComponentFrameRoot");)d++;for(;m<H.length&&!H[m].includes("DetermineComponentFrameRoot");)m++;if(d===L.length||m===H.length)for(d=L.length-1,m=H.length-1;1<=d&&0<=m&&L[d]!==H[m];)m--;for(;1<=d&&0<=m;d--,m--)if(L[d]!==H[m]){if(d!==1||m!==1)do if(d--,m--,0>m||L[d]!==H[m]){var K=`
7
+ `+L[d].replace(" at new "," at ");return r.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",r.displayName)),K}while(1<=d&&0<=m);break}}}finally{In=!1,Error.prepareStackTrace=l}return(l=r?r.displayName||r.name:"")?Lt(l):""}function tn(r,i){switch(r.tag){case 26:case 27:case 5:return Lt(r.type);case 16:return Lt("Lazy");case 13:return r.child!==i&&i!==null?Lt("Suspense Fallback"):Lt("Suspense");case 19:return Lt("SuspenseList");case 0:case 15:return Hn(r.type,!1);case 11:return Hn(r.type.render,!1);case 1:return Hn(r.type,!0);case 31:return Lt("Activity");default:return""}}function Ct(r){try{var i="",l=null;do i+=tn(r,l),l=r,r=r.return;while(r);return i}catch(d){return`
8
+ Error generating stack: `+d.message+`
9
+ `+d.stack}}var le=Object.prototype.hasOwnProperty,Oe=e.unstable_scheduleCallback,qe=e.unstable_cancelCallback,Le=e.unstable_shouldYield,Vt=e.unstable_requestPaint,cn=e.unstable_now,Bf=e.unstable_getCurrentPriorityLevel,at=e.unstable_ImmediatePriority,Ht=e.unstable_UserBlockingPriority,nn=e.unstable_NormalPriority,Rc=e.unstable_LowPriority,vv=e.unstable_IdlePriority,lI=e.log,cI=e.unstable_setDisableYieldValue,Ma=null,On=null;function yo(r){if(typeof lI=="function"&&cI(r),On&&typeof On.setStrictMode=="function")try{On.setStrictMode(Ma,r)}catch{}}var kn=Math.clz32?Math.clz32:fI,uI=Math.log,dI=Math.LN2;function fI(r){return r>>>=0,r===0?32:31-(uI(r)/dI|0)|0}var Nc=256,Ic=262144,Oc=4194304;function hi(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function kc(r,i,l){var d=r.pendingLanes;if(d===0)return 0;var m=0,v=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var O=d&134217727;return O!==0?(d=O&~v,d!==0?m=hi(d):(E&=O,E!==0?m=hi(E):l||(l=O&~r,l!==0&&(m=hi(l))))):(O=d&~v,O!==0?m=hi(O):E!==0?m=hi(E):l||(l=d&~r,l!==0&&(m=hi(l)))),m===0?0:i!==0&&i!==m&&(i&v)===0&&(v=m&-m,l=i&-i,v>=l||v===32&&(l&4194048)!==0)?i:m}function Da(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function hI(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bv(){var r=Oc;return Oc<<=1,(Oc&62914560)===0&&(Oc=4194304),r}function qf(r){for(var i=[],l=0;31>l;l++)i.push(r);return i}function ja(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function pI(r,i,l,d,m,v){var E=r.pendingLanes;r.pendingLanes=l,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=l,r.entangledLanes&=l,r.errorRecoveryDisabledLanes&=l,r.shellSuspendCounter=0;var O=r.entanglements,L=r.expirationTimes,H=r.hiddenUpdates;for(l=E&~l;0<l;){var K=31-kn(l),ne=1<<K;O[K]=0,L[K]=-1;var Q=H[K];if(Q!==null)for(H[K]=null,K=0;K<Q.length;K++){var G=Q[K];G!==null&&(G.lane&=-536870913)}l&=~ne}d!==0&&wv(r,d,0),v!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=v&~(E&~i))}function wv(r,i,l){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-kn(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|l&261930}function xv(r,i){var l=r.entangledLanes|=i;for(r=r.entanglements;l;){var d=31-kn(l),m=1<<d;m&i|r[d]&i&&(r[d]|=i),l&=~m}}function Sv(r,i){var l=i&-i;return l=(l&42)!==0?1:Uf(l),(l&(r.suspendedLanes|i))!==0?0:l}function Uf(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Vf(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function _v(){var r=X.p;return r!==0?r:(r=window.event,r===void 0?32:lx(r.type))}function Ev(r,i){var l=X.p;try{return X.p=r,i()}finally{X.p=l}}var vo=Math.random().toString(36).slice(2),Qt="__reactFiber$"+vo,yn="__reactProps$"+vo,is="__reactContainer$"+vo,Hf="__reactEvents$"+vo,mI="__reactListeners$"+vo,gI="__reactHandles$"+vo,Tv="__reactResources$"+vo,La="__reactMarker$"+vo;function Qf(r){delete r[Qt],delete r[yn],delete r[Hf],delete r[mI],delete r[gI]}function ss(r){var i=r[Qt];if(i)return i;for(var l=r.parentNode;l;){if(i=l[is]||l[Qt]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(r=Q0(r);r!==null;){if(l=r[Qt])return l;r=Q0(r)}return i}r=l,l=r.parentNode}return null}function as(r){if(r=r[Qt]||r[is]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function za(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(o(33))}function ls(r){var i=r[Tv];return i||(i=r[Tv]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Bt(r){r[La]=!0}var Cv=new Set,Av={};function pi(r,i){cs(r,i),cs(r+"Capture",i)}function cs(r,i){for(Av[r]=i,r=0;r<i.length;r++)Cv.add(i[r])}var yI=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Rv={},Nv={};function vI(r){return le.call(Nv,r)?!0:le.call(Rv,r)?!1:yI.test(r)?Nv[r]=!0:(Rv[r]=!0,!1)}function Mc(r,i,l){if(vI(i))if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+l)}}function Dc(r,i,l){if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+l)}}function qr(r,i,l,d){if(d===null)r.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(l);return}r.setAttributeNS(i,l,""+d)}}function Qn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Iv(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function bI(r,i,l){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return m.call(this)},set:function(E){l=""+E,v.call(this,E)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(E){l=""+E},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Zf(r){if(!r._valueTracker){var i=Iv(r)?"checked":"value";r._valueTracker=bI(r,i,""+r[i])}}function Ov(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var l=i.getValue(),d="";return r&&(d=Iv(r)?r.checked?"true":"false":r.value),r=d,r!==l?(i.setValue(r),!0):!1}function jc(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var wI=/[\n"\\]/g;function Zn(r){return r.replace(wI,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Gf(r,i,l,d,m,v,E,O){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),i!=null?E==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Qn(i)):r.value!==""+Qn(i)&&(r.value=""+Qn(i)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),i!=null?Yf(r,E,Qn(i)):l!=null?Yf(r,E,Qn(l)):d!=null&&r.removeAttribute("value"),m==null&&v!=null&&(r.defaultChecked=!!v),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?r.name=""+Qn(O):r.removeAttribute("name")}function kv(r,i,l,d,m,v,E,O){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Zf(r);return}l=l!=null?""+Qn(l):"",i=i!=null?""+Qn(i):l,O||i===r.value||(r.value=i),r.defaultValue=i}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=O?r.checked:!!d,r.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),Zf(r)}function Yf(r,i,l){i==="number"&&jc(r.ownerDocument)===r||r.defaultValue===""+l||(r.defaultValue=""+l)}function us(r,i,l,d){if(r=r.options,i){i={};for(var m=0;m<l.length;m++)i["$"+l[m]]=!0;for(l=0;l<r.length;l++)m=i.hasOwnProperty("$"+r[l].value),r[l].selected!==m&&(r[l].selected=m),m&&d&&(r[l].defaultSelected=!0)}else{for(l=""+Qn(l),i=null,m=0;m<r.length;m++){if(r[m].value===l){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}i!==null||r[m].disabled||(i=r[m])}i!==null&&(i.selected=!0)}}function Mv(r,i,l){if(i!=null&&(i=""+Qn(i),i!==r.value&&(r.value=i),l==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=l!=null?""+Qn(l):""}function Dv(r,i,l,d){if(i==null){if(d!=null){if(l!=null)throw Error(o(92));if(he(d)){if(1<d.length)throw Error(o(93));d=d[0]}l=d}l==null&&(l=""),i=l}l=Qn(i),r.defaultValue=l,d=r.textContent,d===l&&d!==""&&d!==null&&(r.value=d),Zf(r)}function ds(r,i){if(i){var l=r.firstChild;if(l&&l===r.lastChild&&l.nodeType===3){l.nodeValue=i;return}}r.textContent=i}var xI=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function jv(r,i,l){var d=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,l):typeof l!="number"||l===0||xI.has(i)?i==="float"?r.cssFloat=l:r[i]=(""+l).trim():r[i]=l+"px"}function Lv(r,i,l){if(i!=null&&typeof i!="object")throw Error(o(62));if(r=r.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in i)d=i[m],i.hasOwnProperty(m)&&l[m]!==d&&jv(r,m,d)}else for(var v in i)i.hasOwnProperty(v)&&jv(r,v,i[v])}function Kf(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var SI=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),_I=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Lc(r){return _I.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Ur(){}var Xf=null;function Jf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var fs=null,hs=null;function zv(r){var i=as(r);if(i&&(r=i.stateNode)){var l=r[yn]||null;e:switch(r=i.stateNode,i.type){case"input":if(Gf(r,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=r;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Zn(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var d=l[i];if(d!==r&&d.form===r.form){var m=d[yn]||null;if(!m)throw Error(o(90));Gf(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(i=0;i<l.length;i++)d=l[i],d.form===r.form&&Ov(d)}break e;case"textarea":Mv(r,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&us(r,!!l.multiple,i,!1)}}}var Wf=!1;function Pv(r,i,l){if(Wf)return r(i,l);Wf=!0;try{var d=r(i);return d}finally{if(Wf=!1,(fs!==null||hs!==null)&&(_u(),fs&&(i=fs,r=hs,hs=fs=null,zv(i),r)))for(i=0;i<r.length;i++)zv(r[i])}}function Pa(r,i){var l=r.stateNode;if(l===null)return null;var d=l[yn]||null;if(d===null)return null;l=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(l&&typeof l!="function")throw Error(o(231,i,typeof l));return l}var Vr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eh=!1;if(Vr)try{var $a={};Object.defineProperty($a,"passive",{get:function(){eh=!0}}),window.addEventListener("test",$a,$a),window.removeEventListener("test",$a,$a)}catch{eh=!1}var bo=null,th=null,zc=null;function $v(){if(zc)return zc;var r,i=th,l=i.length,d,m="value"in bo?bo.value:bo.textContent,v=m.length;for(r=0;r<l&&i[r]===m[r];r++);var E=l-r;for(d=1;d<=E&&i[l-d]===m[v-d];d++);return zc=m.slice(r,1<d?1-d:void 0)}function Pc(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function $c(){return!0}function Fv(){return!1}function vn(r){function i(l,d,m,v,E){this._reactName=l,this._targetInst=m,this.type=d,this.nativeEvent=v,this.target=E,this.currentTarget=null;for(var O in r)r.hasOwnProperty(O)&&(l=r[O],this[O]=l?l(v):v[O]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?$c:Fv,this.isPropagationStopped=Fv,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=$c)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=$c)},persist:function(){},isPersistent:$c}),i}var mi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fc=vn(mi),Fa=g({},mi,{view:0,detail:0}),EI=vn(Fa),nh,rh,Ba,Bc=g({},Fa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ih,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ba&&(Ba&&r.type==="mousemove"?(nh=r.screenX-Ba.screenX,rh=r.screenY-Ba.screenY):rh=nh=0,Ba=r),nh)},movementY:function(r){return"movementY"in r?r.movementY:rh}}),Bv=vn(Bc),TI=g({},Bc,{dataTransfer:0}),CI=vn(TI),AI=g({},Fa,{relatedTarget:0}),oh=vn(AI),RI=g({},mi,{animationName:0,elapsedTime:0,pseudoElement:0}),NI=vn(RI),II=g({},mi,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),OI=vn(II),kI=g({},mi,{data:0}),qv=vn(kI),MI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},DI={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},jI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LI(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=jI[r])?!!i[r]:!1}function ih(){return LI}var zI=g({},Fa,{key:function(r){if(r.key){var i=MI[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Pc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?DI[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ih,charCode:function(r){return r.type==="keypress"?Pc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Pc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),PI=vn(zI),$I=g({},Bc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uv=vn($I),FI=g({},Fa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ih}),BI=vn(FI),qI=g({},mi,{propertyName:0,elapsedTime:0,pseudoElement:0}),UI=vn(qI),VI=g({},Bc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),HI=vn(VI),QI=g({},mi,{newState:0,oldState:0}),ZI=vn(QI),GI=[9,13,27,32],sh=Vr&&"CompositionEvent"in window,qa=null;Vr&&"documentMode"in document&&(qa=document.documentMode);var YI=Vr&&"TextEvent"in window&&!qa,Vv=Vr&&(!sh||qa&&8<qa&&11>=qa),Hv=" ",Qv=!1;function Zv(r,i){switch(r){case"keyup":return GI.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gv(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ps=!1;function KI(r,i){switch(r){case"compositionend":return Gv(i);case"keypress":return i.which!==32?null:(Qv=!0,Hv);case"textInput":return r=i.data,r===Hv&&Qv?null:r;default:return null}}function XI(r,i){if(ps)return r==="compositionend"||!sh&&Zv(r,i)?(r=$v(),zc=th=bo=null,ps=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Vv&&i.locale!=="ko"?null:i.data;default:return null}}var JI={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Yv(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!JI[r.type]:i==="textarea"}function Kv(r,i,l,d){fs?hs?hs.push(d):hs=[d]:fs=d,i=Iu(i,"onChange"),0<i.length&&(l=new Fc("onChange","change",null,l,d),r.push({event:l,listeners:i}))}var Ua=null,Va=null;function WI(r){k0(r,0)}function qc(r){var i=za(r);if(Ov(i))return r}function Xv(r,i){if(r==="change")return i}var Jv=!1;if(Vr){var ah;if(Vr){var lh="oninput"in document;if(!lh){var Wv=document.createElement("div");Wv.setAttribute("oninput","return;"),lh=typeof Wv.oninput=="function"}ah=lh}else ah=!1;Jv=ah&&(!document.documentMode||9<document.documentMode)}function eb(){Ua&&(Ua.detachEvent("onpropertychange",tb),Va=Ua=null)}function tb(r){if(r.propertyName==="value"&&qc(Va)){var i=[];Kv(i,Va,r,Jf(r)),Pv(WI,i)}}function eO(r,i,l){r==="focusin"?(eb(),Ua=i,Va=l,Ua.attachEvent("onpropertychange",tb)):r==="focusout"&&eb()}function tO(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return qc(Va)}function nO(r,i){if(r==="click")return qc(i)}function rO(r,i){if(r==="input"||r==="change")return qc(i)}function oO(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var Mn=typeof Object.is=="function"?Object.is:oO;function Ha(r,i){if(Mn(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var l=Object.keys(r),d=Object.keys(i);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var m=l[d];if(!le.call(i,m)||!Mn(r[m],i[m]))return!1}return!0}function nb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function rb(r,i){var l=nb(r);r=0;for(var d;l;){if(l.nodeType===3){if(d=r+l.textContent.length,r<=i&&d>=i)return{node:l,offset:i-r};r=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=nb(l)}}function ob(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?ob(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function ib(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=jc(r.document);i instanceof r.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)r=i.contentWindow;else break;i=jc(r.document)}return i}function ch(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var iO=Vr&&"documentMode"in document&&11>=document.documentMode,ms=null,uh=null,Qa=null,dh=!1;function sb(r,i,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;dh||ms==null||ms!==jc(d)||(d=ms,"selectionStart"in d&&ch(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Qa&&Ha(Qa,d)||(Qa=d,d=Iu(uh,"onSelect"),0<d.length&&(i=new Fc("onSelect","select",null,i,l),r.push({event:i,listeners:d}),i.target=ms)))}function gi(r,i){var l={};return l[r.toLowerCase()]=i.toLowerCase(),l["Webkit"+r]="webkit"+i,l["Moz"+r]="moz"+i,l}var gs={animationend:gi("Animation","AnimationEnd"),animationiteration:gi("Animation","AnimationIteration"),animationstart:gi("Animation","AnimationStart"),transitionrun:gi("Transition","TransitionRun"),transitionstart:gi("Transition","TransitionStart"),transitioncancel:gi("Transition","TransitionCancel"),transitionend:gi("Transition","TransitionEnd")},fh={},ab={};Vr&&(ab=document.createElement("div").style,"AnimationEvent"in window||(delete gs.animationend.animation,delete gs.animationiteration.animation,delete gs.animationstart.animation),"TransitionEvent"in window||delete gs.transitionend.transition);function yi(r){if(fh[r])return fh[r];if(!gs[r])return r;var i=gs[r],l;for(l in i)if(i.hasOwnProperty(l)&&l in ab)return fh[r]=i[l];return r}var lb=yi("animationend"),cb=yi("animationiteration"),ub=yi("animationstart"),sO=yi("transitionrun"),aO=yi("transitionstart"),lO=yi("transitioncancel"),db=yi("transitionend"),fb=new Map,hh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");hh.push("scrollEnd");function hr(r,i){fb.set(r,i),pi(i,[r])}var Uc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Gn=[],ys=0,ph=0;function Vc(){for(var r=ys,i=ph=ys=0;i<r;){var l=Gn[i];Gn[i++]=null;var d=Gn[i];Gn[i++]=null;var m=Gn[i];Gn[i++]=null;var v=Gn[i];if(Gn[i++]=null,d!==null&&m!==null){var E=d.pending;E===null?m.next=m:(m.next=E.next,E.next=m),d.pending=m}v!==0&&hb(l,m,v)}}function Hc(r,i,l,d){Gn[ys++]=r,Gn[ys++]=i,Gn[ys++]=l,Gn[ys++]=d,ph|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function mh(r,i,l,d){return Hc(r,i,l,d),Qc(r)}function vi(r,i){return Hc(r,null,null,i),Qc(r)}function hb(r,i,l){r.lanes|=l;var d=r.alternate;d!==null&&(d.lanes|=l);for(var m=!1,v=r.return;v!==null;)v.childLanes|=l,d=v.alternate,d!==null&&(d.childLanes|=l),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(m=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,m&&i!==null&&(m=31-kn(l),r=v.hiddenUpdates,d=r[m],d===null?r[m]=[i]:d.push(i),i.lane=l|536870912),v):null}function Qc(r){if(50<pl)throw pl=0,Ep=null,Error(o(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var vs={};function cO(r,i,l,d){this.tag=r,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(r,i,l,d){return new cO(r,i,l,d)}function gh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Hr(r,i){var l=r.alternate;return l===null?(l=Dn(r.tag,i,r.key,r.mode),l.elementType=r.elementType,l.type=r.type,l.stateNode=r.stateNode,l.alternate=r,r.alternate=l):(l.pendingProps=i,l.type=r.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=r.flags&65011712,l.childLanes=r.childLanes,l.lanes=r.lanes,l.child=r.child,l.memoizedProps=r.memoizedProps,l.memoizedState=r.memoizedState,l.updateQueue=r.updateQueue,i=r.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=r.sibling,l.index=r.index,l.ref=r.ref,l.refCleanup=r.refCleanup,l}function pb(r,i){r.flags&=65011714;var l=r.alternate;return l===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=l.childLanes,r.lanes=l.lanes,r.child=l.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=l.memoizedProps,r.memoizedState=l.memoizedState,r.updateQueue=l.updateQueue,r.type=l.type,i=l.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Zc(r,i,l,d,m,v){var E=0;if(d=r,typeof r=="function")gh(r)&&(E=1);else if(typeof r=="string")E=p2(r,l,se.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case U:return r=Dn(31,l,i,m),r.elementType=U,r.lanes=v,r;case S:return bi(l.children,m,v,i);case A:E=8,m|=24;break;case I:return r=Dn(12,l,i,m|2),r.elementType=I,r.lanes=v,r;case j:return r=Dn(13,l,i,m),r.elementType=j,r.lanes=v,r;case B:return r=Dn(19,l,i,m),r.elementType=B,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case R:E=10;break e;case k:E=9;break e;case N:E=11;break e;case P:E=14;break e;case M:E=16,d=null;break e}E=29,l=Error(o(130,r===null?"null":typeof r,"")),d=null}return i=Dn(E,l,i,m),i.elementType=r,i.type=d,i.lanes=v,i}function bi(r,i,l,d){return r=Dn(7,r,d,i),r.lanes=l,r}function yh(r,i,l){return r=Dn(6,r,null,i),r.lanes=l,r}function mb(r){var i=Dn(18,null,null,0);return i.stateNode=r,i}function vh(r,i,l){return i=Dn(4,r.children!==null?r.children:[],r.key,i),i.lanes=l,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var gb=new WeakMap;function Yn(r,i){if(typeof r=="object"&&r!==null){var l=gb.get(r);return l!==void 0?l:(i={value:r,source:i,stack:Ct(i)},gb.set(r,i),i)}return{value:r,source:i,stack:Ct(i)}}var bs=[],ws=0,Gc=null,Za=0,Kn=[],Xn=0,wo=null,_r=1,Er="";function Qr(r,i){bs[ws++]=Za,bs[ws++]=Gc,Gc=r,Za=i}function yb(r,i,l){Kn[Xn++]=_r,Kn[Xn++]=Er,Kn[Xn++]=wo,wo=r;var d=_r;r=Er;var m=32-kn(d)-1;d&=~(1<<m),l+=1;var v=32-kn(i)+m;if(30<v){var E=m-m%5;v=(d&(1<<E)-1).toString(32),d>>=E,m-=E,_r=1<<32-kn(i)+m|l<<m|d,Er=v+r}else _r=1<<v|l<<m|d,Er=r}function bh(r){r.return!==null&&(Qr(r,1),yb(r,1,0))}function wh(r){for(;r===Gc;)Gc=bs[--ws],bs[ws]=null,Za=bs[--ws],bs[ws]=null;for(;r===wo;)wo=Kn[--Xn],Kn[Xn]=null,Er=Kn[--Xn],Kn[Xn]=null,_r=Kn[--Xn],Kn[Xn]=null}function vb(r,i){Kn[Xn++]=_r,Kn[Xn++]=Er,Kn[Xn++]=wo,_r=i.id,Er=i.overflow,wo=r}var Zt=null,lt=null,Ue=!1,xo=null,Jn=!1,xh=Error(o(519));function So(r){var i=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ga(Yn(i,r)),xh}function bb(r){var i=r.stateNode,l=r.type,d=r.memoizedProps;switch(i[Qt]=r,i[yn]=d,l){case"dialog":Pe("cancel",i),Pe("close",i);break;case"iframe":case"object":case"embed":Pe("load",i);break;case"video":case"audio":for(l=0;l<gl.length;l++)Pe(gl[l],i);break;case"source":Pe("error",i);break;case"img":case"image":case"link":Pe("error",i),Pe("load",i);break;case"details":Pe("toggle",i);break;case"input":Pe("invalid",i),kv(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Pe("invalid",i);break;case"textarea":Pe("invalid",i),Dv(i,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||d.suppressHydrationWarning===!0||L0(i.textContent,l)?(d.popover!=null&&(Pe("beforetoggle",i),Pe("toggle",i)),d.onScroll!=null&&Pe("scroll",i),d.onScrollEnd!=null&&Pe("scrollend",i),d.onClick!=null&&(i.onclick=Ur),i=!0):i=!1,i||So(r,!0)}function wb(r){for(Zt=r.return;Zt;)switch(Zt.tag){case 5:case 31:case 13:Jn=!1;return;case 27:case 3:Jn=!0;return;default:Zt=Zt.return}}function xs(r){if(r!==Zt)return!1;if(!Ue)return wb(r),Ue=!0,!1;var i=r.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=r.type,l=!(l!=="form"&&l!=="button")||$p(r.type,r.memoizedProps)),l=!l),l&&lt&&So(r),wb(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));lt=H0(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(317));lt=H0(r)}else i===27?(i=lt,Lo(r.type)?(r=Vp,Vp=null,lt=r):lt=i):lt=Zt?er(r.stateNode.nextSibling):null;return!0}function wi(){lt=Zt=null,Ue=!1}function Sh(){var r=xo;return r!==null&&(Sn===null?Sn=r:Sn.push.apply(Sn,r),xo=null),r}function Ga(r){xo===null?xo=[r]:xo.push(r)}var _h=z(null),xi=null,Zr=null;function _o(r,i,l){ie(_h,i._currentValue),i._currentValue=l}function Gr(r){r._currentValue=_h.current,Y(_h)}function Eh(r,i,l){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===l)break;r=r.return}}function Th(r,i,l,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var v=m.dependencies;if(v!==null){var E=m.child;v=v.firstContext;e:for(;v!==null;){var O=v;v=m;for(var L=0;L<i.length;L++)if(O.context===i[L]){v.lanes|=l,O=v.alternate,O!==null&&(O.lanes|=l),Eh(v.return,l,r),d||(E=null);break e}v=O.next}}else if(m.tag===18){if(E=m.return,E===null)throw Error(o(341));E.lanes|=l,v=E.alternate,v!==null&&(v.lanes|=l),Eh(E,l,r),E=null}else E=m.child;if(E!==null)E.return=m;else for(E=m;E!==null;){if(E===r){E=null;break}if(m=E.sibling,m!==null){m.return=E.return,E=m;break}E=E.return}m=E}}function Ss(r,i,l,d){r=null;for(var m=i,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var E=m.alternate;if(E===null)throw Error(o(387));if(E=E.memoizedProps,E!==null){var O=m.type;Mn(m.pendingProps.value,E.value)||(r!==null?r.push(O):r=[O])}}else if(m===J.current){if(E=m.alternate,E===null)throw Error(o(387));E.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(xl):r=[xl])}m=m.return}r!==null&&Th(i,r,l,d),i.flags|=262144}function Yc(r){for(r=r.firstContext;r!==null;){if(!Mn(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Si(r){xi=r,Zr=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Gt(r){return xb(xi,r)}function Kc(r,i){return xi===null&&Si(r),xb(r,i)}function xb(r,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},Zr===null){if(r===null)throw Error(o(308));Zr=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Zr=Zr.next=i;return l}var uO=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(l,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(l){return l()})}},dO=e.unstable_scheduleCallback,fO=e.unstable_NormalPriority,At={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ch(){return{controller:new uO,data:new Map,refCount:0}}function Ya(r){r.refCount--,r.refCount===0&&dO(fO,function(){r.controller.abort()})}var Ka=null,Ah=0,_s=0,Es=null;function hO(r,i){if(Ka===null){var l=Ka=[];Ah=0,_s=Ip(),Es={status:"pending",value:void 0,then:function(d){l.push(d)}}}return Ah++,i.then(Sb,Sb),i}function Sb(){if(--Ah===0&&Ka!==null){Es!==null&&(Es.status="fulfilled");var r=Ka;Ka=null,_s=0,Es=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function pO(r,i){var l=[],d={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var m=0;m<l.length;m++)(0,l[m])(i)},function(m){for(d.status="rejected",d.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),d}var _b=F.S;F.S=function(r,i){s0=cn(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&hO(r,i),_b!==null&&_b(r,i)};var _i=z(null);function Rh(){var r=_i.current;return r!==null?r:rt.pooledCache}function Xc(r,i){i===null?ie(_i,_i.current):ie(_i,i.pool)}function Eb(){var r=Rh();return r===null?null:{parent:At._currentValue,pool:r}}var Ts=Error(o(460)),Nh=Error(o(474)),Jc=Error(o(542)),Wc={then:function(){}};function Tb(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Cb(r,i,l){switch(l=r[l],l===void 0?r.push(i):l!==i&&(i.then(Ur,Ur),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Rb(r),r;default:if(typeof i.status=="string")i.then(Ur,Ur);else{if(r=rt,r!==null&&100<r.shellSuspendCounter)throw Error(o(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var m=i;m.status="fulfilled",m.value=d}},function(d){if(i.status==="pending"){var m=i;m.status="rejected",m.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Rb(r),r}throw Ti=i,Ts}}function Ei(r){try{var i=r._init;return i(r._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Ti=l,Ts):l}}var Ti=null;function Ab(){if(Ti===null)throw Error(o(459));var r=Ti;return Ti=null,r}function Rb(r){if(r===Ts||r===Jc)throw Error(o(483))}var Cs=null,Xa=0;function eu(r){var i=Xa;return Xa+=1,Cs===null&&(Cs=[]),Cb(Cs,r,i)}function Ja(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function tu(r,i){throw i.$$typeof===b?Error(o(525)):(r=Object.prototype.toString.call(i),Error(o(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Nb(r){function i(q,$){if(r){var V=q.deletions;V===null?(q.deletions=[$],q.flags|=16):V.push($)}}function l(q,$){if(!r)return null;for(;$!==null;)i(q,$),$=$.sibling;return null}function d(q){for(var $=new Map;q!==null;)q.key!==null?$.set(q.key,q):$.set(q.index,q),q=q.sibling;return $}function m(q,$){return q=Hr(q,$),q.index=0,q.sibling=null,q}function v(q,$,V){return q.index=V,r?(V=q.alternate,V!==null?(V=V.index,V<$?(q.flags|=67108866,$):V):(q.flags|=67108866,$)):(q.flags|=1048576,$)}function E(q){return r&&q.alternate===null&&(q.flags|=67108866),q}function O(q,$,V,W){return $===null||$.tag!==6?($=yh(V,q.mode,W),$.return=q,$):($=m($,V),$.return=q,$)}function L(q,$,V,W){var we=V.type;return we===S?K(q,$,V.props.children,W,V.key):$!==null&&($.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===M&&Ei(we)===$.type)?($=m($,V.props),Ja($,V),$.return=q,$):($=Zc(V.type,V.key,V.props,null,q.mode,W),Ja($,V),$.return=q,$)}function H(q,$,V,W){return $===null||$.tag!==4||$.stateNode.containerInfo!==V.containerInfo||$.stateNode.implementation!==V.implementation?($=vh(V,q.mode,W),$.return=q,$):($=m($,V.children||[]),$.return=q,$)}function K(q,$,V,W,we){return $===null||$.tag!==7?($=bi(V,q.mode,W,we),$.return=q,$):($=m($,V),$.return=q,$)}function ne(q,$,V){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=yh(""+$,q.mode,V),$.return=q,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return V=Zc($.type,$.key,$.props,null,q.mode,V),Ja(V,$),V.return=q,V;case C:return $=vh($,q.mode,V),$.return=q,$;case M:return $=Ei($),ne(q,$,V)}if(he($)||re($))return $=bi($,q.mode,V,null),$.return=q,$;if(typeof $.then=="function")return ne(q,eu($),V);if($.$$typeof===R)return ne(q,Kc(q,$),V);tu(q,$)}return null}function Q(q,$,V,W){var we=$!==null?$.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return we!==null?null:O(q,$,""+V,W);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case x:return V.key===we?L(q,$,V,W):null;case C:return V.key===we?H(q,$,V,W):null;case M:return V=Ei(V),Q(q,$,V,W)}if(he(V)||re(V))return we!==null?null:K(q,$,V,W,null);if(typeof V.then=="function")return Q(q,$,eu(V),W);if(V.$$typeof===R)return Q(q,$,Kc(q,V),W);tu(q,V)}return null}function G(q,$,V,W,we){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return q=q.get(V)||null,O($,q,""+W,we);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case x:return q=q.get(W.key===null?V:W.key)||null,L($,q,W,we);case C:return q=q.get(W.key===null?V:W.key)||null,H($,q,W,we);case M:return W=Ei(W),G(q,$,V,W,we)}if(he(W)||re(W))return q=q.get(V)||null,K($,q,W,we,null);if(typeof W.then=="function")return G(q,$,V,eu(W),we);if(W.$$typeof===R)return G(q,$,V,Kc($,W),we);tu($,W)}return null}function fe(q,$,V,W){for(var we=null,He=null,ye=$,ke=$=0,Be=null;ye!==null&&ke<V.length;ke++){ye.index>ke?(Be=ye,ye=null):Be=ye.sibling;var Qe=Q(q,ye,V[ke],W);if(Qe===null){ye===null&&(ye=Be);break}r&&ye&&Qe.alternate===null&&i(q,ye),$=v(Qe,$,ke),He===null?we=Qe:He.sibling=Qe,He=Qe,ye=Be}if(ke===V.length)return l(q,ye),Ue&&Qr(q,ke),we;if(ye===null){for(;ke<V.length;ke++)ye=ne(q,V[ke],W),ye!==null&&($=v(ye,$,ke),He===null?we=ye:He.sibling=ye,He=ye);return Ue&&Qr(q,ke),we}for(ye=d(ye);ke<V.length;ke++)Be=G(ye,q,ke,V[ke],W),Be!==null&&(r&&Be.alternate!==null&&ye.delete(Be.key===null?ke:Be.key),$=v(Be,$,ke),He===null?we=Be:He.sibling=Be,He=Be);return r&&ye.forEach(function(Bo){return i(q,Bo)}),Ue&&Qr(q,ke),we}function Ee(q,$,V,W){if(V==null)throw Error(o(151));for(var we=null,He=null,ye=$,ke=$=0,Be=null,Qe=V.next();ye!==null&&!Qe.done;ke++,Qe=V.next()){ye.index>ke?(Be=ye,ye=null):Be=ye.sibling;var Bo=Q(q,ye,Qe.value,W);if(Bo===null){ye===null&&(ye=Be);break}r&&ye&&Bo.alternate===null&&i(q,ye),$=v(Bo,$,ke),He===null?we=Bo:He.sibling=Bo,He=Bo,ye=Be}if(Qe.done)return l(q,ye),Ue&&Qr(q,ke),we;if(ye===null){for(;!Qe.done;ke++,Qe=V.next())Qe=ne(q,Qe.value,W),Qe!==null&&($=v(Qe,$,ke),He===null?we=Qe:He.sibling=Qe,He=Qe);return Ue&&Qr(q,ke),we}for(ye=d(ye);!Qe.done;ke++,Qe=V.next())Qe=G(ye,q,ke,Qe.value,W),Qe!==null&&(r&&Qe.alternate!==null&&ye.delete(Qe.key===null?ke:Qe.key),$=v(Qe,$,ke),He===null?we=Qe:He.sibling=Qe,He=Qe);return r&&ye.forEach(function(T2){return i(q,T2)}),Ue&&Qr(q,ke),we}function nt(q,$,V,W){if(typeof V=="object"&&V!==null&&V.type===S&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case x:e:{for(var we=V.key;$!==null;){if($.key===we){if(we=V.type,we===S){if($.tag===7){l(q,$.sibling),W=m($,V.props.children),W.return=q,q=W;break e}}else if($.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===M&&Ei(we)===$.type){l(q,$.sibling),W=m($,V.props),Ja(W,V),W.return=q,q=W;break e}l(q,$);break}else i(q,$);$=$.sibling}V.type===S?(W=bi(V.props.children,q.mode,W,V.key),W.return=q,q=W):(W=Zc(V.type,V.key,V.props,null,q.mode,W),Ja(W,V),W.return=q,q=W)}return E(q);case C:e:{for(we=V.key;$!==null;){if($.key===we)if($.tag===4&&$.stateNode.containerInfo===V.containerInfo&&$.stateNode.implementation===V.implementation){l(q,$.sibling),W=m($,V.children||[]),W.return=q,q=W;break e}else{l(q,$);break}else i(q,$);$=$.sibling}W=vh(V,q.mode,W),W.return=q,q=W}return E(q);case M:return V=Ei(V),nt(q,$,V,W)}if(he(V))return fe(q,$,V,W);if(re(V)){if(we=re(V),typeof we!="function")throw Error(o(150));return V=we.call(V),Ee(q,$,V,W)}if(typeof V.then=="function")return nt(q,$,eu(V),W);if(V.$$typeof===R)return nt(q,$,Kc(q,V),W);tu(q,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,$!==null&&$.tag===6?(l(q,$.sibling),W=m($,V),W.return=q,q=W):(l(q,$),W=yh(V,q.mode,W),W.return=q,q=W),E(q)):l(q,$)}return function(q,$,V,W){try{Xa=0;var we=nt(q,$,V,W);return Cs=null,we}catch(ye){if(ye===Ts||ye===Jc)throw ye;var He=Dn(29,ye,null,q.mode);return He.lanes=W,He.return=q,He}}}var Ci=Nb(!0),Ib=Nb(!1),Eo=!1;function Ih(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oh(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function To(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Co(r,i,l){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Ye&2)!==0){var m=d.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),d.pending=i,i=Qc(r),hb(r,null,l),i}return Hc(r,d,i,l),Qc(r)}function Wa(r,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,xv(r,l)}}function kh(r,i){var l=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var m=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var E={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?m=v=E:v=v.next=E,l=l.next}while(l!==null);v===null?m=v=i:v=v.next=i}else m=v=i;l={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=l;return}r=l.lastBaseUpdate,r===null?l.firstBaseUpdate=i:r.next=i,l.lastBaseUpdate=i}var Mh=!1;function el(){if(Mh){var r=Es;if(r!==null)throw r}}function tl(r,i,l,d){Mh=!1;var m=r.updateQueue;Eo=!1;var v=m.firstBaseUpdate,E=m.lastBaseUpdate,O=m.shared.pending;if(O!==null){m.shared.pending=null;var L=O,H=L.next;L.next=null,E===null?v=H:E.next=H,E=L;var K=r.alternate;K!==null&&(K=K.updateQueue,O=K.lastBaseUpdate,O!==E&&(O===null?K.firstBaseUpdate=H:O.next=H,K.lastBaseUpdate=L))}if(v!==null){var ne=m.baseState;E=0,K=H=L=null,O=v;do{var Q=O.lane&-536870913,G=Q!==O.lane;if(G?(Fe&Q)===Q:(d&Q)===Q){Q!==0&&Q===_s&&(Mh=!0),K!==null&&(K=K.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var fe=r,Ee=O;Q=i;var nt=l;switch(Ee.tag){case 1:if(fe=Ee.payload,typeof fe=="function"){ne=fe.call(nt,ne,Q);break e}ne=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=Ee.payload,Q=typeof fe=="function"?fe.call(nt,ne,Q):fe,Q==null)break e;ne=g({},ne,Q);break e;case 2:Eo=!0}}Q=O.callback,Q!==null&&(r.flags|=64,G&&(r.flags|=8192),G=m.callbacks,G===null?m.callbacks=[Q]:G.push(Q))}else G={lane:Q,tag:O.tag,payload:O.payload,callback:O.callback,next:null},K===null?(H=K=G,L=ne):K=K.next=G,E|=Q;if(O=O.next,O===null){if(O=m.shared.pending,O===null)break;G=O,O=G.next,G.next=null,m.lastBaseUpdate=G,m.shared.pending=null}}while(!0);K===null&&(L=ne),m.baseState=L,m.firstBaseUpdate=H,m.lastBaseUpdate=K,v===null&&(m.shared.lanes=0),Oo|=E,r.lanes=E,r.memoizedState=ne}}function Ob(r,i){if(typeof r!="function")throw Error(o(191,r));r.call(i)}function kb(r,i){var l=r.callbacks;if(l!==null)for(r.callbacks=null,r=0;r<l.length;r++)Ob(l[r],i)}var As=z(null),nu=z(0);function Mb(r,i){r=ro,ie(nu,r),ie(As,i),ro=r|i.baseLanes}function Dh(){ie(nu,ro),ie(As,As.current)}function jh(){ro=nu.current,Y(As),Y(nu)}var jn=z(null),Wn=null;function Ao(r){var i=r.alternate;ie(_t,_t.current&1),ie(jn,r),Wn===null&&(i===null||As.current!==null||i.memoizedState!==null)&&(Wn=r)}function Lh(r){ie(_t,_t.current),ie(jn,r),Wn===null&&(Wn=r)}function Db(r){r.tag===22?(ie(_t,_t.current),ie(jn,r),Wn===null&&(Wn=r)):Ro()}function Ro(){ie(_t,_t.current),ie(jn,jn.current)}function Ln(r){Y(jn),Wn===r&&(Wn=null),Y(_t)}var _t=z(0);function ru(r){for(var i=r;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||qp(l)||Up(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Yr=0,Re=null,et=null,Rt=null,ou=!1,Rs=!1,Ai=!1,iu=0,nl=0,Ns=null,mO=0;function yt(){throw Error(o(321))}function zh(r,i){if(i===null)return!1;for(var l=0;l<i.length&&l<r.length;l++)if(!Mn(r[l],i[l]))return!1;return!0}function Ph(r,i,l,d,m,v){return Yr=v,Re=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=r===null||r.memoizedState===null?yw:Wh,Ai=!1,v=l(d,m),Ai=!1,Rs&&(v=Lb(i,l,d,m)),jb(r),v}function jb(r){F.H=il;var i=et!==null&&et.next!==null;if(Yr=0,Rt=et=Re=null,ou=!1,nl=0,Ns=null,i)throw Error(o(300));r===null||Nt||(r=r.dependencies,r!==null&&Yc(r)&&(Nt=!0))}function Lb(r,i,l,d){Re=r;var m=0;do{if(Rs&&(Ns=null),nl=0,Rs=!1,25<=m)throw Error(o(301));if(m+=1,Rt=et=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}F.H=vw,v=i(l,d)}while(Rs);return v}function gO(){var r=F.H,i=r.useState()[0];return i=typeof i.then=="function"?rl(i):i,r=r.useState()[0],(et!==null?et.memoizedState:null)!==r&&(Re.flags|=1024),i}function $h(){var r=iu!==0;return iu=0,r}function Fh(r,i,l){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~l}function Bh(r){if(ou){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ou=!1}Yr=0,Rt=et=Re=null,Rs=!1,nl=iu=0,Ns=null}function un(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Re.memoizedState=Rt=r:Rt=Rt.next=r,Rt}function Et(){if(et===null){var r=Re.alternate;r=r!==null?r.memoizedState:null}else r=et.next;var i=Rt===null?Re.memoizedState:Rt.next;if(i!==null)Rt=i,et=r;else{if(r===null)throw Re.alternate===null?Error(o(467)):Error(o(310));et=r,r={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},Rt===null?Re.memoizedState=Rt=r:Rt=Rt.next=r}return Rt}function su(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rl(r){var i=nl;return nl+=1,Ns===null&&(Ns=[]),r=Cb(Ns,r,i),i=Re,(Rt===null?i.memoizedState:Rt.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?yw:Wh),r}function au(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return rl(r);if(r.$$typeof===R)return Gt(r)}throw Error(o(438,String(r)))}function qh(r){var i=null,l=Re.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var d=Re.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(m){return m.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=su(),Re.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(r),d=0;d<r;d++)l[d]=ee;return i.index++,l}function Kr(r,i){return typeof i=="function"?i(r):i}function lu(r){var i=Et();return Uh(i,et,r)}function Uh(r,i,l){var d=r.queue;if(d===null)throw Error(o(311));d.lastRenderedReducer=l;var m=r.baseQueue,v=d.pending;if(v!==null){if(m!==null){var E=m.next;m.next=v.next,v.next=E}i.baseQueue=m=v,d.pending=null}if(v=r.baseState,m===null)r.memoizedState=v;else{i=m.next;var O=E=null,L=null,H=i,K=!1;do{var ne=H.lane&-536870913;if(ne!==H.lane?(Fe&ne)===ne:(Yr&ne)===ne){var Q=H.revertLane;if(Q===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),ne===_s&&(K=!0);else if((Yr&Q)===Q){H=H.next,Q===_s&&(K=!0);continue}else ne={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},L===null?(O=L=ne,E=v):L=L.next=ne,Re.lanes|=Q,Oo|=Q;ne=H.action,Ai&&l(v,ne),v=H.hasEagerState?H.eagerState:l(v,ne)}else Q={lane:ne,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},L===null?(O=L=Q,E=v):L=L.next=Q,Re.lanes|=ne,Oo|=ne;H=H.next}while(H!==null&&H!==i);if(L===null?E=v:L.next=O,!Mn(v,r.memoizedState)&&(Nt=!0,K&&(l=Es,l!==null)))throw l;r.memoizedState=v,r.baseState=E,r.baseQueue=L,d.lastRenderedState=v}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Vh(r){var i=Et(),l=i.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=r;var d=l.dispatch,m=l.pending,v=i.memoizedState;if(m!==null){l.pending=null;var E=m=m.next;do v=r(v,E.action),E=E.next;while(E!==m);Mn(v,i.memoizedState)||(Nt=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),l.lastRenderedState=v}return[v,d]}function zb(r,i,l){var d=Re,m=Et(),v=Ue;if(v){if(l===void 0)throw Error(o(407));l=l()}else l=i();var E=!Mn((et||m).memoizedState,l);if(E&&(m.memoizedState=l,Nt=!0),m=m.queue,Zh(Fb.bind(null,d,m,r),[r]),m.getSnapshot!==i||E||Rt!==null&&Rt.memoizedState.tag&1){if(d.flags|=2048,Is(9,{destroy:void 0},$b.bind(null,d,m,l,i),null),rt===null)throw Error(o(349));v||(Yr&127)!==0||Pb(d,i,l)}return l}function Pb(r,i,l){r.flags|=16384,r={getSnapshot:i,value:l},i=Re.updateQueue,i===null?(i=su(),Re.updateQueue=i,i.stores=[r]):(l=i.stores,l===null?i.stores=[r]:l.push(r))}function $b(r,i,l,d){i.value=l,i.getSnapshot=d,Bb(i)&&qb(r)}function Fb(r,i,l){return l(function(){Bb(i)&&qb(r)})}function Bb(r){var i=r.getSnapshot;r=r.value;try{var l=i();return!Mn(r,l)}catch{return!0}}function qb(r){var i=vi(r,2);i!==null&&_n(i,r,2)}function Hh(r){var i=un();if(typeof r=="function"){var l=r;if(r=l(),Ai){yo(!0);try{l()}finally{yo(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:r},i}function Ub(r,i,l,d){return r.baseState=l,Uh(r,et,typeof d=="function"?d:Kr)}function yO(r,i,l,d,m){if(du(r))throw Error(o(485));if(r=i.action,r!==null){var v={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){v.listeners.push(E)}};F.T!==null?l(!0):v.isTransition=!1,d(v),l=i.pending,l===null?(v.next=i.pending=v,Vb(i,v)):(v.next=l.next,i.pending=l.next=v)}}function Vb(r,i){var l=i.action,d=i.payload,m=r.state;if(i.isTransition){var v=F.T,E={};F.T=E;try{var O=l(m,d),L=F.S;L!==null&&L(E,O),Hb(r,i,O)}catch(H){Qh(r,i,H)}finally{v!==null&&E.types!==null&&(v.types=E.types),F.T=v}}else try{v=l(m,d),Hb(r,i,v)}catch(H){Qh(r,i,H)}}function Hb(r,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){Qb(r,i,d)},function(d){return Qh(r,i,d)}):Qb(r,i,l)}function Qb(r,i,l){i.status="fulfilled",i.value=l,Zb(i),r.state=l,i=r.pending,i!==null&&(l=i.next,l===i?r.pending=null:(l=l.next,i.next=l,Vb(r,l)))}function Qh(r,i,l){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=l,Zb(i),i=i.next;while(i!==d)}r.action=null}function Zb(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Gb(r,i){return i}function Yb(r,i){if(Ue){var l=rt.formState;if(l!==null){e:{var d=Re;if(Ue){if(lt){t:{for(var m=lt,v=Jn;m.nodeType!==8;){if(!v){m=null;break t}if(m=er(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){lt=er(m.nextSibling),d=m.data==="F!";break e}}So(d)}d=!1}d&&(i=l[0])}}return l=un(),l.memoizedState=l.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gb,lastRenderedState:i},l.queue=d,l=pw.bind(null,Re,d),d.dispatch=l,d=Hh(!1),v=Jh.bind(null,Re,!1,d.queue),d=un(),m={state:i,dispatch:null,action:r,pending:null},d.queue=m,l=yO.bind(null,Re,m,v,l),m.dispatch=l,d.memoizedState=r,[i,l,!1]}function Kb(r){var i=Et();return Xb(i,et,r)}function Xb(r,i,l){if(i=Uh(r,i,Gb)[0],r=lu(Kr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=rl(i)}catch(E){throw E===Ts?Jc:E}else d=i;i=Et();var m=i.queue,v=m.dispatch;return l!==i.memoizedState&&(Re.flags|=2048,Is(9,{destroy:void 0},vO.bind(null,m,l),null)),[d,v,r]}function vO(r,i){r.action=i}function Jb(r){var i=Et(),l=et;if(l!==null)return Xb(i,l,r);Et(),i=i.memoizedState,l=Et();var d=l.queue.dispatch;return l.memoizedState=r,[i,d,!1]}function Is(r,i,l,d){return r={tag:r,create:l,deps:d,inst:i,next:null},i=Re.updateQueue,i===null&&(i=su(),Re.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=r.next=r:(d=l.next,l.next=r,r.next=d,i.lastEffect=r),r}function Wb(){return Et().memoizedState}function cu(r,i,l,d){var m=un();Re.flags|=r,m.memoizedState=Is(1|i,{destroy:void 0},l,d===void 0?null:d)}function uu(r,i,l,d){var m=Et();d=d===void 0?null:d;var v=m.memoizedState.inst;et!==null&&d!==null&&zh(d,et.memoizedState.deps)?m.memoizedState=Is(i,v,l,d):(Re.flags|=r,m.memoizedState=Is(1|i,v,l,d))}function ew(r,i){cu(8390656,8,r,i)}function Zh(r,i){uu(2048,8,r,i)}function bO(r){Re.flags|=4;var i=Re.updateQueue;if(i===null)i=su(),Re.updateQueue=i,i.events=[r];else{var l=i.events;l===null?i.events=[r]:l.push(r)}}function tw(r){var i=Et().memoizedState;return bO({ref:i,nextImpl:r}),function(){if((Ye&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}function nw(r,i){return uu(4,2,r,i)}function rw(r,i){return uu(4,4,r,i)}function ow(r,i){if(typeof i=="function"){r=r();var l=i(r);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function iw(r,i,l){l=l!=null?l.concat([r]):null,uu(4,4,ow.bind(null,i,r),l)}function Gh(){}function sw(r,i){var l=Et();i=i===void 0?null:i;var d=l.memoizedState;return i!==null&&zh(i,d[1])?d[0]:(l.memoizedState=[r,i],r)}function aw(r,i){var l=Et();i=i===void 0?null:i;var d=l.memoizedState;if(i!==null&&zh(i,d[1]))return d[0];if(d=r(),Ai){yo(!0);try{r()}finally{yo(!1)}}return l.memoizedState=[d,i],d}function Yh(r,i,l){return l===void 0||(Yr&1073741824)!==0&&(Fe&261930)===0?r.memoizedState=i:(r.memoizedState=l,r=l0(),Re.lanes|=r,Oo|=r,l)}function lw(r,i,l,d){return Mn(l,i)?l:As.current!==null?(r=Yh(r,l,d),Mn(r,i)||(Nt=!0),r):(Yr&42)===0||(Yr&1073741824)!==0&&(Fe&261930)===0?(Nt=!0,r.memoizedState=l):(r=l0(),Re.lanes|=r,Oo|=r,i)}function cw(r,i,l,d,m){var v=X.p;X.p=v!==0&&8>v?v:8;var E=F.T,O={};F.T=O,Jh(r,!1,i,l);try{var L=m(),H=F.S;if(H!==null&&H(O,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var K=pO(L,d);ol(r,i,K,$n(r))}else ol(r,i,d,$n(r))}catch(ne){ol(r,i,{then:function(){},status:"rejected",reason:ne},$n())}finally{X.p=v,E!==null&&O.types!==null&&(E.types=O.types),F.T=E}}function wO(){}function Kh(r,i,l,d){if(r.tag!==5)throw Error(o(476));var m=uw(r).queue;cw(r,m,i,Z,l===null?wO:function(){return dw(r),l(d)})}function uw(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:Z},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Kr,lastRenderedState:l},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function dw(r){var i=uw(r);i.next===null&&(i=r.alternate.memoizedState),ol(r,i.next.queue,{},$n())}function Xh(){return Gt(xl)}function fw(){return Et().memoizedState}function hw(){return Et().memoizedState}function xO(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var l=$n();r=To(l);var d=Co(i,r,l);d!==null&&(_n(d,i,l),Wa(d,i,l)),i={cache:Ch()},r.payload=i;return}i=i.return}}function SO(r,i,l){var d=$n();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},du(r)?mw(i,l):(l=mh(r,i,l,d),l!==null&&(_n(l,r,d),gw(l,i,d)))}function pw(r,i,l){var d=$n();ol(r,i,l,d)}function ol(r,i,l,d){var m={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(du(r))mw(i,m);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var E=i.lastRenderedState,O=v(E,l);if(m.hasEagerState=!0,m.eagerState=O,Mn(O,E))return Hc(r,i,m,0),rt===null&&Vc(),!1}catch{}if(l=mh(r,i,m,d),l!==null)return _n(l,r,d),gw(l,i,d),!0}return!1}function Jh(r,i,l,d){if(d={lane:2,revertLane:Ip(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},du(r)){if(i)throw Error(o(479))}else i=mh(r,l,d,2),i!==null&&_n(i,r,2)}function du(r){var i=r.alternate;return r===Re||i!==null&&i===Re}function mw(r,i){Rs=ou=!0;var l=r.pending;l===null?i.next=i:(i.next=l.next,l.next=i),r.pending=i}function gw(r,i,l){if((l&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,xv(r,l)}}var il={readContext:Gt,use:au,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useLayoutEffect:yt,useInsertionEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useSyncExternalStore:yt,useId:yt,useHostTransitionStatus:yt,useFormState:yt,useActionState:yt,useOptimistic:yt,useMemoCache:yt,useCacheRefresh:yt};il.useEffectEvent=yt;var yw={readContext:Gt,use:au,useCallback:function(r,i){return un().memoizedState=[r,i===void 0?null:i],r},useContext:Gt,useEffect:ew,useImperativeHandle:function(r,i,l){l=l!=null?l.concat([r]):null,cu(4194308,4,ow.bind(null,i,r),l)},useLayoutEffect:function(r,i){return cu(4194308,4,r,i)},useInsertionEffect:function(r,i){cu(4,2,r,i)},useMemo:function(r,i){var l=un();i=i===void 0?null:i;var d=r();if(Ai){yo(!0);try{r()}finally{yo(!1)}}return l.memoizedState=[d,i],d},useReducer:function(r,i,l){var d=un();if(l!==void 0){var m=l(i);if(Ai){yo(!0);try{l(i)}finally{yo(!1)}}}else m=i;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=SO.bind(null,Re,r),[d.memoizedState,r]},useRef:function(r){var i=un();return r={current:r},i.memoizedState=r},useState:function(r){r=Hh(r);var i=r.queue,l=pw.bind(null,Re,i);return i.dispatch=l,[r.memoizedState,l]},useDebugValue:Gh,useDeferredValue:function(r,i){var l=un();return Yh(l,r,i)},useTransition:function(){var r=Hh(!1);return r=cw.bind(null,Re,r.queue,!0,!1),un().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,l){var d=Re,m=un();if(Ue){if(l===void 0)throw Error(o(407));l=l()}else{if(l=i(),rt===null)throw Error(o(349));(Fe&127)!==0||Pb(d,i,l)}m.memoizedState=l;var v={value:l,getSnapshot:i};return m.queue=v,ew(Fb.bind(null,d,v,r),[r]),d.flags|=2048,Is(9,{destroy:void 0},$b.bind(null,d,v,l,i),null),l},useId:function(){var r=un(),i=rt.identifierPrefix;if(Ue){var l=Er,d=_r;l=(d&~(1<<32-kn(d)-1)).toString(32)+l,i="_"+i+"R_"+l,l=iu++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=mO++,i="_"+i+"r_"+l.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Xh,useFormState:Yb,useActionState:Yb,useOptimistic:function(r){var i=un();i.memoizedState=i.baseState=r;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Jh.bind(null,Re,!0,l),l.dispatch=i,[r,i]},useMemoCache:qh,useCacheRefresh:function(){return un().memoizedState=xO.bind(null,Re)},useEffectEvent:function(r){var i=un(),l={impl:r};return i.memoizedState=l,function(){if((Ye&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Wh={readContext:Gt,use:au,useCallback:sw,useContext:Gt,useEffect:Zh,useImperativeHandle:iw,useInsertionEffect:nw,useLayoutEffect:rw,useMemo:aw,useReducer:lu,useRef:Wb,useState:function(){return lu(Kr)},useDebugValue:Gh,useDeferredValue:function(r,i){var l=Et();return lw(l,et.memoizedState,r,i)},useTransition:function(){var r=lu(Kr)[0],i=Et().memoizedState;return[typeof r=="boolean"?r:rl(r),i]},useSyncExternalStore:zb,useId:fw,useHostTransitionStatus:Xh,useFormState:Kb,useActionState:Kb,useOptimistic:function(r,i){var l=Et();return Ub(l,et,r,i)},useMemoCache:qh,useCacheRefresh:hw};Wh.useEffectEvent=tw;var vw={readContext:Gt,use:au,useCallback:sw,useContext:Gt,useEffect:Zh,useImperativeHandle:iw,useInsertionEffect:nw,useLayoutEffect:rw,useMemo:aw,useReducer:Vh,useRef:Wb,useState:function(){return Vh(Kr)},useDebugValue:Gh,useDeferredValue:function(r,i){var l=Et();return et===null?Yh(l,r,i):lw(l,et.memoizedState,r,i)},useTransition:function(){var r=Vh(Kr)[0],i=Et().memoizedState;return[typeof r=="boolean"?r:rl(r),i]},useSyncExternalStore:zb,useId:fw,useHostTransitionStatus:Xh,useFormState:Jb,useActionState:Jb,useOptimistic:function(r,i){var l=Et();return et!==null?Ub(l,et,r,i):(l.baseState=r,[r,l.queue.dispatch])},useMemoCache:qh,useCacheRefresh:hw};vw.useEffectEvent=tw;function ep(r,i,l,d){i=r.memoizedState,l=l(d,i),l=l==null?i:g({},i,l),r.memoizedState=l,r.lanes===0&&(r.updateQueue.baseState=l)}var tp={enqueueSetState:function(r,i,l){r=r._reactInternals;var d=$n(),m=To(d);m.payload=i,l!=null&&(m.callback=l),i=Co(r,m,d),i!==null&&(_n(i,r,d),Wa(i,r,d))},enqueueReplaceState:function(r,i,l){r=r._reactInternals;var d=$n(),m=To(d);m.tag=1,m.payload=i,l!=null&&(m.callback=l),i=Co(r,m,d),i!==null&&(_n(i,r,d),Wa(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var l=$n(),d=To(l);d.tag=2,i!=null&&(d.callback=i),i=Co(r,d,l),i!==null&&(_n(i,r,l),Wa(i,r,l))}};function bw(r,i,l,d,m,v,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,E):i.prototype&&i.prototype.isPureReactComponent?!Ha(l,d)||!Ha(m,v):!0}function ww(r,i,l,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,d),i.state!==r&&tp.enqueueReplaceState(i,i.state,null)}function Ri(r,i){var l=i;if("ref"in i){l={};for(var d in i)d!=="ref"&&(l[d]=i[d])}if(r=r.defaultProps){l===i&&(l=g({},l));for(var m in r)l[m]===void 0&&(l[m]=r[m])}return l}function xw(r){Uc(r)}function Sw(r){console.error(r)}function _w(r){Uc(r)}function fu(r,i){try{var l=r.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function Ew(r,i,l){try{var d=r.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function np(r,i,l){return l=To(l),l.tag=3,l.payload={element:null},l.callback=function(){fu(r,i)},l}function Tw(r){return r=To(r),r.tag=3,r}function Cw(r,i,l,d){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var v=d.value;r.payload=function(){return m(v)},r.callback=function(){Ew(i,l,d)}}var E=l.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){Ew(i,l,d),typeof m!="function"&&(ko===null?ko=new Set([this]):ko.add(this));var O=d.stack;this.componentDidCatch(d.value,{componentStack:O!==null?O:""})})}function _O(r,i,l,d,m){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=l.alternate,i!==null&&Ss(i,l,m,!0),l=jn.current,l!==null){switch(l.tag){case 31:case 13:return Wn===null?Eu():l.alternate===null&&vt===0&&(vt=3),l.flags&=-257,l.flags|=65536,l.lanes=m,d===Wc?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([d]):i.add(d),Ap(r,d,m)),!1;case 22:return l.flags|=65536,d===Wc?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([d]):l.add(d)),Ap(r,d,m)),!1}throw Error(o(435,l.tag))}return Ap(r,d,m),Eu(),!1}if(Ue)return i=jn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=m,d!==xh&&(r=Error(o(422),{cause:d}),Ga(Yn(r,l)))):(d!==xh&&(i=Error(o(423),{cause:d}),Ga(Yn(i,l))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=Yn(d,l),m=np(r.stateNode,d,m),kh(r,m),vt!==4&&(vt=2)),!1;var v=Error(o(520),{cause:d});if(v=Yn(v,l),hl===null?hl=[v]:hl.push(v),vt!==4&&(vt=2),i===null)return!0;d=Yn(d,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,r=m&-m,l.lanes|=r,r=np(l.stateNode,d,r),kh(l,r),!1;case 1:if(i=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(ko===null||!ko.has(v))))return l.flags|=65536,m&=-m,l.lanes|=m,m=Tw(m),Cw(m,r,l,d),kh(l,m),!1}l=l.return}while(l!==null);return!1}var rp=Error(o(461)),Nt=!1;function Yt(r,i,l,d){i.child=r===null?Ib(i,null,l,d):Ci(i,r.child,l,d)}function Aw(r,i,l,d,m){l=l.render;var v=i.ref;if("ref"in d){var E={};for(var O in d)O!=="ref"&&(E[O]=d[O])}else E=d;return Si(i),d=Ph(r,i,l,E,v,m),O=$h(),r!==null&&!Nt?(Fh(r,i,m),Xr(r,i,m)):(Ue&&O&&bh(i),i.flags|=1,Yt(r,i,d,m),i.child)}function Rw(r,i,l,d,m){if(r===null){var v=l.type;return typeof v=="function"&&!gh(v)&&v.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=v,Nw(r,i,v,d,m)):(r=Zc(l.type,null,d,i,i.mode,m),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!dp(r,m)){var E=v.memoizedProps;if(l=l.compare,l=l!==null?l:Ha,l(E,d)&&r.ref===i.ref)return Xr(r,i,m)}return i.flags|=1,r=Hr(v,d),r.ref=i.ref,r.return=i,i.child=r}function Nw(r,i,l,d,m){if(r!==null){var v=r.memoizedProps;if(Ha(v,d)&&r.ref===i.ref)if(Nt=!1,i.pendingProps=d=v,dp(r,m))(r.flags&131072)!==0&&(Nt=!0);else return i.lanes=r.lanes,Xr(r,i,m)}return op(r,i,l,d,m)}function Iw(r,i,l,d){var m=d.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,r!==null){for(d=i.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~v}else d=0,i.child=null;return Ow(r,i,v,l,d)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Xc(i,v!==null?v.cachePool:null),v!==null?Mb(i,v):Dh(),Db(i);else return d=i.lanes=536870912,Ow(r,i,v!==null?v.baseLanes|l:l,l,d)}else v!==null?(Xc(i,v.cachePool),Mb(i,v),Ro(),i.memoizedState=null):(r!==null&&Xc(i,null),Dh(),Ro());return Yt(r,i,m,l),i.child}function sl(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Ow(r,i,l,d,m){var v=Rh();return v=v===null?null:{parent:At._currentValue,pool:v},i.memoizedState={baseLanes:l,cachePool:v},r!==null&&Xc(i,null),Dh(),Db(i),r!==null&&Ss(r,i,d,!0),i.childLanes=m,null}function hu(r,i){return i=mu({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function kw(r,i,l){return Ci(i,r.child,null,l),r=hu(i,i.pendingProps),r.flags|=2,Ln(i),i.memoizedState=null,r}function EO(r,i,l){var d=i.pendingProps,m=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(Ue){if(d.mode==="hidden")return r=hu(i,d),i.lanes=536870912,sl(null,r);if(Lh(i),(r=lt)?(r=V0(r,Jn),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:wo!==null?{id:_r,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},l=mb(r),l.return=i,i.child=l,Zt=i,lt=null)):r=null,r===null)throw So(i);return i.lanes=536870912,null}return hu(i,d)}var v=r.memoizedState;if(v!==null){var E=v.dehydrated;if(Lh(i),m)if(i.flags&256)i.flags&=-257,i=kw(r,i,l);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(o(558));else if(Nt||Ss(r,i,l,!1),m=(l&r.childLanes)!==0,Nt||m){if(d=rt,d!==null&&(E=Sv(d,l),E!==0&&E!==v.retryLane))throw v.retryLane=E,vi(r,E),_n(d,r,E),rp;Eu(),i=kw(r,i,l)}else r=v.treeContext,lt=er(E.nextSibling),Zt=i,Ue=!0,xo=null,Jn=!1,r!==null&&vb(i,r),i=hu(i,d),i.flags|=4096;return i}return r=Hr(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function pu(r,i){var l=i.ref;if(l===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(r===null||r.ref!==l)&&(i.flags|=4194816)}}function op(r,i,l,d,m){return Si(i),l=Ph(r,i,l,d,void 0,m),d=$h(),r!==null&&!Nt?(Fh(r,i,m),Xr(r,i,m)):(Ue&&d&&bh(i),i.flags|=1,Yt(r,i,l,m),i.child)}function Mw(r,i,l,d,m,v){return Si(i),i.updateQueue=null,l=Lb(i,d,l,m),jb(r),d=$h(),r!==null&&!Nt?(Fh(r,i,v),Xr(r,i,v)):(Ue&&d&&bh(i),i.flags|=1,Yt(r,i,l,v),i.child)}function Dw(r,i,l,d,m){if(Si(i),i.stateNode===null){var v=vs,E=l.contextType;typeof E=="object"&&E!==null&&(v=Gt(E)),v=new l(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=tp,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Ih(i),E=l.contextType,v.context=typeof E=="object"&&E!==null?Gt(E):vs,v.state=i.memoizedState,E=l.getDerivedStateFromProps,typeof E=="function"&&(ep(i,l,E,d),v.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(E=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),E!==v.state&&tp.enqueueReplaceState(v,v.state,null),tl(i,d,v,m),el(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var O=i.memoizedProps,L=Ri(l,O);v.props=L;var H=v.context,K=l.contextType;E=vs,typeof K=="object"&&K!==null&&(E=Gt(K));var ne=l.getDerivedStateFromProps;K=typeof ne=="function"||typeof v.getSnapshotBeforeUpdate=="function",O=i.pendingProps!==O,K||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(O||H!==E)&&ww(i,v,d,E),Eo=!1;var Q=i.memoizedState;v.state=Q,tl(i,d,v,m),el(),H=i.memoizedState,O||Q!==H||Eo?(typeof ne=="function"&&(ep(i,l,ne,d),H=i.memoizedState),(L=Eo||bw(i,l,L,d,Q,H,E))?(K||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=H),v.props=d,v.state=H,v.context=E,d=L):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,Oh(r,i),E=i.memoizedProps,K=Ri(l,E),v.props=K,ne=i.pendingProps,Q=v.context,H=l.contextType,L=vs,typeof H=="object"&&H!==null&&(L=Gt(H)),O=l.getDerivedStateFromProps,(H=typeof O=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E!==ne||Q!==L)&&ww(i,v,d,L),Eo=!1,Q=i.memoizedState,v.state=Q,tl(i,d,v,m),el();var G=i.memoizedState;E!==ne||Q!==G||Eo||r!==null&&r.dependencies!==null&&Yc(r.dependencies)?(typeof O=="function"&&(ep(i,l,O,d),G=i.memoizedState),(K=Eo||bw(i,l,K,d,Q,G,L)||r!==null&&r.dependencies!==null&&Yc(r.dependencies))?(H||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,G,L),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,G,L)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&Q===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&Q===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=G),v.props=d,v.state=G,v.context=L,d=K):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&Q===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&Q===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,pu(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Ci(i,r.child,null,m),i.child=Ci(i,null,l,m)):Yt(r,i,l,m),i.memoizedState=v.state,r=i.child):r=Xr(r,i,m),r}function jw(r,i,l,d){return wi(),i.flags|=256,Yt(r,i,l,d),i.child}var ip={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sp(r){return{baseLanes:r,cachePool:Eb()}}function ap(r,i,l){return r=r!==null?r.childLanes&~l:0,i&&(r|=Pn),r}function Lw(r,i,l){var d=i.pendingProps,m=!1,v=(i.flags&128)!==0,E;if((E=v)||(E=r!==null&&r.memoizedState===null?!1:(_t.current&2)!==0),E&&(m=!0,i.flags&=-129),E=(i.flags&32)!==0,i.flags&=-33,r===null){if(Ue){if(m?Ao(i):Ro(),(r=lt)?(r=V0(r,Jn),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:wo!==null?{id:_r,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},l=mb(r),l.return=i,i.child=l,Zt=i,lt=null)):r=null,r===null)throw So(i);return Up(r)?i.lanes=32:i.lanes=536870912,null}var O=d.children;return d=d.fallback,m?(Ro(),m=i.mode,O=mu({mode:"hidden",children:O},m),d=bi(d,m,l,null),O.return=i,d.return=i,O.sibling=d,i.child=O,d=i.child,d.memoizedState=sp(l),d.childLanes=ap(r,E,l),i.memoizedState=ip,sl(null,d)):(Ao(i),lp(i,O))}var L=r.memoizedState;if(L!==null&&(O=L.dehydrated,O!==null)){if(v)i.flags&256?(Ao(i),i.flags&=-257,i=cp(r,i,l)):i.memoizedState!==null?(Ro(),i.child=r.child,i.flags|=128,i=null):(Ro(),O=d.fallback,m=i.mode,d=mu({mode:"visible",children:d.children},m),O=bi(O,m,l,null),O.flags|=2,d.return=i,O.return=i,d.sibling=O,i.child=d,Ci(i,r.child,null,l),d=i.child,d.memoizedState=sp(l),d.childLanes=ap(r,E,l),i.memoizedState=ip,i=sl(null,d));else if(Ao(i),Up(O)){if(E=O.nextSibling&&O.nextSibling.dataset,E)var H=E.dgst;E=H,d=Error(o(419)),d.stack="",d.digest=E,Ga({value:d,source:null,stack:null}),i=cp(r,i,l)}else if(Nt||Ss(r,i,l,!1),E=(l&r.childLanes)!==0,Nt||E){if(E=rt,E!==null&&(d=Sv(E,l),d!==0&&d!==L.retryLane))throw L.retryLane=d,vi(r,d),_n(E,r,d),rp;qp(O)||Eu(),i=cp(r,i,l)}else qp(O)?(i.flags|=192,i.child=r.child,i=null):(r=L.treeContext,lt=er(O.nextSibling),Zt=i,Ue=!0,xo=null,Jn=!1,r!==null&&vb(i,r),i=lp(i,d.children),i.flags|=4096);return i}return m?(Ro(),O=d.fallback,m=i.mode,L=r.child,H=L.sibling,d=Hr(L,{mode:"hidden",children:d.children}),d.subtreeFlags=L.subtreeFlags&65011712,H!==null?O=Hr(H,O):(O=bi(O,m,l,null),O.flags|=2),O.return=i,d.return=i,d.sibling=O,i.child=d,sl(null,d),d=i.child,O=r.child.memoizedState,O===null?O=sp(l):(m=O.cachePool,m!==null?(L=At._currentValue,m=m.parent!==L?{parent:L,pool:L}:m):m=Eb(),O={baseLanes:O.baseLanes|l,cachePool:m}),d.memoizedState=O,d.childLanes=ap(r,E,l),i.memoizedState=ip,sl(r.child,d)):(Ao(i),l=r.child,r=l.sibling,l=Hr(l,{mode:"visible",children:d.children}),l.return=i,l.sibling=null,r!==null&&(E=i.deletions,E===null?(i.deletions=[r],i.flags|=16):E.push(r)),i.child=l,i.memoizedState=null,l)}function lp(r,i){return i=mu({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function mu(r,i){return r=Dn(22,r,null,i),r.lanes=0,r}function cp(r,i,l){return Ci(i,r.child,null,l),r=lp(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function zw(r,i,l){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),Eh(r.return,i,l)}function up(r,i,l,d,m,v){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:m,treeForkCount:v}:(E.isBackwards=i,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=l,E.tailMode=m,E.treeForkCount=v)}function Pw(r,i,l){var d=i.pendingProps,m=d.revealOrder,v=d.tail;d=d.children;var E=_t.current,O=(E&2)!==0;if(O?(E=E&1|2,i.flags|=128):E&=1,ie(_t,E),Yt(r,i,d,l),d=Ue?Za:0,!O&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&zw(r,l,i);else if(r.tag===19)zw(r,l,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(l=i.child,m=null;l!==null;)r=l.alternate,r!==null&&ru(r)===null&&(m=l),l=l.sibling;l=m,l===null?(m=i.child,i.child=null):(m=l.sibling,l.sibling=null),up(i,!1,m,l,v,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=i.child,i.child=null;m!==null;){if(r=m.alternate,r!==null&&ru(r)===null){i.child=m;break}r=m.sibling,m.sibling=l,l=m,m=r}up(i,!0,l,null,v,d);break;case"together":up(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Xr(r,i,l){if(r!==null&&(i.dependencies=r.dependencies),Oo|=i.lanes,(l&i.childLanes)===0)if(r!==null){if(Ss(r,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(o(153));if(i.child!==null){for(r=i.child,l=Hr(r,r.pendingProps),i.child=l,l.return=i;r.sibling!==null;)r=r.sibling,l=l.sibling=Hr(r,r.pendingProps),l.return=i;l.sibling=null}return i.child}function dp(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Yc(r)))}function TO(r,i,l){switch(i.tag){case 3:_e(i,i.stateNode.containerInfo),_o(i,At,r.memoizedState.cache),wi();break;case 27:case 5:Ce(i);break;case 4:_e(i,i.stateNode.containerInfo);break;case 10:_o(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Lh(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ao(i),i.flags|=128,null):(l&i.child.childLanes)!==0?Lw(r,i,l):(Ao(i),r=Xr(r,i,l),r!==null?r.sibling:null);Ao(i);break;case 19:var m=(r.flags&128)!==0;if(d=(l&i.childLanes)!==0,d||(Ss(r,i,l,!1),d=(l&i.childLanes)!==0),m){if(d)return Pw(r,i,l);i.flags|=128}if(m=i.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),ie(_t,_t.current),d)break;return null;case 22:return i.lanes=0,Iw(r,i,l,i.pendingProps);case 24:_o(i,At,r.memoizedState.cache)}return Xr(r,i,l)}function $w(r,i,l){if(r!==null)if(r.memoizedProps!==i.pendingProps)Nt=!0;else{if(!dp(r,l)&&(i.flags&128)===0)return Nt=!1,TO(r,i,l);Nt=(r.flags&131072)!==0}else Nt=!1,Ue&&(i.flags&1048576)!==0&&yb(i,Za,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Ei(i.elementType),i.type=r,typeof r=="function")gh(r)?(d=Ri(r,d),i.tag=1,i=Dw(null,i,r,d,l)):(i.tag=0,i=op(null,i,r,d,l));else{if(r!=null){var m=r.$$typeof;if(m===N){i.tag=11,i=Aw(null,i,r,d,l);break e}else if(m===P){i.tag=14,i=Rw(null,i,r,d,l);break e}}throw i=ce(r)||r,Error(o(306,i,""))}}return i;case 0:return op(r,i,i.type,i.pendingProps,l);case 1:return d=i.type,m=Ri(d,i.pendingProps),Dw(r,i,d,m,l);case 3:e:{if(_e(i,i.stateNode.containerInfo),r===null)throw Error(o(387));d=i.pendingProps;var v=i.memoizedState;m=v.element,Oh(r,i),tl(i,d,null,l);var E=i.memoizedState;if(d=E.cache,_o(i,At,d),d!==v.cache&&Th(i,[At],l,!0),el(),d=E.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:E.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=jw(r,i,d,l);break e}else if(d!==m){m=Yn(Error(o(424)),i),Ga(m),i=jw(r,i,d,l);break e}else for(r=i.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,lt=er(r.firstChild),Zt=i,Ue=!0,xo=null,Jn=!0,l=Ib(i,null,d,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(wi(),d===m){i=Xr(r,i,l);break e}Yt(r,i,d,l)}i=i.child}return i;case 26:return pu(r,i),r===null?(l=K0(i.type,null,i.pendingProps,null))?i.memoizedState=l:Ue||(l=i.type,r=i.pendingProps,d=Ou(ve.current).createElement(l),d[Qt]=i,d[yn]=r,Kt(d,l,r),Bt(d),i.stateNode=d):i.memoizedState=K0(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ce(i),r===null&&Ue&&(d=i.stateNode=Z0(i.type,i.pendingProps,ve.current),Zt=i,Jn=!0,m=lt,Lo(i.type)?(Vp=m,lt=er(d.firstChild)):lt=m),Yt(r,i,i.pendingProps.children,l),pu(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&Ue&&((m=d=lt)&&(d=t2(d,i.type,i.pendingProps,Jn),d!==null?(i.stateNode=d,Zt=i,lt=er(d.firstChild),Jn=!1,m=!0):m=!1),m||So(i)),Ce(i),m=i.type,v=i.pendingProps,E=r!==null?r.memoizedProps:null,d=v.children,$p(m,v)?d=null:E!==null&&$p(m,E)&&(i.flags|=32),i.memoizedState!==null&&(m=Ph(r,i,gO,null,null,l),xl._currentValue=m),pu(r,i),Yt(r,i,d,l),i.child;case 6:return r===null&&Ue&&((r=l=lt)&&(l=n2(l,i.pendingProps,Jn),l!==null?(i.stateNode=l,Zt=i,lt=null,r=!0):r=!1),r||So(i)),null;case 13:return Lw(r,i,l);case 4:return _e(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ci(i,null,d,l):Yt(r,i,d,l),i.child;case 11:return Aw(r,i,i.type,i.pendingProps,l);case 7:return Yt(r,i,i.pendingProps,l),i.child;case 8:return Yt(r,i,i.pendingProps.children,l),i.child;case 12:return Yt(r,i,i.pendingProps.children,l),i.child;case 10:return d=i.pendingProps,_o(i,i.type,d.value),Yt(r,i,d.children,l),i.child;case 9:return m=i.type._context,d=i.pendingProps.children,Si(i),m=Gt(m),d=d(m),i.flags|=1,Yt(r,i,d,l),i.child;case 14:return Rw(r,i,i.type,i.pendingProps,l);case 15:return Nw(r,i,i.type,i.pendingProps,l);case 19:return Pw(r,i,l);case 31:return EO(r,i,l);case 22:return Iw(r,i,l,i.pendingProps);case 24:return Si(i),d=Gt(At),r===null?(m=Rh(),m===null&&(m=rt,v=Ch(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=l),m=v),i.memoizedState={parent:d,cache:m},Ih(i),_o(i,At,m)):((r.lanes&l)!==0&&(Oh(r,i),tl(i,null,null,l),el()),m=r.memoizedState,v=i.memoizedState,m.parent!==d?(m={parent:d,cache:d},i.memoizedState=m,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=m),_o(i,At,d)):(d=v.cache,_o(i,At,d),d!==m.cache&&Th(i,[At],l,!0))),Yt(r,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(o(156,i.tag))}function Jr(r){r.flags|=4}function fp(r,i,l,d,m){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(f0())r.flags|=8192;else throw Ti=Wc,Nh}else r.flags&=-16777217}function Fw(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!tx(i))if(f0())r.flags|=8192;else throw Ti=Wc,Nh}function gu(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?bv():536870912,r.lanes|=i,Ds|=i)}function al(r,i){if(!Ue)switch(r.tailMode){case"hidden":i=r.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?r.tail=null:l.sibling=null;break;case"collapsed":l=r.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function ct(r){var i=r.alternate!==null&&r.alternate.child===r.child,l=0,d=0;if(i)for(var m=r.child;m!==null;)l|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)l|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=l,i}function CO(r,i,l){var d=i.pendingProps;switch(wh(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ct(i),null;case 1:return ct(i),null;case 3:return l=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Gr(At),Te(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(r===null||r.child===null)&&(xs(i)?Jr(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Sh())),ct(i),null;case 26:var m=i.type,v=i.memoizedState;return r===null?(Jr(i),v!==null?(ct(i),Fw(i,v)):(ct(i),fp(i,m,null,d,l))):v?v!==r.memoizedState?(Jr(i),ct(i),Fw(i,v)):(ct(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Jr(i),ct(i),fp(i,m,r,d,l)),null;case 27:if(Ie(i),l=ve.current,m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Jr(i);else{if(!d){if(i.stateNode===null)throw Error(o(166));return ct(i),null}r=se.current,xs(i)?bb(i):(r=Z0(m,d,l),i.stateNode=r,Jr(i))}return ct(i),null;case 5:if(Ie(i),m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Jr(i);else{if(!d){if(i.stateNode===null)throw Error(o(166));return ct(i),null}if(v=se.current,xs(i))bb(i);else{var E=Ou(ve.current);switch(v){case 1:v=E.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=E.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=E.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=E.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=E.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?E.createElement(m,{is:d.is}):E.createElement(m)}}v[Qt]=i,v[yn]=d;e:for(E=i.child;E!==null;){if(E.tag===5||E.tag===6)v.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===i)break e;for(;E.sibling===null;){if(E.return===null||E.return===i)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}i.stateNode=v;e:switch(Kt(v,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Jr(i)}}return ct(i),fp(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,l),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Jr(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(o(166));if(r=ve.current,xs(i)){if(r=i.stateNode,l=i.memoizedProps,d=null,m=Zt,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Qt]=i,r=!!(r.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||L0(r.nodeValue,l)),r||So(i,!0)}else r=Ou(r).createTextNode(d),r[Qt]=i,i.stateNode=r}return ct(i),null;case 31:if(l=i.memoizedState,r===null||r.memoizedState!==null){if(d=xs(i),l!==null){if(r===null){if(!d)throw Error(o(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(o(557));r[Qt]=i}else wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;ct(i),r=!1}else l=Sh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=l),r=!0;if(!r)return i.flags&256?(Ln(i),i):(Ln(i),null);if((i.flags&128)!==0)throw Error(o(558))}return ct(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=xs(i),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(o(318));if(m=i.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));m[Qt]=i}else wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;ct(i),m=!1}else m=Sh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return i.flags&256?(Ln(i),i):(Ln(i),null)}return Ln(i),(i.flags&128)!==0?(i.lanes=l,i):(l=d!==null,r=r!==null&&r.memoizedState!==null,l&&(d=i.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==m&&(d.flags|=2048)),l!==r&&l&&(i.child.flags|=8192),gu(i,i.updateQueue),ct(i),null);case 4:return Te(),r===null&&Dp(i.stateNode.containerInfo),ct(i),null;case 10:return Gr(i.type),ct(i),null;case 19:if(Y(_t),d=i.memoizedState,d===null)return ct(i),null;if(m=(i.flags&128)!==0,v=d.rendering,v===null)if(m)al(d,!1);else{if(vt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=ru(r),v!==null){for(i.flags|=128,al(d,!1),r=v.updateQueue,i.updateQueue=r,gu(i,r),i.subtreeFlags=0,r=l,l=i.child;l!==null;)pb(l,r),l=l.sibling;return ie(_t,_t.current&1|2),Ue&&Qr(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&cn()>xu&&(i.flags|=128,m=!0,al(d,!1),i.lanes=4194304)}else{if(!m)if(r=ru(v),r!==null){if(i.flags|=128,m=!0,r=r.updateQueue,i.updateQueue=r,gu(i,r),al(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!Ue)return ct(i),null}else 2*cn()-d.renderingStartTime>xu&&l!==536870912&&(i.flags|=128,m=!0,al(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=cn(),r.sibling=null,l=_t.current,ie(_t,m?l&1|2:l&1),Ue&&Qr(i,d.treeForkCount),r):(ct(i),null);case 22:case 23:return Ln(i),jh(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(l&536870912)!==0&&(i.flags&128)===0&&(ct(i),i.subtreeFlags&6&&(i.flags|=8192)):ct(i),l=i.updateQueue,l!==null&&gu(i,l.retryQueue),l=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==l&&(i.flags|=2048),r!==null&&Y(_i),null;case 24:return l=null,r!==null&&(l=r.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),Gr(At),ct(i),null;case 25:return null;case 30:return null}throw Error(o(156,i.tag))}function AO(r,i){switch(wh(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Gr(At),Te(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Ie(i),null;case 31:if(i.memoizedState!==null){if(Ln(i),i.alternate===null)throw Error(o(340));wi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Ln(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(o(340));wi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return Y(_t),null;case 4:return Te(),null;case 10:return Gr(i.type),null;case 22:case 23:return Ln(i),jh(),r!==null&&Y(_i),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Gr(At),null;case 25:return null;default:return null}}function Bw(r,i){switch(wh(i),i.tag){case 3:Gr(At),Te();break;case 26:case 27:case 5:Ie(i);break;case 4:Te();break;case 31:i.memoizedState!==null&&Ln(i);break;case 13:Ln(i);break;case 19:Y(_t);break;case 10:Gr(i.type);break;case 22:case 23:Ln(i),jh(),r!==null&&Y(_i);break;case 24:Gr(At)}}function ll(r,i){try{var l=i.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var m=d.next;l=m;do{if((l.tag&r)===r){d=void 0;var v=l.create,E=l.inst;d=v(),E.destroy=d}l=l.next}while(l!==m)}}catch(O){Je(i,i.return,O)}}function No(r,i,l){try{var d=i.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var v=m.next;d=v;do{if((d.tag&r)===r){var E=d.inst,O=E.destroy;if(O!==void 0){E.destroy=void 0,m=i;var L=l,H=O;try{H()}catch(K){Je(m,L,K)}}}d=d.next}while(d!==v)}}catch(K){Je(i,i.return,K)}}function qw(r){var i=r.updateQueue;if(i!==null){var l=r.stateNode;try{kb(i,l)}catch(d){Je(r,r.return,d)}}}function Uw(r,i,l){l.props=Ri(r.type,r.memoizedProps),l.state=r.memoizedState;try{l.componentWillUnmount()}catch(d){Je(r,i,d)}}function cl(r,i){try{var l=r.ref;if(l!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof l=="function"?r.refCleanup=l(d):l.current=d}}catch(m){Je(r,i,m)}}function Tr(r,i){var l=r.ref,d=r.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(m){Je(r,i,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){Je(r,i,m)}else l.current=null}function Vw(r){var i=r.type,l=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(m){Je(r,r.return,m)}}function hp(r,i,l){try{var d=r.stateNode;YO(d,r.type,l,i),d[yn]=i}catch(m){Je(r,r.return,m)}}function Hw(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Lo(r.type)||r.tag===4}function pp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Hw(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Lo(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function mp(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(r,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(r),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=Ur));else if(d!==4&&(d===27&&Lo(r.type)&&(l=r.stateNode,i=null),r=r.child,r!==null))for(mp(r,i,l),r=r.sibling;r!==null;)mp(r,i,l),r=r.sibling}function yu(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?l.insertBefore(r,i):l.appendChild(r);else if(d!==4&&(d===27&&Lo(r.type)&&(l=r.stateNode),r=r.child,r!==null))for(yu(r,i,l),r=r.sibling;r!==null;)yu(r,i,l),r=r.sibling}function Qw(r){var i=r.stateNode,l=r.memoizedProps;try{for(var d=r.type,m=i.attributes;m.length;)i.removeAttributeNode(m[0]);Kt(i,d,l),i[Qt]=r,i[yn]=l}catch(v){Je(r,r.return,v)}}var Wr=!1,It=!1,gp=!1,Zw=typeof WeakSet=="function"?WeakSet:Set,qt=null;function RO(r,i){if(r=r.containerInfo,zp=Pu,r=ib(r),ch(r)){if("selectionStart"in r)var l={start:r.selectionStart,end:r.selectionEnd};else e:{l=(l=r.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var m=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var E=0,O=-1,L=-1,H=0,K=0,ne=r,Q=null;t:for(;;){for(var G;ne!==l||m!==0&&ne.nodeType!==3||(O=E+m),ne!==v||d!==0&&ne.nodeType!==3||(L=E+d),ne.nodeType===3&&(E+=ne.nodeValue.length),(G=ne.firstChild)!==null;)Q=ne,ne=G;for(;;){if(ne===r)break t;if(Q===l&&++H===m&&(O=E),Q===v&&++K===d&&(L=E),(G=ne.nextSibling)!==null)break;ne=Q,Q=ne.parentNode}ne=G}l=O===-1||L===-1?null:{start:O,end:L}}else l=null}l=l||{start:0,end:0}}else l=null;for(Pp={focusedElem:r,selectionRange:l},Pu=!1,qt=i;qt!==null;)if(i=qt,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,qt=r;else for(;qt!==null;){switch(i=qt,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(l=0;l<r.length;l++)m=r[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,l=i,m=v.memoizedProps,v=v.memoizedState,d=l.stateNode;try{var fe=Ri(l.type,m);r=d.getSnapshotBeforeUpdate(fe,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ee){Je(l,l.return,Ee)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,l=r.nodeType,l===9)Bp(r);else if(l===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Bp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(o(163))}if(r=i.sibling,r!==null){r.return=i.return,qt=r;break}qt=i.return}}function Gw(r,i,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:to(r,l),d&4&&ll(5,l);break;case 1:if(to(r,l),d&4)if(r=l.stateNode,i===null)try{r.componentDidMount()}catch(E){Je(l,l.return,E)}else{var m=Ri(l.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(m,i,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Je(l,l.return,E)}}d&64&&qw(l),d&512&&cl(l,l.return);break;case 3:if(to(r,l),d&64&&(r=l.updateQueue,r!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{kb(r,i)}catch(E){Je(l,l.return,E)}}break;case 27:i===null&&d&4&&Qw(l);case 26:case 5:to(r,l),i===null&&d&4&&Vw(l),d&512&&cl(l,l.return);break;case 12:to(r,l);break;case 31:to(r,l),d&4&&Xw(r,l);break;case 13:to(r,l),d&4&&Jw(r,l),d&64&&(r=l.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(l=zO.bind(null,l),r2(r,l))));break;case 22:if(d=l.memoizedState!==null||Wr,!d){i=i!==null&&i.memoizedState!==null||It,m=Wr;var v=It;Wr=d,(It=i)&&!v?no(r,l,(l.subtreeFlags&8772)!==0):to(r,l),Wr=m,It=v}break;case 30:break;default:to(r,l)}}function Yw(r){var i=r.alternate;i!==null&&(r.alternate=null,Yw(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Qf(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var dt=null,bn=!1;function eo(r,i,l){for(l=l.child;l!==null;)Kw(r,i,l),l=l.sibling}function Kw(r,i,l){if(On&&typeof On.onCommitFiberUnmount=="function")try{On.onCommitFiberUnmount(Ma,l)}catch{}switch(l.tag){case 26:It||Tr(l,i),eo(r,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:It||Tr(l,i);var d=dt,m=bn;Lo(l.type)&&(dt=l.stateNode,bn=!1),eo(r,i,l),vl(l.stateNode),dt=d,bn=m;break;case 5:It||Tr(l,i);case 6:if(d=dt,m=bn,dt=null,eo(r,i,l),dt=d,bn=m,dt!==null)if(bn)try{(dt.nodeType===9?dt.body:dt.nodeName==="HTML"?dt.ownerDocument.body:dt).removeChild(l.stateNode)}catch(v){Je(l,i,v)}else try{dt.removeChild(l.stateNode)}catch(v){Je(l,i,v)}break;case 18:dt!==null&&(bn?(r=dt,q0(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,l.stateNode),qs(r)):q0(dt,l.stateNode));break;case 4:d=dt,m=bn,dt=l.stateNode.containerInfo,bn=!0,eo(r,i,l),dt=d,bn=m;break;case 0:case 11:case 14:case 15:No(2,l,i),It||No(4,l,i),eo(r,i,l);break;case 1:It||(Tr(l,i),d=l.stateNode,typeof d.componentWillUnmount=="function"&&Uw(l,i,d)),eo(r,i,l);break;case 21:eo(r,i,l);break;case 22:It=(d=It)||l.memoizedState!==null,eo(r,i,l),It=d;break;default:eo(r,i,l)}}function Xw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{qs(r)}catch(l){Je(i,i.return,l)}}}function Jw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{qs(r)}catch(l){Je(i,i.return,l)}}function NO(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Zw),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Zw),i;default:throw Error(o(435,r.tag))}}function vu(r,i){var l=NO(r);i.forEach(function(d){if(!l.has(d)){l.add(d);var m=PO.bind(null,r,d);d.then(m,m)}})}function wn(r,i){var l=i.deletions;if(l!==null)for(var d=0;d<l.length;d++){var m=l[d],v=r,E=i,O=E;e:for(;O!==null;){switch(O.tag){case 27:if(Lo(O.type)){dt=O.stateNode,bn=!1;break e}break;case 5:dt=O.stateNode,bn=!1;break e;case 3:case 4:dt=O.stateNode.containerInfo,bn=!0;break e}O=O.return}if(dt===null)throw Error(o(160));Kw(v,E,m),dt=null,bn=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Ww(i,r),i=i.sibling}var pr=null;function Ww(r,i){var l=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:wn(i,r),xn(r),d&4&&(No(3,r,r.return),ll(3,r),No(5,r,r.return));break;case 1:wn(i,r),xn(r),d&512&&(It||l===null||Tr(l,l.return)),d&64&&Wr&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(l=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var m=pr;if(wn(i,r),xn(r),d&512&&(It||l===null||Tr(l,l.return)),d&4){var v=l!==null?l.memoizedState:null;if(d=r.memoizedState,l===null)if(d===null)if(r.stateNode===null){e:{d=r.type,l=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":v=m.getElementsByTagName("title")[0],(!v||v[La]||v[Qt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(d),m.head.insertBefore(v,m.querySelector("head > title"))),Kt(v,d,l),v[Qt]=r,Bt(v),d=v;break e;case"link":var E=W0("link","href",m).get(d+(l.href||""));if(E){for(var O=0;O<E.length;O++)if(v=E[O],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){E.splice(O,1);break t}}v=m.createElement(d),Kt(v,d,l),m.head.appendChild(v);break;case"meta":if(E=W0("meta","content",m).get(d+(l.content||""))){for(O=0;O<E.length;O++)if(v=E[O],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){E.splice(O,1);break t}}v=m.createElement(d),Kt(v,d,l),m.head.appendChild(v);break;default:throw Error(o(468,d))}v[Qt]=r,Bt(v),d=v}r.stateNode=d}else ex(m,r.type,r.stateNode);else r.stateNode=J0(m,d,r.memoizedProps);else v!==d?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,d===null?ex(m,r.type,r.stateNode):J0(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&hp(r,r.memoizedProps,l.memoizedProps)}break;case 27:wn(i,r),xn(r),d&512&&(It||l===null||Tr(l,l.return)),l!==null&&d&4&&hp(r,r.memoizedProps,l.memoizedProps);break;case 5:if(wn(i,r),xn(r),d&512&&(It||l===null||Tr(l,l.return)),r.flags&32){m=r.stateNode;try{ds(m,"")}catch(fe){Je(r,r.return,fe)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,hp(r,m,l!==null?l.memoizedProps:m)),d&1024&&(gp=!0);break;case 6:if(wn(i,r),xn(r),d&4){if(r.stateNode===null)throw Error(o(162));d=r.memoizedProps,l=r.stateNode;try{l.nodeValue=d}catch(fe){Je(r,r.return,fe)}}break;case 3:if(Du=null,m=pr,pr=ku(i.containerInfo),wn(i,r),pr=m,xn(r),d&4&&l!==null&&l.memoizedState.isDehydrated)try{qs(i.containerInfo)}catch(fe){Je(r,r.return,fe)}gp&&(gp=!1,e0(r));break;case 4:d=pr,pr=ku(r.stateNode.containerInfo),wn(i,r),xn(r),pr=d;break;case 12:wn(i,r),xn(r);break;case 31:wn(i,r),xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,vu(r,d)));break;case 13:wn(i,r),xn(r),r.child.flags&8192&&r.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(wu=cn()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,vu(r,d)));break;case 22:m=r.memoizedState!==null;var L=l!==null&&l.memoizedState!==null,H=Wr,K=It;if(Wr=H||m,It=K||L,wn(i,r),It=K,Wr=H,xn(r),d&8192)e:for(i=r.stateNode,i._visibility=m?i._visibility&-2:i._visibility|1,m&&(l===null||L||Wr||It||Ni(r)),l=null,i=r;;){if(i.tag===5||i.tag===26){if(l===null){L=l=i;try{if(v=L.stateNode,m)E=v.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{O=L.stateNode;var ne=L.memoizedProps.style,Q=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;O.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(fe){Je(L,L.return,fe)}}}else if(i.tag===6){if(l===null){L=i;try{L.stateNode.nodeValue=m?"":L.memoizedProps}catch(fe){Je(L,L.return,fe)}}}else if(i.tag===18){if(l===null){L=i;try{var G=L.stateNode;m?U0(G,!0):U0(L.stateNode,!1)}catch(fe){Je(L,L.return,fe)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,vu(r,l))));break;case 19:wn(i,r),xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,vu(r,d)));break;case 30:break;case 21:break;default:wn(i,r),xn(r)}}function xn(r){var i=r.flags;if(i&2){try{for(var l,d=r.return;d!==null;){if(Hw(d)){l=d;break}d=d.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var m=l.stateNode,v=pp(r);yu(r,v,m);break;case 5:var E=l.stateNode;l.flags&32&&(ds(E,""),l.flags&=-33);var O=pp(r);yu(r,O,E);break;case 3:case 4:var L=l.stateNode.containerInfo,H=pp(r);mp(r,H,L);break;default:throw Error(o(161))}}catch(K){Je(r,r.return,K)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function e0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;e0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function to(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Gw(r,i.alternate,i),i=i.sibling}function Ni(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:No(4,i,i.return),Ni(i);break;case 1:Tr(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&Uw(i,i.return,l),Ni(i);break;case 27:vl(i.stateNode);case 26:case 5:Tr(i,i.return),Ni(i);break;case 22:i.memoizedState===null&&Ni(i);break;case 30:Ni(i);break;default:Ni(i)}r=r.sibling}}function no(r,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,m=r,v=i,E=v.flags;switch(v.tag){case 0:case 11:case 15:no(m,v,l),ll(4,v);break;case 1:if(no(m,v,l),d=v,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(H){Je(d,d.return,H)}if(d=v,m=d.updateQueue,m!==null){var O=d.stateNode;try{var L=m.shared.hiddenCallbacks;if(L!==null)for(m.shared.hiddenCallbacks=null,m=0;m<L.length;m++)Ob(L[m],O)}catch(H){Je(d,d.return,H)}}l&&E&64&&qw(v),cl(v,v.return);break;case 27:Qw(v);case 26:case 5:no(m,v,l),l&&d===null&&E&4&&Vw(v),cl(v,v.return);break;case 12:no(m,v,l);break;case 31:no(m,v,l),l&&E&4&&Xw(m,v);break;case 13:no(m,v,l),l&&E&4&&Jw(m,v);break;case 22:v.memoizedState===null&&no(m,v,l),cl(v,v.return);break;case 30:break;default:no(m,v,l)}i=i.sibling}}function yp(r,i){var l=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==l&&(r!=null&&r.refCount++,l!=null&&Ya(l))}function vp(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Ya(r))}function mr(r,i,l,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)t0(r,i,l,d),i=i.sibling}function t0(r,i,l,d){var m=i.flags;switch(i.tag){case 0:case 11:case 15:mr(r,i,l,d),m&2048&&ll(9,i);break;case 1:mr(r,i,l,d);break;case 3:mr(r,i,l,d),m&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Ya(r)));break;case 12:if(m&2048){mr(r,i,l,d),r=i.stateNode;try{var v=i.memoizedProps,E=v.id,O=v.onPostCommit;typeof O=="function"&&O(E,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(L){Je(i,i.return,L)}}else mr(r,i,l,d);break;case 31:mr(r,i,l,d);break;case 13:mr(r,i,l,d);break;case 23:break;case 22:v=i.stateNode,E=i.alternate,i.memoizedState!==null?v._visibility&2?mr(r,i,l,d):ul(r,i):v._visibility&2?mr(r,i,l,d):(v._visibility|=2,Os(r,i,l,d,(i.subtreeFlags&10256)!==0||!1)),m&2048&&yp(E,i);break;case 24:mr(r,i,l,d),m&2048&&vp(i.alternate,i);break;default:mr(r,i,l,d)}}function Os(r,i,l,d,m){for(m=m&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,E=i,O=l,L=d,H=E.flags;switch(E.tag){case 0:case 11:case 15:Os(v,E,O,L,m),ll(8,E);break;case 23:break;case 22:var K=E.stateNode;E.memoizedState!==null?K._visibility&2?Os(v,E,O,L,m):ul(v,E):(K._visibility|=2,Os(v,E,O,L,m)),m&&H&2048&&yp(E.alternate,E);break;case 24:Os(v,E,O,L,m),m&&H&2048&&vp(E.alternate,E);break;default:Os(v,E,O,L,m)}i=i.sibling}}function ul(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=r,d=i,m=d.flags;switch(d.tag){case 22:ul(l,d),m&2048&&yp(d.alternate,d);break;case 24:ul(l,d),m&2048&&vp(d.alternate,d);break;default:ul(l,d)}i=i.sibling}}var dl=8192;function ks(r,i,l){if(r.subtreeFlags&dl)for(r=r.child;r!==null;)n0(r,i,l),r=r.sibling}function n0(r,i,l){switch(r.tag){case 26:ks(r,i,l),r.flags&dl&&r.memoizedState!==null&&m2(l,pr,r.memoizedState,r.memoizedProps);break;case 5:ks(r,i,l);break;case 3:case 4:var d=pr;pr=ku(r.stateNode.containerInfo),ks(r,i,l),pr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=dl,dl=16777216,ks(r,i,l),dl=d):ks(r,i,l));break;default:ks(r,i,l)}}function r0(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function fl(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];qt=d,i0(d,r)}r0(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)o0(r),r=r.sibling}function o0(r){switch(r.tag){case 0:case 11:case 15:fl(r),r.flags&2048&&No(9,r,r.return);break;case 3:fl(r);break;case 12:fl(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,bu(r)):fl(r);break;default:fl(r)}}function bu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];qt=d,i0(d,r)}r0(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:No(8,i,i.return),bu(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,bu(i));break;default:bu(i)}r=r.sibling}}function i0(r,i){for(;qt!==null;){var l=qt;switch(l.tag){case 0:case 11:case 15:No(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Ya(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,qt=d;else e:for(l=r;qt!==null;){d=qt;var m=d.sibling,v=d.return;if(Yw(d),d===l){qt=null;break e}if(m!==null){m.return=v,qt=m;break e}qt=v}}}var IO={getCacheForType:function(r){var i=Gt(At),l=i.data.get(r);return l===void 0&&(l=r(),i.data.set(r,l)),l},cacheSignal:function(){return Gt(At).controller.signal}},OO=typeof WeakMap=="function"?WeakMap:Map,Ye=0,rt=null,ze=null,Fe=0,Xe=0,zn=null,Io=!1,Ms=!1,bp=!1,ro=0,vt=0,Oo=0,Ii=0,wp=0,Pn=0,Ds=0,hl=null,Sn=null,xp=!1,wu=0,s0=0,xu=1/0,Su=null,ko=null,zt=0,Mo=null,js=null,oo=0,Sp=0,_p=null,a0=null,pl=0,Ep=null;function $n(){return(Ye&2)!==0&&Fe!==0?Fe&-Fe:F.T!==null?Ip():_v()}function l0(){if(Pn===0)if((Fe&536870912)===0||Ue){var r=Ic;Ic<<=1,(Ic&3932160)===0&&(Ic=262144),Pn=r}else Pn=536870912;return r=jn.current,r!==null&&(r.flags|=32),Pn}function _n(r,i,l){(r===rt&&(Xe===2||Xe===9)||r.cancelPendingCommit!==null)&&(Ls(r,0),Do(r,Fe,Pn,!1)),ja(r,l),((Ye&2)===0||r!==rt)&&(r===rt&&((Ye&2)===0&&(Ii|=l),vt===4&&Do(r,Fe,Pn,!1)),Cr(r))}function c0(r,i,l){if((Ye&6)!==0)throw Error(o(327));var d=!l&&(i&127)===0&&(i&r.expiredLanes)===0||Da(r,i),m=d?DO(r,i):Cp(r,i,!0),v=d;do{if(m===0){Ms&&!d&&Do(r,i,0,!1);break}else{if(l=r.current.alternate,v&&!kO(l)){m=Cp(r,i,!1),v=!1;continue}if(m===2){if(v=i,r.errorRecoveryDisabledLanes&v)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){i=E;e:{var O=r;m=hl;var L=O.current.memoizedState.isDehydrated;if(L&&(Ls(O,E).flags|=256),E=Cp(O,E,!1),E!==2){if(bp&&!L){O.errorRecoveryDisabledLanes|=v,Ii|=v,m=4;break e}v=Sn,Sn=m,v!==null&&(Sn===null?Sn=v:Sn.push.apply(Sn,v))}m=E}if(v=!1,m!==2)continue}}if(m===1){Ls(r,0),Do(r,i,0,!0);break}e:{switch(d=r,v=m,v){case 0:case 1:throw Error(o(345));case 4:if((i&4194048)!==i)break;case 6:Do(d,i,Pn,!Io);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((i&62914560)===i&&(m=wu+300-cn(),10<m)){if(Do(d,i,Pn,!Io),kc(d,0,!0)!==0)break e;oo=i,d.timeoutHandle=F0(u0.bind(null,d,l,Sn,Su,xp,i,Pn,Ii,Ds,Io,v,"Throttled",-0,0),m);break e}u0(d,l,Sn,Su,xp,i,Pn,Ii,Ds,Io,v,null,-0,0)}}break}while(!0);Cr(r)}function u0(r,i,l,d,m,v,E,O,L,H,K,ne,Q,G){if(r.timeoutHandle=-1,ne=i.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ur},n0(i,v,ne);var fe=(v&62914560)===v?wu-cn():(v&4194048)===v?s0-cn():0;if(fe=g2(ne,fe),fe!==null){oo=v,r.cancelPendingCommit=fe(v0.bind(null,r,i,v,l,d,m,E,O,L,K,ne,null,Q,G)),Do(r,v,E,!H);return}}v0(r,i,v,l,d,m,E,O,L)}function kO(r){for(var i=r;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var m=l[d],v=m.getSnapshot;m=m.value;try{if(!Mn(v(),m))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Do(r,i,l,d){i&=~wp,i&=~Ii,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var m=i;0<m;){var v=31-kn(m),E=1<<v;d[v]=-1,m&=~E}l!==0&&wv(r,l,i)}function _u(){return(Ye&6)===0?(ml(0),!1):!0}function Tp(){if(ze!==null){if(Xe===0)var r=ze.return;else r=ze,Zr=xi=null,Bh(r),Cs=null,Xa=0,r=ze;for(;r!==null;)Bw(r.alternate,r),r=r.return;ze=null}}function Ls(r,i){var l=r.timeoutHandle;l!==-1&&(r.timeoutHandle=-1,JO(l)),l=r.cancelPendingCommit,l!==null&&(r.cancelPendingCommit=null,l()),oo=0,Tp(),rt=r,ze=l=Hr(r.current,null),Fe=i,Xe=0,zn=null,Io=!1,Ms=Da(r,i),bp=!1,Ds=Pn=wp=Ii=Oo=vt=0,Sn=hl=null,xp=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var m=31-kn(d),v=1<<m;i|=r[m],d&=~v}return ro=i,Vc(),l}function d0(r,i){Re=null,F.H=il,i===Ts||i===Jc?(i=Ab(),Xe=3):i===Nh?(i=Ab(),Xe=4):Xe=i===rp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,zn=i,ze===null&&(vt=1,fu(r,Yn(i,r.current)))}function f0(){var r=jn.current;return r===null?!0:(Fe&4194048)===Fe?Wn===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?r===Wn:!1}function h0(){var r=F.H;return F.H=il,r===null?il:r}function p0(){var r=F.A;return F.A=IO,r}function Eu(){vt=4,Io||(Fe&4194048)!==Fe&&jn.current!==null||(Ms=!0),(Oo&134217727)===0&&(Ii&134217727)===0||rt===null||Do(rt,Fe,Pn,!1)}function Cp(r,i,l){var d=Ye;Ye|=2;var m=h0(),v=p0();(rt!==r||Fe!==i)&&(Su=null,Ls(r,i)),i=!1;var E=vt;e:do try{if(Xe!==0&&ze!==null){var O=ze,L=zn;switch(Xe){case 8:Tp(),E=6;break e;case 3:case 2:case 9:case 6:jn.current===null&&(i=!0);var H=Xe;if(Xe=0,zn=null,zs(r,O,L,H),l&&Ms){E=0;break e}break;default:H=Xe,Xe=0,zn=null,zs(r,O,L,H)}}MO(),E=vt;break}catch(K){d0(r,K)}while(!0);return i&&r.shellSuspendCounter++,Zr=xi=null,Ye=d,F.H=m,F.A=v,ze===null&&(rt=null,Fe=0,Vc()),E}function MO(){for(;ze!==null;)m0(ze)}function DO(r,i){var l=Ye;Ye|=2;var d=h0(),m=p0();rt!==r||Fe!==i?(Su=null,xu=cn()+500,Ls(r,i)):Ms=Da(r,i);e:do try{if(Xe!==0&&ze!==null){i=ze;var v=zn;t:switch(Xe){case 1:Xe=0,zn=null,zs(r,i,v,1);break;case 2:case 9:if(Tb(v)){Xe=0,zn=null,g0(i);break}i=function(){Xe!==2&&Xe!==9||rt!==r||(Xe=7),Cr(r)},v.then(i,i);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:Tb(v)?(Xe=0,zn=null,g0(i)):(Xe=0,zn=null,zs(r,i,v,7));break;case 5:var E=null;switch(ze.tag){case 26:E=ze.memoizedState;case 5:case 27:var O=ze;if(E?tx(E):O.stateNode.complete){Xe=0,zn=null;var L=O.sibling;if(L!==null)ze=L;else{var H=O.return;H!==null?(ze=H,Tu(H)):ze=null}break t}}Xe=0,zn=null,zs(r,i,v,5);break;case 6:Xe=0,zn=null,zs(r,i,v,6);break;case 8:Tp(),vt=6;break e;default:throw Error(o(462))}}jO();break}catch(K){d0(r,K)}while(!0);return Zr=xi=null,F.H=d,F.A=m,Ye=l,ze!==null?0:(rt=null,Fe=0,Vc(),vt)}function jO(){for(;ze!==null&&!Le();)m0(ze)}function m0(r){var i=$w(r.alternate,r,ro);r.memoizedProps=r.pendingProps,i===null?Tu(r):ze=i}function g0(r){var i=r,l=i.alternate;switch(i.tag){case 15:case 0:i=Mw(l,i,i.pendingProps,i.type,void 0,Fe);break;case 11:i=Mw(l,i,i.pendingProps,i.type.render,i.ref,Fe);break;case 5:Bh(i);default:Bw(l,i),i=ze=pb(i,ro),i=$w(l,i,ro)}r.memoizedProps=r.pendingProps,i===null?Tu(r):ze=i}function zs(r,i,l,d){Zr=xi=null,Bh(i),Cs=null,Xa=0;var m=i.return;try{if(_O(r,m,i,l,Fe)){vt=1,fu(r,Yn(l,r.current)),ze=null;return}}catch(v){if(m!==null)throw ze=m,v;vt=1,fu(r,Yn(l,r.current)),ze=null;return}i.flags&32768?(Ue||d===1?r=!0:Ms||(Fe&536870912)!==0?r=!1:(Io=r=!0,(d===2||d===9||d===3||d===6)&&(d=jn.current,d!==null&&d.tag===13&&(d.flags|=16384))),y0(i,r)):Tu(i)}function Tu(r){var i=r;do{if((i.flags&32768)!==0){y0(i,Io);return}r=i.return;var l=CO(i.alternate,i,ro);if(l!==null){ze=l;return}if(i=i.sibling,i!==null){ze=i;return}ze=i=r}while(i!==null);vt===0&&(vt=5)}function y0(r,i){do{var l=AO(r.alternate,r);if(l!==null){l.flags&=32767,ze=l;return}if(l=r.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(r=r.sibling,r!==null)){ze=r;return}ze=r=l}while(r!==null);vt=6,ze=null}function v0(r,i,l,d,m,v,E,O,L){r.cancelPendingCommit=null;do Cu();while(zt!==0);if((Ye&6)!==0)throw Error(o(327));if(i!==null){if(i===r.current)throw Error(o(177));if(v=i.lanes|i.childLanes,v|=ph,pI(r,l,v,E,O,L),r===rt&&(ze=rt=null,Fe=0),js=i,Mo=r,oo=l,Sp=v,_p=m,a0=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,$O(nn,function(){return _0(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=F.T,F.T=null,m=X.p,X.p=2,E=Ye,Ye|=4;try{RO(r,i,l)}finally{Ye=E,X.p=m,F.T=d}}zt=1,b0(),w0(),x0()}}function b0(){if(zt===1){zt=0;var r=Mo,i=js,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=F.T,F.T=null;var d=X.p;X.p=2;var m=Ye;Ye|=4;try{Ww(i,r);var v=Pp,E=ib(r.containerInfo),O=v.focusedElem,L=v.selectionRange;if(E!==O&&O&&O.ownerDocument&&ob(O.ownerDocument.documentElement,O)){if(L!==null&&ch(O)){var H=L.start,K=L.end;if(K===void 0&&(K=H),"selectionStart"in O)O.selectionStart=H,O.selectionEnd=Math.min(K,O.value.length);else{var ne=O.ownerDocument||document,Q=ne&&ne.defaultView||window;if(Q.getSelection){var G=Q.getSelection(),fe=O.textContent.length,Ee=Math.min(L.start,fe),nt=L.end===void 0?Ee:Math.min(L.end,fe);!G.extend&&Ee>nt&&(E=nt,nt=Ee,Ee=E);var q=rb(O,Ee),$=rb(O,nt);if(q&&$&&(G.rangeCount!==1||G.anchorNode!==q.node||G.anchorOffset!==q.offset||G.focusNode!==$.node||G.focusOffset!==$.offset)){var V=ne.createRange();V.setStart(q.node,q.offset),G.removeAllRanges(),Ee>nt?(G.addRange(V),G.extend($.node,$.offset)):(V.setEnd($.node,$.offset),G.addRange(V))}}}}for(ne=[],G=O;G=G.parentNode;)G.nodeType===1&&ne.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ne.length;O++){var W=ne[O];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}Pu=!!zp,Pp=zp=null}finally{Ye=m,X.p=d,F.T=l}}r.current=i,zt=2}}function w0(){if(zt===2){zt=0;var r=Mo,i=js,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=F.T,F.T=null;var d=X.p;X.p=2;var m=Ye;Ye|=4;try{Gw(r,i.alternate,i)}finally{Ye=m,X.p=d,F.T=l}}zt=3}}function x0(){if(zt===4||zt===3){zt=0,Vt();var r=Mo,i=js,l=oo,d=a0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?zt=5:(zt=0,js=Mo=null,S0(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(ko=null),Vf(l),i=i.stateNode,On&&typeof On.onCommitFiberRoot=="function")try{On.onCommitFiberRoot(Ma,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=F.T,m=X.p,X.p=2,F.T=null;try{for(var v=r.onRecoverableError,E=0;E<d.length;E++){var O=d[E];v(O.value,{componentStack:O.stack})}}finally{F.T=i,X.p=m}}(oo&3)!==0&&Cu(),Cr(r),m=r.pendingLanes,(l&261930)!==0&&(m&42)!==0?r===Ep?pl++:(pl=0,Ep=r):pl=0,ml(0)}}function S0(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Ya(i)))}function Cu(){return b0(),w0(),x0(),_0()}function _0(){if(zt!==5)return!1;var r=Mo,i=Sp;Sp=0;var l=Vf(oo),d=F.T,m=X.p;try{X.p=32>l?32:l,F.T=null,l=_p,_p=null;var v=Mo,E=oo;if(zt=0,js=Mo=null,oo=0,(Ye&6)!==0)throw Error(o(331));var O=Ye;if(Ye|=4,o0(v.current),t0(v,v.current,E,l),Ye=O,ml(0,!1),On&&typeof On.onPostCommitFiberRoot=="function")try{On.onPostCommitFiberRoot(Ma,v)}catch{}return!0}finally{X.p=m,F.T=d,S0(r,i)}}function E0(r,i,l){i=Yn(l,i),i=np(r.stateNode,i,2),r=Co(r,i,2),r!==null&&(ja(r,2),Cr(r))}function Je(r,i,l){if(r.tag===3)E0(r,r,l);else for(;i!==null;){if(i.tag===3){E0(i,r,l);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ko===null||!ko.has(d))){r=Yn(l,r),l=Tw(2),d=Co(i,l,2),d!==null&&(Cw(l,d,i,r),ja(d,2),Cr(d));break}}i=i.return}}function Ap(r,i,l){var d=r.pingCache;if(d===null){d=r.pingCache=new OO;var m=new Set;d.set(i,m)}else m=d.get(i),m===void 0&&(m=new Set,d.set(i,m));m.has(l)||(bp=!0,m.add(l),r=LO.bind(null,r,i,l),i.then(r,r))}function LO(r,i,l){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&l,r.warmLanes&=~l,rt===r&&(Fe&l)===l&&(vt===4||vt===3&&(Fe&62914560)===Fe&&300>cn()-wu?(Ye&2)===0&&Ls(r,0):wp|=l,Ds===Fe&&(Ds=0)),Cr(r)}function T0(r,i){i===0&&(i=bv()),r=vi(r,i),r!==null&&(ja(r,i),Cr(r))}function zO(r){var i=r.memoizedState,l=0;i!==null&&(l=i.retryLane),T0(r,l)}function PO(r,i){var l=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(l=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(o(314))}d!==null&&d.delete(i),T0(r,l)}function $O(r,i){return Oe(r,i)}var Au=null,Ps=null,Rp=!1,Ru=!1,Np=!1,jo=0;function Cr(r){r!==Ps&&r.next===null&&(Ps===null?Au=Ps=r:Ps=Ps.next=r),Ru=!0,Rp||(Rp=!0,BO())}function ml(r,i){if(!Np&&Ru){Np=!0;do for(var l=!1,d=Au;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var v=0;else{var E=d.suspendedLanes,O=d.pingedLanes;v=(1<<31-kn(42|r)+1)-1,v&=m&~(E&~O),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,N0(d,v))}else v=Fe,v=kc(d,d===rt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Da(d,v)||(l=!0,N0(d,v));d=d.next}while(l);Np=!1}}function FO(){C0()}function C0(){Ru=Rp=!1;var r=0;jo!==0&&XO()&&(r=jo);for(var i=cn(),l=null,d=Au;d!==null;){var m=d.next,v=A0(d,i);v===0?(d.next=null,l===null?Au=m:l.next=m,m===null&&(Ps=l)):(l=d,(r!==0||(v&3)!==0)&&(Ru=!0)),d=m}zt!==0&&zt!==5||ml(r),jo!==0&&(jo=0)}function A0(r,i){for(var l=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var E=31-kn(v),O=1<<E,L=m[E];L===-1?((O&l)===0||(O&d)!==0)&&(m[E]=hI(O,i)):L<=i&&(r.expiredLanes|=O),v&=~O}if(i=rt,l=Fe,l=kc(r,r===i?l:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,l===0||r===i&&(Xe===2||Xe===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&qe(d),r.callbackNode=null,r.callbackPriority=0;if((l&3)===0||Da(r,l)){if(i=l&-l,i===r.callbackPriority)return i;switch(d!==null&&qe(d),Vf(l)){case 2:case 8:l=Ht;break;case 32:l=nn;break;case 268435456:l=vv;break;default:l=nn}return d=R0.bind(null,r),l=Oe(l,d),r.callbackPriority=i,r.callbackNode=l,i}return d!==null&&d!==null&&qe(d),r.callbackPriority=2,r.callbackNode=null,2}function R0(r,i){if(zt!==0&&zt!==5)return r.callbackNode=null,r.callbackPriority=0,null;var l=r.callbackNode;if(Cu()&&r.callbackNode!==l)return null;var d=Fe;return d=kc(r,r===rt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(c0(r,d,i),A0(r,cn()),r.callbackNode!=null&&r.callbackNode===l?R0.bind(null,r):null)}function N0(r,i){if(Cu())return null;c0(r,i,!0)}function BO(){WO(function(){(Ye&6)!==0?Oe(at,FO):C0()})}function Ip(){if(jo===0){var r=_s;r===0&&(r=Nc,Nc<<=1,(Nc&261888)===0&&(Nc=256)),jo=r}return jo}function I0(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Lc(""+r)}function O0(r,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,r.id&&l.setAttribute("form",r.id),i.parentNode.insertBefore(l,i),r=new FormData(r),l.parentNode.removeChild(l),r}function qO(r,i,l,d,m){if(i==="submit"&&l&&l.stateNode===m){var v=I0((m[yn]||null).action),E=d.submitter;E&&(i=(i=E[yn]||null)?I0(i.formAction):E.getAttribute("formAction"),i!==null&&(v=i,E=null));var O=new Fc("action","action",null,d,m);r.push({event:O,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(jo!==0){var L=E?O0(m,E):new FormData(m);Kh(l,{pending:!0,data:L,method:m.method,action:v},null,L)}}else typeof v=="function"&&(O.preventDefault(),L=E?O0(m,E):new FormData(m),Kh(l,{pending:!0,data:L,method:m.method,action:v},v,L))},currentTarget:m}]})}}for(var Op=0;Op<hh.length;Op++){var kp=hh[Op],UO=kp.toLowerCase(),VO=kp[0].toUpperCase()+kp.slice(1);hr(UO,"on"+VO)}hr(lb,"onAnimationEnd"),hr(cb,"onAnimationIteration"),hr(ub,"onAnimationStart"),hr("dblclick","onDoubleClick"),hr("focusin","onFocus"),hr("focusout","onBlur"),hr(sO,"onTransitionRun"),hr(aO,"onTransitionStart"),hr(lO,"onTransitionCancel"),hr(db,"onTransitionEnd"),cs("onMouseEnter",["mouseout","mouseover"]),cs("onMouseLeave",["mouseout","mouseover"]),cs("onPointerEnter",["pointerout","pointerover"]),cs("onPointerLeave",["pointerout","pointerover"]),pi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pi("onBeforeInput",["compositionend","keypress","textInput","paste"]),pi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),HO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gl));function k0(r,i){i=(i&4)!==0;for(var l=0;l<r.length;l++){var d=r[l],m=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var E=d.length-1;0<=E;E--){var O=d[E],L=O.instance,H=O.currentTarget;if(O=O.listener,L!==v&&m.isPropagationStopped())break e;v=O,m.currentTarget=H;try{v(m)}catch(K){Uc(K)}m.currentTarget=null,v=L}else for(E=0;E<d.length;E++){if(O=d[E],L=O.instance,H=O.currentTarget,O=O.listener,L!==v&&m.isPropagationStopped())break e;v=O,m.currentTarget=H;try{v(m)}catch(K){Uc(K)}m.currentTarget=null,v=L}}}}function Pe(r,i){var l=i[Hf];l===void 0&&(l=i[Hf]=new Set);var d=r+"__bubble";l.has(d)||(M0(i,r,2,!1),l.add(d))}function Mp(r,i,l){var d=0;i&&(d|=4),M0(l,r,d,i)}var Nu="_reactListening"+Math.random().toString(36).slice(2);function Dp(r){if(!r[Nu]){r[Nu]=!0,Cv.forEach(function(l){l!=="selectionchange"&&(HO.has(l)||Mp(l,!1,r),Mp(l,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Nu]||(i[Nu]=!0,Mp("selectionchange",!1,i))}}function M0(r,i,l,d){switch(lx(i)){case 2:var m=b2;break;case 8:m=w2;break;default:m=Yp}l=m.bind(null,i,l,r),m=void 0,!eh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(i,l,{capture:!0,passive:m}):r.addEventListener(i,l,!0):m!==void 0?r.addEventListener(i,l,{passive:m}):r.addEventListener(i,l,!1)}function jp(r,i,l,d,m){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var O=d.stateNode.containerInfo;if(O===m)break;if(E===4)for(E=d.return;E!==null;){var L=E.tag;if((L===3||L===4)&&E.stateNode.containerInfo===m)return;E=E.return}for(;O!==null;){if(E=ss(O),E===null)return;if(L=E.tag,L===5||L===6||L===26||L===27){d=v=E;continue e}O=O.parentNode}}d=d.return}Pv(function(){var H=v,K=Jf(l),ne=[];e:{var Q=fb.get(r);if(Q!==void 0){var G=Fc,fe=r;switch(r){case"keypress":if(Pc(l)===0)break e;case"keydown":case"keyup":G=PI;break;case"focusin":fe="focus",G=oh;break;case"focusout":fe="blur",G=oh;break;case"beforeblur":case"afterblur":G=oh;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":G=Bv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=CI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=BI;break;case lb:case cb:case ub:G=NI;break;case db:G=UI;break;case"scroll":case"scrollend":G=EI;break;case"wheel":G=HI;break;case"copy":case"cut":case"paste":G=OI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=Uv;break;case"toggle":case"beforetoggle":G=ZI}var Ee=(i&4)!==0,nt=!Ee&&(r==="scroll"||r==="scrollend"),q=Ee?Q!==null?Q+"Capture":null:Q;Ee=[];for(var $=H,V;$!==null;){var W=$;if(V=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||V===null||q===null||(W=Pa($,q),W!=null&&Ee.push(yl($,W,V))),nt)break;$=$.return}0<Ee.length&&(Q=new G(Q,fe,null,l,K),ne.push({event:Q,listeners:Ee}))}}if((i&7)===0){e:{if(Q=r==="mouseover"||r==="pointerover",G=r==="mouseout"||r==="pointerout",Q&&l!==Xf&&(fe=l.relatedTarget||l.fromElement)&&(ss(fe)||fe[is]))break e;if((G||Q)&&(Q=K.window===K?K:(Q=K.ownerDocument)?Q.defaultView||Q.parentWindow:window,G?(fe=l.relatedTarget||l.toElement,G=H,fe=fe?ss(fe):null,fe!==null&&(nt=c(fe),Ee=fe.tag,fe!==nt||Ee!==5&&Ee!==27&&Ee!==6)&&(fe=null)):(G=null,fe=H),G!==fe)){if(Ee=Bv,W="onMouseLeave",q="onMouseEnter",$="mouse",(r==="pointerout"||r==="pointerover")&&(Ee=Uv,W="onPointerLeave",q="onPointerEnter",$="pointer"),nt=G==null?Q:za(G),V=fe==null?Q:za(fe),Q=new Ee(W,$+"leave",G,l,K),Q.target=nt,Q.relatedTarget=V,W=null,ss(K)===H&&(Ee=new Ee(q,$+"enter",fe,l,K),Ee.target=V,Ee.relatedTarget=nt,W=Ee),nt=W,G&&fe)t:{for(Ee=QO,q=G,$=fe,V=0,W=q;W;W=Ee(W))V++;W=0;for(var we=$;we;we=Ee(we))W++;for(;0<V-W;)q=Ee(q),V--;for(;0<W-V;)$=Ee($),W--;for(;V--;){if(q===$||$!==null&&q===$.alternate){Ee=q;break t}q=Ee(q),$=Ee($)}Ee=null}else Ee=null;G!==null&&D0(ne,Q,G,Ee,!1),fe!==null&&nt!==null&&D0(ne,nt,fe,Ee,!0)}}e:{if(Q=H?za(H):window,G=Q.nodeName&&Q.nodeName.toLowerCase(),G==="select"||G==="input"&&Q.type==="file")var He=Xv;else if(Yv(Q))if(Jv)He=rO;else{He=tO;var ye=eO}else G=Q.nodeName,!G||G.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?H&&Kf(H.elementType)&&(He=Xv):He=nO;if(He&&(He=He(r,H))){Kv(ne,He,l,K);break e}ye&&ye(r,Q,H),r==="focusout"&&H&&Q.type==="number"&&H.memoizedProps.value!=null&&Yf(Q,"number",Q.value)}switch(ye=H?za(H):window,r){case"focusin":(Yv(ye)||ye.contentEditable==="true")&&(ms=ye,uh=H,Qa=null);break;case"focusout":Qa=uh=ms=null;break;case"mousedown":dh=!0;break;case"contextmenu":case"mouseup":case"dragend":dh=!1,sb(ne,l,K);break;case"selectionchange":if(iO)break;case"keydown":case"keyup":sb(ne,l,K)}var ke;if(sh)e:{switch(r){case"compositionstart":var Be="onCompositionStart";break e;case"compositionend":Be="onCompositionEnd";break e;case"compositionupdate":Be="onCompositionUpdate";break e}Be=void 0}else ps?Zv(r,l)&&(Be="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(Be="onCompositionStart");Be&&(Vv&&l.locale!=="ko"&&(ps||Be!=="onCompositionStart"?Be==="onCompositionEnd"&&ps&&(ke=$v()):(bo=K,th="value"in bo?bo.value:bo.textContent,ps=!0)),ye=Iu(H,Be),0<ye.length&&(Be=new qv(Be,r,null,l,K),ne.push({event:Be,listeners:ye}),ke?Be.data=ke:(ke=Gv(l),ke!==null&&(Be.data=ke)))),(ke=YI?KI(r,l):XI(r,l))&&(Be=Iu(H,"onBeforeInput"),0<Be.length&&(ye=new qv("onBeforeInput","beforeinput",null,l,K),ne.push({event:ye,listeners:Be}),ye.data=ke)),qO(ne,r,H,l,K)}k0(ne,i)})}function yl(r,i,l){return{instance:r,listener:i,currentTarget:l}}function Iu(r,i){for(var l=i+"Capture",d=[];r!==null;){var m=r,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=Pa(r,l),m!=null&&d.unshift(yl(r,m,v)),m=Pa(r,i),m!=null&&d.push(yl(r,m,v))),r.tag===3)return d;r=r.return}return[]}function QO(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function D0(r,i,l,d,m){for(var v=i._reactName,E=[];l!==null&&l!==d;){var O=l,L=O.alternate,H=O.stateNode;if(O=O.tag,L!==null&&L===d)break;O!==5&&O!==26&&O!==27||H===null||(L=H,m?(H=Pa(l,v),H!=null&&E.unshift(yl(l,H,L))):m||(H=Pa(l,v),H!=null&&E.push(yl(l,H,L)))),l=l.return}E.length!==0&&r.push({event:i,listeners:E})}var ZO=/\r\n?/g,GO=/\u0000|\uFFFD/g;function j0(r){return(typeof r=="string"?r:""+r).replace(ZO,`
10
+ `).replace(GO,"")}function L0(r,i){return i=j0(i),j0(r)===i}function tt(r,i,l,d,m,v){switch(l){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||ds(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&ds(r,""+d);break;case"className":Dc(r,"class",d);break;case"tabIndex":Dc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Dc(r,l,d);break;case"style":Lv(r,d,v);break;case"data":if(i!=="object"){Dc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||l!=="href")){r.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=Lc(""+d),r.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(i!=="input"&&tt(r,i,"name",m.name,m,null),tt(r,i,"formEncType",m.formEncType,m,null),tt(r,i,"formMethod",m.formMethod,m,null),tt(r,i,"formTarget",m.formTarget,m,null)):(tt(r,i,"encType",m.encType,m,null),tt(r,i,"method",m.method,m,null),tt(r,i,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=Lc(""+d),r.setAttribute(l,d);break;case"onClick":d!=null&&(r.onclick=Ur);break;case"onScroll":d!=null&&Pe("scroll",r);break;case"onScrollEnd":d!=null&&Pe("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(l=d.__html,l!=null){if(m.children!=null)throw Error(o(60));r.innerHTML=l}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}l=Lc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""+d):r.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""):r.removeAttribute(l);break;case"capture":case"download":d===!0?r.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,d):r.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(l,d):r.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(l):r.setAttribute(l,d);break;case"popover":Pe("beforetoggle",r),Pe("toggle",r),Mc(r,"popover",d);break;case"xlinkActuate":qr(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":qr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":qr(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":qr(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":qr(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":qr(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":qr(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":qr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":qr(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Mc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=SI.get(l)||l,Mc(r,l,d))}}function Lp(r,i,l,d,m,v){switch(l){case"style":Lv(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(l=d.__html,l!=null){if(m.children!=null)throw Error(o(60));r.innerHTML=l}}break;case"children":typeof d=="string"?ds(r,d):(typeof d=="number"||typeof d=="bigint")&&ds(r,""+d);break;case"onScroll":d!=null&&Pe("scroll",r);break;case"onScrollEnd":d!=null&&Pe("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Ur);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Av.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),i=l.slice(2,m?l.length-7:void 0),v=r[yn]||null,v=v!=null?v[l]:null,typeof v=="function"&&r.removeEventListener(i,v,m),typeof d=="function")){typeof v!="function"&&v!==null&&(l in r?r[l]=null:r.hasAttribute(l)&&r.removeAttribute(l)),r.addEventListener(i,d,m);break e}l in r?r[l]=d:d===!0?r.setAttribute(l,""):Mc(r,l,d)}}}function Kt(r,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",r),Pe("load",r);var d=!1,m=!1,v;for(v in l)if(l.hasOwnProperty(v)){var E=l[v];if(E!=null)switch(v){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,i));default:tt(r,i,v,E,l,null)}}m&&tt(r,i,"srcSet",l.srcSet,l,null),d&&tt(r,i,"src",l.src,l,null);return;case"input":Pe("invalid",r);var O=v=E=m=null,L=null,H=null;for(d in l)if(l.hasOwnProperty(d)){var K=l[d];if(K!=null)switch(d){case"name":m=K;break;case"type":E=K;break;case"checked":L=K;break;case"defaultChecked":H=K;break;case"value":v=K;break;case"defaultValue":O=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,i));break;default:tt(r,i,d,K,l,null)}}kv(r,v,O,L,H,E,m,!1);return;case"select":Pe("invalid",r),d=E=v=null;for(m in l)if(l.hasOwnProperty(m)&&(O=l[m],O!=null))switch(m){case"value":v=O;break;case"defaultValue":E=O;break;case"multiple":d=O;default:tt(r,i,m,O,l,null)}i=v,l=E,r.multiple=!!d,i!=null?us(r,!!d,i,!1):l!=null&&us(r,!!d,l,!0);return;case"textarea":Pe("invalid",r),v=m=d=null;for(E in l)if(l.hasOwnProperty(E)&&(O=l[E],O!=null))switch(E){case"value":d=O;break;case"defaultValue":m=O;break;case"children":v=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(o(91));break;default:tt(r,i,E,O,l,null)}Dv(r,d,m,v);return;case"option":for(L in l)l.hasOwnProperty(L)&&(d=l[L],d!=null)&&(L==="selected"?r.selected=d&&typeof d!="function"&&typeof d!="symbol":tt(r,i,L,d,l,null));return;case"dialog":Pe("beforetoggle",r),Pe("toggle",r),Pe("cancel",r),Pe("close",r);break;case"iframe":case"object":Pe("load",r);break;case"video":case"audio":for(d=0;d<gl.length;d++)Pe(gl[d],r);break;case"image":Pe("error",r),Pe("load",r);break;case"details":Pe("toggle",r);break;case"embed":case"source":case"link":Pe("error",r),Pe("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(H in l)if(l.hasOwnProperty(H)&&(d=l[H],d!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,i));default:tt(r,i,H,d,l,null)}return;default:if(Kf(i)){for(K in l)l.hasOwnProperty(K)&&(d=l[K],d!==void 0&&Lp(r,i,K,d,l,void 0));return}}for(O in l)l.hasOwnProperty(O)&&(d=l[O],d!=null&&tt(r,i,O,d,l,null))}function YO(r,i,l,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,v=null,E=null,O=null,L=null,H=null,K=null;for(G in l){var ne=l[G];if(l.hasOwnProperty(G)&&ne!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":L=ne;default:d.hasOwnProperty(G)||tt(r,i,G,null,d,ne)}}for(var Q in d){var G=d[Q];if(ne=l[Q],d.hasOwnProperty(Q)&&(G!=null||ne!=null))switch(Q){case"type":v=G;break;case"name":m=G;break;case"checked":H=G;break;case"defaultChecked":K=G;break;case"value":E=G;break;case"defaultValue":O=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,i));break;default:G!==ne&&tt(r,i,Q,G,d,ne)}}Gf(r,E,O,L,H,K,v,m);return;case"select":G=E=O=Q=null;for(v in l)if(L=l[v],l.hasOwnProperty(v)&&L!=null)switch(v){case"value":break;case"multiple":G=L;default:d.hasOwnProperty(v)||tt(r,i,v,null,d,L)}for(m in d)if(v=d[m],L=l[m],d.hasOwnProperty(m)&&(v!=null||L!=null))switch(m){case"value":Q=v;break;case"defaultValue":O=v;break;case"multiple":E=v;default:v!==L&&tt(r,i,m,v,d,L)}i=O,l=E,d=G,Q!=null?us(r,!!l,Q,!1):!!d!=!!l&&(i!=null?us(r,!!l,i,!0):us(r,!!l,l?[]:"",!1));return;case"textarea":G=Q=null;for(O in l)if(m=l[O],l.hasOwnProperty(O)&&m!=null&&!d.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:tt(r,i,O,null,d,m)}for(E in d)if(m=d[E],v=l[E],d.hasOwnProperty(E)&&(m!=null||v!=null))switch(E){case"value":Q=m;break;case"defaultValue":G=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(o(91));break;default:m!==v&&tt(r,i,E,m,d,v)}Mv(r,Q,G);return;case"option":for(var fe in l)Q=l[fe],l.hasOwnProperty(fe)&&Q!=null&&!d.hasOwnProperty(fe)&&(fe==="selected"?r.selected=!1:tt(r,i,fe,null,d,Q));for(L in d)Q=d[L],G=l[L],d.hasOwnProperty(L)&&Q!==G&&(Q!=null||G!=null)&&(L==="selected"?r.selected=Q&&typeof Q!="function"&&typeof Q!="symbol":tt(r,i,L,Q,d,G));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in l)Q=l[Ee],l.hasOwnProperty(Ee)&&Q!=null&&!d.hasOwnProperty(Ee)&&tt(r,i,Ee,null,d,Q);for(H in d)if(Q=d[H],G=l[H],d.hasOwnProperty(H)&&Q!==G&&(Q!=null||G!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,i));break;default:tt(r,i,H,Q,d,G)}return;default:if(Kf(i)){for(var nt in l)Q=l[nt],l.hasOwnProperty(nt)&&Q!==void 0&&!d.hasOwnProperty(nt)&&Lp(r,i,nt,void 0,d,Q);for(K in d)Q=d[K],G=l[K],!d.hasOwnProperty(K)||Q===G||Q===void 0&&G===void 0||Lp(r,i,K,Q,d,G);return}}for(var q in l)Q=l[q],l.hasOwnProperty(q)&&Q!=null&&!d.hasOwnProperty(q)&&tt(r,i,q,null,d,Q);for(ne in d)Q=d[ne],G=l[ne],!d.hasOwnProperty(ne)||Q===G||Q==null&&G==null||tt(r,i,ne,Q,d,G)}function z0(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function KO(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var m=l[d],v=m.transferSize,E=m.initiatorType,O=m.duration;if(v&&O&&z0(E)){for(E=0,O=m.responseEnd,d+=1;d<l.length;d++){var L=l[d],H=L.startTime;if(H>O)break;var K=L.transferSize,ne=L.initiatorType;K&&z0(ne)&&(L=L.responseEnd,E+=K*(L<O?1:(O-H)/(L-H)))}if(--d,i+=8*(v+E)/(m.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var zp=null,Pp=null;function Ou(r){return r.nodeType===9?r:r.ownerDocument}function P0(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function $0(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function $p(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Fp=null;function XO(){var r=window.event;return r&&r.type==="popstate"?r===Fp?!1:(Fp=r,!0):(Fp=null,!1)}var F0=typeof setTimeout=="function"?setTimeout:void 0,JO=typeof clearTimeout=="function"?clearTimeout:void 0,B0=typeof Promise=="function"?Promise:void 0,WO=typeof queueMicrotask=="function"?queueMicrotask:typeof B0<"u"?function(r){return B0.resolve(null).then(r).catch(e2)}:F0;function e2(r){setTimeout(function(){throw r})}function Lo(r){return r==="head"}function q0(r,i){var l=i,d=0;do{var m=l.nextSibling;if(r.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(d===0){r.removeChild(m),qs(i);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")vl(r.ownerDocument.documentElement);else if(l==="head"){l=r.ownerDocument.head,vl(l);for(var v=l.firstChild;v;){var E=v.nextSibling,O=v.nodeName;v[La]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=E}}else l==="body"&&vl(r.ownerDocument.body);l=m}while(l);qs(i)}function U0(r,i){var l=r;r=0;do{var d=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(r===0)break;r--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||r++;l=d}while(l)}function Bp(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Bp(l),Qf(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}r.removeChild(l)}}function t2(r,i,l,d){for(;r.nodeType===1;){var m=l;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[La])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=er(r.nextSibling),r===null)break}return null}function n2(r,i,l){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!l||(r=er(r.nextSibling),r===null))return null;return r}function V0(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=er(r.nextSibling),r===null))return null;return r}function qp(r){return r.data==="$?"||r.data==="$~"}function Up(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function r2(r,i){var l=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||l.readyState!=="loading")i();else{var d=function(){i(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function er(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Vp=null;function H0(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="/$"||l==="/&"){if(i===0)return er(r.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}r=r.nextSibling}return null}function Q0(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return r;i--}else l!=="/$"&&l!=="/&"||i++}r=r.previousSibling}return null}function Z0(r,i,l){switch(i=Ou(l),r){case"html":if(r=i.documentElement,!r)throw Error(o(452));return r;case"head":if(r=i.head,!r)throw Error(o(453));return r;case"body":if(r=i.body,!r)throw Error(o(454));return r;default:throw Error(o(451))}}function vl(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Qf(r)}var tr=new Map,G0=new Set;function ku(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var io=X.d;X.d={f:o2,r:i2,D:s2,C:a2,L:l2,m:c2,X:d2,S:u2,M:f2};function o2(){var r=io.f(),i=_u();return r||i}function i2(r){var i=as(r);i!==null&&i.tag===5&&i.type==="form"?dw(i):io.r(r)}var $s=typeof document>"u"?null:document;function Y0(r,i,l){var d=$s;if(d&&typeof i=="string"&&i){var m=Zn(i);m='link[rel="'+r+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),G0.has(m)||(G0.add(m),r={rel:r,crossOrigin:l,href:i},d.querySelector(m)===null&&(i=d.createElement("link"),Kt(i,"link",r),Bt(i),d.head.appendChild(i)))}}function s2(r){io.D(r),Y0("dns-prefetch",r,null)}function a2(r,i){io.C(r,i),Y0("preconnect",r,i)}function l2(r,i,l){io.L(r,i,l);var d=$s;if(d&&r&&i){var m='link[rel="preload"][as="'+Zn(i)+'"]';i==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Zn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Zn(l.imageSizes)+'"]')):m+='[href="'+Zn(r)+'"]';var v=m;switch(i){case"style":v=Fs(r);break;case"script":v=Bs(r)}tr.has(v)||(r=g({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:r,as:i},l),tr.set(v,r),d.querySelector(m)!==null||i==="style"&&d.querySelector(bl(v))||i==="script"&&d.querySelector(wl(v))||(i=d.createElement("link"),Kt(i,"link",r),Bt(i),d.head.appendChild(i)))}}function c2(r,i){io.m(r,i);var l=$s;if(l&&r){var d=i&&typeof i.as=="string"?i.as:"script",m='link[rel="modulepreload"][as="'+Zn(d)+'"][href="'+Zn(r)+'"]',v=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Bs(r)}if(!tr.has(v)&&(r=g({rel:"modulepreload",href:r},i),tr.set(v,r),l.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(wl(v)))return}d=l.createElement("link"),Kt(d,"link",r),Bt(d),l.head.appendChild(d)}}}function u2(r,i,l){io.S(r,i,l);var d=$s;if(d&&r){var m=ls(d).hoistableStyles,v=Fs(r);i=i||"default";var E=m.get(v);if(!E){var O={loading:0,preload:null};if(E=d.querySelector(bl(v)))O.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},l),(l=tr.get(v))&&Hp(r,l);var L=E=d.createElement("link");Bt(L),Kt(L,"link",r),L._p=new Promise(function(H,K){L.onload=H,L.onerror=K}),L.addEventListener("load",function(){O.loading|=1}),L.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Mu(E,i,d)}E={type:"stylesheet",instance:E,count:1,state:O},m.set(v,E)}}}function d2(r,i){io.X(r,i);var l=$s;if(l&&r){var d=ls(l).hoistableScripts,m=Bs(r),v=d.get(m);v||(v=l.querySelector(wl(m)),v||(r=g({src:r,async:!0},i),(i=tr.get(m))&&Qp(r,i),v=l.createElement("script"),Bt(v),Kt(v,"link",r),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function f2(r,i){io.M(r,i);var l=$s;if(l&&r){var d=ls(l).hoistableScripts,m=Bs(r),v=d.get(m);v||(v=l.querySelector(wl(m)),v||(r=g({src:r,async:!0,type:"module"},i),(i=tr.get(m))&&Qp(r,i),v=l.createElement("script"),Bt(v),Kt(v,"link",r),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function K0(r,i,l,d){var m=(m=ve.current)?ku(m):null;if(!m)throw Error(o(446));switch(r){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=Fs(l.href),l=ls(m).hoistableStyles,d=l.get(i),d||(d={type:"style",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){r=Fs(l.href);var v=ls(m).hoistableStyles,E=v.get(r);if(E||(m=m.ownerDocument||m,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,E),(v=m.querySelector(bl(r)))&&!v._p&&(E.instance=v,E.state.loading=5),tr.has(r)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},tr.set(r,l),v||h2(m,r,l,E.state))),i&&d===null)throw Error(o(528,""));return E}if(i&&d!==null)throw Error(o(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Bs(l),l=ls(m).hoistableScripts,d=l.get(i),d||(d={type:"script",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,r))}}function Fs(r){return'href="'+Zn(r)+'"'}function bl(r){return'link[rel="stylesheet"]['+r+"]"}function X0(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function h2(r,i,l,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Kt(i,"link",l),Bt(i),r.head.appendChild(i))}function Bs(r){return'[src="'+Zn(r)+'"]'}function wl(r){return"script[async]"+r}function J0(r,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Zn(l.href)+'"]');if(d)return i.instance=d,Bt(d),d;var m=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Bt(d),Kt(d,"style",m),Mu(d,l.precedence,r),i.instance=d;case"stylesheet":m=Fs(l.href);var v=r.querySelector(bl(m));if(v)return i.state.loading|=4,i.instance=v,Bt(v),v;d=X0(l),(m=tr.get(m))&&Hp(d,m),v=(r.ownerDocument||r).createElement("link"),Bt(v);var E=v;return E._p=new Promise(function(O,L){E.onload=O,E.onerror=L}),Kt(v,"link",d),i.state.loading|=4,Mu(v,l.precedence,r),i.instance=v;case"script":return v=Bs(l.src),(m=r.querySelector(wl(v)))?(i.instance=m,Bt(m),m):(d=l,(m=tr.get(v))&&(d=g({},l),Qp(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Bt(m),Kt(m,"link",d),r.head.appendChild(m),i.instance=m);case"void":return null;default:throw Error(o(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Mu(d,l.precedence,r));return i.instance}function Mu(r,i,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,v=m,E=0;E<d.length;E++){var O=d[E];if(O.dataset.precedence===i)v=O;else if(v!==m)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(r,i.firstChild))}function Hp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Qp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Du=null;function W0(r,i,l){if(Du===null){var d=new Map,m=Du=new Map;m.set(l,d)}else m=Du,d=m.get(l),d||(d=new Map,m.set(l,d));if(d.has(r))return d;for(d.set(r,null),l=l.getElementsByTagName(r),m=0;m<l.length;m++){var v=l[m];if(!(v[La]||v[Qt]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var E=v.getAttribute(i)||"";E=r+E;var O=d.get(E);O?O.push(v):d.set(E,[v])}}return d}function ex(r,i,l){r=r.ownerDocument||r,r.head.insertBefore(l,i==="title"?r.querySelector("head > title"):null)}function p2(r,i,l){if(l===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(r=i.disabled,typeof i.precedence=="string"&&r==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function tx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function m2(r,i,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var m=Fs(d.href),v=i.querySelector(bl(m));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=ju.bind(r),i.then(r,r)),l.state.loading|=4,l.instance=v,Bt(v);return}v=i.ownerDocument||i,d=X0(d),(m=tr.get(m))&&Hp(d,m),v=v.createElement("link"),Bt(v);var E=v;E._p=new Promise(function(O,L){E.onload=O,E.onerror=L}),Kt(v,"link",d),l.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(r.count++,l=ju.bind(r),i.addEventListener("load",l),i.addEventListener("error",l))}}var Zp=0;function g2(r,i){return r.stylesheets&&r.count===0&&zu(r,r.stylesheets),0<r.count||0<r.imgCount?function(l){var d=setTimeout(function(){if(r.stylesheets&&zu(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Zp===0&&(Zp=62500*KO());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&zu(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Zp?50:800)+i);return r.unsuspend=l,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function ju(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Lu=null;function zu(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Lu=new Map,i.forEach(y2,r),Lu=null,ju.call(r))}function y2(r,i){if(!(i.state.loading&4)){var l=Lu.get(r);if(l)var d=l.get(null);else{l=new Map,Lu.set(r,l);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var E=m[v];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(l.set(E.dataset.precedence,E),d=E)}d&&l.set(null,d)}m=i.instance,E=m.getAttribute("data-precedence"),v=l.get(E)||d,v===d&&l.set(null,m),l.set(E,m),this.count++,d=ju.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),v?v.parentNode.insertBefore(m,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),i.state.loading|=4}}var xl={$$typeof:R,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function v2(r,i,l,d,m,v,E,O,L){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=qf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qf(0),this.hiddenUpdates=qf(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function nx(r,i,l,d,m,v,E,O,L,H,K,ne){return r=new v2(r,i,l,E,L,H,K,ne,O),i=1,v===!0&&(i|=24),v=Dn(3,null,null,i),r.current=v,v.stateNode=r,i=Ch(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:l,cache:i},Ih(v),r}function rx(r){return r?(r=vs,r):vs}function ox(r,i,l,d,m,v){m=rx(m),d.context===null?d.context=m:d.pendingContext=m,d=To(i),d.payload={element:l},v=v===void 0?null:v,v!==null&&(d.callback=v),l=Co(r,d,i),l!==null&&(_n(l,r,i),Wa(l,r,i))}function ix(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<i?l:i}}function Gp(r,i){ix(r,i),(r=r.alternate)&&ix(r,i)}function sx(r){if(r.tag===13||r.tag===31){var i=vi(r,67108864);i!==null&&_n(i,r,67108864),Gp(r,67108864)}}function ax(r){if(r.tag===13||r.tag===31){var i=$n();i=Uf(i);var l=vi(r,i);l!==null&&_n(l,r,i),Gp(r,i)}}var Pu=!0;function b2(r,i,l,d){var m=F.T;F.T=null;var v=X.p;try{X.p=2,Yp(r,i,l,d)}finally{X.p=v,F.T=m}}function w2(r,i,l,d){var m=F.T;F.T=null;var v=X.p;try{X.p=8,Yp(r,i,l,d)}finally{X.p=v,F.T=m}}function Yp(r,i,l,d){if(Pu){var m=Kp(d);if(m===null)jp(r,i,d,$u,l),cx(r,d);else if(S2(m,r,i,l,d))d.stopPropagation();else if(cx(r,d),i&4&&-1<x2.indexOf(r)){for(;m!==null;){var v=as(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var E=hi(v.pendingLanes);if(E!==0){var O=v;for(O.pendingLanes|=2,O.entangledLanes|=2;E;){var L=1<<31-kn(E);O.entanglements[1]|=L,E&=~L}Cr(v),(Ye&6)===0&&(xu=cn()+500,ml(0))}}break;case 31:case 13:O=vi(v,2),O!==null&&_n(O,v,2),_u(),Gp(v,2)}if(v=Kp(d),v===null&&jp(r,i,d,$u,l),v===m)break;m=v}m!==null&&d.stopPropagation()}else jp(r,i,d,null,l)}}function Kp(r){return r=Jf(r),Xp(r)}var $u=null;function Xp(r){if($u=null,r=ss(r),r!==null){var i=c(r);if(i===null)r=null;else{var l=i.tag;if(l===13){if(r=u(i),r!==null)return r;r=null}else if(l===31){if(r=f(i),r!==null)return r;r=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return $u=r,null}function lx(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Bf()){case at:return 2;case Ht:return 8;case nn:case Rc:return 32;case vv:return 268435456;default:return 32}default:return 32}}var Jp=!1,zo=null,Po=null,$o=null,Sl=new Map,_l=new Map,Fo=[],x2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function cx(r,i){switch(r){case"focusin":case"focusout":zo=null;break;case"dragenter":case"dragleave":Po=null;break;case"mouseover":case"mouseout":$o=null;break;case"pointerover":case"pointerout":Sl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":_l.delete(i.pointerId)}}function El(r,i,l,d,m,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:l,eventSystemFlags:d,nativeEvent:v,targetContainers:[m]},i!==null&&(i=as(i),i!==null&&sx(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,m!==null&&i.indexOf(m)===-1&&i.push(m),r)}function S2(r,i,l,d,m){switch(i){case"focusin":return zo=El(zo,r,i,l,d,m),!0;case"dragenter":return Po=El(Po,r,i,l,d,m),!0;case"mouseover":return $o=El($o,r,i,l,d,m),!0;case"pointerover":var v=m.pointerId;return Sl.set(v,El(Sl.get(v)||null,r,i,l,d,m)),!0;case"gotpointercapture":return v=m.pointerId,_l.set(v,El(_l.get(v)||null,r,i,l,d,m)),!0}return!1}function ux(r){var i=ss(r.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=u(l),i!==null){r.blockedOn=i,Ev(r.priority,function(){ax(l)});return}}else if(i===31){if(i=f(l),i!==null){r.blockedOn=i,Ev(r.priority,function(){ax(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){r.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Fu(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var l=Kp(r.nativeEvent);if(l===null){l=r.nativeEvent;var d=new l.constructor(l.type,l);Xf=d,l.target.dispatchEvent(d),Xf=null}else return i=as(l),i!==null&&sx(i),r.blockedOn=l,!1;i.shift()}return!0}function dx(r,i,l){Fu(r)&&l.delete(i)}function _2(){Jp=!1,zo!==null&&Fu(zo)&&(zo=null),Po!==null&&Fu(Po)&&(Po=null),$o!==null&&Fu($o)&&($o=null),Sl.forEach(dx),_l.forEach(dx)}function Bu(r,i){r.blockedOn===i&&(r.blockedOn=null,Jp||(Jp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_2)))}var qu=null;function fx(r){qu!==r&&(qu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){qu===r&&(qu=null);for(var i=0;i<r.length;i+=3){var l=r[i],d=r[i+1],m=r[i+2];if(typeof d!="function"){if(Xp(d||l)===null)continue;break}var v=as(l);v!==null&&(r.splice(i,3),i-=3,Kh(v,{pending:!0,data:m,method:l.method,action:d},d,m))}}))}function qs(r){function i(L){return Bu(L,r)}zo!==null&&Bu(zo,r),Po!==null&&Bu(Po,r),$o!==null&&Bu($o,r),Sl.forEach(i),_l.forEach(i);for(var l=0;l<Fo.length;l++){var d=Fo[l];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Fo.length&&(l=Fo[0],l.blockedOn===null);)ux(l),l.blockedOn===null&&Fo.shift();if(l=(r.ownerDocument||r).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var m=l[d],v=l[d+1],E=m[yn]||null;if(typeof v=="function")E||fx(l);else if(E){var O=null;if(v&&v.hasAttribute("formAction")){if(m=v,E=v[yn]||null)O=E.formAction;else if(Xp(m)!==null)continue}else O=E.action;typeof O=="function"?l[d+1]=O:(l.splice(d,3),d-=3),fx(l)}}}function hx(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(E){return m=E})},focusReset:"manual",scroll:"manual"})}function i(){m!==null&&(m(),m=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),m!==null&&(m(),m=null)}}}function Wp(r){this._internalRoot=r}Uu.prototype.render=Wp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(o(409));var l=i.current,d=$n();ox(l,d,r,i,null,null)},Uu.prototype.unmount=Wp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;ox(r.current,2,null,r,null,null),_u(),i[is]=null}};function Uu(r){this._internalRoot=r}Uu.prototype.unstable_scheduleHydration=function(r){if(r){var i=_v();r={blockedOn:null,target:r,priority:i};for(var l=0;l<Fo.length&&i!==0&&i<Fo[l].priority;l++);Fo.splice(l,0,r),l===0&&ux(r)}};var px=t.version;if(px!=="19.2.4")throw Error(o(527,px,"19.2.4"));X.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(o(188)):(r=Object.keys(r).join(","),Error(o(268,r)));return r=p(i),r=r!==null?y(r):null,r=r===null?null:r.stateNode,r};var E2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vu.isDisabled&&Vu.supportsFiber)try{Ma=Vu.inject(E2),On=Vu}catch{}}return Cl.createRoot=function(r,i){if(!s(r))throw Error(o(299));var l=!1,d="",m=xw,v=Sw,E=_w;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(E=i.onRecoverableError)),i=nx(r,1,!1,null,null,l,d,null,m,v,E,hx),r[is]=i.current,Dp(r),new Wp(i)},Cl.hydrateRoot=function(r,i,l){if(!s(r))throw Error(o(299));var d=!1,m="",v=xw,E=Sw,O=_w,L=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(E=l.onCaughtError),l.onRecoverableError!==void 0&&(O=l.onRecoverableError),l.formState!==void 0&&(L=l.formState)),i=nx(r,1,!0,i,l??null,d,m,L,v,E,O,hx),i.context=rx(null),l=i.current,d=$n(),d=Uf(d),m=To(d),m.callback=null,Co(l,m,d),l=d,i.current.lanes=l,ja(i,l),Cr(i),r[is]=i.current,Dp(r),new Uu(i)},Cl.version="19.2.4",Cl}var Ex;function D2(){if(Ex)return nm.exports;Ex=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),nm.exports=M2(),nm.exports}var j2=D2();const Jm=new WeakMap,L2=new WeakMap,vd={current:[]};let sm=!1,Fl=0;const Dl=new Set,Hu=new Map;function vE(e){for(const t of e){if(vd.current.includes(t))continue;vd.current.push(t),t.recompute();const n=L2.get(t);if(n)for(const o of n){const s=Jm.get(o);s?.length&&vE(s)}}}function z2(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function P2(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function bE(e){if(Fl>0&&!Hu.has(e)&&Hu.set(e,e.prevState),Dl.add(e),!(Fl>0)&&!sm)try{for(sm=!0;Dl.size>0;){const t=Array.from(Dl);Dl.clear();for(const n of t){const o=Hu.get(n)??n.prevState;n.prevState=o,z2(n)}for(const n of t){const o=Jm.get(n);o&&(vd.current.push(n),vE(o))}for(const n of t){const o=Jm.get(n);if(o)for(const s of o)P2(s)}}}finally{sm=!1,vd.current=[],Hu.clear()}}function $2(e){Fl++;try{e()}finally{if(Fl--,Fl===0){const t=Dl.values().next().value;t&&bE(t)}}}function F2(e){return typeof e=="function"}class B2{constructor(t,n){this.listeners=new Set,this.subscribe=o=>{var s,c;this.listeners.add(o);const u=(c=(s=this.options)==null?void 0:s.onSubscribe)==null?void 0:c.call(s,o,this);return()=>{this.listeners.delete(o),u?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,o,s;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):F2(t)?this.state=t(this.prevState):this.state=t,(s=(o=this.options)==null?void 0:o.onUpdate)==null||s.call(o),bE(this)}}const Yo="__TSR_index",Tx="popstate",Cx="beforeunload";function q2(e){let t=e.getLocation();const n=new Set,o=u=>{t=e.getLocation(),n.forEach(f=>f({location:t,action:u}))},s=u=>{e.notifyOnIndexChange??!0?o(u):t=e.getLocation()},c=async({task:u,navigateOpts:f,...h})=>{if(f?.ignoreBlocker??!1){u();return}const y=e.getBlockers?.()??[],g=h.type==="PUSH"||h.type==="REPLACE";if(typeof document<"u"&&y.length&&g)for(const b of y){const x=bd(h.path,h.state);if(await b.blockerFn({currentLocation:t,nextLocation:x,action:h.type})){e.onBlocked?.();return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,f,h)=>{const p=t.state[Yo];f=Ax(p+1,f),c({task:()=>{e.pushState(u,f),o({type:"PUSH"})},navigateOpts:h,type:"PUSH",path:u,state:f})},replace:(u,f,h)=>{const p=t.state[Yo];f=Ax(p,f),c({task:()=>{e.replaceState(u,f),o({type:"REPLACE"})},navigateOpts:h,type:"REPLACE",path:u,state:f})},go:(u,f)=>{c({task:()=>{e.go(u),s({type:"GO",index:u})},navigateOpts:f,type:"GO"})},back:u=>{c({task:()=>{e.back(u?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{c({task:()=>{e.forward(u?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[Yo]!==0,createHref:u=>e.createHref(u),block:u=>{if(!e.setBlockers)return()=>{};const f=e.getBlockers?.()??[];return e.setBlockers([...f,u]),()=>{const h=e.getBlockers?.()??[];e.setBlockers?.(h.filter(p=>p!==u))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:o}}function Ax(e,t){t||(t={});const n=jg();return{...t,key:n,__TSR_key:n,[Yo]:e}}function U2(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,o=t.history.replaceState;let s=[];const c=()=>s,u=M=>s=M,f=(M=>M),h=(()=>bd(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const M=jg();t.history.replaceState({[Yo]:0,key:M,__TSR_key:M},"")}let p=h(),y,g=!1,b=!1,x=!1,C=!1;const S=()=>p;let A,I;const k=()=>{A&&(P._ignoreSubscribers=!0,(A.isPush?t.history.pushState:t.history.replaceState)(A.state,"",A.href),P._ignoreSubscribers=!1,A=void 0,I=void 0,y=void 0)},R=(M,U,ee)=>{const ae=f(U);I||(y=p),p=bd(U,ee),A={href:ae,state:ee,isPush:A?.isPush||M==="push"},I||(I=Promise.resolve().then(()=>k()))},N=M=>{p=h(),P.notify({type:M})},j=async()=>{if(b){b=!1;return}const M=h(),U=M.state[Yo]-p.state[Yo],ee=U===1,ae=U===-1,re=!ee&&!ae||g;g=!1;const ue=re?"GO":ae?"BACK":"FORWARD",ce=re?{type:"GO",index:U}:{type:ae?"BACK":"FORWARD"};if(x)x=!1;else{const he=c();if(typeof document<"u"&&he.length){for(const F of he)if(await F.blockerFn({currentLocation:p,nextLocation:M,action:ue})){b=!0,t.history.go(1),P.notify(ce);return}}}p=h(),P.notify(ce)},B=M=>{if(C){C=!1;return}let U=!1;const ee=c();if(typeof document<"u"&&ee.length)for(const ae of ee){const re=ae.enableBeforeUnload??!0;if(re===!0){U=!0;break}if(typeof re=="function"&&re()===!0){U=!0;break}}if(U)return M.preventDefault(),M.returnValue=""},P=q2({getLocation:S,getLength:()=>t.history.length,pushState:(M,U)=>R("push",M,U),replaceState:(M,U)=>R("replace",M,U),back:M=>(M&&(x=!0),C=!0,t.history.back()),forward:M=>{M&&(x=!0),C=!0,t.history.forward()},go:M=>{g=!0,t.history.go(M)},createHref:M=>f(M),flush:k,destroy:()=>{t.history.pushState=n,t.history.replaceState=o,t.removeEventListener(Cx,B,{capture:!0}),t.removeEventListener(Tx,j)},onBlocked:()=>{y&&p!==y&&(p=y)},getBlockers:c,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(Cx,B,{capture:!0}),t.addEventListener(Tx,j),t.history.pushState=function(...M){const U=n.apply(t.history,M);return P._ignoreSubscribers||N("PUSH"),U},t.history.replaceState=function(...M){const U=o.apply(t.history,M);return P._ignoreSubscribers||N("REPLACE"),U},P}function V2(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function bd(e,t){const n=V2(e),o=n.indexOf("#"),s=n.indexOf("?"),c=jg();return{href:n,pathname:n.substring(0,o>0?s>0?Math.min(o,s):o:s>0?s:n.length),hash:o>-1?n.substring(o):"",search:s>-1?n.slice(s,o===-1?void 0:o):"",state:t||{[Yo]:0,key:c,__TSR_key:c}}}function jg(){return(Math.random()+1).toString(36).substring(7)}const H2=!1;function ta(e){let t;return $2(()=>{t=e()}),t}function Yl(e){return e[e.length-1]}function Q2(e){return typeof e=="function"}function Zo(e,t){return Q2(e)?e(t):e}const Z2=Object.prototype.hasOwnProperty,Rx=Object.prototype.propertyIsEnumerable;function En(e,t,n=0){if(e===t)return e;if(n>500)return t;const o=t,s=Ox(e)&&Ox(o);if(!s&&!(wd(e)&&wd(o)))return o;const c=s?e:Nx(e);if(!c)return o;const u=s?o:Nx(o);if(!u)return o;const f=c.length,h=u.length,p=s?new Array(h):{};let y=0;for(let g=0;g<h;g++){const b=s?g:u[g],x=e[b],C=o[b];if(x===C){p[b]=x,(s?g<f:Z2.call(e,b))&&y++;continue}if(x===null||C===null||typeof x!="object"||typeof C!="object"){p[b]=C;continue}const S=En(x,C,n+1);p[b]=S,S===x&&y++}return f===h&&y===f?e:p}function Nx(e){const t=Object.getOwnPropertyNames(e);for(const s of t)if(!Rx.call(e,s))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const o=t;for(const s of n){if(!Rx.call(e,s))return!1;o.push(s)}return o}function wd(e){if(!Ix(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Ix(n)||!n.hasOwnProperty("isPrototypeOf"))}function Ix(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ox(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Bi(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let o=0,s=e.length;o<s;o++)if(!Bi(e[o],t[o],n))return!1;return!0}if(wd(e)&&wd(t)){const o=n?.ignoreUndefined??!0;if(n?.partial){for(const u in t)if((!o||t[u]!==void 0)&&!Bi(e[u],t[u],n))return!1;return!0}let s=0;if(!o)s=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&s++;let c=0;for(const u in t)if((!o||t[u]!==void 0)&&(c++,c>s||!Bi(e[u],t[u],n)))return!1;return s===c}return!1}function Vi(e){let t,n;const o=new Promise((s,c)=>{t=s,n=c});return o.status="pending",o.resolve=s=>{o.status="resolved",o.value=s,t(s),e?.(s)},o.reject=s=>{o.status="rejected",n(s)},o}function G2(e){return typeof e?.message!="string"?!1:e.message.startsWith("Failed to fetch dynamically imported module")||e.message.startsWith("error loading dynamically imported module")||e.message.startsWith("Importing a module script failed")}function na(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Y2(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function kx(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Y2(t)}const wE=["http:","https:","mailto:","tel:"];function xd(e){if(!e)return!1;try{const t=new URL(e);return!wE.includes(t.protocol)}catch{return!1}}const K2={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},X2=/[&><\u2028\u2029]/g;function J2(e){return e.replace(X2,t=>K2[t])}function Al(e,t){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return e;const n=/%25|%5C/gi;let o=0,s="",c;for(;(c=n.exec(e))!==null;)s+=kx(e.slice(o,c.index))+c[0],o=n.lastIndex;return s=s+kx(o?e.slice(o):e),s.startsWith("//")&&(s="/"+s.replace(/^\/+/,"")),s}function W2(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var ek="Invariant failed";function An(e,t){if(!e)throw new Error(ek)}function Sd(e){const t=new Map;let n,o;const s=c=>{c.next&&(c.prev?(c.prev.next=c.next,c.next.prev=c.prev,c.next=void 0,o&&(o.next=c,c.prev=o)):(c.next.prev=void 0,n=c.next,c.next=void 0,o&&(c.prev=o,o.next=c)),o=c)};return{get(c){const u=t.get(c);if(u)return s(u),u.value},set(c,u){if(t.size>=e&&n){const h=n;t.delete(h.key),h.next&&(n=h.next,h.next.prev=void 0),h===o&&(o=void 0)}const f=t.get(c);if(f)f.value=u,s(f);else{const h={key:c,value:u,prev:o};o&&(o.next=h),o=h,n||(n=h),t.set(c,h)}},clear(){t.clear(),n=void 0,o=void 0}}}const fa=0,Hi=1,Qi=2,Kl=3,Li=4,xE=5;function tk(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function Lg(e,t,n=new Uint16Array(6)){const o=e.indexOf("/",t),s=o===-1?e.length:o,c=e.substring(t,s);if(!c||!c.includes("$"))return n[0]=fa,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(c==="$"){const f=e.length;return n[0]=Qi,n[1]=t,n[2]=t,n[3]=f,n[4]=f,n[5]=f,n}if(c.charCodeAt(0)===36)return n[0]=Hi,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const u=tk(c);if(u){const[f,h]=u,p=c.charCodeAt(f+1);if(p===45){if(f+2<c.length&&c.charCodeAt(f+2)===36){const y=f+3,g=h;if(y<g)return n[0]=Kl,n[1]=t+f,n[2]=t+y,n[3]=t+g,n[4]=t+h+1,n[5]=s,n}}else if(p===36){const y=f+1,g=f+2;return g===h?(n[0]=Qi,n[1]=t+f,n[2]=t+y,n[3]=t+g,n[4]=t+h+1,n[5]=e.length,n):(n[0]=Hi,n[1]=t+f,n[2]=t+g,n[3]=t+h,n[4]=t+h+1,n[5]=s,n)}}return n[0]=fa,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n}function Xd(e,t,n,o,s,c,u){u?.(n);let f=o;{const h=n.fullPath??n.from,p=h.length,y=n.options?.caseSensitive??e,g=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;f<p;){const x=Lg(h,f,t);let C;const S=f,A=x[5];switch(f=A+1,c++,x[0]){case fa:{const k=h.substring(x[2],x[3]);if(y){const R=s.static?.get(k);if(R)C=R;else{s.static??=new Map;const N=zi(n.fullPath??n.from);N.parent=s,N.depth=c,C=N,s.static.set(k,N)}}else{const R=k.toLowerCase(),N=s.staticInsensitive?.get(R);if(N)C=N;else{s.staticInsensitive??=new Map;const j=zi(n.fullPath??n.from);j.parent=s,j.depth=c,C=j,s.staticInsensitive.set(R,j)}}break}case Hi:{const k=h.substring(S,x[1]),R=h.substring(x[4],A),N=y&&!!(k||R),j=k?N?k:k.toLowerCase():void 0,B=R?N?R:R.toLowerCase():void 0,P=!g&&s.dynamic?.find(M=>!M.skipOnParamError&&M.caseSensitive===N&&M.prefix===j&&M.suffix===B);if(P)C=P;else{const M=lm(Hi,n.fullPath??n.from,N,j,B);C=M,M.depth=c,M.parent=s,s.dynamic??=[],s.dynamic.push(M)}break}case Kl:{const k=h.substring(S,x[1]),R=h.substring(x[4],A),N=y&&!!(k||R),j=k?N?k:k.toLowerCase():void 0,B=R?N?R:R.toLowerCase():void 0,P=!g&&s.optional?.find(M=>!M.skipOnParamError&&M.caseSensitive===N&&M.prefix===j&&M.suffix===B);if(P)C=P;else{const M=lm(Kl,n.fullPath??n.from,N,j,B);C=M,M.parent=s,M.depth=c,s.optional??=[],s.optional.push(M)}break}case Qi:{const k=h.substring(S,x[1]),R=h.substring(x[4],A),N=y&&!!(k||R),j=k?N?k:k.toLowerCase():void 0,B=R?N?R:R.toLowerCase():void 0,P=lm(Qi,n.fullPath??n.from,N,j,B);C=P,P.parent=s,P.depth=c,s.wildcard??=[],s.wildcard.push(P)}}s=C}if(g&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const x=zi(n.fullPath??n.from);x.kind=xE,x.parent=s,c++,x.depth=c,s.pathless??=[],s.pathless.push(x),s=x}const b=(n.path||!n.children)&&!n.isRoot;if(b&&h.endsWith("/")){const x=zi(n.fullPath??n.from);x.kind=Li,x.parent=s,c++,x.depth=c,s.index=x,s=x}s.parse=n.options?.params?.parse??null,s.skipOnParamError=g,s.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,b&&!s.route&&(s.route=n,s.fullPath=n.fullPath??n.from)}if(n.children)for(const h of n.children)Xd(e,t,h,f,s,c,u)}function am(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Vo(e){if(e.pathless)for(const t of e.pathless)Vo(t);if(e.static)for(const t of e.static.values())Vo(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())Vo(t);if(e.dynamic?.length){e.dynamic.sort(am);for(const t of e.dynamic)Vo(t)}if(e.optional?.length){e.optional.sort(am);for(const t of e.optional)Vo(t)}if(e.wildcard?.length){e.wildcard.sort(am);for(const t of e.wildcard)Vo(t)}}function zi(e){return{kind:fa,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function lm(e,t,n,o,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:o,suffix:s}}function nk(e,t){const n=zi("/"),o=new Uint16Array(6);for(const s of e)Xd(!1,o,s,1,n,0);Vo(n),t.masksTree=n,t.flatCache=Sd(1e3)}function rk(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const o=zg(e,t.masksTree);return t.flatCache.set(e,o),o}function ok(e,t,n,o,s){e||="/",o||="/";const c=t?`case\0${e}`:e;let u=s.singleCache.get(c);if(!u){u=zi("/");const f=new Uint16Array(6);Xd(t,f,{from:e},1,u,0),s.singleCache.set(c,u)}return zg(o,u,n)}function ik(e,t,n=!1){const o=n?e:`nofuzz\0${e}`,s=t.matchCache.get(o);if(s!==void 0)return s;e||="/";let c;try{c=zg(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)c=null;else throw u}return c&&(c.branch=lk(c.route)),t.matchCache.set(o,c),c}function sk(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function ak(e,t=!1,n){const o=zi(e.fullPath),s=new Uint16Array(6),c={},u={};let f=0;return Xd(t,s,e,1,o,0,p=>{if(n?.(p,f),An(!(p.id in c),`Duplicate routes found with id: ${String(p.id)}`),c[p.id]=p,f!==0&&p.path){const y=sk(p.fullPath);(!u[y]||p.fullPath.endsWith("/"))&&(u[y]=p)}f++}),Vo(o),{processedTree:{segmentTree:o,singleCache:Sd(1e3),matchCache:Sd(1e3),flatCache:null,masksTree:null},routesById:c,routesByPath:u}}function zg(e,t,n=!1){const o=e.split("/"),s=uk(e,o,t,n);if(!s)return null;const[c]=SE(e,o,s);return{route:s.node.route,rawParams:c,parsedParams:s.parsedParams}}function SE(e,t,n){const o=ck(n.node);let s=null;const c={};let u=n.extract?.part??0,f=n.extract?.node??0,h=n.extract?.path??0,p=n.extract?.segment??0;for(;f<o.length;u++,f++,h++,p++){const y=o[f];if(y.kind===Li)break;if(y.kind===xE){p--,u--,h--;continue}const g=t[u],b=h;if(g&&(h+=g.length),y.kind===Hi){s??=n.node.fullPath.split("/");const x=s[p],C=y.prefix?.length??0;if(x.charCodeAt(C)===123){const A=y.suffix?.length??0,I=x.substring(C+2,x.length-A-1),k=g.substring(C,g.length-A);c[I]=decodeURIComponent(k)}else{const A=x.substring(1);c[A]=decodeURIComponent(g)}}else if(y.kind===Kl){if(n.skipped&1<<f){u--,h=b-1;continue}s??=n.node.fullPath.split("/");const x=s[p],C=y.prefix?.length??0,S=y.suffix?.length??0,A=x.substring(C+3,x.length-S-1),I=y.suffix||y.prefix?g.substring(C,g.length-S):g;I&&(c[A]=decodeURIComponent(I))}else if(y.kind===Qi){const x=y,C=e.substring(b+(x.prefix?.length??0),e.length-(x.suffix?.length??0)),S=decodeURIComponent(C);c["*"]=S,c._splat=S;break}}return n.rawParams&&Object.assign(c,n.rawParams),[c,{part:u,node:f,path:h,segment:p}]}function lk(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ck(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function uk(e,t,n,o){if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!Yl(t),c=s&&e!=="/",u=t.length-(s?1:0),f=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let h=null,p=null,y=null;for(;f.length;){const g=f.pop(),{node:b,index:x,skipped:C,depth:S,statics:A,dynamics:I,optionals:k}=g;let{extract:R,rawParams:N,parsedParams:j}=g;if(b.skipOnParamError){if(!cm(e,t,g))continue;N=g.rawParams,R=g.extract,j=g.parsedParams}o&&b.route&&b.kind!==Li&&Rl(p,g)&&(p=g);const B=x===u;if(B&&(b.route&&!c&&Rl(y,g)&&(y=g),!b.optional&&!b.wildcard&&!b.index&&!b.pathless))continue;const P=B?void 0:t[x];let M;if(B&&b.index){const U={node:b.index,index:x,skipped:C,depth:S+1,statics:A,dynamics:I,optionals:k,extract:R,rawParams:N,parsedParams:j};let ee=!0;if(b.index.skipOnParamError&&(cm(e,t,U)||(ee=!1)),ee){if(A===u&&!I&&!k&&!C)return U;Rl(y,U)&&(y=U)}}if(b.wildcard&&Rl(h,g))for(const U of b.wildcard){const{prefix:ee,suffix:ae}=U;if(ee&&(B||!(U.caseSensitive?P:M??=P.toLowerCase()).startsWith(ee)))continue;if(ae){if(B)continue;const ue=t.slice(x).join("/").slice(-ae.length);if((U.caseSensitive?ue:ue.toLowerCase())!==ae)continue}const re={node:U,index:u,skipped:C,depth:S,statics:A,dynamics:I,optionals:k,extract:R,rawParams:N,parsedParams:j};if(!(U.skipOnParamError&&!cm(e,t,re))){h=re;break}}if(b.optional){const U=C|1<<S,ee=S+1;for(let ae=b.optional.length-1;ae>=0;ae--){const re=b.optional[ae];f.push({node:re,index:x,skipped:U,depth:ee,statics:A,dynamics:I,optionals:k,extract:R,rawParams:N,parsedParams:j})}if(!B)for(let ae=b.optional.length-1;ae>=0;ae--){const re=b.optional[ae],{prefix:ue,suffix:ce}=re;if(ue||ce){const he=re.caseSensitive?P:M??=P.toLowerCase();if(ue&&!he.startsWith(ue)||ce&&!he.endsWith(ce))continue}f.push({node:re,index:x+1,skipped:C,depth:ee,statics:A,dynamics:I,optionals:k+1,extract:R,rawParams:N,parsedParams:j})}}if(!B&&b.dynamic&&P)for(let U=b.dynamic.length-1;U>=0;U--){const ee=b.dynamic[U],{prefix:ae,suffix:re}=ee;if(ae||re){const ue=ee.caseSensitive?P:M??=P.toLowerCase();if(ae&&!ue.startsWith(ae)||re&&!ue.endsWith(re))continue}f.push({node:ee,index:x+1,skipped:C,depth:S+1,statics:A,dynamics:I+1,optionals:k,extract:R,rawParams:N,parsedParams:j})}if(!B&&b.staticInsensitive){const U=b.staticInsensitive.get(M??=P.toLowerCase());U&&f.push({node:U,index:x+1,skipped:C,depth:S+1,statics:A+1,dynamics:I,optionals:k,extract:R,rawParams:N,parsedParams:j})}if(!B&&b.static){const U=b.static.get(P);U&&f.push({node:U,index:x+1,skipped:C,depth:S+1,statics:A+1,dynamics:I,optionals:k,extract:R,rawParams:N,parsedParams:j})}if(b.pathless){const U=S+1;for(let ee=b.pathless.length-1;ee>=0;ee--){const ae=b.pathless[ee];f.push({node:ae,index:x,skipped:C,depth:U,statics:A,dynamics:I,optionals:k,extract:R,rawParams:N,parsedParams:j})}}}if(y&&h)return Rl(h,y)?y:h;if(y)return y;if(h)return h;if(o&&p){let g=p.index;for(let x=0;x<p.index;x++)g+=t[x].length;const b=g===e.length?"/":e.slice(g);return p.rawParams??={},p.rawParams["**"]=decodeURIComponent(b),p}return null}function cm(e,t,n){try{const[o,s]=SE(e,t,n);n.rawParams=o,n.extract=s;const c=n.node.parse(o);return n.parsedParams=Object.assign({},n.parsedParams,c),!0}catch{return null}}function Rl(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Li)>(e.node.kind===Li)||t.node.kind===Li==(e.node.kind===Li)&&t.depth>e.depth))):!0}function ld(e){return Pg(e.filter(t=>t!==void 0).join("/"))}function Pg(e){return e.replace(/\/{2,}/g,"/")}function _E(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function co(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function EE(e){return co(_E(e))}function _d(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function dk(e,t,n){return _d(e,n)===_d(t,n)}function fk({base:e,to:t,trailingSlash:n="never",cache:o}){const s=t.startsWith("/"),c=!s&&t===".";let u;if(o){u=s?t:c?e:e+"\0"+t;const g=o.get(u);if(g)return g}let f;if(c)f=e.split("/");else if(s)f=t.split("/");else{for(f=e.split("/");f.length>1&&Yl(f)==="";)f.pop();const g=t.split("/");for(let b=0,x=g.length;b<x;b++){const C=g[b];C===""?b?b===x-1&&f.push(C):f=[C]:C===".."?f.pop():C==="."||f.push(C)}}f.length>1&&(Yl(f)===""?n==="never"&&f.pop():n==="always"&&f.push(""));let h,p="";for(let g=0;g<f.length;g++){g>0&&(p+="/");const b=f[g];if(!b)continue;h=Lg(b,0,h);const x=h[0];if(x===fa){p+=b;continue}const C=h[5],S=b.substring(0,h[1]),A=b.substring(h[4],C),I=b.substring(h[2],h[3]);x===Hi?p+=S||A?`${S}{$${I}}${A}`:`$${I}`:x===Qi?p+=S||A?`${S}{$}${A}`:"$":p+=`${S}{-$${I}}${A}`}p=Pg(p);const y=p||"/";return u&&o&&o.set(u,y),y}function hk(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),o=new RegExp(n,"g");return s=>s.replace(o,c=>t.get(c)??c)}function um(e,t,n){const o=t[e];return typeof o!="string"?o:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(o)?o:o.split("/").map(s=>Mx(s,n)).join("/"):Mx(o,n)}function dm({path:e,params:t,decoder:n,server:o}){let s=!1;const c={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:c,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:c,isMissingParams:s};const u=e.length;let f=0,h,p="";for(;f<u;){const g=f;h=Lg(e,g,h);const b=h[5];if(f=b+1,g===b)continue;const x=h[0];if(x===fa){p+="/"+e.substring(g,b);continue}if(x===Qi){const C=t._splat;c._splat=C,c["*"]=C;const S=e.substring(g,h[1]),A=e.substring(h[4],b);if(!C){s=!0,(S||A)&&(p+="/"+S+A);continue}const I=um("_splat",t,n);p+="/"+S+I+A;continue}if(x===Hi){const C=e.substring(h[2],h[3]);!s&&!(C in t)&&(s=!0),c[C]=t[C];const S=e.substring(g,h[1]),A=e.substring(h[4],b),I=um(C,t,n)??"undefined";p+="/"+S+I+A;continue}if(x===Kl){const C=e.substring(h[2],h[3]),S=t[C];if(S==null)continue;c[C]=S;const A=e.substring(g,h[1]),I=e.substring(h[4],b),k=um(C,t,n)??"";p+="/"+A+k+I;continue}}return e.endsWith("/")&&(p+="/"),{usedParams:c,interpolatedPath:p||"/",isMissingParams:s}}function Mx(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function fn(e){return!!e?.isNotFound}function pk(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Wm="tsr-scroll-restoration-v1_3",mk=(e,t)=>{let n;return(...o)=>{n||(n=setTimeout(()=>{e(...o),n=null},t))}};function gk(){const e=pk();if(!e)return null;const t=e.getItem(Wm);let n=t?JSON.parse(t):{};return{state:n,set:o=>{n=Zo(o,n)||n;try{e.setItem(Wm,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Qu=gk(),yk=e=>e.state.__TSR_key||e.href;function vk(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let Ed=!1;function bk({storageKey:e,key:t,behavior:n,shouldScrollRestoration:o,scrollToTopSelectors:s,location:c}){let u;try{u=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(p){console.error(p);return}const f=t||window.history.state?.__TSR_key,h=u[f];Ed=!0;e:{if(o&&h&&Object.keys(h).length>0){for(const g in h){const b=h[g];if(g==="window")window.scrollTo({top:b.scrollY,left:b.scrollX,behavior:n});else if(g){const x=document.querySelector(g);x&&(x.scrollLeft=b.scrollX,x.scrollTop=b.scrollY)}}break e}const p=(c??window.location).hash.split("#",2)[1];if(p){const g=window.history.state?.__hashScrollIntoViewOptions??!0;if(g){const b=document.getElementById(p);b&&b.scrollIntoView(g)}break e}const y={top:0,left:0,behavior:n};if(window.scrollTo(y),s)for(const g of s){if(g==="window")continue;const b=typeof g=="function"?g():document.querySelector(g);b&&b.scrollTo(y)}}Ed=!1}function wk(e,t){if(!Qu||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Qu))return;e.isScrollRestorationSetup=!0,Ed=!1;const o=e.options.getScrollRestorationKey||yk;window.history.scrollRestoration="manual";const s=c=>{if(Ed||!e.isScrollRestoring)return;let u="";if(c.target===document||c.target===window)u="window";else{const h=c.target.getAttribute("data-scroll-restoration-id");h?u=`[data-scroll-restoration-id="${h}"]`:u=vk(c.target)}const f=o(e.state.location);Qu.set(h=>{const p=h[f]||={},y=p[u]||={};if(u==="window")y.scrollX=window.scrollX||0,y.scrollY=window.scrollY||0;else if(u){const g=document.querySelector(u);g&&(y.scrollX=g.scrollLeft||0,y.scrollY=g.scrollTop||0)}return h})};typeof document<"u"&&document.addEventListener("scroll",mk(s,100),!0),e.subscribe("onRendered",c=>{const u=o(c.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(bk({storageKey:Wm,key:u,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Qu.set(f=>(f[u]||={},f)))})}function xk(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function TE(e,t=String){const n=new URLSearchParams;for(const o in e){const s=e[o];s!==void 0&&n.set(o,t(s))}return n.toString()}function fm(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Sk(e){const t=new URLSearchParams(e),n={};for(const[o,s]of t.entries()){const c=n[o];c==null?n[o]=fm(s):Array.isArray(c)?c.push(fm(s)):n[o]=[c,fm(s)]}return n}const _k=Tk(JSON.parse),Ek=Ck(JSON.stringify,JSON.parse);function Tk(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Sk(t);for(const o in n){const s=n[o];if(typeof s=="string")try{n[o]=e(s)}catch{}}return n}}function Ck(e,t){const n=typeof t=="function";function o(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch{}else if(n&&typeof s=="string")try{return t(s),e(s)}catch{}return s}return s=>{const c=TE(s,o);return c?`?${c}`:""}}const ir="__root__";function CE(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&xd(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${wE.join(", ")} protocols are allowed.`);if(!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Bn(e){return e instanceof Response&&!!e.options}function AE(e){if(e!==null&&typeof e=="object"&&e.isSerializedRedirect)return CE(e)}const cd=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Jd=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),ra=(e,t,n=!0)=>{const o={...e.router.options.context??{}},s=n?t:t-1;for(let c=0;c<=s;c++){const u=e.matches[c];if(!u)continue;const f=e.router.getMatch(u.id);f&&Object.assign(o,f.__routeContext,f.__beforeLoadContext)}return o},RE=(e,t)=>{const n=e.router.routesById[t.routeId??""]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),An(n.options.notFoundComponent);const o=e.matches.find(s=>s.routeId===n.id);An(o,"Could not find match for route: "+n.id),e.updateMatch(o.id,s=>({...s,status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,RE(e,t))},Go=(e,t,n)=>{if(!(!Bn(n)&&!fn(n))){if(Bn(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const o=Bn(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,s=>({...s,status:o,context:ra(e,t.index),isFetching:!1,error:n})),fn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Bn(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(RE(e,n),n)}},NE=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,Nl=(e,t,n,o)=>{const{id:s,routeId:c}=e.matches[t],u=e.router.looseRoutesById[c];if(n instanceof Promise)throw n;n.routerCode=o,e.firstBadMatchIndex??=t,Go(e,e.router.getMatch(s),n);try{u.options.onError?.(n)}catch(f){n=f,Go(e,e.router.getMatch(s),n)}e.updateMatch(s,f=>(f._nonReactive.beforeLoadPromise?.resolve(),f._nonReactive.beforeLoadPromise=void 0,f._nonReactive.loadPromise?.resolve(),{...f,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},IE=(e,t,n,o)=>{if(o._nonReactive.pendingTimeout!==void 0)return;const s=n.options.pendingMs??e.router.options.defaultPendingMs;if(!!(e.onReady&&!Jd(e,t)&&(n.options.loader||n.options.beforeLoad||ME(n))&&typeof s=="number"&&s!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent))){const u=setTimeout(()=>{cd(e)},s);o._nonReactive.pendingTimeout=u}},Ak=(e,t,n)=>{const o=e.router.getMatch(t);if(!o._nonReactive.beforeLoadPromise&&!o._nonReactive.loaderPromise)return;IE(e,t,n,o);const s=()=>{const c=e.router.getMatch(t);c.preload&&(c.status==="redirected"||c.status==="notFound")&&Go(e,c,c.error)};return o._nonReactive.beforeLoadPromise?o._nonReactive.beforeLoadPromise.then(s):s()},Rk=(e,t,n,o)=>{const s=e.router.getMatch(t),c=s._nonReactive.loadPromise;s._nonReactive.loadPromise=Vi(()=>{c?.resolve()});const{paramsError:u,searchError:f}=s;u&&Nl(e,n,u,"PARSE_PARAMS"),f&&Nl(e,n,f,"VALIDATE_SEARCH"),IE(e,t,o,s);const h=new AbortController;let p=!1;const y=()=>{p||(p=!0,e.updateMatch(t,N=>({...N,isFetching:"beforeLoad",fetchCount:N.fetchCount+1,abortController:h})))},g=()=>{s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,N=>({...N,isFetching:!1}))};if(!o.options.beforeLoad){ta(()=>{y(),g()});return}s._nonReactive.beforeLoadPromise=Vi();const b={...ra(e,n,!1),...s.__routeContext},{search:x,params:C,cause:S}=s,A=Jd(e,t),I={search:x,abortController:h,params:C,preload:A,context:b,location:e.location,navigate:N=>e.router.navigate({...N,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:A?"preload":S,matches:e.matches,...e.router.options.additionalContext},k=N=>{if(N===void 0){ta(()=>{y(),g()});return}(Bn(N)||fn(N))&&(y(),Nl(e,n,N,"BEFORE_LOAD")),ta(()=>{y(),e.updateMatch(t,j=>({...j,__beforeLoadContext:N})),g()})};let R;try{if(R=o.options.beforeLoad(I),na(R))return y(),R.catch(N=>{Nl(e,n,N,"BEFORE_LOAD")}).then(k)}catch(N){y(),Nl(e,n,N,"BEFORE_LOAD")}k(R)},Nk=(e,t)=>{const{id:n,routeId:o}=e.matches[t],s=e.router.looseRoutesById[o],c=()=>f(),u=()=>Rk(e,n,t,s),f=()=>{if(NE(e,n))return;const h=Ak(e,n,s);return na(h)?h.then(u):u()};return c()},Ik=(e,t,n)=>{const o=e.router.getMatch(t);if(!o||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:o,params:o.params,loaderData:o.loaderData};return Promise.all([n.options.head?.(s),n.options.scripts?.(s),n.options.headers?.(s)]).then(([c,u,f])=>{const h=c?.meta,p=c?.links,y=c?.scripts,g=c?.styles;return{meta:h,links:p,headScripts:y,headers:f,scripts:u,styles:g}})},OE=(e,t,n,o)=>{const s=e.matchPromises[n-1],{params:c,loaderDeps:u,abortController:f,cause:h}=e.router.getMatch(t),p=ra(e,n),y=Jd(e,t);return{params:c,deps:u,preload:!!y,parentMatchPromise:s,abortController:f,context:p,location:e.location,navigate:g=>e.router.navigate({...g,_fromLocation:e.location}),cause:y?"preload":h,route:o,...e.router.options.additionalContext}},Dx=async(e,t,n,o)=>{try{const s=e.router.getMatch(t);try{(!(H2??e.router.isServer)||s.ssr===!0)&&kE(o);const c=o.options.loader?.(OE(e,t,n,o)),u=o.options.loader&&na(c);if((u||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||s._nonReactive.minPendingPromise)&&e.updateMatch(t,p=>({...p,isFetching:"loader"})),o.options.loader){const p=u?await c:c;Go(e,e.router.getMatch(t),p),p!==void 0&&e.updateMatch(t,y=>({...y,loaderData:p}))}o._lazyPromise&&await o._lazyPromise;const h=s._nonReactive.minPendingPromise;h&&await h,o._componentsPromise&&await o._componentsPromise,e.updateMatch(t,p=>({...p,error:void 0,context:ra(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(c){let u=c;if(u?.name==="AbortError"){e.updateMatch(t,h=>({...h,status:h.status==="pending"?"success":h.status,isFetching:!1,context:ra(e,n)}));return}const f=s._nonReactive.minPendingPromise;f&&await f,fn(c)&&await o.options.notFoundComponent?.preload?.(),Go(e,e.router.getMatch(t),c);try{o.options.onError?.(c)}catch(h){u=h,Go(e,e.router.getMatch(t),h)}e.updateMatch(t,h=>({...h,error:u,context:ra(e,n),status:"error",isFetching:!1}))}}catch(s){const c=e.router.getMatch(t);c&&(c._nonReactive.loaderPromise=void 0),Go(e,c,s)}},Ok=async(e,t)=>{const{id:n,routeId:o}=e.matches[t];let s=!1,c=!1;const u=e.router.looseRoutesById[o];if(!NE(e,n)){const p=e.router.getMatch(n);if(p._nonReactive.loaderPromise){if(p.status==="success"&&!e.sync&&!p.preload)return p;await p._nonReactive.loaderPromise;const y=e.router.getMatch(n),g=y._nonReactive.error||y.error;g&&Go(e,y,g)}else{const y=Date.now()-p.updatedAt,g=Jd(e,n),b=g?u.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:u.options.staleTime??e.router.options.defaultStaleTime??0,x=u.options.shouldReload,C=typeof x=="function"?x(OE(e,n,t,u)):x,S=!!g&&!e.router.state.matches.some(R=>R.id===n),A=e.router.getMatch(n);A._nonReactive.loaderPromise=Vi(),S!==A.preload&&e.updateMatch(n,R=>({...R,preload:S}));const{status:I,invalid:k}=A;s=I==="success"&&(k||(C??y>b)),g&&u.options.preload===!1||(s&&!e.sync?(c=!0,(async()=>{try{await Dx(e,n,t,u);const R=e.router.getMatch(n);R._nonReactive.loaderPromise?.resolve(),R._nonReactive.loadPromise?.resolve(),R._nonReactive.loaderPromise=void 0}catch(R){Bn(R)&&await e.router.navigate(R.options)}})()):(I!=="success"||s&&e.sync)&&await Dx(e,n,t,u))}}const f=e.router.getMatch(n);c||(f._nonReactive.loaderPromise?.resolve(),f._nonReactive.loadPromise?.resolve()),clearTimeout(f._nonReactive.pendingTimeout),f._nonReactive.pendingTimeout=void 0,c||(f._nonReactive.loaderPromise=void 0),f._nonReactive.dehydrated=void 0;const h=c?f.isFetching:!1;return h!==f.isFetching||f.invalid!==!1?(e.updateMatch(n,p=>({...p,isFetching:h,invalid:!1})),e.router.getMatch(n)):f};async function jx(e){const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(n=>n._forcePending)&&cd(t);try{for(let f=0;f<t.matches.length;f++){const h=Nk(t,f);na(h)&&await h}const n=t.firstBadMatchIndex??t.matches.length;for(let f=0;f<n;f++)t.matchPromises.push(Ok(t,f));const s=(await Promise.allSettled(t.matchPromises)).filter(f=>f.status==="rejected").map(f=>f.reason);let c;for(const f of s){if(Bn(f))throw f;!c&&fn(f)&&(c=f)}for(const f of t.matches){const{id:h,routeId:p}=f,y=t.router.looseRoutesById[p];try{const g=Ik(t,h,y);if(g){const b=await g;t.updateMatch(h,x=>({...x,...b}))}}catch(g){console.error(`Error executing head for route ${p}:`,g)}}if(c)throw c;const u=cd(t);na(u)&&await u}catch(n){if(fn(n)&&!t.preload){const o=cd(t);throw na(o)&&await o,n}if(Bn(n))throw n}return t.matches}async function kE(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const{id:n,...o}=t.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{const n=[];for(const o of DE){const s=e.options[o]?.preload;s&&n.push(s())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function ME(e){for(const t of DE)if(e.options[t]?.preload)return!0;return!1}const DE=["component","errorComponent","pendingComponent","notFoundComponent"];function kk(e){return{input:({url:t})=>{for(const n of e)t=eg(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=jE(e[n],t);return t}}}function Mk(e){const t=EE(e.basepath),n=`/${t}`,o=`${n}/`,s=e.caseSensitive?n:n.toLowerCase(),c=e.caseSensitive?o:o.toLowerCase();return{input:({url:u})=>{const f=e.caseSensitive?u.pathname:u.pathname.toLowerCase();return f===s?u.pathname="/":f.startsWith(c)&&(u.pathname=u.pathname.slice(n.length)),u},output:({url:u})=>(u.pathname=ld(["/",t,u.pathname]),u)}}function eg(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function jE(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Dk(e){return e instanceof Error?{name:e.name,message:e.message}:{data:e}}function qi(e){const t=e.resolvedLocation,n=e.location,o=t?.pathname!==n.pathname,s=t?.href!==n.href,c=t?.hash!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:o,hrefChanged:s,hashChanged:c}}class jk{constructor(t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=n=>n(),this.update=n=>{n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const o=this.options,s=this.basepath??o?.basepath??"/",c=this.basepath===void 0,u=o?.rewrite;if(this.options={...o,...n},this.isServer=this.options.isServer??typeof document>"u",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=hk(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=U2()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let b;this.resolvePathCache=Sd(1e3),b=this.buildRouteTree(),this.setRoutes(b)}!this.__store&&this.latestLocation&&(this.__store=new B2(zk(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(b=>!["redirected"].includes(b.status))}}}),wk(this));let f=!1;const h=this.options.basepath??"/",p=this.options.rewrite;if(c||s!==h||u!==p){this.basepath=h;const b=[],x=EE(h);x&&x!=="/"&&b.push(Mk({basepath:h})),p&&b.push(p),this.rewrite=b.length===0?void 0:b.length===1?b[0]:kk(b),this.history&&this.updateLatestLocation(),f=!0}f&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=ak(this.routeTree,this.options.caseSensitive,(o,s)=>{o.init({originalIndex:s})});return this.options.routeMasks&&nk(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,o)=>{const s={eventType:n,fn:o};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{this.subscribers.forEach(o=>{o.eventType===n.type&&o.fn(n)})},this.parseLocation=(n,o)=>{const s=({pathname:h,search:p,hash:y,href:g,state:b})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(h)){const k=this.options.parseSearch(p),R=this.options.stringifySearch(k);return{href:h+R+y,publicHref:g,pathname:Al(h),external:!1,searchStr:R,search:En(o?.search,k),hash:Al(y.slice(1)),state:En(o?.state,b)}}const x=new URL(g,this.origin),C=eg(this.rewrite,x),S=this.options.parseSearch(C.search),A=this.options.stringifySearch(S);return C.search=A,{href:C.href.replace(C.origin,""),publicHref:g,pathname:Al(C.pathname),external:!!this.rewrite&&C.origin!==this.origin,searchStr:A,search:En(o?.search,S),hash:Al(C.hash.slice(1)),state:En(o?.state,b)}},c=s(n),{__tempLocation:u,__tempKey:f}=c.state;if(u&&(!f||f===this.tempLocationKey)){const h=s(u);return h.state.key=c.state.key,h.state.__TSR_key=c.state.__TSR_key,delete h.state.__tempLocation,{...h,maskedLocation:c}}return c},this.resolvePathWithBase=(n,o)=>fk({base:n,to:Pg(o),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,o,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:o},s):this.matchRoutesInternal(n,o),this.getMatchedRoutes=n=>Pk({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const o=this.getMatch(n);o&&(o.abortController.abort(),clearTimeout(o._nonReactive.pendingTimeout),o._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const n=this.state.matches.filter(c=>c.status==="pending"),o=this.state.matches.filter(c=>c.isFetching==="loader");new Set([...this.state.pendingMatches??[],...n,...o]).forEach(c=>{this.cancelMatch(c.id)})},this.buildLocation=n=>{const o=(c={})=>{const u=c._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(u);c.from;const h=c.unsafeRelative==="path"?u.pathname:c.from??f.fullPath,p=this.resolvePathWithBase(h,"."),y=f.search,g={...f.params},b=c.to?this.resolvePathWithBase(p,`${c.to}`):this.resolvePathWithBase(p,"."),x=c.params===!1||c.params===null?{}:(c.params??!0)===!0?g:Object.assign(g,Zo(c.params,g)),C=dm({path:b,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,S=this.getMatchedRoutes(C);let A=S.matchedRoutes;(S.foundRoute?S.foundRoute.path!=="/"&&S.routeParams["**"]:co(C))&&this.options.notFoundRoute&&(A=[...A,this.options.notFoundRoute]);let k=!1;if(Object.keys(x).length>0)for(const ue of A){const ce=ue.options.params?.stringify??ue.options.stringifyParams;ce&&(k=!0,Object.assign(x,ce(x)))}const R=n.leaveParams?b:Al(k?dm({path:b,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:C);let N=y;if(n._includeValidateSearch&&this.options.search?.strict){const ue={};A.forEach(ce=>{if(ce.options.validateSearch)try{Object.assign(ue,ud(ce.options.validateSearch,{...ue,...N}))}catch{}}),N=ue}N=$k({search:N,dest:c,destRoutes:A,_includeValidateSearch:n._includeValidateSearch}),N=En(y,N);const j=this.options.stringifySearch(N),B=c.hash===!0?u.hash:c.hash?Zo(c.hash,u.hash):void 0,P=B?`#${B}`:"";let M=c.state===!0?u.state:c.state?Zo(c.state,u.state):{};M=En(u.state,M);const U=`${R}${j}${P}`;let ee,ae,re=!1;if(this.rewrite){const ue=new URL(U,this.origin),ce=jE(this.rewrite,ue);ee=ue.href.replace(ue.origin,""),ce.origin!==this.origin?(ae=ce.href,re=!0):ae=ce.pathname+ce.search+ce.hash}else ee=W2(U),ae=ee;return{publicHref:ae,href:ee,pathname:R,search:N,searchStr:j,state:M,hash:B??"",external:re,unmaskOnReload:c.unmaskOnReload}},s=(c={},u)=>{const f=o(c);let h=u?o(u):void 0;if(!h){const p={};if(this.options.routeMasks){const y=rk(f.pathname,this.processedTree);if(y){Object.assign(p,y.rawParams);const{from:g,params:b,...x}=y.route,C=b===!1||b===null?{}:(b??!0)===!0?p:Object.assign(p,Zo(b,p));u={from:n.from,...x,params:C},h=o(u)}}}return h&&(f.maskedLocation=h),f};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:o,...s})=>{const c=()=>{const h=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];h.forEach(y=>{s.state[y]=this.latestLocation.state[y]});const p=Bi(s.state,this.latestLocation.state);return h.forEach(y=>{delete s.state[y]}),p},u=co(this.latestLocation.href)===co(s.href),f=this.commitLocationPromise;if(this.commitLocationPromise=Vi(()=>{f?.resolve()}),u&&c())this.load();else{let{maskedLocation:h,hashScrollIntoView:p,...y}=s;h&&(y={...h,state:{...h.state,__tempKey:void 0,__tempLocation:{...y,search:y.searchStr,state:{...y.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(y.unmaskOnReload??this.options.unmaskOnReload??!1)&&(y.state.__tempKey=this.tempLocationKey)),y.state.__hashScrollIntoViewOptions=p??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,this.history[s.replace?"replace":"push"](y.publicHref,y.state,{ignoreBlocker:o})}return this.resetNextScroll=s.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:o,hashScrollIntoView:s,viewTransition:c,ignoreBlocker:u,href:f,...h}={})=>{if(f){const g=this.history.location.state.__TSR_index,b=bd(f,{__TSR_index:n?g:g+1}),x=new URL(b.pathname,this.origin),C=eg(this.rewrite,x);h.to=C.pathname,h.search=this.options.parseSearch(b.search),h.hash=b.hash.slice(1)}const p=this.buildLocation({...h,_includeValidateSearch:!0});this.pendingBuiltLocation=p;const y=this.commitLocation({...p,viewTransition:c,replace:n,resetScroll:o,hashScrollIntoView:s,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===p&&(this.pendingBuiltLocation=void 0)}),y},this.navigate=async({to:n,reloadDocument:o,href:s,publicHref:c,...u})=>{let f=!1;if(s)try{new URL(`${s}`),f=!0}catch{}if(f&&!o&&(o=!0),o){if(n!==void 0||!s){const p=this.buildLocation({to:n,...u});s=s??p.publicHref,c=c??p.publicHref}const h=!f&&c?c:s;if(xd(h))return Promise.resolve();if(!u.ignoreBlocker){const y=this.history.getBlockers?.()??[];for(const g of y)if(g?.blockerFn&&await g.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(h):window.location.href=h,Promise.resolve()}return this.buildAndCommitLocation({...u,href:s,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation);this.__store.setState(o=>({...o,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:n,cachedMatches:o.cachedMatches.filter(s=>!n.some(c=>c.id===s.id))}))},this.load=async n=>{let o,s,c;for(c=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad();const h=this.latestLocation,p=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...qi({resolvedLocation:p,location:h})}),this.emit({type:"onBeforeLoad",...qi({resolvedLocation:p,location:h})}),await jx({router:this,sync:n?.sync,matches:this.state.pendingMatches,location:h,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let y=[],g=[],b=[];ta(()=>{this.__store.setState(x=>{const C=x.matches,S=x.pendingMatches||x.matches;return y=C.filter(A=>!S.some(I=>I.id===A.id)),g=S.filter(A=>!C.some(I=>I.id===A.id)),b=S.filter(A=>C.some(I=>I.id===A.id)),{...x,isLoading:!1,loadedAt:Date.now(),matches:S,pendingMatches:void 0,cachedMatches:[...x.cachedMatches,...y.filter(A=>A.status!=="error"&&A.status!=="notFound")]}}),this.clearExpiredCache()}),[[y,"onLeave"],[g,"onEnter"],[b,"onStay"]].forEach(([x,C])=>{x.forEach(S=>{this.looseRoutesById[S.routeId].options[C]?.(S)})})})})}})}catch(h){Bn(h)?(o=h,this.navigate({...o.options,replace:!0,ignoreBlocker:!0})):fn(h)&&(s=h),this.__store.setState(p=>({...p,statusCode:o?o.status:s?404:p.matches.some(y=>y.status==="error")?500:200,redirect:o}))}this.latestLoadPromise===c&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=c,await c;this.latestLoadPromise&&c!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.__store.state.matches.some(f=>f.status==="error")&&(u=500),u!==void 0&&this.__store.setState(f=>({...f,statusCode:u}))},this.startViewTransition=n=>{const o=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,o&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let s;if(typeof o=="object"&&this.isViewTransitionTypesSupported){const c=this.latestLocation,u=this.state.resolvedLocation,f=typeof o.types=="function"?o.types(qi({resolvedLocation:u,location:c})):o.types;if(f===!1){n();return}s={update:n,types:f}}else s=n;document.startViewTransition(s)}else n()},this.updateMatch=(n,o)=>{this.startTransition(()=>{const s=this.state.pendingMatches?.some(c=>c.id===n)?"pendingMatches":this.state.matches.some(c=>c.id===n)?"matches":this.state.cachedMatches.some(c=>c.id===n)?"cachedMatches":"";s&&this.__store.setState(c=>({...c,[s]:c[s]?.map(u=>u.id===n?o(u):u)}))})},this.getMatch=n=>{const o=s=>s.id===n;return this.state.cachedMatches.find(o)??this.state.pendingMatches?.find(o)??this.state.matches.find(o)},this.invalidate=n=>{const o=s=>n?.filter?.(s)??!0?{...s,invalid:!0,...n?.forcePending||s.status==="error"||s.status==="notFound"?{status:"pending",error:void 0}:void 0}:s;return this.__store.setState(s=>({...s,matches:s.matches.map(o),cachedMatches:s.cachedMatches.map(o),pendingMatches:s.pendingMatches?.map(o)})),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const o=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=n.options._builtLocation??this.buildLocation(n.options),c=this.getParsedLocationHref(s);n.options.href=c,n.headers.set("Location",c)}else if(o)try{const s=new URL(o);if(this.origin&&s.origin===this.origin){const c=s.pathname+s.search+s.hash;n.options.href=c,n.headers.set("Location",c)}}catch{}return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const o=n?.filter;o!==void 0?this.__store.setState(s=>({...s,cachedMatches:s.cachedMatches.filter(c=>!o(c))})):this.__store.setState(s=>({...s,cachedMatches:[]}))},this.clearExpiredCache=()=>{const n=o=>{const s=this.looseRoutesById[o.routeId];if(!s.options.loader)return!0;const c=(o.preload?s.options.preloadGcTime??this.options.defaultPreloadGcTime:s.options.gcTime??this.options.defaultGcTime)??300*1e3;return o.status==="error"?!0:Date.now()-o.updatedAt>=c};this.clearCache({filter:n})},this.loadRouteChunk=kE,this.preloadRoute=async n=>{const o=this.buildLocation(n);let s=this.matchRoutes(o,{throwOnError:!0,preload:!0,dest:n});const c=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(f=>f.id)),u=new Set([...c,...this.state.cachedMatches.map(f=>f.id)]);ta(()=>{s.forEach(f=>{u.has(f.id)||this.__store.setState(h=>({...h,cachedMatches:[...h.cachedMatches,f]}))})});try{return s=await jx({router:this,matches:s,location:o,preload:!0,updateMatch:(f,h)=>{c.has(f)?s=s.map(p=>p.id===f?h(p):p):this.updateMatch(f,h)}}),s}catch(f){if(Bn(f))return f.options.reloadDocument?void 0:await this.preloadRoute({...f.options,_fromLocation:o});fn(f)||console.error(f);return}},this.matchRoute=(n,o)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},c=this.buildLocation(s);if(o?.pending&&this.state.status!=="pending")return!1;const f=(o?.pending===void 0?!this.state.isLoading:o.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,h=ok(c.pathname,o?.caseSensitive??!1,o?.fuzzy??!1,f.pathname,this.processedTree);return!h||n.params&&!Bi(h.rawParams,n.params,{partial:!0})?!1:o?.includeSearch??!0?Bi(f.search,c.search,{partial:!0})?h.rawParams:!1:h.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(n=>n.status==="notFound"||n.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??Ek,parseSearch:t.parseSearch??_k}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:n,processedTree:o}){this.routesById=t,this.routesByPath=n,this.processedTree=o;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}get looseRoutesById(){return this.routesById}matchRoutesInternal(t,n){const o=this.getMatchedRoutes(t.pathname),{foundRoute:s,routeParams:c,parsedParams:u}=o;let{matchedRoutes:f}=o,h=!1;(s?s.path!=="/"&&c["**"]:co(t.pathname))&&(this.options.notFoundRoute?f=[...f,this.options.notFoundRoute]:h=!0);const p=h?Bk(this.options.notFoundMode,f):void 0,y=[],g=b=>b?.id?b.context??this.options.context??void 0:this.options.context??void 0;return f.forEach((b,x)=>{const C=y[x-1],[S,A,I]=(()=>{const ce=C?.search??t.search,he=C?._strictSearch??void 0;try{const F=ud(b.options.validateSearch,{...ce})??void 0;return[{...ce,...F},{...he,...F},void 0]}catch(F){let X=F;if(F instanceof Td||(X=new Td(F.message,{cause:F})),n?.throwOnError)throw X;return[ce,{},X]}})(),k=b.options.loaderDeps?.({search:S})??"",R=k?JSON.stringify(k):"",{interpolatedPath:N,usedParams:j}=dm({path:b.fullPath,params:c,decoder:this.pathParamsDecoder,server:this.isServer}),B=b.id+N+R,P=this.getMatch(B),M=this.state.matches.find(ce=>ce.routeId===b.id),U=P?._strictParams??j;let ee;if(!P)try{Lx(b,j,u,U)}catch(ce){if(fn(ce)||Bn(ce)?ee=ce:ee=new Lk(ce.message,{cause:ce}),n?.throwOnError)throw ee}Object.assign(c,U);const ae=M?"stay":"enter";let re;if(P)re={...P,cause:ae,params:M?En(M.params,c):c,_strictParams:U,search:En(M?M.search:P.search,S),_strictSearch:A};else{const ce=b.options.loader||b.options.beforeLoad||b.lazyFn||ME(b)?"pending":"success";re={id:B,ssr:b.options.ssr,index:x,routeId:b.id,params:M?En(M.params,c):c,_strictParams:U,pathname:N,updatedAt:Date.now(),search:M?En(M.search,S):S,_strictSearch:A,searchError:void 0,status:ce,isFetching:!1,error:void 0,paramsError:ee,__routeContext:void 0,_nonReactive:{loadPromise:Vi()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:ae,loaderDeps:M?En(M.loaderDeps,k):k,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:b.options.staticData||{},fullPath:b.fullPath}}n?.preload||(re.globalNotFound=p===b.id),re.searchError=I;const ue=g(C);re.context={...ue,...re.__routeContext,...re.__beforeLoadContext},y.push(re)}),y.forEach((b,x)=>{const C=this.looseRoutesById[b.routeId];if(!this.getMatch(b.id)){const A=y[x-1],I=g(A);if(C.options.context){const k={deps:b.loaderDeps,params:b.params,context:I??{},location:t,navigate:R=>this.navigate({...R,_fromLocation:t}),buildLocation:this.buildLocation,cause:b.cause,abortController:b.abortController,preload:!!b.preload,matches:y};b.__routeContext=C.options.context(k)??void 0}b.context={...I,...b.__routeContext,...b.__beforeLoadContext}}}),y}matchRoutesLightweight(t){const{matchedRoutes:n,routeParams:o,parsedParams:s}=this.getMatchedRoutes(t.pathname),c=Yl(n),u={...t.search};for(const y of n)try{Object.assign(u,ud(y.options.validateSearch,u))}catch{}const f=Yl(this.state.matches),h=f&&f.routeId===c.id&&t.pathname===this.state.location.pathname;let p;if(h)p=f.params;else{const y={...o};for(const g of n)try{Lx(g,o,s??{},y)}catch{}p=y}return{matchedRoutes:n,fullPath:c.fullPath,search:u,params:p}}}class Td extends Error{}class Lk extends Error{}function zk(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function ud(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Td("Async validation not supported");if(n.issues)throw new Td(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function Pk({pathname:e,routesById:t,processedTree:n}){const o={},s=co(e);let c,u;const f=ik(s,n,!0);return f&&(c=f.route,Object.assign(o,f.rawParams),u=Object.assign({},f.parsedParams)),{matchedRoutes:f?.branch||[t[ir]],routeParams:o,foundRoute:c,parsedParams:u}}function $k({search:e,dest:t,destRoutes:n,_includeValidateSearch:o}){return Fk(n)(e,t,o??!1)}function Fk(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const s of e){if("search"in s.options)s.options.search?.middlewares&&t.middlewares.push(...s.options.search.middlewares);else if(s.options.preSearchFilters||s.options.postSearchFilters){const c=({search:u,next:f})=>{let h=u;"preSearchFilters"in s.options&&s.options.preSearchFilters&&(h=s.options.preSearchFilters.reduce((y,g)=>g(y),u));const p=f(h);return"postSearchFilters"in s.options&&s.options.postSearchFilters?s.options.postSearchFilters.reduce((y,g)=>g(y),p):p};t.middlewares.push(c)}if(s.options.validateSearch){const c=({search:u,next:f})=>{const h=f(u);if(!t._includeValidateSearch)return h;try{return{...h,...ud(s.options.validateSearch,h)??void 0}}catch{return h}};t.middlewares.push(c)}}const n=({search:s})=>{const c=t.dest;return c.search?c.search===!0?s:Zo(c.search,s):{}};t.middlewares.push(n);const o=(s,c,u)=>{if(s>=u.length)return c;const f=u[s];return f({search:c,next:p=>o(s+1,p,u)})};return function(c,u,f){return t.dest=u,t._includeValidateSearch=f,o(0,c,t.middlewares)}}function Bk(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const o=t[n];if(o.children)return o.id}return ir}function Lx(e,t,n,o){const s=e.options.params?.parse??e.options.parseParams;if(s)if(e.options.skipRouteOnParseError)for(const c in t)c in n&&(o[c]=n[c]);else{const c=s(o);Object.assign(o,c)}}const Nr=Symbol.for("TSR_DEFERRED_PROMISE");function qk(e,t){const n=e;return n[Nr]||(n[Nr]={status:"pending"},n.then(o=>{n[Nr].status="success",n[Nr].data=o}).catch(o=>{n[Nr].status="error",n[Nr].error={data:Dk(o),__isServerError:!0}})),n}const Uk="Error preloading route! ☝️";class LE{constructor(t){if(this.init=n=>{this.originalIndex=n.originalIndex;const o=this.options,s=!o?.path&&!o?.id;this.parentRoute=this.options.getParentRoute?.(),s?this._path=ir:this.parentRoute||An(!1);let c=s?ir:o?.path;c&&c!=="/"&&(c=_E(c));const u=o?.id||c;let f=s?ir:ld([this.parentRoute.id===ir?"":this.parentRoute.id,u]);c===ir&&(c="/"),f!==ir&&(f=ld(["/",f]));const h=f===ir?"/":ld([this.parentRoute.fullPath,c]);this._path=c,this._id=f,this._fullPath=h,this._to=co(h)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>CE({from:this.fullPath,...n}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Vk extends LE{constructor(t){super(t)}}var Hk=(e=>(e[e.AggregateError=1]="AggregateError",e[e.ArrowFunction=2]="ArrowFunction",e[e.ErrorPrototypeStack=4]="ErrorPrototypeStack",e[e.ObjectAssign=8]="ObjectAssign",e[e.BigIntTypedArray=16]="BigIntTypedArray",e[e.RegExp=32]="RegExp",e))(Hk||{}),fo=Symbol.asyncIterator,zE=Symbol.hasInstance,oa=Symbol.isConcatSpreadable,ho=Symbol.iterator,PE=Symbol.match,$E=Symbol.matchAll,FE=Symbol.replace,BE=Symbol.search,qE=Symbol.species,UE=Symbol.split,VE=Symbol.toPrimitive,ia=Symbol.toStringTag,HE=Symbol.unscopables,QE={[fo]:0,[zE]:1,[oa]:2,[ho]:3,[PE]:4,[$E]:5,[FE]:6,[BE]:7,[qE]:8,[UE]:9,[VE]:10,[ia]:11,[HE]:12},Qk={0:fo,1:zE,2:oa,3:ho,4:PE,5:$E,6:FE,7:BE,8:qE,9:UE,10:VE,11:ia,12:HE},D=void 0,Zk={2:!0,3:!1,1:D,0:null,4:-0,5:Number.POSITIVE_INFINITY,6:Number.NEGATIVE_INFINITY,7:Number.NaN},Gk={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},Yk={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function Ge(e,t,n,o,s,c,u,f,h,p,y,g){return{t:e,i:t,s:n,c:o,m:s,p:c,e:u,a:f,f:h,b:p,o:y,l:g}}function oi(e){return Ge(2,D,e,D,D,D,D,D,D,D,D,D)}var ZE=oi(2),GE=oi(3),Kk=oi(1),Xk=oi(0),Jk=oi(4),Wk=oi(5),eM=oi(6),tM=oi(7);function nM(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case`
11
+ `:return"\\n";case"\r":return"\\r";case"\b":return"\\b";case" ":return"\\t";case"\f":return"\\f";case"<":return"\\x3C";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return D}}function ii(e){let t="",n=0,o;for(let s=0,c=e.length;s<c;s++)o=nM(e[s]),o&&(t+=e.slice(n,s)+o,n=s+1);return n===0?t=e:t+=e.slice(n),t}function rM(e){switch(e){case"\\\\":return"\\";case'\\"':return'"';case"\\n":return`
12
+ `;case"\\r":return"\r";case"\\b":return"\b";case"\\t":return" ";case"\\f":return"\f";case"\\x3C":return"<";case"\\u2028":return"\u2028";case"\\u2029":return"\u2029";default:return e}}function Wi(e){return e.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,rM)}var Zu="__SEROVAL_REFS__",YE=new Map,Xs=new Map;function KE(e){return YE.has(e)}function oM(e){return Xs.has(e)}function iM(e){if(KE(e))return YE.get(e);throw new LM(e)}function sM(e){if(oM(e))return Xs.get(e);throw new zM(e)}typeof globalThis<"u"?Object.defineProperty(globalThis,Zu,{value:Xs,configurable:!0,writable:!1,enumerable:!1}):typeof window<"u"?Object.defineProperty(window,Zu,{value:Xs,configurable:!0,writable:!1,enumerable:!1}):typeof self<"u"?Object.defineProperty(self,Zu,{value:Xs,configurable:!0,writable:!1,enumerable:!1}):typeof global<"u"&&Object.defineProperty(global,Zu,{value:Xs,configurable:!0,writable:!1,enumerable:!1});function $g(e){return e instanceof EvalError?1:e instanceof RangeError?2:e instanceof ReferenceError?3:e instanceof SyntaxError?4:e instanceof TypeError?5:e instanceof URIError?6:0}function aM(e){let t=Gk[$g(e)];return e.name!==t?{name:e.name}:e.constructor.name!==t?{name:e.constructor.name}:{}}function XE(e,t){let n=aM(e),o=Object.getOwnPropertyNames(e);for(let s=0,c=o.length,u;s<c;s++)u=o[s],u!=="name"&&u!=="message"&&(u==="stack"?t&4&&(n=n||{},n[u]=e[u]):(n=n||{},n[u]=e[u]));return n}function JE(e){return Object.isFrozen(e)?3:Object.isSealed(e)?2:Object.isExtensible(e)?0:1}function lM(e){switch(e){case Number.POSITIVE_INFINITY:return Wk;case Number.NEGATIVE_INFINITY:return eM}return e!==e?tM:Object.is(e,-0)?Jk:Ge(0,D,e,D,D,D,D,D,D,D,D,D)}function WE(e){return Ge(1,D,ii(e),D,D,D,D,D,D,D,D,D)}function cM(e){return Ge(3,D,""+e,D,D,D,D,D,D,D,D,D)}function uM(e){return Ge(4,e,D,D,D,D,D,D,D,D,D,D)}function dM(e,t){let n=t.valueOf();return Ge(5,e,n!==n?"":t.toISOString(),D,D,D,D,D,D,D,D,D)}function fM(e,t){return Ge(6,e,D,ii(t.source),t.flags,D,D,D,D,D,D,D)}function hM(e,t){return Ge(17,e,QE[t],D,D,D,D,D,D,D,D,D)}function pM(e,t){return Ge(18,e,ii(iM(t)),D,D,D,D,D,D,D,D,D)}function mM(e,t,n){return Ge(25,e,n,ii(t),D,D,D,D,D,D,D,D)}function gM(e,t,n){return Ge(9,e,D,D,D,D,D,n,D,D,JE(t),D)}function yM(e,t){return Ge(21,e,D,D,D,D,D,D,t,D,D,D)}function vM(e,t,n){return Ge(15,e,D,t.constructor.name,D,D,D,D,n,t.byteOffset,D,t.length)}function bM(e,t,n){return Ge(16,e,D,t.constructor.name,D,D,D,D,n,t.byteOffset,D,t.byteLength)}function wM(e,t,n){return Ge(20,e,D,D,D,D,D,D,n,t.byteOffset,D,t.byteLength)}function xM(e,t,n){return Ge(13,e,$g(t),D,ii(t.message),n,D,D,D,D,D,D)}function SM(e,t,n){return Ge(14,e,$g(t),D,ii(t.message),n,D,D,D,D,D,D)}function _M(e,t){return Ge(7,e,D,D,D,D,D,t,D,D,D,D)}function EM(e,t){return Ge(28,D,D,D,D,D,D,[e,t],D,D,D,D)}function TM(e,t){return Ge(30,D,D,D,D,D,D,[e,t],D,D,D,D)}function CM(e,t,n){return Ge(31,e,D,D,D,D,D,n,t,D,D,D)}function AM(e,t){return Ge(32,e,D,D,D,D,D,D,t,D,D,D)}function RM(e,t){return Ge(33,e,D,D,D,D,D,D,t,D,D,D)}function NM(e,t){return Ge(34,e,D,D,D,D,D,D,t,D,D,D)}function IM(e,t,n,o){return Ge(35,e,n,D,D,D,D,t,D,D,D,o)}var OM={parsing:1,serialization:2,deserialization:3};function kM(e){return`Seroval Error (step: ${OM[e]})`}var MM=(e,t)=>kM(e),eT=class extends Error{constructor(e,t){super(MM(e)),this.cause=t}},zx=class extends eT{constructor(e){super("parsing",e)}},DM=class extends eT{constructor(e){super("deserialization",e)}};function go(e){return`Seroval Error (specific: ${e})`}var Wd=class extends Error{constructor(t){super(go(1)),this.value=t}},tT=class extends Error{constructor(t){super(go(2))}},jM=class extends Error{constructor(e){super(go(3))}},dc=class extends Error{constructor(e){super(go(4))}},LM=class extends Error{constructor(e){super(go(5)),this.value=e}},zM=class extends Error{constructor(e){super(go(6))}},PM=class extends Error{constructor(e){super(go(7))}},si=class extends Error{constructor(e){super(go(8))}},$M=class extends Error{constructor(t){super(go(9))}},FM=class{constructor(e,t){this.value=e,this.replacement=t}},ef=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((t,n)=>{e.s=t,e.f=n}),e},BM=(e,t)=>{e.s(t),e.p.s=1,e.p.v=t},qM=(e,t)=>{e.f(t),e.p.s=2,e.p.v=t};ef.toString();BM.toString();qM.toString();var UM=()=>{let e=[],t=[],n=!0,o=!1,s=0,c=(h,p,y)=>{for(y=0;y<s;y++)t[y]&&t[y][p](h)},u=(h,p,y,g)=>{for(p=0,y=e.length;p<y;p++)g=e[p],!n&&p===y-1?h[o?"return":"throw"](g):h.next(g)},f=(h,p)=>(n&&(p=s++,t[p]=h),u(h),()=>{n&&(t[p]=t[s],t[s--]=void 0)});return{__SEROVAL_STREAM__:!0,on:h=>f(h),next:h=>{n&&(e.push(h),c(h,"next"))},throw:h=>{n&&(e.push(h),c(h,"throw"),n=!1,o=!1,t.length=0)},return:h=>{n&&(e.push(h),c(h,"return"),n=!1,o=!0,t.length=0)}}},VM=e=>t=>()=>{let n=0,o={[e]:()=>o,next:()=>{if(n>t.d)return{done:!0,value:void 0};let s=n++,c=t.v[s];if(s===t.t)throw c;return{done:s===t.d,value:c}}};return o},HM=(e,t)=>n=>()=>{let o=0,s=-1,c=!1,u=[],f=[],h=(y=0,g=f.length)=>{for(;y<g;y++)f[y].s({done:!0,value:void 0})};n.on({next:y=>{let g=f.shift();g&&g.s({done:!1,value:y}),u.push(y)},throw:y=>{let g=f.shift();g&&g.f(y),h(),s=u.length,c=!0,u.push(y)},return:y=>{let g=f.shift();g&&g.s({done:!0,value:y}),h(),s=u.length,u.push(y)}});let p={[e]:()=>p,next:()=>{if(s===-1){let b=o++;if(b>=u.length){let x=t();return f.push(x),x.p}return{done:!1,value:u[b]}}if(o>s)return{done:!0,value:void 0};let y=o++,g=u[y];if(y!==s)return{done:!1,value:g};if(c)throw g;return{done:!0,value:g}}};return p},nT=e=>{let t=atob(e),n=t.length,o=new Uint8Array(n);for(let s=0;s<n;s++)o[s]=t.charCodeAt(s);return o.buffer};nT.toString();function QM(e){return"__SEROVAL_SEQUENCE__"in e}function rT(e,t,n){return{__SEROVAL_SEQUENCE__:!0,v:e,t,d:n}}function ZM(e){let t=[],n=-1,o=-1,s=e[ho]();for(;;)try{let c=s.next();if(t.push(c.value),c.done){o=t.length-1;break}}catch(c){n=t.length,t.push(c)}return rT(t,n,o)}var GM=VM(ho);function YM(e){return GM(e)}var KM={},XM={},JM={0:{},1:{},2:{},3:{},4:{},5:{}};function tf(e){return"__SEROVAL_STREAM__"in e}function es(){return UM()}function WM(e){let t=es(),n=e[fo]();async function o(){try{let s=await n.next();s.done?t.return(s.value):(t.next(s.value),await o())}catch(s){t.throw(s)}}return o().catch(()=>{}),t}var eD=HM(fo,ef);function tD(e){return eD(e)}async function nD(e){try{return[1,await e]}catch(t){return[0,t]}}function rD(e,t){return{plugins:t.plugins,mode:e,marked:new Set,features:63^(t.disabledFeatures||0),refs:t.refs||new Map,depthLimit:t.depthLimit||1e3}}function dd(e,t){e.marked.add(t)}function oD(e,t){let n=e.refs.size;return e.refs.set(t,n),n}function nf(e,t){let n=e.refs.get(t);return n!=null?(dd(e,n),{type:1,value:uM(n)}):{type:0,value:oD(e,t)}}function Fg(e,t){let n=nf(e,t);return n.type===1?n:KE(t)?{type:2,value:pM(n.value,t)}:n}function Pi(e,t){let n=Fg(e,t);if(n.type!==0)return n.value;if(t in QE)return hM(n.value,t);throw new Wd(t)}function rf(e,t){let n=nf(e,JM[t]);return n.type===1?n.value:Ge(26,n.value,t,D,D,D,D,D,D,D,D,D)}function iD(e){let t=nf(e,KM);return t.type===1?t.value:Ge(27,t.value,D,D,D,D,D,D,Pi(e,ho),D,D,D)}function sD(e){let t=nf(e,XM);return t.type===1?t.value:Ge(29,t.value,D,D,D,D,D,[rf(e,1),Pi(e,fo)],D,D,D,D)}function aD(e,t,n,o){return Ge(n?11:10,e,D,D,D,o,D,D,D,D,JE(t),D)}function lD(e,t,n,o){return Ge(8,t,D,D,D,D,{k:n,v:o},D,rf(e,0),D,D,D)}function cD(e,t,n){let o=new Uint8Array(n),s="";for(let c=0,u=o.length;c<u;c++)s+=String.fromCharCode(o[c]);return Ge(19,t,ii(btoa(s)),D,D,D,D,D,rf(e,5),D,D,D)}function uD(e,t){return{base:rD(e,t),child:void 0}}var dD=class{constructor(e,t){this._p=e,this.depth=t}parse(e){return $t(this._p,this.depth,e)}};async function fD(e,t,n){let o=[];for(let s=0,c=n.length;s<c;s++)s in n?o[s]=await $t(e,t,n[s]):o[s]=0;return o}async function hD(e,t,n,o){return gM(n,o,await fD(e,t,o))}async function Bg(e,t,n){let o=Object.entries(n),s=[],c=[];for(let u=0,f=o.length;u<f;u++)s.push(ii(o[u][0])),c.push(await $t(e,t,o[u][1]));return ho in n&&(s.push(Pi(e.base,ho)),c.push(EM(iD(e.base),await $t(e,t,ZM(n))))),fo in n&&(s.push(Pi(e.base,fo)),c.push(TM(sD(e.base),await $t(e,t,WM(n))))),ia in n&&(s.push(Pi(e.base,ia)),c.push(WE(n[ia]))),oa in n&&(s.push(Pi(e.base,oa)),c.push(n[oa]?ZE:GE)),{k:s,v:c}}async function hm(e,t,n,o,s){return aD(n,o,s,await Bg(e,t,o))}async function pD(e,t,n,o){return yM(n,await $t(e,t,o.valueOf()))}async function mD(e,t,n,o){return vM(n,o,await $t(e,t,o.buffer))}async function gD(e,t,n,o){return bM(n,o,await $t(e,t,o.buffer))}async function yD(e,t,n,o){return wM(n,o,await $t(e,t,o.buffer))}async function Px(e,t,n,o){let s=XE(o,e.base.features);return xM(n,o,s?await Bg(e,t,s):D)}async function vD(e,t,n,o){let s=XE(o,e.base.features);return SM(n,o,s?await Bg(e,t,s):D)}async function bD(e,t,n,o){let s=[],c=[];for(let[u,f]of o.entries())s.push(await $t(e,t,u)),c.push(await $t(e,t,f));return lD(e.base,n,s,c)}async function wD(e,t,n,o){let s=[];for(let c of o.keys())s.push(await $t(e,t,c));return _M(n,s)}async function oT(e,t,n,o){let s=e.base.plugins;if(s)for(let c=0,u=s.length;c<u;c++){let f=s[c];if(f.parse.async&&f.test(o))return mM(n,f.tag,await f.parse.async(o,new dD(e,t),{id:n}))}return D}async function xD(e,t,n,o){let[s,c]=await nD(o);return Ge(12,n,s,D,D,D,D,D,await $t(e,t,c),D,D,D)}function SD(e,t,n,o,s){let c=[],u=n.on({next:f=>{dd(this.base,t),$t(this,e,f).then(h=>{c.push(AM(t,h))},h=>{s(h),u()})},throw:f=>{dd(this.base,t),$t(this,e,f).then(h=>{c.push(RM(t,h)),o(c),u()},h=>{s(h),u()})},return:f=>{dd(this.base,t),$t(this,e,f).then(h=>{c.push(NM(t,h)),o(c),u()},h=>{s(h),u()})}})}async function _D(e,t,n,o){return CM(n,rf(e.base,4),await new Promise(SD.bind(e,t,n,o)))}async function ED(e,t,n,o){let s=[];for(let c=0,u=o.v.length;c<u;c++)s[c]=await $t(e,t,o.v[c]);return IM(n,s,o.t,o.d)}async function TD(e,t,n,o){if(Array.isArray(o))return hD(e,t,n,o);if(tf(o))return _D(e,t,n,o);if(QM(o))return ED(e,t,n,o);let s=o.constructor;if(s===FM)return $t(e,t,o.replacement);let c=await oT(e,t,n,o);if(c)return c;switch(s){case Object:return hm(e,t,n,o,!1);case D:return hm(e,t,n,o,!0);case Date:return dM(n,o);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return Px(e,t,n,o);case Number:case Boolean:case String:case BigInt:return pD(e,t,n,o);case ArrayBuffer:return cD(e.base,n,o);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return mD(e,t,n,o);case DataView:return yD(e,t,n,o);case Map:return bD(e,t,n,o);case Set:return wD(e,t,n,o)}if(s===Promise||o instanceof Promise)return xD(e,t,n,o);let u=e.base.features;if(u&32&&s===RegExp)return fM(n,o);if(u&16)switch(s){case BigInt64Array:case BigUint64Array:return gD(e,t,n,o)}if(u&1&&typeof AggregateError<"u"&&(s===AggregateError||o instanceof AggregateError))return vD(e,t,n,o);if(o instanceof Error)return Px(e,t,n,o);if(ho in o||fo in o)return hm(e,t,n,o,!!s);throw new Wd(o)}async function CD(e,t,n){let o=Fg(e.base,n);if(o.type!==0)return o.value;let s=await oT(e,t,o.value,n);if(s)return s;throw new Wd(n)}async function $t(e,t,n){switch(typeof n){case"boolean":return n?ZE:GE;case"undefined":return Kk;case"string":return WE(n);case"number":return lM(n);case"bigint":return cM(n);case"object":{if(n){let o=Fg(e.base,n);return o.type===0?await TD(e,t+1,o.value,n):o.value}return Xk}case"symbol":return Pi(e.base,n);case"function":return CD(e,t,n);default:throw new Wd(n)}}async function AD(e,t){try{return await $t(e,0,t)}catch(n){throw n instanceof zx?n:new zx(n)}}var RD=(e=>(e[e.Vanilla=1]="Vanilla",e[e.Cross=2]="Cross",e))(RD||{});function iT(e,t){for(let n=0,o=t.length;n<o;n++){let s=t[n];e.has(s)||(e.add(s),s.extends&&iT(e,s.extends))}}function sT(e){if(e){let t=new Set;return iT(t,e),[...t]}}function ND(e){switch(e){case"Int8Array":return Int8Array;case"Int16Array":return Int16Array;case"Int32Array":return Int32Array;case"Uint8Array":return Uint8Array;case"Uint16Array":return Uint16Array;case"Uint32Array":return Uint32Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new PM(e)}}var ID=1e6,OD=1e4,kD=2e4;function aT(e,t){switch(t){case 3:return Object.freeze(e);case 1:return Object.preventExtensions(e);case 2:return Object.seal(e);default:return e}}var MD=1e3;function DD(e,t){var n;return{mode:e,plugins:t.plugins,refs:t.refs||new Map,features:(n=t.features)!=null?n:63^(t.disabledFeatures||0),depthLimit:t.depthLimit||MD}}function jD(e){return{mode:2,base:DD(2,e),child:D}}var LD=class{constructor(e,t){this._p=e,this.depth=t}deserialize(e){return it(this._p,this.depth,e)}};function lT(e,t){if(t<0||!Number.isFinite(t)||!Number.isInteger(t))throw new si({t:4,i:t});if(e.refs.has(t))throw new Error("Conflicted ref id: "+t)}function zD(e,t,n){return lT(e.base,t),e.state.marked.has(t)&&e.base.refs.set(t,n),n}function PD(e,t,n){return lT(e.base,t),e.base.refs.set(t,n),n}function Ft(e,t,n){return e.mode===1?zD(e,t,n):PD(e,t,n)}function tg(e,t,n){if(Object.hasOwn(t,n))return t[n];throw new si(e)}function $D(e,t){return Ft(e,t.i,sM(Wi(t.s)))}function FD(e,t,n){let o=n.a,s=o.length,c=Ft(e,n.i,new Array(s));for(let u=0,f;u<s;u++)f=o[u],f&&(c[u]=it(e,t,f));return aT(c,n.o),c}function BD(e){switch(e){case"constructor":case"__proto__":case"prototype":case"__defineGetter__":case"__defineSetter__":case"__lookupGetter__":case"__lookupSetter__":return!1;default:return!0}}function qD(e){switch(e){case fo:case oa:case ia:case ho:return!0;default:return!1}}function $x(e,t,n){BD(t)?e[t]=n:Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function UD(e,t,n,o,s){if(typeof o=="string")$x(n,o,it(e,t,s));else{let c=it(e,t,o);switch(typeof c){case"string":$x(n,c,it(e,t,s));break;case"symbol":qD(c)&&(n[c]=it(e,t,s));break;default:throw new si(o)}}}function cT(e,t,n,o){let s=n.k;if(s.length>0)for(let c=0,u=n.v,f=s.length;c<f;c++)UD(e,t,o,s[c],u[c]);return o}function VD(e,t,n){let o=Ft(e,n.i,n.t===10?{}:Object.create(null));return cT(e,t,n.p,o),aT(o,n.o),o}function HD(e,t){return Ft(e,t.i,new Date(t.s))}function QD(e,t){if(e.base.features&32){let n=Wi(t.c);if(n.length>kD)throw new si(t);return Ft(e,t.i,new RegExp(n,t.m))}throw new tT(t)}function ZD(e,t,n){let o=Ft(e,n.i,new Set);for(let s=0,c=n.a,u=c.length;s<u;s++)o.add(it(e,t,c[s]));return o}function GD(e,t,n){let o=Ft(e,n.i,new Map);for(let s=0,c=n.e.k,u=n.e.v,f=c.length;s<f;s++)o.set(it(e,t,c[s]),it(e,t,u[s]));return o}function YD(e,t){if(t.s.length>ID)throw new si(t);return Ft(e,t.i,nT(Wi(t.s)))}function KD(e,t,n){var o;let s=ND(n.c),c=it(e,t,n.f),u=(o=n.b)!=null?o:0;if(u<0||u>c.byteLength)throw new si(n);return Ft(e,n.i,new s(c,u,n.l))}function XD(e,t,n){var o;let s=it(e,t,n.f),c=(o=n.b)!=null?o:0;if(c<0||c>s.byteLength)throw new si(n);return Ft(e,n.i,new DataView(s,c,n.l))}function uT(e,t,n,o){if(n.p){let s=cT(e,t,n.p,{});Object.defineProperties(o,Object.getOwnPropertyDescriptors(s))}return o}function JD(e,t,n){let o=Ft(e,n.i,new AggregateError([],Wi(n.m)));return uT(e,t,n,o)}function WD(e,t,n){let o=tg(n,Yk,n.s),s=Ft(e,n.i,new o(Wi(n.m)));return uT(e,t,n,s)}function ej(e,t,n){let o=ef(),s=Ft(e,n.i,o.p),c=it(e,t,n.f);return n.s?o.s(c):o.f(c),s}function tj(e,t,n){return Ft(e,n.i,Object(it(e,t,n.f)))}function nj(e,t,n){let o=e.base.plugins;if(o){let s=Wi(n.c);for(let c=0,u=o.length;c<u;c++){let f=o[c];if(f.tag===s)return Ft(e,n.i,f.deserialize(n.s,new LD(e,t),{id:n.i}))}}throw new jM(n.c)}function rj(e,t){return Ft(e,t.i,Ft(e,t.s,ef()).p)}function oj(e,t,n){let o=e.base.refs.get(n.i);if(o)return o.s(it(e,t,n.a[1])),D;throw new dc("Promise")}function ij(e,t,n){let o=e.base.refs.get(n.i);if(o)return o.f(it(e,t,n.a[1])),D;throw new dc("Promise")}function sj(e,t,n){it(e,t,n.a[0]);let o=it(e,t,n.a[1]);return YM(o)}function aj(e,t,n){it(e,t,n.a[0]);let o=it(e,t,n.a[1]);return tD(o)}function lj(e,t,n){let o=Ft(e,n.i,es()),s=n.a,c=s.length;if(c)for(let u=0;u<c;u++)it(e,t,s[u]);return o}function cj(e,t,n){let o=e.base.refs.get(n.i);if(o&&tf(o))return o.next(it(e,t,n.f)),D;throw new dc("Stream")}function uj(e,t,n){let o=e.base.refs.get(n.i);if(o&&tf(o))return o.throw(it(e,t,n.f)),D;throw new dc("Stream")}function dj(e,t,n){let o=e.base.refs.get(n.i);if(o&&tf(o))return o.return(it(e,t,n.f)),D;throw new dc("Stream")}function fj(e,t,n){return it(e,t,n.f),D}function hj(e,t,n){return it(e,t,n.a[1]),D}function pj(e,t,n){let o=Ft(e,n.i,rT([],n.s,n.l));for(let s=0,c=n.a.length;s<c;s++)o.v[s]=it(e,t,n.a[s]);return o}function it(e,t,n){if(t>e.base.depthLimit)throw new $M(e.base.depthLimit);switch(t+=1,n.t){case 2:return tg(n,Zk,n.s);case 0:return Number(n.s);case 1:return Wi(String(n.s));case 3:if(String(n.s).length>OD)throw new si(n);return BigInt(n.s);case 4:return e.base.refs.get(n.i);case 18:return $D(e,n);case 9:return FD(e,t,n);case 10:case 11:return VD(e,t,n);case 5:return HD(e,n);case 6:return QD(e,n);case 7:return ZD(e,t,n);case 8:return GD(e,t,n);case 19:return YD(e,n);case 16:case 15:return KD(e,t,n);case 20:return XD(e,t,n);case 14:return JD(e,t,n);case 13:return WD(e,t,n);case 12:return ej(e,t,n);case 17:return tg(n,Qk,n.s);case 21:return tj(e,t,n);case 25:return nj(e,t,n);case 22:return rj(e,n);case 23:return oj(e,t,n);case 24:return ij(e,t,n);case 28:return sj(e,t,n);case 30:return aj(e,t,n);case 31:return lj(e,t,n);case 32:return cj(e,t,n);case 33:return uj(e,t,n);case 34:return dj(e,t,n);case 27:return fj(e,t,n);case 29:return hj(e,t,n);case 35:return pj(e,t,n);default:throw new tT(n)}}function mj(e,t){try{return it(e,0,t)}catch(n){throw new DM(n)}}var gj=()=>T;gj.toString();function pm(e,t){let n=sT(t.plugins),o=jD({plugins:n,refs:t.refs,features:t.features,disabledFeatures:t.disabledFeatures});return mj(o,e)}async function yj(e,t={}){let n=sT(t.plugins),o=uD(1,{plugins:n,disabledFeatures:t.disabledFeatures});return{t:await AD(o,e),f:o.base.features,m:Array.from(o.base.marked)}}function vj(e){return{tag:"$TSR/t/"+e.key,test:e.test,parse:{sync(t,n){return n.parse(e.toSerializable(t))},async async(t,n){return await n.parse(e.toSerializable(t))},stream(t,n){return n.parse(e.toSerializable(t))}},serialize:void 0,deserialize(t,n){return e.fromSerializable(n.deserialize(t))}}}var Qo={},dT=e=>new ReadableStream({start:t=>{e.on({next:n=>{try{t.enqueue(n)}catch{}},throw:n=>{t.error(n)},return:()=>{try{t.close()}catch{}}})}}),bj={tag:"seroval-plugins/web/ReadableStreamFactory",test(e){return e===Qo},parse:{sync(){return Qo},async async(){return await Promise.resolve(Qo)},stream(){return Qo}},serialize(){return dT.toString()},deserialize(){return Qo}};function Fx(e){let t=es(),n=e.getReader();async function o(){try{let s=await n.read();s.done?t.return(s.value):(t.next(s.value),await o())}catch(s){t.throw(s)}}return o().catch(()=>{}),t}var wj={tag:"seroval/plugins/web/ReadableStream",extends:[bj],test(e){return typeof ReadableStream>"u"?!1:e instanceof ReadableStream},parse:{sync(e,t){return{factory:t.parse(Qo),stream:t.parse(es())}},async async(e,t){return{factory:await t.parse(Qo),stream:await t.parse(Fx(e))}},stream(e,t){return{factory:t.parse(Qo),stream:t.parse(Fx(e))}}},serialize(e,t){return"("+t.serialize(e.factory)+")("+t.serialize(e.stream)+")"},deserialize(e,t){let n=t.deserialize(e.stream);return dT(n)}},xj=wj;const Sj={tag:"$TSR/Error",test(e){return e instanceof Error},parse:{sync(e,t){return{message:t.parse(e.message)}},async async(e,t){return{message:await t.parse(e.message)}},stream(e,t){return{message:t.parse(e.message)}}},serialize(e,t){return"new Error("+t.serialize(e.message)+")"},deserialize(e,t){return new Error(t.deserialize(e.message))}};class _j{constructor(t,n){this.stream=t,this.hint=n?.hint??"binary"}}const Cd=globalThis.Buffer,fT=!!Cd&&typeof Cd.from=="function";function hT(e){if(e.length===0)return"";if(fT)return Cd.from(e).toString("base64");const t=32768,n=[];for(let o=0;o<e.length;o+=t){const s=e.subarray(o,o+t);n.push(String.fromCharCode.apply(null,s))}return btoa(n.join(""))}function pT(e){if(e.length===0)return new Uint8Array(0);if(fT){const o=Cd.from(e,"base64");return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}const Bl=Object.create(null),ql=Object.create(null),Ej=e=>new ReadableStream({start(t){e.on({next(n){try{t.enqueue(pT(n))}catch{}},throw(n){t.error(n)},return(){try{t.close()}catch{}}})}}),Tj=new TextEncoder,Cj=e=>new ReadableStream({start(t){e.on({next(n){try{typeof n=="string"?t.enqueue(Tj.encode(n)):t.enqueue(pT(n.$b64))}catch{}},throw(n){t.error(n)},return(){try{t.close()}catch{}}})}}),Aj="(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}catch(_){}},throw(e){c.error(e)},return(){try{c.close()}catch(_){}}})}}))",Rj="(s=>{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}}catch(_){}},throw(x){c.error(x)},return(){try{c.close()}catch(_){}}})}})})";function Bx(e){const t=es(),n=e.getReader();return(async()=>{try{for(;;){const{done:o,value:s}=await n.read();if(o){t.return(void 0);break}t.next(hT(s))}}catch(o){t.throw(o)}finally{n.releaseLock()}})(),t}function qx(e){const t=es(),n=e.getReader(),o=new TextDecoder("utf-8",{fatal:!0});return(async()=>{try{for(;;){const{done:s,value:c}=await n.read();if(s){try{const u=o.decode();u.length>0&&t.next(u)}catch{}t.return(void 0);break}try{const u=o.decode(c,{stream:!0});u.length>0&&t.next(u)}catch{t.next({$b64:hT(c)})}}}catch(s){t.throw(s)}finally{n.releaseLock()}})(),t}const Nj={tag:"tss/RawStreamFactory",test(e){return e===Bl},parse:{sync(){},async(){return Promise.resolve(void 0)},stream(){}},serialize(){return Aj},deserialize(){return Bl}},Ij={tag:"tss/RawStreamFactoryText",test(e){return e===ql},parse:{sync(){},async(){return Promise.resolve(void 0)},stream(){}},serialize(){return Rj},deserialize(){return ql}},Oj={tag:"tss/RawStream",extends:[Nj,Ij],test(e){return e instanceof _j},parse:{sync(e,t){const n=e.hint==="text"?ql:Bl;return{hint:e.hint,factory:t.parse(n),stream:t.parse(es())}},async async(e,t){const n=e.hint==="text"?ql:Bl,o=e.hint==="text"?qx(e.stream):Bx(e.stream);return{hint:e.hint,factory:await t.parse(n),stream:await t.parse(o)}},stream(e,t){const n=e.hint==="text"?ql:Bl,o=e.hint==="text"?qx(e.stream):Bx(e.stream);return{hint:e.hint,factory:t.parse(n),stream:t.parse(o)}}},serialize(e,t){return"("+t.serialize(e.factory)+")("+t.serialize(e.stream)+")"},deserialize(e,t){const n=t.deserialize(e.stream);return e.hint==="text"?Cj(n):Ej(n)}};function kj(e){return{tag:"tss/RawStream",test:()=>!1,parse:{},serialize(){throw new Error("RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.")},deserialize(t){return e(t.streamId)}}}const Mj=[Sj,Oj,xj],Dj="use",Ad=Kd[Dj],Gu=typeof window<"u"?_.useLayoutEffect:_.useEffect;function mm(e){const t=_.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function jj(e,t,n={},o={}){_.useEffect(()=>{if(!e.current||o.disabled||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([c])=>{t(c)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,n,o.disabled,e])}function Lj(e){const t=_.useRef(null);return _.useImperativeHandle(e,()=>t.current,[]),t}function zj({promise:e}){if(Ad)return Ad(e);const t=qk(e);if(t[Nr].status==="pending")throw t;if(t[Nr].status==="error")throw t[Nr].error;return t[Nr].data}function Pj(e){const t=w.jsx($j,{...e});return e.fallback?w.jsx(_.Suspense,{fallback:e.fallback,children:t}):t}function $j(e){const t=zj(e);return e.children(t)}function qg(e){const t=e.errorComponent??Ug;return w.jsx(Fj,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:o})=>n?_.createElement(t,{error:n,reset:o}):e.children})}class Fj extends _.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function Ug({error:e}){const[t,n]=_.useState(!1);return w.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[w.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[w.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),w.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(o=>!o),children:t?"Hide Error":"Show Error"})]}),w.jsx("div",{style:{height:".25rem"}}),t?w.jsx("div",{children:w.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?w.jsx("code",{children:e.message}):null})}):null]})}function Bj({children:e,fallback:t=null}){return mT()?w.jsx(sn.Fragment,{children:e}):w.jsx(sn.Fragment,{children:t})}function mT(){return sn.useSyncExternalStore(qj,()=>!0,()=>!1)}function qj(){return()=>{}}var gm={exports:{}},ym={},vm={exports:{}},bm={};var Ux;function Uj(){if(Ux)return bm;Ux=1;var e=uc();function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,s=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(g,b){var x=b(),C=o({inst:{value:x,getSnapshot:b}}),S=C[0].inst,A=C[1];return c(function(){S.value=x,S.getSnapshot=b,h(S)&&A({inst:S})},[g,x,b]),s(function(){return h(S)&&A({inst:S}),g(function(){h(S)&&A({inst:S})})},[g]),u(x),x}function h(g){var b=g.getSnapshot;g=g.value;try{var x=b();return!n(g,x)}catch{return!0}}function p(g,b){return b()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:f;return bm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,bm}var Vx;function gT(){return Vx||(Vx=1,vm.exports=Uj()),vm.exports}var Hx;function Vj(){if(Hx)return ym;Hx=1;var e=uc(),t=gT();function n(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var o=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,f=e.useMemo,h=e.useDebugValue;return ym.useSyncExternalStoreWithSelector=function(p,y,g,b,x){var C=c(null);if(C.current===null){var S={hasValue:!1,value:null};C.current=S}else S=C.current;C=f(function(){function I(B){if(!k){if(k=!0,R=B,B=b(B),x!==void 0&&S.hasValue){var P=S.value;if(x(P,B))return N=P}return N=B}if(P=N,o(R,B))return P;var M=b(B);return x!==void 0&&x(P,M)?(R=B,P):(R=B,N=M)}var k=!1,R,N,j=g===void 0?null:g;return[function(){return I(y())},j===null?void 0:function(){return I(j())}]},[y,g,b,x]);var A=s(p,C[0],C[1]);return u(function(){S.hasValue=!0,S.value=A},[A]),h(A),A},ym}var Qx;function Hj(){return Qx||(Qx=1,gm.exports=Vj()),gm.exports}var Qj=Hj();function Zj(e,t=o=>o,n={}){const o=n.equal??Gj;return Qj.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,o)}function Gj(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,s]of e)if(!t.has(o)||!Object.is(s,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=Zx(e);if(n.length!==Zx(t).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(t,n[o])||!Object.is(e[n[o]],t[n[o]]))return!1;return!0}function Zx(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const wm=_.createContext(null);function yT(){return typeof document>"u"?wm:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=wm,wm)}function an(e){const t=_.useContext(yT());return e?.warn,t}function Tt(e){const t=an({warn:e?.router===void 0}),n=e?.router||t,o=_.useRef(void 0);return Zj(n.__store,s=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const c=En(o.current,e.select(s));return o.current=c,c}return e.select(s)}return s})}const of=_.createContext(void 0),Yj=_.createContext(void 0);function Dr(e){const t=_.useContext(e.from?Yj:of);return Tt({select:o=>{const s=o.matches.find(c=>e.from?e.from===c.routeId:c.id===t);if(An(!((e.shouldThrow??!0)&&!s),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),s!==void 0)return e.select?e.select(s):s},structuralSharing:e.structuralSharing})}function Vg(e){return Dr({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Hg(e){const{select:t,...n}=e;return Dr({...n,select:o=>t?t(o.loaderDeps):o.loaderDeps})}function Qg(e){return Dr({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Zg(e){return Dr({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function sf(e){const t=an();return _.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var ba=yE();const Kj=gE(ba);function Xj(e,t){const n=an(),o=Lj(t),{activeProps:s,inactiveProps:c,activeOptions:u,to:f,preload:h,preloadDelay:p,hashScrollIntoView:y,replace:g,startTransition:b,resetScroll:x,viewTransition:C,children:S,target:A,disabled:I,style:k,className:R,onClick:N,onFocus:j,onMouseEnter:B,onMouseLeave:P,onTouchStart:M,ignoreBlocker:U,params:ee,search:ae,hash:re,state:ue,mask:ce,reloadDocument:he,unsafeRelative:F,from:X,_fromLocation:Z,...oe}=e,be=mT(),z=Tt({select:at=>at.location.search,structuralSharing:!0}),Y=e.from,ie=_.useMemo(()=>({...e,from:Y}),[n,z,Y,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),se=_.useMemo(()=>n.buildLocation({...ie}),[n,ie]),de=se.maskedLocation?se.maskedLocation.publicHref:se.publicHref,ve=se.maskedLocation?se.maskedLocation.external:se.external,J=_.useMemo(()=>rL(de,ve,n.history,I),[I,ve,de,n.history]),_e=_.useMemo(()=>{if(J?.external)return xd(J.href)?void 0:J.href;if(!oL(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),xd(f)?void 0:f}catch{}},[f,J]),Te=Tt({select:at=>{if(_e)return!1;if(u?.exact){if(!dk(at.location.pathname,se.pathname,n.basepath))return!1}else{const Ht=_d(at.location.pathname,n.basepath),nn=_d(se.pathname,n.basepath);if(!(Ht.startsWith(nn)&&(Ht.length===nn.length||Ht[nn.length]==="/")))return!1}return(u?.includeSearch??!0)&&!Bi(at.location.search,se.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?be&&at.location.hash===se.hash:!0}}),Ce=Te?Zo(s,{})??Jj:xm,Ie=Te?xm:Zo(c,{})??xm,je=[R,Ce.className,Ie.className].filter(Boolean).join(" "),gt=(k||Ce.style||Ie.style)&&{...k,...Ce.style,...Ie.style},[Lt,In]=_.useState(!1),Hn=_.useRef(!1),tn=e.reloadDocument||_e?!1:h??n.options.defaultPreload,Ct=p??n.options.defaultPreloadDelay??0,le=_.useCallback(()=>{n.preloadRoute({...ie}).catch(at=>{console.warn(at),console.warn(Uk)})},[n,ie]),Oe=_.useCallback(at=>{at?.isIntersecting&&le()},[le]);jj(o,Oe,nL,{disabled:!!I||tn!=="viewport"}),_.useEffect(()=>{Hn.current||!I&&tn==="render"&&(le(),Hn.current=!0)},[I,le,tn]);const qe=at=>{const Ht=at.currentTarget.getAttribute("target"),nn=A!==void 0?A:Ht;if(!I&&!iL(at)&&!at.defaultPrevented&&(!nn||nn==="_self")&&at.button===0){at.preventDefault(),ba.flushSync(()=>{In(!0)});const Rc=n.subscribe("onResolved",()=>{Rc(),In(!1)});n.navigate({...ie,replace:g,resetScroll:x,hashScrollIntoView:y,startTransition:b,viewTransition:C,ignoreBlocker:U})}};if(_e)return{...oe,ref:o,href:_e,...S&&{children:S},...A&&{target:A},...I&&{disabled:I},...k&&{style:k},...R&&{className:R},...N&&{onClick:N},...j&&{onFocus:j},...B&&{onMouseEnter:B},...P&&{onMouseLeave:P},...M&&{onTouchStart:M}};const Le=at=>{I||tn&&le()},Vt=Le,cn=at=>{if(!(I||!tn))if(!Ct)le();else{const Ht=at.target;if(Il.has(Ht))return;const nn=setTimeout(()=>{Il.delete(Ht),le()},Ct);Il.set(Ht,nn)}},Bf=at=>{if(I||!tn||!Ct)return;const Ht=at.target,nn=Il.get(Ht);nn&&(clearTimeout(nn),Il.delete(Ht))};return{...oe,...Ce,...Ie,href:J?.href,ref:o,onClick:Ol([N,qe]),onFocus:Ol([j,Le]),onMouseEnter:Ol([B,cn]),onMouseLeave:Ol([P,Bf]),onTouchStart:Ol([M,Vt]),disabled:!!I,target:A,...gt&&{style:gt},...je&&{className:je},...I&&Wj,...Te&&eL,...be&&Lt&&tL}}const xm={},Jj={className:"active"},Wj={role:"link","aria-disabled":!0},eL={"data-status":"active","aria-current":"page"},tL={"data-transitioning":"transitioning"},Il=new WeakMap,nL={rootMargin:"100px"},Ol=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function rL(e,t,n,o){if(!o)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function oL(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const $i=_.forwardRef((e,t)=>{const{_asChild:n,...o}=e,{type:s,...c}=Xj(o,t),u=typeof o.children=="function"?o.children({isActive:c["data-status"]==="active"}):o.children;if(!n){const{disabled:f,...h}=c;return _.createElement("a",h,u)}return _.createElement(n,c,u)});function iL(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}let sL=class extends LE{constructor(t){super(t),this.useMatch=n=>Dr({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Dr({...n,from:this.id,select:o=>n?.select?n.select(o.context):o.context}),this.useSearch=n=>Zg({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>Qg({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Hg({...n,from:this.id}),this.useLoaderData=n=>Vg({...n,from:this.id}),this.useNavigate=()=>sf({from:this.fullPath}),this.Link=sn.forwardRef((n,o)=>w.jsx($i,{ref:o,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}};function aL(e){return new sL(e)}class lL extends Vk{constructor(t){super(t),this.useMatch=n=>Dr({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Dr({...n,from:this.id,select:o=>n?.select?n.select(o.context):o.context}),this.useSearch=n=>Zg({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>Qg({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Hg({...n,from:this.id}),this.useLoaderData=n=>Vg({...n,from:this.id}),this.useNavigate=()=>sf({from:this.fullPath}),this.Link=sn.forwardRef((n,o)=>w.jsx($i,{ref:o,from:this.fullPath,...n})),this.$$typeof=Symbol.for("react.memo")}}function cL(e){return new lL(e)}function lr(e){return typeof e=="object"?new Gx(e,{silent:!0}).createRoute(e):new Gx(e,{silent:!0}).createRoute}class Gx{constructor(t,n){this.path=t,this.createRoute=o=>{this.silent;const s=aL(o);return s.isRoot=!1,s},this.silent=n?.silent}}class Yx{constructor(t){this.useMatch=n=>Dr({select:n?.select,from:this.options.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Dr({from:this.options.id,select:o=>n?.select?n.select(o.context):o.context}),this.useSearch=n=>Zg({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useParams=n=>Qg({select:n?.select,structuralSharing:n?.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>Hg({...n,from:this.options.id}),this.useLoaderData=n=>Vg({...n,from:this.options.id}),this.useNavigate=()=>{const n=an();return sf({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function Kx(e){return typeof e=="object"?new Yx(e):t=>new Yx({id:e,...t})}function Lr(e,t){let n,o,s,c;const u=()=>(n||(n=e().then(h=>{n=void 0,o=h[t]}).catch(h=>{if(s=h,G2(s)&&s instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const p=`tanstack_router_reload:${s.message}`;sessionStorage.getItem(p)||(sessionStorage.setItem(p,"1"),c=!0)}})),n),f=function(p){if(c)throw window.location.reload(),new Promise(()=>{});if(s)throw s;if(!o)if(Ad)Ad(u());else throw u();return _.createElement(o,p)};return f.preload=u,f}function uL(){const e=an(),t=_.useRef({router:e,mounted:!1}),[n,o]=_.useState(!1),{hasPendingMatches:s,isLoading:c}=Tt({select:g=>({isLoading:g.isLoading,hasPendingMatches:g.matches.some(b=>b.status==="pending")}),structuralSharing:!0}),u=mm(c),f=c||n||s,h=mm(f),p=c||s,y=mm(p);return e.startTransition=g=>{o(!0),_.startTransition(()=>{g(),o(!1)})},_.useEffect(()=>{const g=e.history.subscribe(e.load),b=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return co(e.latestLocation.publicHref)!==co(b.publicHref)&&e.commitLocation({...b,replace:!0}),()=>{g()}},[e,e.history]),Gu(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(b){console.error(b)}})()},[e]),Gu(()=>{u&&!c&&e.emit({type:"onLoad",...qi(e.state)})},[u,e,c]),Gu(()=>{y&&!p&&e.emit({type:"onBeforeRouteMount",...qi(e.state)})},[p,y,e]),Gu(()=>{if(h&&!f){const g=qi(e.state);e.emit({type:"onResolved",...g}),e.__store.setState(b=>({...b,status:"idle",resolvedLocation:b.location})),g.hrefChanged&&xk(e)}},[f,h,e]),null}function dL(e){const t=Tt({select:n=>`not-found-${n.location.pathname}-${n.status}`});return w.jsx(qg,{getResetKey:()=>t,onCatch:(n,o)=>{if(fn(n))e.onCatch?.(n,o);else throw n},errorComponent:({error:n})=>{if(fn(n))return e.fallback?.(n);throw n},children:e.children})}function fL(){return w.jsx("p",{children:"Not Found"})}function Ys(e){return w.jsx(w.Fragment,{children:e.children})}function vT(e,t,n){return t.options.notFoundComponent?w.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?w.jsx(e.options.defaultNotFoundComponent,{...n}):w.jsx(fL,{})}function hL(){return an().isScrollRestoring,null}const bT=_.memo(function({matchId:t}){const n=an(),o=Tt({select:S=>{const A=S.matches.findIndex(k=>k.id===t),I=S.matches[A];return An(I),{routeId:I.routeId,ssr:I.ssr,_displayPending:I._displayPending,resetKey:S.loadedAt,parentRouteId:S.matches[A-1]?.routeId}},structuralSharing:!0}),s=n.routesById[o.routeId],c=s.options.pendingComponent??n.options.defaultPendingComponent,u=c?w.jsx(c,{}):null,f=s.options.errorComponent??n.options.defaultErrorComponent,h=s.options.onCatch??n.options.defaultOnCatch,p=s.isRoot?s.options.notFoundComponent??n.options.notFoundRoute?.options.component:s.options.notFoundComponent,y=o.ssr===!1||o.ssr==="data-only",g=(!s.isRoot||s.options.wrapInSuspense||y)&&(s.options.wrapInSuspense??c??(s.options.errorComponent?.preload||y))?_.Suspense:Ys,b=f?qg:Ys,x=p?dL:Ys,C=s.isRoot?s.options.shellComponent??Ys:Ys;return w.jsxs(C,{children:[w.jsx(of.Provider,{value:t,children:w.jsx(g,{fallback:u,children:w.jsx(b,{getResetKey:()=>o.resetKey,errorComponent:f||Ug,onCatch:(S,A)=>{if(fn(S))throw S;h?.(S,A)},children:w.jsx(x,{fallback:S=>{if(!p||S.routeId&&S.routeId!==o.routeId||!S.routeId&&!s.isRoot)throw S;return _.createElement(p,S)},children:y||o._displayPending?w.jsx(Bj,{fallback:u,children:w.jsx(Xx,{matchId:t})}):w.jsx(Xx,{matchId:t})})})})}),o.parentRouteId===ir&&n.options.scrollRestoration?w.jsxs(w.Fragment,{children:[w.jsx(pL,{}),w.jsx(hL,{})]}):null]})});function pL(){const e=an(),t=_.useRef(void 0);return w.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...qi(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const Xx=_.memo(function({matchId:t}){const n=an(),{match:o,key:s,routeId:c}=Tt({select:h=>{const p=h.matches.find(C=>C.id===t),y=p.routeId,b=(n.routesById[y].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:y,loaderDeps:p.loaderDeps,params:p._strictParams,search:p._strictSearch});return{key:b?JSON.stringify(b):void 0,routeId:y,match:{id:p.id,status:p.status,error:p.error,invalid:p.invalid,_forcePending:p._forcePending,_displayPending:p._displayPending}}},structuralSharing:!0}),u=n.routesById[c],f=_.useMemo(()=>{const h=u.options.component??n.options.defaultComponent;return h?w.jsx(h,{},s):w.jsx(wT,{})},[s,u.options.component,n.options.defaultComponent]);if(o._displayPending)throw n.getMatch(o.id)?._nonReactive.displayPendingPromise;if(o._forcePending)throw n.getMatch(o.id)?._nonReactive.minPendingPromise;if(o.status==="pending"){const h=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(h){const p=n.getMatch(o.id);if(p&&!p._nonReactive.minPendingPromise){const y=Vi();p._nonReactive.minPendingPromise=y,setTimeout(()=>{y.resolve(),p._nonReactive.minPendingPromise=void 0},h)}}throw n.getMatch(o.id)?._nonReactive.loadPromise}if(o.status==="notFound")return An(fn(o.error)),vT(n,u,o.error);if(o.status==="redirected")throw An(Bn(o.error)),n.getMatch(o.id)?._nonReactive.loadPromise;if(o.status==="error")throw o.error;return f}),wT=_.memo(function(){const t=an(),n=_.useContext(of),o=Tt({select:p=>p.matches.find(y=>y.id===n)?.routeId}),s=t.routesById[o],c=Tt({select:p=>{const g=p.matches.find(b=>b.id===n);return An(g),g.globalNotFound}}),u=Tt({select:p=>{const y=p.matches,g=y.findIndex(b=>b.id===n);return y[g+1]?.id}}),f=t.options.defaultPendingComponent?w.jsx(t.options.defaultPendingComponent,{}):null;if(c)return vT(t,s,void 0);if(!u)return null;const h=w.jsx(bT,{matchId:u});return o===ir?w.jsx(_.Suspense,{fallback:f,children:h}):h});function mL(){const e=an(),n=e.routesById[ir].options.pendingComponent??e.options.defaultPendingComponent,o=n?w.jsx(n,{}):null,s=typeof document<"u"&&e.ssr?Ys:_.Suspense,c=w.jsxs(s,{fallback:o,children:[w.jsx(uL,{}),w.jsx(gL,{})]});return e.options.InnerWrap?w.jsx(e.options.InnerWrap,{children:c}):c}function gL(){const e=an(),t=Tt({select:s=>s.matches[0]?.id}),n=Tt({select:s=>s.loadedAt}),o=t?w.jsx(bT,{matchId:t}):null;return w.jsx(of.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?o:w.jsx(qg,{getResetKey:()=>n,errorComponent:Ug,onCatch:s=>{s.message||s.toString()},children:o})})}const yL=e=>new vL(e);class vL extends jk{constructor(t){super(t)}}typeof globalThis<"u"?(globalThis.createFileRoute=lr,globalThis.createLazyFileRoute=Kx):typeof window<"u"&&(window.createFileRoute=lr,window.createLazyFileRoute=Kx);function bL({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const o=yT(),s=w.jsx(o.Provider,{value:e,children:t});return e.options.Wrap?w.jsx(e.options.Wrap,{children:s}):s}function wL({router:e,...t}){return w.jsx(bL,{router:e,...t,children:w.jsx(mL,{})})}function xT({tag:e,attrs:t,children:n,nonce:o}){switch(e){case"title":return w.jsx("title",{...t,suppressHydrationWarning:!0,children:n});case"meta":return w.jsx("meta",{...t,suppressHydrationWarning:!0});case"link":return w.jsx("link",{...t,nonce:o,suppressHydrationWarning:!0});case"style":return w.jsx("style",{...t,dangerouslySetInnerHTML:{__html:n},nonce:o});case"script":return w.jsx(xL,{attrs:t,children:n});default:return null}}function xL({attrs:e,children:t}){an(),_.useEffect(()=>{if(e?.src){const n=(()=>{try{const c=document.baseURI||window.location.href;return new URL(e.src,c).href}catch{return e.src}})();if(Array.from(document.querySelectorAll("script[src]")).find(c=>c.src===n))return;const s=document.createElement("script");for(const[c,u]of Object.entries(e))c!=="suppressHydrationWarning"&&u!==void 0&&u!==!1&&s.setAttribute(c,typeof u=="boolean"?"":String(u));return document.head.appendChild(s),()=>{s.parentNode&&s.parentNode.removeChild(s)}}if(typeof t=="string"){const n=typeof e?.type=="string"?e.type:"text/javascript",o=typeof e?.nonce=="string"?e.nonce:void 0;if(Array.from(document.querySelectorAll("script:not([src])")).find(u=>{if(!(u instanceof HTMLScriptElement))return!1;const f=u.getAttribute("type")??"text/javascript",h=u.getAttribute("nonce")??void 0;return u.textContent===t&&f===n&&h===o}))return;const c=document.createElement("script");if(c.textContent=t,e)for(const[u,f]of Object.entries(e))u!=="suppressHydrationWarning"&&f!==void 0&&f!==!1&&c.setAttribute(u,typeof f=="boolean"?"":String(f));return document.head.appendChild(c),()=>{c.parentNode&&c.parentNode.removeChild(c)}}},[e,t]);{const{src:n,...o}=e||{};return w.jsx("script",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:""},...o})}}const SL=()=>{const e=an(),t=e.options.ssr?.nonce,n=Tt({select:h=>h.matches.map(p=>p.meta).filter(Boolean)}),o=_.useMemo(()=>{const h=[],p={};let y;for(let g=n.length-1;g>=0;g--){const b=n[g];for(let x=b.length-1;x>=0;x--){const C=b[x];if(C)if(C.title)y||(y={tag:"title",children:C.title});else if("script:ld+json"in C)try{const S=JSON.stringify(C["script:ld+json"]);h.push({tag:"script",attrs:{type:"application/ld+json"},children:J2(S)})}catch{}else{const S=C.name??C.property;if(S){if(p[S])continue;p[S]=!0}h.push({tag:"meta",attrs:{...C,nonce:t}})}}}return y&&h.push(y),t&&h.push({tag:"meta",attrs:{property:"csp-nonce",content:t}}),h.reverse(),h},[n,t]),s=Tt({select:h=>{const p=h.matches.map(b=>b.links).filter(Boolean).flat(1).map(b=>({tag:"link",attrs:{...b,nonce:t}})),y=e.ssr?.manifest,g=h.matches.map(b=>y?.routes[b.routeId]?.assets??[]).filter(Boolean).flat(1).filter(b=>b.tag==="link").map(b=>({tag:"link",attrs:{...b.attrs,suppressHydrationWarning:!0,nonce:t}}));return[...p,...g]},structuralSharing:!0}),c=Tt({select:h=>{const p=[];return h.matches.map(y=>e.looseRoutesById[y.routeId]).forEach(y=>e.ssr?.manifest?.routes[y.id]?.preloads?.filter(Boolean).forEach(g=>{p.push({tag:"link",attrs:{rel:"modulepreload",href:g,nonce:t}})})),p},structuralSharing:!0}),u=Tt({select:h=>h.matches.map(p=>p.styles).flat(1).filter(Boolean).map(({children:p,...y})=>({tag:"style",attrs:{...y,nonce:t},children:p})),structuralSharing:!0}),f=Tt({select:h=>h.matches.map(p=>p.headScripts).flat(1).filter(Boolean).map(({children:p,...y})=>({tag:"script",attrs:{...y,nonce:t},children:p})),structuralSharing:!0});return _L([...o,...c,...s,...u,...f],h=>JSON.stringify(h))};function _L(e,t){const n=new Set;return e.filter(o=>{const s=t(o);return n.has(s)?!1:(n.add(s),!0)})}function EL(){const e=SL(),n=an().options.ssr?.nonce;return w.jsx(w.Fragment,{children:e.map(o=>_.createElement(xT,{...o,key:`tsr-meta-${JSON.stringify(o)}`,nonce:n}))})}const TL=()=>{const e=an(),t=e.options.ssr?.nonce,n=Tt({select:u=>{const f=[],h=e.ssr?.manifest;return h?(u.matches.map(p=>e.looseRoutesById[p.routeId]).forEach(p=>h.routes[p.id]?.assets?.filter(y=>y.tag==="script").forEach(y=>{f.push({tag:"script",attrs:{...y.attrs,nonce:t},children:y.children})})),f):[]},structuralSharing:!0}),{scripts:o}=Tt({select:u=>({scripts:u.matches.map(f=>f.scripts).flat(1).filter(Boolean).map(({children:f,...h})=>({tag:"script",attrs:{...h,suppressHydrationWarning:!0,nonce:t},children:f}))}),structuralSharing:!0});let s;e.serverSsr&&(s=e.serverSsr.takeBufferedScripts());const c=[...o,...n];return s&&c.unshift(s),w.jsx(w.Fragment,{children:c.map((u,f)=>_.createElement(xT,{...u,key:`tsr-scripts-${u.tag}-${f}`}))})};function ST(e){if(Array.isArray(e))return e.flatMap(y=>ST(y));if(typeof e!="string")return[];const t=[];let n=0,o,s,c,u,f;const h=()=>{for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length},p=()=>(s=e.charAt(n),s!=="="&&s!==";"&&s!==",");for(;n<e.length;){for(o=n,f=!1;h();)if(s=e.charAt(n),s===","){for(c=n,n+=1,h(),u=n;n<e.length&&p();)n+=1;n<e.length&&e.charAt(n)==="="?(f=!0,n=u,t.push(e.slice(o,c)),o=n):n=c+1}else n+=1;(!f||n>=e.length)&&t.push(e.slice(o))}return t}function CL(e){return e instanceof Headers?e:Array.isArray(e)?new Headers(e):typeof e=="object"?new Headers(e):null}function AL(...e){return e.reduce((t,n)=>{const o=CL(n);if(!o)return t;for(const[s,c]of o.entries())s==="set-cookie"?ST(c).forEach(f=>t.append("set-cookie",f)):t.set(s,c);return t},new Headers)}function RL(e,t){e.id=t.i,e.__beforeLoadContext=t.b,e.loaderData=t.l,e.status=t.s,e.ssr=t.ssr,e.updatedAt=t.u,e.error=t.e}async function NL(e){An(window.$_TSR);const t=e.options.serializationAdapters;if(t?.length){const S=new Map;t.forEach(A=>{S.set(A.key,A.fromSerializable)}),window.$_TSR.t=S,window.$_TSR.buffer.forEach(A=>A())}window.$_TSR.initialized=!0,An(window.$_TSR.router);const{manifest:n,dehydratedData:o,lastMatchId:s}=window.$_TSR.router;e.ssr={manifest:n};const u=document.querySelector('meta[property="csp-nonce"]')?.content;e.options.ssr={nonce:u};const f=e.matchRoutes(e.state.location),h=Promise.all(f.map(S=>{const A=e.looseRoutesById[S.routeId];return e.loadRouteChunk(A)}));function p(S){const I=e.looseRoutesById[S.routeId].options.pendingMinMs??e.options.defaultPendingMinMs;if(I){const k=Vi();S._nonReactive.minPendingPromise=k,S._forcePending=!0,setTimeout(()=>{k.resolve(),e.updateMatch(S.id,R=>(R._nonReactive.minPendingPromise=void 0,{...R,_forcePending:void 0}))},I)}}function y(S){const A=e.looseRoutesById[S.routeId];A&&(A.options.ssr=S.ssr)}let g;f.forEach(S=>{const A=window.$_TSR.router.matches.find(I=>I.i===S.id);if(!A){S._nonReactive.dehydrated=!1,S.ssr=!1,y(S);return}RL(S,A),y(S),S._nonReactive.dehydrated=S.ssr!==!1,(S.ssr==="data-only"||S.ssr===!1)&&g===void 0&&(g=S.index,p(S))}),e.__store.setState(S=>({...S,matches:f})),await e.options.hydrate?.(o),await Promise.all(e.state.matches.map(async S=>{try{const A=e.looseRoutesById[S.routeId],k=e.state.matches[S.index-1]?.context??e.options.context;if(A.options.context){const B={deps:S.loaderDeps,params:S.params,context:k??{},location:e.state.location,navigate:P=>e.navigate({...P,_fromLocation:e.state.location}),buildLocation:e.buildLocation,cause:S.cause,abortController:S.abortController,preload:!1,matches:f};S.__routeContext=A.options.context(B)??void 0}S.context={...k,...S.__routeContext,...S.__beforeLoadContext};const R={ssr:e.options.ssr,matches:e.state.matches,match:S,params:S.params,loaderData:S.loaderData},N=await A.options.head?.(R),j=await A.options.scripts?.(R);S.meta=N?.meta,S.links=N?.links,S.headScripts=N?.scripts,S.styles=N?.styles,S.scripts=j}catch(A){if(fn(A))S.error={isNotFound:!0},console.error(`NotFound error during hydration for routeId: ${S.routeId}`,A);else throw S.error=A,console.error(`Error during hydration for route ${S.routeId}:`,A),A}}));const b=f[f.length-1].id!==s;if(!f.some(S=>S.ssr===!1)&&!b)return f.forEach(S=>{S._nonReactive.dehydrated=void 0}),h;const C=Promise.resolve().then(()=>e.load()).catch(S=>{console.error("Error during router hydration:",S)});if(b){const S=f[1];An(S),p(S),S._displayPending=!0,S._nonReactive.displayPendingPromise=C,C.then(()=>{ta(()=>{e.__store.state.status==="pending"&&e.__store.setState(A=>({...A,status:"idle",resolvedLocation:A.location})),e.updateMatch(S.id,A=>({...A,_displayPending:void 0,displayPendingPromise:void 0}))})})}return h}const IL="__TSS_CONTEXT",ng=Symbol.for("TSS_SERVER_FUNCTION"),Jx=Symbol.for("TSS_SERVER_FUNCTION_FACTORY"),OL="x-tss-serialized",kL="x-tss-raw",_T="application/x-tss-framed",so={JSON:0,CHUNK:1,END:2,ERROR:3},Us=9,Wx=1,ML=/;\s*v=(\d+)/;function DL(e){const t=e.match(ML);return t?parseInt(t[1],10):void 0}function jL(e){const t=DL(e);if(t!==void 0&&t!==Wx)throw new Error(`Incompatible framed protocol version: server=${t}, client=${Wx}. Please ensure client and server are using compatible versions.`)}const Gg=()=>window.__TSS_START_OPTIONS__;function LL(){return[...Gg()?.serializationAdapters?.map(vj)??[],...Mj]}const eS=new TextDecoder,zL=new Uint8Array(0),tS=16*1024*1024,nS=32*1024*1024,rS=1024,oS=1e5;function PL(e){const t=new Map,n=new Map,o=new Set;let s=!1,c=null,u=0,f;const h=new ReadableStream({start(g){f=g},cancel(){s=!0;try{c?.cancel()}catch{}t.forEach(g=>{try{g.error(new Error("Framed response cancelled"))}catch{}}),t.clear(),n.clear(),o.clear()}});function p(g){const b=n.get(g);if(b)return b;if(o.has(g))return new ReadableStream({start(C){C.close()}});if(n.size>=rS)throw new Error(`Too many raw streams in framed response (max ${rS})`);const x=new ReadableStream({start(C){t.set(g,C)},cancel(){o.add(g),t.delete(g),n.delete(g)}});return n.set(g,x),x}function y(g){return p(g),t.get(g)}return(async()=>{const g=e.getReader();c=g;const b=[];let x=0;function C(){if(x<Us)return null;const A=b[0];if(A.length>=Us){const P=A[0],M=(A[1]<<24|A[2]<<16|A[3]<<8|A[4])>>>0,U=(A[5]<<24|A[6]<<16|A[7]<<8|A[8])>>>0;return{type:P,streamId:M,length:U}}const I=new Uint8Array(Us);let k=0,R=Us;for(let P=0;P<b.length&&R>0;P++){const M=b[P],U=Math.min(M.length,R);I.set(M.subarray(0,U),k),k+=U,R-=U}const N=I[0],j=(I[1]<<24|I[2]<<16|I[3]<<8|I[4])>>>0,B=(I[5]<<24|I[6]<<16|I[7]<<8|I[8])>>>0;return{type:N,streamId:j,length:B}}function S(A){if(A===0)return zL;const I=new Uint8Array(A);let k=0,R=A;for(;R>0&&b.length>0;){const N=b[0];if(!N)break;const j=Math.min(N.length,R);I.set(N.subarray(0,j),k),k+=j,R-=j,j===N.length?b.shift():b[0]=N.subarray(j)}return x-=A,I}try{for(;;){const{done:A,value:I}=await g.read();if(s||A)break;if(I){if(x+I.length>nS)throw new Error(`Framed response buffer exceeded ${nS} bytes`);for(b.push(I),x+=I.length;;){const k=C();if(!k)break;const{type:R,streamId:N,length:j}=k;if(R!==so.JSON&&R!==so.CHUNK&&R!==so.END&&R!==so.ERROR)throw new Error(`Unknown frame type: ${R}`);if(R===so.JSON){if(N!==0)throw new Error("Invalid JSON frame streamId (expected 0)")}else if(N===0)throw new Error("Invalid raw frame streamId (expected non-zero)");if(j>tS)throw new Error(`Frame payload too large: ${j} bytes (max ${tS})`);const B=Us+j;if(x<B)break;if(++u>oS)throw new Error(`Too many frames in framed response (max ${oS})`);S(Us);const P=S(j);switch(R){case so.JSON:{try{f.enqueue(eS.decode(P))}catch{}break}case so.CHUNK:{const M=y(N);M&&M.enqueue(P);break}case so.END:{const M=y(N);if(o.add(N),M){try{M.close()}catch{}t.delete(N)}break}case so.ERROR:{const M=y(N);if(o.add(N),M){const U=eS.decode(P);M.error(new Error(U)),t.delete(N)}break}}}}}if(x!==0)throw new Error("Incomplete frame at end of framed response");try{f.close()}catch{}t.forEach(A=>{try{A.close()}catch{}}),t.clear()}catch(A){try{f.error(A)}catch{}t.forEach(I=>{try{I.error(A)}catch{}}),t.clear()}finally{try{g.releaseLock()}catch{}c=null}})(),{getOrCreateStream:p,jsonChunks:h}}let sa=null;const $L=Object.prototype.hasOwnProperty;function ET(e){for(const t in e)if($L.call(e,t))return!0;return!1}async function FL(e,t,n){sa||(sa=LL());const s=t[0],c=s.fetch??n,u=s.data instanceof FormData?"formData":"payload",f=s.headers?new Headers(s.headers):new Headers;if(f.set("x-tsr-serverFn","true"),u==="payload"&&f.set("accept",`${_T}, application/x-ndjson, application/json`),s.method==="GET"){if(u==="formData")throw new Error("FormData is not supported with GET requests");const p=await TT(s);if(p!==void 0){const y=TE({payload:p});e.includes("?")?e+=`&${y}`:e+=`?${y}`}}let h;if(s.method==="POST"){const p=await BL(s);p?.contentType&&f.set("content-type",p.contentType),h=p?.body}return await qL(async()=>c(e,{method:s.method,headers:f,signal:s.signal,body:h}))}async function TT(e){let t=!1;const n={};if(e.data!==void 0&&(t=!0,n.data=e.data),e.context&&ET(e.context)&&(t=!0,n.context=e.context),t)return CT(n)}async function CT(e){return JSON.stringify(await Promise.resolve(yj(e,{plugins:sa})))}async function BL(e){if(e.data instanceof FormData){let n;return e.context&&ET(e.context)&&(n=await CT(e.context)),n!==void 0&&e.data.set(IL,n),{body:e.data}}const t=await TT(e);if(t)return{body:t,contentType:"application/json"}}async function qL(e){let t;try{t=await e()}catch(s){if(s instanceof Response)t=s;else throw console.log(s),s}if(t.headers.get(kL)==="true")return t;const n=t.headers.get("content-type");if(An(n),!!t.headers.get(OL)){let s;if(n.includes(_T)){if(jL(n),!t.body)throw new Error("No response body for framed response");const{getOrCreateStream:c,jsonChunks:u}=PL(t.body),h=[kj(c),...sa||[]],p=new Map;s=await VL({jsonStream:u,onMessage:y=>pm(y,{refs:p,plugins:h}),onError(y,g){console.error(y,g)}})}else if(n.includes("application/x-ndjson")){const c=new Map;s=await UL({response:t,onMessage:u=>pm(u,{refs:c,plugins:sa}),onError(u,f){console.error(u,f)}})}else if(n.includes("application/json")){const c=await t.json();s=pm(c,{plugins:sa})}if(An(s),s instanceof Error)throw s;return s}if(n.includes("application/json")){const s=await t.json(),c=AE(s);if(c)throw c;if(fn(s))throw s;return s}if(!t.ok)throw new Error(await t.text());return t}async function UL({response:e,onMessage:t,onError:n}){if(!e.body)throw new Error("No response body");const o=e.body.pipeThrough(new TextDecoderStream).getReader();let s="",c=!1,u;for(;!c;){const{value:f,done:h}=await o.read();if(f&&(s+=f),s.length===0&&h)throw new Error("Stream ended before first object");if(s.endsWith(`
13
+ `)){const p=s.split(`
14
+ `).filter(Boolean),y=p[0];if(!y)throw new Error("No JSON line in the first chunk");u=JSON.parse(y),c=!0,s=p.slice(1).join(`
15
+ `)}else{const p=s.indexOf(`
16
+ `);if(p>=0){const y=s.slice(0,p).trim();s=s.slice(p+1),y.length>0&&(u=JSON.parse(y),c=!0)}}}return(async()=>{try{for(;;){const{value:f,done:h}=await o.read();f&&(s+=f);const p=s.lastIndexOf(`
17
+ `);if(p>=0){const y=s.slice(0,p);s=s.slice(p+1);const g=y.split(`
18
+ `).filter(Boolean);for(const b of g)try{t(JSON.parse(b))}catch(x){n?.(`Invalid JSON line: ${b}`,x)}}if(h)break}}catch(f){n?.("Stream processing error:",f)}})(),t(u)}async function VL({jsonStream:e,onMessage:t,onError:n}){const o=e.getReader(),{value:s,done:c}=await o.read();if(c||!s)throw new Error("Stream ended before first object");const u=JSON.parse(s);return(async()=>{try{for(;;){const{value:f,done:h}=await o.read();if(h)break;if(f)try{t(JSON.parse(f))}catch(p){n?.(`Invalid JSON: ${f}`,p)}}}catch(f){n?.("Stream processing error:",f)}})(),t(u)}function AT(e){const t="/_serverFn/"+e;return Object.assign((...s)=>{const c=Gg()?.serverFns?.fetch;return FL(t,s,c??fetch)},{url:t,serverFnMeta:{id:e},[ng]:!0})}const HL={key:"$TSS/serverfn",test:e=>typeof e!="function"||!(ng in e)?!1:!!e[ng],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>AT(e)};var Ir=[],or=[],QL=Uint8Array,Sm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Vs=0,ZL=Sm.length;Vs<ZL;++Vs)Ir[Vs]=Sm[Vs],or[Sm.charCodeAt(Vs)]=Vs;or[45]=62;or[95]=63;function GL(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var o=n===t?0:4-n%4;return[n,o]}function YL(e,t,n){return(t+n)*3/4-n}function Xl(e){var t,n=GL(e),o=n[0],s=n[1],c=new QL(YL(e,o,s)),u=0,f=s>0?o-4:o,h;for(h=0;h<f;h+=4)t=or[e.charCodeAt(h)]<<18|or[e.charCodeAt(h+1)]<<12|or[e.charCodeAt(h+2)]<<6|or[e.charCodeAt(h+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return s===2&&(t=or[e.charCodeAt(h)]<<2|or[e.charCodeAt(h+1)]>>4,c[u++]=t&255),s===1&&(t=or[e.charCodeAt(h)]<<10|or[e.charCodeAt(h+1)]<<4|or[e.charCodeAt(h+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function KL(e){return Ir[e>>18&63]+Ir[e>>12&63]+Ir[e>>6&63]+Ir[e&63]}function XL(e,t,n){for(var o,s=[],c=t;c<n;c+=3)o=(e[c]<<16&16711680)+(e[c+1]<<8&65280)+(e[c+2]&255),s.push(KL(o));return s.join("")}function Jl(e){for(var t,n=e.length,o=n%3,s=[],c=16383,u=0,f=n-o;u<f;u+=c)s.push(XL(e,u,u+c>f?f:u+c));return o===1?(t=e[n-1],s.push(Ir[t>>2]+Ir[t<<4&63]+"==")):o===2&&(t=(e[n-2]<<8)+e[n-1],s.push(Ir[t>>10]+Ir[t>>4&63]+Ir[t<<2&63]+"=")),s.join("")}function sr(e){if(e===void 0)return{};if(!RT(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function JL(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function RT(e){const t=typeof e=="object",n=Object.getPrototypeOf(e),o=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&o}const NT=!0,ha=BigInt("-9223372036854775808"),Yg=BigInt("9223372036854775807"),rg=BigInt("0"),WL=BigInt("8"),ez=BigInt("256");function IT(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function tz(e){e<rg&&(e-=ha+ha);let t=e.toString(16);t.length%2===1&&(t="0"+t);const n=new Uint8Array(new ArrayBuffer(8));let o=0;for(const s of t.match(/.{2}/g).reverse())n.set([parseInt(s,16)],o++),e>>=WL;return Jl(n)}function nz(e){const t=Xl(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=rg,o=rg;for(const s of t)n+=BigInt(s)*ez**o,o++;return n>Yg&&(n+=ha+ha),n}function rz(e){if(e<ha||Yg<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Jl(new Uint8Array(t))}function oz(e){const t=Xl(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}const iz=DataView.prototype.setBigInt64?rz:tz,sz=DataView.prototype.getBigInt64?oz:nz,iS=1024;function og(e){if(e.length>iS)throw new Error(`Field name ${e} exceeds maximum field name length ${iS}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const n=e.charCodeAt(t);if(n<32||n>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function Wt(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(o=>Wt(o));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const o=t[0][0];if(o==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Xl(e.$bytes).buffer}if(o==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return sz(e.$integer)}if(o==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const s=Xl(e.$float);if(s.byteLength!==8)throw new Error(`Received ${s.byteLength} bytes, expected 8 for $float`);const u=new DataView(s.buffer).getFloat64(0,NT);if(!IT(u))throw new Error(`Float ${u} should be encoded as a number`);return u}if(o==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(o==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[o,s]of Object.entries(e))og(o),n[o]=Wt(s);return n}const sS=16384;function aa(e){const t=JSON.stringify(e,(n,o)=>o===void 0?"undefined":typeof o=="bigint"?`${o.toString()}n`:o);if(t.length>sS){const n="[...truncated]";let o=sS-n.length;const s=t.codePointAt(o-1);return s!==void 0&&s>65535&&(o-=1),t.substring(0,o)+n}return t}function Wl(e,t,n,o){if(e===void 0){const u=n&&` (present at path ${n} in original object ${aa(t)})`;throw new Error(`undefined is not a valid Convex value${u}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<ha||Yg<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:iz(e)}}if(typeof e=="number")if(IT(e)){const u=new ArrayBuffer(8);return new DataView(u).setFloat64(0,e,NT),{$float:Jl(new Uint8Array(u))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Jl(new Uint8Array(e))};if(Array.isArray(e))return e.map((u,f)=>Wl(u,t,n+`[${f}]`,!1));if(e instanceof Set)throw new Error(_m(n,"Set",[...e],t));if(e instanceof Map)throw new Error(_m(n,"Map",[...e],t));if(!RT(e)){const u=e?.constructor?.name,f=u?`${u} `:"";throw new Error(_m(n,f,e,t))}const s={},c=Object.entries(e);c.sort(([u,f],[h,p])=>u===h?0:u<h?-1:1);for(const[u,f]of c)f!==void 0?(og(u),s[u]=Wl(f,t,n+`.${u}`,!1)):o&&(og(u),s[u]=OT(f,t,n+`.${u}`));return s}function _m(e,t,n,o){return e?`${t}${aa(n)} is not a supported Convex type (present at path ${e} in original object ${aa(o)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${aa(n)} is not a supported Convex type.`}function OT(e,t,n){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${aa(e)} but original value is undefined`);return Wl(e,t,n,!1)}function ut(e){return Wl(e,e,"",!1)}function ki(e){return OT(e,e,"")}function az(e){return Wl(e,e,"",!0)}var lz=Object.defineProperty,cz=(e,t,n)=>t in e?lz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ht=(e,t,n)=>cz(e,typeof t!="symbol"?t+"":t,n);const uz="https://docs.convex.dev/error#undefined-validator";function ec(e,t){const n=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${uz} for details.`)}class Un{constructor({isOptional:t}){ht(this,"type"),ht(this,"fieldPaths"),ht(this,"isOptional"),ht(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}}class Kg extends Un{constructor({isOptional:t,tableName:n}){if(super({isOptional:t}),ht(this,"tableName"),ht(this,"kind","id"),typeof n!="string")throw new Error("v.id(tableName) requires a string");this.tableName=n}get json(){return{type:"id",tableName:this.tableName}}asOptional(){return new Kg({isOptional:"optional",tableName:this.tableName})}}class Rd extends Un{constructor(){super(...arguments),ht(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new Rd({isOptional:"optional"})}}class Nd extends Un{constructor(){super(...arguments),ht(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new Nd({isOptional:"optional"})}}class Xg extends Un{constructor(){super(...arguments),ht(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new Xg({isOptional:"optional"})}}class Jg extends Un{constructor(){super(...arguments),ht(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new Jg({isOptional:"optional"})}}class Wg extends Un{constructor(){super(...arguments),ht(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new Wg({isOptional:"optional"})}}class ey extends Un{constructor(){super(...arguments),ht(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new ey({isOptional:"optional"})}}class ty extends Un{constructor(){super(...arguments),ht(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new ty({isOptional:"optional"})}}class Mi extends Un{constructor({isOptional:t,fields:n}){super({isOptional:t}),ht(this,"fields"),ht(this,"kind","object"),globalThis.Object.entries(n).forEach(([o,s])=>{if(s===void 0&&ec("v.object()",o),!s.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=n}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,n])=>[t,{fieldType:n.json,optional:n.isOptional==="optional"}]))}}asOptional(){return new Mi({isOptional:"optional",fields:this.fields})}omit(...t){const n={...this.fields};for(const o of t)delete n[o];return new Mi({isOptional:this.isOptional,fields:n})}pick(...t){const n={};for(const o of t)n[o]=this.fields[o];return new Mi({isOptional:this.isOptional,fields:n})}partial(){const t={};for(const[n,o]of globalThis.Object.entries(this.fields))t[n]=o.asOptional();return new Mi({isOptional:this.isOptional,fields:t})}extend(t){return new Mi({isOptional:this.isOptional,fields:{...this.fields,...t}})}}class ny extends Un{constructor({isOptional:t,value:n}){if(super({isOptional:t}),ht(this,"value"),ht(this,"kind","literal"),typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"&&typeof n!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=n}get json(){return{type:this.kind,value:ut(this.value)}}asOptional(){return new ny({isOptional:"optional",value:this.value})}}class ry extends Un{constructor({isOptional:t,element:n}){super({isOptional:t}),ht(this,"element"),ht(this,"kind","array"),n===void 0&&ec("v.array()"),this.element=n}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new ry({isOptional:"optional",element:this.element})}}class oy extends Un{constructor({isOptional:t,key:n,value:o}){if(super({isOptional:t}),ht(this,"key"),ht(this,"value"),ht(this,"kind","record"),n===void 0&&ec("v.record()","key"),o===void 0&&ec("v.record()","value"),n.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(o.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!n.isConvexValidator||!o.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=n,this.value=o}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new oy({isOptional:"optional",key:this.key,value:this.value})}}class iy extends Un{constructor({isOptional:t,members:n}){super({isOptional:t}),ht(this,"members"),ht(this,"kind","union"),n.forEach((o,s)=>{if(o===void 0&&ec("v.union()",`member at index ${s}`),!o.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=n}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}asOptional(){return new iy({isOptional:"optional",members:this.members})}}function kT(e){return!!e.isConvexValidator}function MT(e){return kT(e)?e:a.object(e)}const a={id:e=>new Kg({isOptional:"required",tableName:e}),null:()=>new ey({isOptional:"required"}),number:()=>new Rd({isOptional:"required"}),float64:()=>new Rd({isOptional:"required"}),bigint:()=>new Nd({isOptional:"required"}),int64:()=>new Nd({isOptional:"required"}),boolean:()=>new Xg({isOptional:"required"}),string:()=>new Wg({isOptional:"required"}),bytes:()=>new Jg({isOptional:"required"}),literal:e=>new ny({isOptional:"required",value:e}),array:e=>new ry({isOptional:"required",element:e}),object:e=>new Mi({isOptional:"required",fields:e}),record:(e,t)=>new oy({isOptional:"required",key:e,value:t}),union:(...e)=>new iy({isOptional:"required",members:e}),any:()=>new ty({isOptional:"required"}),optional:e=>e.asOptional(),nullable:e=>a.union(e,a.null())};var dz=Object.defineProperty,fz=(e,t,n)=>t in e?dz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Em=(e,t,n)=>fz(e,typeof t!="symbol"?t+"":t,n),aS,lS;const hz=Symbol.for("ConvexError");class Id extends(lS=Error,aS=hz,lS){constructor(t){super(typeof t=="string"?t:aa(t)),Em(this,"name","ConvexError"),Em(this,"data"),Em(this,aS,!0),this.data=t}}function pz(e,t){const n=e.length,o=t.length,s=Math.min(n,o);for(let c=0;c<s;){const u=e.codePointAt(c),f=t.codePointAt(c);if(u!==f){if(u<128&&f<128)return u-f;const h=dS(u,cS),p=dS(f,uS);return mz(cS,h,uS,p)}c+=gz(u)}return n-o}function mz(e,t,n,o){const s=Math.min(t,o);for(let c=0;c<s;c++){const u=e[c],f=n[c];if(u!==f)return u-f}return t-o}function gz(e){return e>65535?2:1}const DT=()=>Array.from({length:4},()=>0),cS=DT(),uS=DT();function dS(e,t){if(e<128)return t[0]=e,1;let n,o;if(e<=2047)n=1,o=192;else if(e<=65535)n=2,o=224;else if(e<=1114111)n=3,o=240;else throw new Error("Invalid code point");t[0]=(e>>6*n)+o;let s=1;for(;n>0;n--){const c=e>>6*(n-1);t[s++]=128|c&63}return s}function af(e,t){return jT(Ul(e),Ul(t))}function jT(e,t){return e[0]===t[0]?yz(e[1],t[1]):e[0]<t[0]?-1:1}function yz(e,t){if(e==null)return 0;if(typeof e=="number"){if(typeof t!="number")throw new Error(`Unexpected type ${t}`);return vz(e,t)}if(typeof e=="string"){if(typeof t!="string")throw new Error(`Unexpected type ${t}`);return pz(e,t)}if(typeof e=="bigint"||typeof e=="boolean"||typeof e=="string")return e<t?-1:e===t?0:1;if(!Array.isArray(e)||!Array.isArray(t))throw new Error(`Unexpected type ${e}`);for(let n=0;n<e.length&&n<t.length;n++){const o=jT(e[n],t[n]);if(o!==0)return o}return e.length<t.length?-1:e.length>t.length?1:0}function vz(e,t){if(isNaN(e)||isNaN(t)){const n=new ArrayBuffer(8),o=new ArrayBuffer(8);new DataView(n).setFloat64(0,e,!0),new DataView(o).setFloat64(0,t,!0);const s=BigInt(new DataView(n).getBigInt64(0,!0)),c=BigInt(new DataView(o).getBigInt64(0,!0)),u=(s&0x8000000000000000n)!==0n,f=(c&0x8000000000000000n)!==0n;return isNaN(e)!==isNaN(t)?isNaN(e)?u?-1:1:f?1:-1:u!==f?u?-1:1:s<c?-1:s===c?0:1}return Object.is(e,t)?0:Object.is(e,-0)?Object.is(t,0)?-1:-Math.sign(t):Object.is(t,-0)?Object.is(e,0)?1:Math.sign(e):e<t?-1:1}function Ul(e){return e===void 0?[0,void 0]:e===null?[1,null]:typeof e=="bigint"?[2,e]:typeof e=="number"?[3,e]:typeof e=="boolean"?[4,e]:typeof e=="string"?[5,e]:e instanceof ArrayBuffer?[6,Array.from(new Uint8Array(e)).map(Ul)]:Array.isArray(e)?[7,e.map(Ul)]:[8,Object.keys(e).sort().map(o=>[o,e[o]]).map(Ul)]}const vr="1.31.6";var bz=Object.defineProperty,wz=(e,t,n)=>t in e?bz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fS=(e,t,n)=>wz(e,typeof t!="symbol"?t+"":t,n);const xz="color:rgb(0, 145, 255)";function LT(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class zT{constructor(t){fS(this,"_onLogLineFuncs"),fS(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let n=Math.random().toString(36).substring(2,15);for(let o=0;o<10&&this._onLogLineFuncs[n]!==void 0;o++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=t,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...t){if(this._verbose)for(const n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...t)}log(...t){for(const n of Object.values(this._onLogLineFuncs))n("info",...t)}warn(...t){for(const n of Object.values(this._onLogLineFuncs))n("warn",...t)}error(...t){for(const n of Object.values(this._onLogLineFuncs))n("error",...t)}}function PT(e){const t=new zT(e);return t.addLogLineListener((n,...o)=>{switch(n){case"debug":console.debug(...o);break;case"info":console.log(...o);break;case"warn":console.warn(...o);break;case"error":console.error(...o);break;default:console.log(...o)}}),t}function $T(e){return new zT(e)}function Od(e,t,n,o,s){const c=LT(n);if(typeof s=="object"&&(s=`ConvexError ${JSON.stringify(s.errorData,null,2)}`),t==="info"){const u=s.match(/^\[.*?\] /);if(u===null){e.error(`[CONVEX ${c}(${o})] Could not parse console.log`);return}const f=s.slice(1,u[0].length-2),h=s.slice(u[0].length);e.log(`%c[CONVEX ${c}(${o})] [${f}]`,xz,h)}else e.error(`[CONVEX ${c}(${o})] ${s}`)}function Sz(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function Js(e,t,n){return`[CONVEX ${LT(e)}(${t})] ${n.errorMessage}
19
+ Called by client`}function ig(e,t){return t.data=e.errorData,t}function Zi(e){const t=e.split(":");let n,o;return t.length===1?(n=t[0],o="default"):(n=t.slice(0,t.length-1).join(":"),o=t[t.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${o}`}function Ui(e,t){return JSON.stringify({udfPath:Zi(e),args:ut(t)})}function hS(e,t,n){const{initialNumItems:o,id:s}=n;return JSON.stringify({type:"paginated",udfPath:Zi(e),args:ut(t),options:ut({initialNumItems:o,id:s})})}var _z=Object.defineProperty,Ez=(e,t,n)=>t in e?_z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ar=(e,t,n)=>Ez(e,typeof t!="symbol"?t+"":t,n);class Tz{constructor(){Ar(this,"nextQueryId"),Ar(this,"querySetVersion"),Ar(this,"querySet"),Ar(this,"queryIdToToken"),Ar(this,"identityVersion"),Ar(this,"auth"),Ar(this,"outstandingQueriesOlderThanRestart"),Ar(this,"outstandingAuthOlderThanRestart"),Ar(this,"paused"),Ar(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(t,n,o,s){const c=Zi(t),u=Ui(c,n),f=this.querySet.get(u);if(f!==void 0)return f.numSubscribers+=1,{queryToken:u,modification:null,unsubscribe:()=>this.removeSubscriber(u)};{const h=this.nextQueryId++,p={id:h,canonicalizedUdfPath:c,args:n,numSubscribers:1,journal:o,componentPath:s};this.querySet.set(u,p),this.queryIdToToken.set(h,u);const y=this.querySetVersion,g=this.querySetVersion+1,b={type:"Add",queryId:h,udfPath:c,args:[ut(n)],journal:o,componentPath:s};return this.paused?this.pendingQuerySetModifications.set(h,b):this.querySetVersion=g,{queryToken:u,modification:{type:"ModifyQuerySet",baseVersion:y,newVersion:g,modifications:[b]},unsubscribe:()=>this.removeSubscriber(u)}}}transition(t){for(const n of t.modifications)switch(n.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);const o=n.journal;if(o!==void 0){const s=this.queryIdToToken.get(n.queryId);s!==void 0&&(this.querySet.get(s).journal=o)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(t,n){const o=Zi(t),s=Ui(o,n),c=this.querySet.get(s);return c!==void 0?c.id:null}isCurrentOrNewerAuthVersion(t){return t>=this.identityVersion}getAuth(){return this.auth}setAuth(t){this.auth={tokenType:"User",value:t};const n=this.identityVersion;return this.paused||(this.identityVersion=n+1),{type:"Authenticate",baseVersion:n,...this.auth}}setAdminAuth(t,n){const o={tokenType:"Admin",value:t,impersonating:n};this.auth=o;const s=this.identityVersion;return this.paused||(this.identityVersion=s+1),{type:"Authenticate",baseVersion:s,...o}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",tokenType:"None",baseVersion:t}}hasAuth(){return!!this.auth}isNewAuth(t){return this.auth?.value!==t}queryPath(t){const n=this.queryIdToToken.get(t);return n?this.querySet.get(n).canonicalizedUdfPath:null}queryArgs(t){const n=this.queryIdToToken.get(t);return n?this.querySet.get(n).args:null}queryToken(t){return this.queryIdToToken.get(t)??null}queryJournal(t){return this.querySet.get(t)?.journal}restart(t){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const n=[];for(const c of this.querySet.values()){const u={type:"Add",queryId:c.id,udfPath:c.canonicalizedUdfPath,args:[ut(c.args)],journal:c.journal,componentPath:c.componentPath};n.push(u),t.has(c.id)||this.outstandingQueriesOlderThanRestart.add(c.id)}this.querySetVersion=1;const o={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:n};if(!this.auth)return this.identityVersion=0,[o,void 0];this.outstandingAuthOlderThanRestart=!0;const s={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[o,s]}pause(){this.paused=!0}resume(){const t=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,n=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,n]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const n=this.querySet.get(t);if(n.numSubscribers>1)return n.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(n.id),this.outstandingQueriesOlderThanRestart.delete(n.id);const o=this.querySetVersion,s=this.querySetVersion+1,c={type:"Remove",queryId:n.id};return this.paused?this.pendingQuerySetModifications.has(n.id)?this.pendingQuerySetModifications.delete(n.id):this.pendingQuerySetModifications.set(n.id,c):this.querySetVersion=s,{type:"ModifyQuerySet",baseVersion:o,newVersion:s,modifications:[c]}}}}var Cz=Object.defineProperty,Az=(e,t,n)=>t in e?Cz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yu=(e,t,n)=>Az(e,typeof t!="symbol"?t+"":t,n);class Rz{constructor(t,n){this.logger=t,this.markConnectionStateDirty=n,Yu(this,"inflightRequests"),Yu(this,"requestsOlderThanRestart"),Yu(this,"inflightMutationsCount",0),Yu(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,n){const o=new Promise(s=>{const c=n?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:c,requestedAt:new Date,onResult:s}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),o}onResponse(t){const n=this.inflightRequests.get(t.requestId);if(n===void 0||n.status.status==="Completed")return null;const o=n.message.type==="Mutation"?"mutation":"action",s=n.message.udfPath;for(const h of t.logLines)Od(this.logger,"info",o,s,h);const c=n.status;let u,f;if(t.success)u={success:!0,logLines:t.logLines,value:Wt(t.result)},f=()=>c.onResult(u);else{const h=t.result,{errorData:p}=t;Od(this.logger,"error",o,s,h),u={success:!1,errorMessage:h,errorData:p!==void 0?Wt(p):void 0,logLines:t.logLines},f=()=>c.onResult(u)}return t.type==="ActionResponse"||!t.success?(f(),this.inflightRequests.delete(t.requestId),this.requestsOlderThanRestart.delete(t.requestId),n.message.type==="Action"?this.inflightActionsCount--:n.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:u}):(n.status={status:"Completed",result:u,ts:t.ts,onResolve:f},null)}removeCompleted(t){const n=new Map;for(const[o,s]of this.inflightRequests.entries()){const c=s.status;c.status==="Completed"&&c.ts.lessThanOrEqual(t)&&(c.onResolve(),n.set(o,c.result),s.message.type==="Mutation"?this.inflightMutationsCount--:s.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(o),this.requestsOlderThanRestart.delete(o))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[n,o]of this.inflightRequests){if(o.status.status==="NotSent"){o.status.status="Requested",t.push(o.message);continue}if(o.message.type==="Mutation")t.push(o.message);else if(o.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,o.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");o.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,n]of this.inflightRequests)if(n.status.status==="NotSent"){n.status.status="Requested",t.push(n.message);continue}return t}hasIncompleteRequests(){for(const t of this.inflightRequests.values())if(t.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let t=Date.now();for(const n of this.inflightRequests.values())n.status.status!=="Completed"&&n.status.requestedAt.getTime()<t&&(t=n.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const tc=Symbol.for("functionName"),FT=Symbol.for("toReferencePath");function Nz(e){return e[FT]??null}function Iz(e){return e.startsWith("function://")}function lf(e){let t;if(typeof e=="string")Iz(e)?t={functionHandle:e}:t={name:e};else if(e[tc])t={name:e[tc]};else{const n=Nz(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function Cn(e){const t=lf(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const n=e[tc];if(!n)throw new Error(`${e} is not a functionReference`);return n}function BT(e){return{[tc]:e}}function qT(e=[]){const t={get(n,o){if(typeof o=="string"){const s=[...e,o];return qT(s)}else if(o===tc){if(e.length<2){const u=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${u}\``)}const s=e.slice(0,-1).join("/"),c=e[e.length-1];return c==="default"?s:s+":"+c}else return o===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}const UT=qT();var Oz=Object.defineProperty,kz=(e,t,n)=>t in e?Oz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kd=(e,t,n)=>kz(e,typeof t!="symbol"?t+"":t,n);class nc{constructor(t){kd(this,"queryResults"),kd(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const o=sr(n[0]),s=Cn(t),c=this.queryResults.get(Ui(s,o));if(c!==void 0)return nc.queryValue(c.result)}getAllQueries(t){const n=[],o=Cn(t);for(const s of this.queryResults.values())s.udfPath===Zi(o)&&n.push({args:s.args,value:nc.queryValue(s.result)});return n}setQuery(t,n,o){const s=sr(n),c=Cn(t),u=Ui(c,s);let f;o===void 0?f=void 0:f={success:!0,value:o,logLines:[]};const h={udfPath:c,args:s,result:f};this.queryResults.set(u,h),this.modifiedQueries.push(u)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}}class Mz{constructor(){kd(this,"queryResults"),kd(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,n){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!n.has(u.mutationId));const o=this.queryResults;this.queryResults=new Map(t);const s=new nc(this.queryResults);for(const u of this.optimisticUpdates)u.update(s);const c=[];for(const[u,f]of this.queryResults){const h=o.get(u);(h===void 0||h.result!==f.result)&&c.push(u)}return c}applyOptimisticUpdate(t,n){this.optimisticUpdates.push({update:t,mutationId:n});const o=new nc(this.queryResults);return t(o),o.modifiedQueries}rawQueryResult(t){const n=this.queryResults.get(t);if(n!==void 0)return n.result}queryResult(t){const n=this.queryResults.get(t);if(n===void 0)return;const o=n.result;if(o!==void 0){if(o.success)return o.value;throw o.errorData!==void 0?ig(o,new Id(Js("query",n.udfPath,o))):new Error(Js("query",n.udfPath,o))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var Dz=Object.defineProperty,jz=(e,t,n)=>t in e?Dz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tm=(e,t,n)=>jz(e,typeof t!="symbol"?t+"":t,n);class Tn{constructor(t,n){Tm(this,"low"),Tm(this,"high"),Tm(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new Tn(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?pS:t>=Lz?zz:new Tn(t%Vl|0,t/Vl|0)}toString(){return(BigInt(this.high)*BigInt(Vl)+BigInt(this.low)).toString()}equals(t){return Tn.isLong(t)||(t=Tn.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return Tn.isLong(t)||(t=Tn.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?Tn.fromNumber(t):new Tn(t.low,t.high)}}const pS=new Tn(0,0),mS=65536,Vl=mS*mS,Lz=Vl*Vl,zz=new Tn(-1,-1);var Pz=Object.defineProperty,$z=(e,t,n)=>t in e?Pz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ku=(e,t,n)=>$z(e,typeof t!="symbol"?t+"":t,n);class gS{constructor(t,n){Ku(this,"version"),Ku(this,"remoteQuerySet"),Ku(this,"queryPath"),Ku(this,"logger"),this.version={querySet:0,ts:Tn.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=n}transition(t){const n=t.startVersion;if(this.version.querySet!==n.querySet||this.version.ts.notEquals(n.ts)||this.version.identity!==n.identity)throw new Error(`Invalid start version: ${n.ts.toString()}:${n.querySet}:${n.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const o of t.modifications)switch(o.type){case"QueryUpdated":{const s=this.queryPath(o.queryId);if(s)for(const u of o.logLines)Od(this.logger,"info","query",s,u);const c=Wt(o.value??null);this.remoteQuerySet.set(o.queryId,{success:!0,value:c,logLines:o.logLines});break}case"QueryFailed":{const s=this.queryPath(o.queryId);if(s)for(const u of o.logLines)Od(this.logger,"info","query",s,u);const{errorData:c}=o;this.remoteQuerySet.set(o.queryId,{success:!1,errorMessage:o.errorMessage,errorData:c!==void 0?Wt(c):void 0,logLines:o.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(o.queryId);break}default:throw new Error(`Invalid modification ${o.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Cm(e){const t=Xl(e);return Tn.fromBytesLE(Array.from(t))}function Fz(e){const t=new Uint8Array(e.toBytesLE());return Jl(t)}function yS(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:Cm(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Cm(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Cm(e.endVersion.ts)}}}}function Bz(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:Fz(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var qz=Object.defineProperty,Uz=(e,t,n)=>t in e?qz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ot=(e,t,n)=>Uz(e,typeof t!="symbol"?t+"":t,n);const Vz=1e3,Hz=1001,Qz=1005,Zz=4040;let fd;function Ks(){return fd===void 0&&(fd=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(fd+performance.now())}function vS(){return`t=${Math.round((Ks()-fd)/100)/10}s`}const VT={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function Gz(e){if(e===void 0)return"Unknown";for(const t of Object.keys(VT))if(e.startsWith(t))return t;return"Unknown"}class Yz{constructor(t,n,o,s,c,u){this.markConnectionStateDirty=c,this.debug=u,Ot(this,"socket"),Ot(this,"connectionCount"),Ot(this,"_hasEverConnected",!1),Ot(this,"lastCloseReason"),Ot(this,"transitionChunkBuffer",null),Ot(this,"defaultInitialBackoff"),Ot(this,"maxBackoff"),Ot(this,"retries"),Ot(this,"serverInactivityThreshold"),Ot(this,"reconnectDueToServerInactivityTimeout"),Ot(this,"scheduledReconnect",null),Ot(this,"networkOnlineHandler",null),Ot(this,"pendingNetworkRecoveryInfo",null),Ot(this,"uri"),Ot(this,"onOpen"),Ot(this,"onResume"),Ot(this,"onMessage"),Ot(this,"webSocketConstructor"),Ot(this,"logger"),Ot(this,"onServerDisconnectError"),this.webSocketConstructor=o,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=t,this.onOpen=n.onOpen,this.onResume=n.onResume,this.onMessage=n.onMessage,this.onServerDisconnectError=n.onServerDisconnectError,this.logger=s,this.setupNetworkListener(),this.connect()}setSocketState(t){this.socket=t,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(t){if(t.partNumber<0||t.partNumber>=t.totalParts||t.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==t.totalParts||this.transitionChunkBuffer.transitionId!==t.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:t.totalParts,transitionId:t.transitionId}),t.partNumber!==this.transitionChunkBuffer.chunks.length){const n=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${n}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const n=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const o=yS(JSON.parse(n));if(o.type!=="Transition")throw new Error(`Expected Transition, got ${o.type} after assembling chunks`);return o}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const t=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:t,paused:"no"}),this.resetServerInactivityTimeout(),t.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:t,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Ks()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",vS(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",vS())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:n}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:n}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(n/1e3)}s of waiting`)}},t.onerror=n=>{this.transitionChunkBuffer=null;const o=n.message;o&&this.logger.log(`WebSocket error message: ${o}`)},t.onmessage=n=>{this.resetServerInactivityTimeout();const o=n.data.length;let s=yS(JSON.parse(n.data));if(this._logVerbose(`received ws message with type ${s.type}`),s.type==="Ping")return;if(s.type==="TransitionChunk"){const u=this.assembleTransition(s);if(!u)return;s=u,this._logVerbose(`assembled full ws message of type ${s.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${s.type} while buffering TransitionChunks`)),s.type==="Transition"&&this.reportLargeTransition({messageLength:o,transition:s}),this.onMessage(s).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=n=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=n.reason||`closed with code ${n.code}`),n.code!==Vz&&n.code!==Hz&&n.code!==Qz&&n.code!==Zz){let s=`WebSocket closed with code ${n.code}`;n.reason&&(s+=`: ${n.reason}`),this.logger.log(s),this.onServerDisconnectError&&n.reason&&this.onServerDisconnectError(s)}const o=Gz(n.reason);this.scheduleReconnect(o)}}socketState(){return this.socket.state}sendMessage(t){const n={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const o=Bz(t),s=JSON.stringify(o);let c=!1;try{this.socket.ws.send(s),c=!0}catch(u){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${u}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${c?"sent":"failed to send"} message with type ${t.type}: ${JSON.stringify(n)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(n)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(t){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const n=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(n)}ms`);const o=Ks(),s=setTimeout(()=>{this.scheduledReconnect?.timeout===s&&(this.scheduledReconnect=null,this.connect())},n);this.scheduledReconnect={timeout:s,scheduledAt:o,backoffMs:n}}closeAndReconnect(t){switch(this._logVerbose(`begin closeAndReconnect with reason ${t}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=t,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const t=this.socket.ws;return t.onmessage=n=>{this._logVerbose("Ignoring message received after close")},new Promise(n=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),n()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=o=>{this._logVerbose("Ignoring message received after close")};const n=new Promise(o=>{t.onclose=()=>{o()}});return t.close(),n}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const t=this.close();return this.setSocketState({state:"terminated"}),t}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const t=this.close();return this.socket={state:"stopped"},t}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let t=null;if(this.scheduledReconnect){const n=Ks()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-n),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(n)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=t!==null?{timeSavedMs:t}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Ks()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(t){this.logger.logVerbose(t)}nextBackoff(t){const o=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:VT[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const s=Math.min(o,this.maxBackoff),c=s*(Math.random()-.5);return s+c}reportLargeTransition({transition:t,messageLength:n}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const o=Ks()-t.clientClockSkew-t.serverTs/1e6,s=`${Math.round(o)}ms`,c=`${Math.round(n/1e4)/100}MB`,u=n/(o/1e3),f=`${Math.round(u/1e4)/100}MB per second`;this._logVerbose(`received ${c} transition in ${s} at ${f}`),n>2e7?this.logger.log(`received query results totaling more that 20MB (${c}) which will take a long time to download on slower connections`):o>2e4&&this.logger.log(`received query results totaling ${c} which took more than 20s to arrive (${s})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:o,messageLength:n}})}}function Kz(){return Xz()}function Xz(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class jl extends Error{}jl.prototype.name="InvalidTokenError";function Jz(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function Wz(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Jz(t)}catch{return atob(t)}}function HT(e,t){if(typeof e!="string")throw new jl("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new jl(`Invalid token specified: missing part #${n+1}`);let s;try{s=Wz(o)}catch(c){throw new jl(`Invalid token specified: invalid base64 for part #${n+1} (${c.message})`)}try{return JSON.parse(s)}catch(c){throw new jl(`Invalid token specified: invalid json for part #${n+1} (${c.message})`)}}var eP=Object.defineProperty,tP=(e,t,n)=>t in e?eP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nr=(e,t,n)=>tP(e,typeof t!="symbol"?t+"":t,n);const nP=480*60*60*1e3,bS=2;class rP{constructor(t,n,o){nr(this,"authState",{state:"noAuth"}),nr(this,"configVersion",0),nr(this,"syncState"),nr(this,"authenticate"),nr(this,"stopSocket"),nr(this,"tryRestartSocket"),nr(this,"pauseSocket"),nr(this,"resumeSocket"),nr(this,"clearAuth"),nr(this,"logger"),nr(this,"refreshTokenLeewaySeconds"),nr(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=n.authenticate,this.stopSocket=n.stopSocket,this.tryRestartSocket=n.tryRestartSocket,this.pauseSocket=n.pauseSocket,this.resumeSocket=n.resumeSocket,this.clearAuth=n.clearAuth,this.logger=o.logger,this.refreshTokenLeewaySeconds=o.refreshTokenLeewaySeconds}async setConfig(t,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const o=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});o.isFromOutdatedConfig||(o.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:n},hasRetried:!1}),this.authenticate(o.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:t,onAuthChange:n}}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket())}onTransition(t){if(this.syncState.isCurrentOrNewerAuthVersion(t.endVersion.identity)&&!(t.endVersion.identity<=t.startVersion.identity)){if(this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid"),this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(t){if(t.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:n}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(n+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(t)}async tryToReauthenticate(t){if(this._logVerbose(`attempting to reauthenticate: ${t.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=bS){this.logger.error(`Failed to authenticate: "${t.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${bS-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const n=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});n.isFromOutdatedConfig||(n.value&&this.syncState.isNewAuth(n.value)?(this.authenticate(n.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:n.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value?this.syncState.isNewAuth(t.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:t.value,config:this.authState.config}),this.authenticate(t.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(t){if(this.authState.state==="noAuth")return;const n=this.decodeToken(t);if(!n){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:o,exp:s}=n;if(!o||!s){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const c=s-o;if(c<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(nP,(c-this.refreshTokenLeewaySeconds)*1e3);u<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${c}s`),u=0);const f=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},u);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:f,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${u}ms`)}async fetchTokenAndGuardAgainstRace(t,n){const o=++this.configVersion;this._logVerbose(`fetching token with config version ${o}`);const s=await t(n);return this.configVersion!==o?(this._logVerbose(`stale config version, expected ${o}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:s}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(t){t(!1),this.resetAuthState()}resetAuthState(){this.setAuthState({state:"noAuth"})}setAuthState(t){const n=t.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:t.hadAuth,state:t.state,token:`...${t.token.slice(-7)}`}:{state:t.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(n)}`),t.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&(clearTimeout(this.authState.refetchTokenTimeoutId),this.syncState.markAuthCompletion()),this.authState=t}decodeToken(t){try{return HT(t)}catch(n){return this._logVerbose(`Error decoding token: ${n instanceof Error?n.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const oP=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function iP(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function sP(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function aP(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of oP){const o=performance.getEntriesByName(n).filter(s=>s.entryType==="mark").filter(s=>s.detail.sessionId===e);t.push(...o)}return t.map(sP)}var lP=Object.defineProperty,cP=(e,t,n)=>t in e?lP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>cP(e,typeof t!="symbol"?t+"":t,n);class uP{constructor(t,n,o){if(kt(this,"address"),kt(this,"state"),kt(this,"requestManager"),kt(this,"webSocketManager"),kt(this,"authenticationManager"),kt(this,"remoteQuerySet"),kt(this,"optimisticQueryResults"),kt(this,"_transitionHandlerCounter",0),kt(this,"_nextRequestId"),kt(this,"_onTransitionFns",new Map),kt(this,"_sessionId"),kt(this,"firstMessageReceived",!1),kt(this,"debug"),kt(this,"logger"),kt(this,"maxObservedTimestamp"),kt(this,"connectionStateSubscribers",new Map),kt(this,"nextConnectionStateSubscriberId",0),kt(this,"_lastPublishedConnectionState"),kt(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const x=this.connectionState();if(JSON.stringify(x)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=x;for(const C of this.connectionStateSubscribers.values())C(x)}})}),kt(this,"mark",x=>{this.debug&&iP(x,this.sessionId)}),typeof t=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");o?.skipConvexDeploymentUrlCheck!==!0&&JL(t),o={...o};const s=o.authRefreshTokenLeewaySeconds??2;let c=o.webSocketConstructor;if(!c&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");c=c||WebSocket,this.debug=o.reportDebugInfoToConvex??!1,this.address=t,this.logger=o.logger===!1?$T({verbose:o.verbose??!1}):o.logger!==!0&&o.logger?o.logger:PT({verbose:o.verbose??!1});const u=t.search("://");if(u===-1)throw new Error("Provided address was not an absolute URL.");const f=t.substring(u+3),h=t.substring(0,u);let p;if(h==="http")p="ws";else if(h==="https")p="wss";else throw new Error(`Unknown parent protocol ${h}`);const y=`${p}://${f}/api/${vr}/sync`;this.state=new Tz,this.remoteQuerySet=new gS(x=>this.state.queryPath(x),this.logger),this.requestManager=new Rz(this.logger,this.markConnectionStateDirty);const g=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new rP(this.state,{authenticate:x=>{const C=this.state.setAuth(x);return this.webSocketManager.sendMessage(C),C.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:g,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:s}),this.optimisticQueryResults=new Mz,this.addOnTransitionHandler(x=>{n(x.queries.map(C=>C.token))}),this._nextRequestId=0,this._sessionId=Kz();const{unsavedChangesWarning:b}=o;if(typeof window>"u"||typeof window.addEventListener>"u"){if(b===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else b!==!1&&window.addEventListener("beforeunload",x=>{if(this.requestManager.hasIncompleteRequests()){x.preventDefault();const C="Are you sure you want to leave? Your changes may not be saved.";return(x||window.event).returnValue=C,C}});this.webSocketManager=new Yz(y,{onOpen:x=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...x,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const C=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new gS(I=>this.state.queryPath(I),this.logger);const[S,A]=this.state.restart(C);A&&this.webSocketManager.sendMessage(A),this.webSocketManager.sendMessage(S);for(const I of this.requestManager.restart())this.webSocketManager.sendMessage(I)},onResume:()=>{const[x,C]=this.state.resume();C&&this.webSocketManager.sendMessage(C),x&&this.webSocketManager.sendMessage(x);for(const S of this.requestManager.resume())this.webSocketManager.sendMessage(S)},onMessage:x=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),x.type){case"Transition":{this.observedTimestamp(x.endVersion.ts),this.authenticationManager.onTransition(x),this.remoteQuerySet.transition(x),this.state.transition(x);const C=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(C);break}case"MutationResponse":{x.success&&this.observedTimestamp(x.ts);const C=this.requestManager.onResponse(x);C!==null&&this.notifyOnQueryResultChanges(new Map([[C.requestId,C.result]]));break}case"ActionResponse":{this.requestManager.onResponse(x);break}case"AuthError":{this.authenticationManager.onAuthError(x);break}case"FatalError":{const C=Sz(this.logger,x.error);throw this.webSocketManager.terminate(),C}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:o.onServerDisconnectError},c,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),o.expectAuth&&g()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()||this.state.hasSyncedPastLastReconnect()}observedTimestamp(t){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(t))&&(this.maxObservedTimestamp=t)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(t){const n=this.remoteQuerySet.remoteQueryResults(),o=new Map;for(const[c,u]of n){const f=this.state.queryToken(c);if(f!==null){const h={result:u,udfPath:this.state.queryPath(c),args:this.state.queryArgs(c)};o.set(f,h)}}const s=this.optimisticQueryResults.ingestQueryResultsFromServer(o,new Set(t.keys()));this.handleTransition({queries:s.map(c=>{const u=this.optimisticQueryResults.rawQueryResult(c);return{token:c,modification:{kind:"Updated",result:u}}}),reflectedMutations:Array.from(t).map(([c,u])=>({requestId:c,result:u})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(t){for(const n of this._onTransitionFns.values())n(t)}addOnTransitionHandler(t){const n=this._transitionHandlerCounter++;return this._onTransitionFns.set(n,t),()=>this._onTransitionFns.delete(n)}getCurrentAuthClaims(){const t=this.state.getAuth();let n={};if(t&&t.tokenType==="User")try{n=t?HT(t.value):{}}catch{n={}}else return;return{token:t.value,decoded:n}}setAuth(t,n){this.authenticationManager.setConfig(t,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,n){const o=this.state.setAdminAuth(t,n);this.webSocketManager.sendMessage(o)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,n,o){const s=sr(n),{modification:c,queryToken:u,unsubscribe:f}=this.state.subscribe(t,s,o?.journal,o?.componentPath);return c!==null&&this.webSocketManager.sendMessage(c),{queryToken:u,unsubscribe:()=>{const h=f();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,n){const o=sr(n),s=Ui(t,o);return this.optimisticQueryResults.queryResult(s)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,n){const o=sr(n),s=Ui(t,o);return this.optimisticQueryResults.queryLogs(s)}queryJournal(t,n){const o=sr(n),s=Ui(t,o);return this.state.queryJournal(s)}connectionState(){const t=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:t.isConnected,hasEverConnected:t.hasEverConnected,connectionCount:t.connectionCount,connectionRetries:t.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(t){const n=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(n,t),()=>{this.connectionStateSubscribers.delete(n)}}async mutation(t,n,o){const s=await this.mutationInternal(t,n,o);if(!s.success)throw s.errorData!==void 0?ig(s,new Id(Js("mutation",t,s))):new Error(Js("mutation",t,s));return s.value}async mutationInternal(t,n,o,s){const{mutationPromise:c}=this.enqueueMutation(t,n,o,s);return c}enqueueMutation(t,n,o,s){const c=sr(n);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,o!==void 0){const y=o.optimisticUpdate;if(y!==void 0){const g=C=>{y(C,c)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},x=this.optimisticQueryResults.applyOptimisticUpdate(g,u).map(C=>{const S=this.localQueryResultByToken(C);return{token:C,modification:{kind:"Updated",result:S===void 0?void 0:{success:!0,value:S,logLines:[]}}}});this.handleTransition({queries:x,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const f={type:"Mutation",requestId:u,udfPath:t,componentPath:s,args:[ut(c)]},h=this.webSocketManager.sendMessage(f),p=this.requestManager.request(f,h);return{requestId:u,mutationPromise:p}}async action(t,n){const o=await this.actionInternal(t,n);if(!o.success)throw o.errorData!==void 0?ig(o,new Id(Js("action",t,o))):new Error(Js("action",t,o));return o.value}async actionInternal(t,n,o){const s=sr(n),c=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:c,udfPath:t,componentPath:o,args:[ut(s)]},f=this.webSocketManager.sendMessage(u);return this.requestManager.request(u,f)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const t=aP(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:t})}}tryReportLongDisconnect(){if(!this.debug)return;const t=this.connectionState().timeOfOldestInflightRequest;if(t===null||Date.now()-t.getTime()<=60*1e3)return;const n=`${this.address}/api/debug_event`;fetch(n,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${vr}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(o=>{o.ok||this.logger.warn("Analytics request failed with response:",o.body)}).catch(o=>{this.logger.warn("Analytics response failed with error:",o)})}}function Am(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var dP=Object.defineProperty,fP=(e,t,n)=>t in e?dP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wS=(e,t,n)=>fP(e,typeof t!="symbol"?t+"":t,n);class hP{constructor(t,n){this.client=t,this.onTransition=n,wS(this,"paginatedQuerySet",new Map),wS(this,"lastTransitionTs"),this.lastTransitionTs=Tn.fromNumber(0),this.client.addOnTransitionHandler(o=>this.onBaseTransition(o))}subscribe(t,n,o){const s=Zi(t),c=hS(s,n,o),u=()=>this.removePaginatedQuerySubscriber(c),f=this.paginatedQuerySet.get(c);return f?(f.numSubscribers+=1,{paginatedQueryToken:c,unsubscribe:u}):(this.paginatedQuerySet.set(c,{token:c,canonicalizedUdfPath:s,args:n,numSubscribers:1,options:{initialNumItems:o.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:o.id}),this.addPageToPaginatedQuery(c,null,o.initialNumItems),{paginatedQueryToken:c,unsubscribe:u})}localQueryResult(t,n,o){const s=Zi(t),c=hS(s,n,o);return this.localQueryResultByToken(c)}localQueryResultByToken(t){const n=this.paginatedQuerySet.get(t);if(!n)return;const o=this.activePageQueryTokens(n);if(o.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let s=[],c=!1,u=!1;for(const h of o){const p=this.client.localQueryResultByToken(h);if(p===void 0){c=!0,u=!1;continue}const y=Am(p);s=s.concat(y.page),u=!!y.isDone}let f;return c?f=s.length===0?"LoadingFirstPage":"LoadingMore":u?f="Exhausted":f="CanLoadMore",{results:s,status:f,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const n=t.queries.map(u=>u.token),o=this.queriesContainingTokens(n);let s=[];o.length>0&&(this.processPaginatedQuerySplits(o,u=>this.client.localQueryResultByToken(u)),s=o.map(u=>({token:u,modification:{kind:"Updated",result:this.localQueryResultByToken(u)}})));const c={...t,paginatedQueries:s};this.onTransition(c)}loadMoreOfPaginatedQuery(t,n){this.mustGetPaginatedQuery(t);const o=this.queryTokenForLastPageOfPaginatedQuery(t),s=this.client.localQueryResultByToken(o);if(!s)return!1;const c=Am(s);if(c.isDone)return!1;this.addPageToPaginatedQuery(t,c.continueCursor,n);const u={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:t,modification:{kind:"Updated",result:this.localQueryResultByToken(t)}}]};return this.onTransition(u),!0}queriesContainingTokens(t){if(t.length===0)return[];const n=[],o=new Set(t);for(const[s,c]of this.paginatedQuerySet)for(const u of this.allQueryTokens(c))if(o.has(u)){n.push(s);break}return n}processPaginatedQuerySplits(t,n){for(const o of t){const s=this.mustGetPaginatedQuery(o),{ongoingSplits:c,pageKeyToQuery:u,pageKeys:f}=s;for(const[h,[p,y]]of c)n(u.get(p).queryToken)!==void 0&&n(u.get(y).queryToken)!==void 0&&this.completePaginatedQuerySplit(s,h,p,y);for(const h of f){if(c.has(h))continue;const p=u.get(h).queryToken,y=n(p);if(!y)continue;const g=Am(y);g.splitCursor&&(g.pageStatus==="SplitRecommended"||g.pageStatus==="SplitRequired"||g.page.length>s.options.initialNumItems*2)&&this.splitPaginatedQueryPage(s,h,g.splitCursor,g.continueCursor)}}}splitPaginatedQueryPage(t,n,o,s){const c=t.nextPageKey++,u=t.nextPageKey++,f={cursor:s,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:null,endCursor:o}});t.pageKeyToQuery.set(c,h);const p=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:o,endCursor:s}});t.pageKeyToQuery.set(u,p),t.ongoingSplits.set(n,[c,u])}addPageToPaginatedQuery(t,n,o){const s=this.mustGetPaginatedQuery(t),c=s.nextPageKey++,u={cursor:n,numItems:o,id:s.id},f={...s.args,paginationOpts:u},h=this.client.subscribe(s.canonicalizedUdfPath,f);return s.pageKeys.push(c),s.pageKeyToQuery.set(c,h),h}removePaginatedQuerySubscriber(t){const n=this.paginatedQuerySet.get(t);if(n&&(n.numSubscribers-=1,!(n.numSubscribers>0))){for(const o of n.pageKeyToQuery.values())o.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,n,o,s){const c=t.pageKeyToQuery.get(n);t.pageKeyToQuery.delete(n);const u=t.pageKeys.indexOf(n);t.pageKeys.splice(u,1,o,s),t.ongoingSplits.delete(n),c.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(n=>t.pageKeyToQuery.get(n).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(n=>n.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const n=this.mustGetPaginatedQuery(t),o=n.pageKeys[n.pageKeys.length-1];if(o===void 0)throw new Error(`No pages for paginated query ${t}`);return n.pageKeyToQuery.get(o).queryToken}mustGetPaginatedQuery(t){const n=this.paginatedQuerySet.get(t);if(!n)throw new Error("paginated query no longer exists for token "+t);return n}}function pP({getCurrentValue:e,subscribe:t}){const[n,o]=_.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let s=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(s=e(),o({getCurrentValue:e,subscribe:t,value:s})),_.useEffect(()=>{let c=!1;const u=()=>{c||o(h=>{if(h.getCurrentValue!==e||h.subscribe!==t)return h;const p=e();return h.value===p?h:{...h,value:p}})},f=t(u);return u(),()=>{c=!0,f()}},[e,t]),s}var mP=Object.defineProperty,gP=(e,t,n)=>t in e?mP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ao=(e,t,n)=>gP(e,typeof t!="symbol"?t+"":t,n);const yP=5e3;if(typeof sn>"u")throw new Error("Required dependency 'react' not found");function QT(e,t,n){function o(s){return xP(s),t.mutation(e,s,{optimisticUpdate:n})}return o.withOptimisticUpdate=function(c){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${Cn(e)}`);return QT(e,t,c)},o}class vP{constructor(t,n){if(ao(this,"address"),ao(this,"cachedSync"),ao(this,"cachedPaginatedQueryClient"),ao(this,"listeners"),ao(this,"options"),ao(this,"closed",!1),ao(this,"_logger"),ao(this,"adminAuth"),ao(this,"fakeUserIdentity"),t===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof t!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof t} instead.`);if(!t.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=t,this.listeners=new Map,this._logger=n?.logger===!1?$T({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:PT({verbose:n?.verbose??!1}),this.options={...n,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=new uP(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new hP(this.cachedSync,t=>this.handleTransition(t)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(t,n){if(typeof t=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(t,n??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,n){if(this.adminAuth=t,this.fakeUserIdentity=n,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,n)}watchQuery(t,...n){const[o,s]=n,c=Cn(t);return{onUpdate:u=>{const{queryToken:f,unsubscribe:h}=this.sync.subscribe(c,o,s),p=this.listeners.get(f);return p!==void 0?p.add(u):this.listeners.set(f,new Set([u])),()=>{if(this.closed)return;const y=this.listeners.get(f);y.delete(u),y.size===0&&this.listeners.delete(f),h()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(c,o)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(c,o)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(c,o)}}}prewarmQuery(t){const n=t.extendSubscriptionFor??yP,s=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(s,n)}watchPaginatedQuery(t,n,o){const s=Cn(t);return{onUpdate:c=>{const{paginatedQueryToken:u,unsubscribe:f}=this.paginatedQueryClient.subscribe(s,n||{},o),h=this.listeners.get(u);return h!==void 0?h.add(c):this.listeners.set(u,new Set([c])),()=>{if(this.closed)return;const p=this.listeners.get(u);p.delete(c),p.size===0&&this.listeners.delete(u),f()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(s,n,o)}}mutation(t,...n){const[o,s]=n,c=Cn(t);return this.sync.mutation(c,o,s)}action(t,...n){const o=Cn(t);return this.sync.action(o,...n)}query(t,...n){const o=this.watchQuery(t,...n),s=o.localQueryResult();return s!==void 0?Promise.resolve(s):new Promise((c,u)=>{const f=o.onUpdate(()=>{f();try{c(o.localQueryResult())}catch(h){u(h)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(t){return this.sync.subscribeToConnectionState(t)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const t=this.cachedSync;this.cachedSync=void 0,await t.close()}}handleTransition(t){const n=t.queries.map(s=>s.token),o=t.paginatedQueries.map(s=>s.token);this.transition([...n,...o])}transition(t){for(const n of t){const o=this.listeners.get(n);if(o)for(const s of o)s()}}}const sy=sn.createContext(void 0);function bP(){return _.useContext(sy)}const wP=({client:e,children:t})=>sn.createElement(sy.Provider,{value:e},t);function ZT(e,...t){const n=t[0]==="skip",o=t[0]==="skip"?{}:sr(t[0]),s=typeof e=="string"?BT(e):e,c=Cn(s),u=_.useMemo(()=>n?{}:{query:{query:s,args:o}},[JSON.stringify(ut(o)),c,n]),h=TP(u).query;if(h instanceof Error)throw h;return h}function xS(e){const t=typeof e=="string"?BT(e):e,n=_.useContext(sy);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return _.useMemo(()=>QT(t,n),[n,Cn(t)])}function xP(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var SP=Object.defineProperty,_P=(e,t,n)=>t in e?SP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rm=(e,t,n)=>_P(e,typeof t!="symbol"?t+"":t,n);class EP{constructor(t){Rm(this,"createWatch"),Rm(this,"queries"),Rm(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const n of Object.keys(t)){const{query:o,args:s,paginationOptions:c}=t[n];if(Cn(o),this.queries[n]===void 0)this.addQuery(n,o,s,c?{paginationOptions:c}:{});else{const u=this.queries[n];(Cn(o)!==Cn(u.query)||JSON.stringify(ut(s))!==JSON.stringify(ut(u.args))||JSON.stringify(c)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(n),this.addQuery(n,o,s,c?{paginationOptions:c}:{}))}}for(const n of Object.keys(this.queries))t[n]===void 0&&this.removeQuery(n)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const n={};for(const o of Object.keys(t)){const{query:s,args:c}=t[o],u=t[o].paginationOptions;Cn(s);const f=this.createWatch(s,c,u?{paginationOptions:u}:{});let h;try{h=f.localQueryResult()}catch(p){if(p instanceof Error)h=p;else throw p}n[o]=h}return n}setCreateWatch(t){this.createWatch=t;for(const n of Object.keys(this.queries)){const{query:o,args:s,watch:c,paginationOptions:u}=this.queries[n],f="journal"in c?c.journal():void 0;this.removeQuery(n),this.addQuery(n,o,s,{...f?{journal:f}:[],...u?{paginationOptions:u}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,n,o,{paginationOptions:s,journal:c}){if(this.queries[t]!==void 0)throw new Error(`Tried to add a new query with identifier ${t} when it already exists.`);const u=this.createWatch(n,o,{...c?{journal:c}:[],...s?{paginationOptions:s}:{}}),f=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:n,args:o,watch:u,unsubscribe:f,...s?{paginationOptions:s}:{}}}removeQuery(t){const n=this.queries[t];if(n===void 0)throw new Error(`No query found with identifier ${t}.`);n.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function TP(e){const t=bP();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const n=_.useMemo(()=>(o,s,{journal:c,paginationOptions:u})=>u?t.watchPaginatedQuery(o,s,u):t.watchQuery(o,s,c?{journal:c}:{}),[t]);return CP(e,n)}function CP(e,t){const[n]=_.useState(()=>new EP(t));n.createWatch!==t&&n.setCreateWatch(t),_.useEffect(()=>()=>n.destroy(),[n]);const o=_.useMemo(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:s=>(n.setQueries(e),n.subscribe(s))}),[n,e]);return pP(o)}const AP="/assets/index-D-4wFfgU.css";const GT=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();const RP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const NP=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());const SS=e=>{const t=NP(e);return t.charAt(0).toUpperCase()+t.slice(1)};var IP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const OP=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const kP=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:s="",children:c,iconNode:u,...f},h)=>_.createElement("svg",{ref:h,...IP,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:GT("lucide",s),...!c&&!OP(f)&&{"aria-hidden":"true"},...f},[...u.map(([p,y])=>_.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Se=(e,t)=>{const n=_.forwardRef(({className:o,...s},c)=>_.createElement(kP,{ref:c,iconNode:t,className:GT(`lucide-${RP(SS(e))}`,`lucide-${e}`,o),...s}));return n.displayName=SS(e),n};const MP=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],DP=Se("archive",MP);const jP=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],sg=Se("bell",jP);const LP=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],zP=Se("book",LP);const PP=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],$P=Se("bookmark",PP);const FP=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],YT=Se("braces",FP);const BP=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ag=Se("calendar",BP);const qP=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],KT=Se("check",qP);const UP=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ts=Se("chevron-down",UP);const VP=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],HP=Se("chevron-right",VP);const QP=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],XT=Se("chevron-up",QP);const ZP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],GP=Se("circle-alert",ZP);const YP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],JT=Se("circle-question-mark",YP);const KP=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],XP=Se("clock",KP);const JP=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],WP=Se("code-xml",JP);const e$=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],t$=Se("code",e$);const n$=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],r$=Se("dollar-sign",n$);const o$=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],i$=Se("external-link",o$);const s$=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],a$=Se("eye",s$);const l$=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],c$=Se("file-code",l$);const u$=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],d$=Se("file-text",u$);const f$=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],h$=Se("file-type",f$);const p$=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],m$=Se("flag",p$);const g$=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],y$=Se("folder-open",g$);const v$=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],b$=Se("folder",v$);const w$=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],x$=Se("globe",w$);const S$=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],WT=Se("hash",S$);const _$=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],E$=Se("heart",_$);const T$=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],e1=Se("house",T$);const C$=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],t1=Se("image",C$);const A$=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],n1=Se("layers",A$);const R$=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],N$=Se("layout-dashboard",R$);const I$=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],O$=Se("link-2",I$);const k$=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],M$=Se("link",k$);const D$=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],j$=Se("list",D$);const L$=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],z$=Se("loader-circle",L$);const P$=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],$$=Se("lock",P$);const F$=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],B$=Se("log-out",F$);const q$=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],U$=Se("mail",q$);const V$=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],H$=Se("map-pin",V$);const Q$=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Z$=Se("message-square",Q$);const G$=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Y$=Se("package",G$);const K$=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],X$=Se("phone",K$);const J$=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],r1=Se("plus",J$);const W$=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],e3=Se("settings",W$);const t3=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],n3=Se("square-check-big",t3);const r3=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],o3=Se("square-pen",r3);const i3=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],s3=Se("star",i3);const a3=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],l3=Se("tag",a3);const c3=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],u3=Se("tags",c3);const d3=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],f3=Se("text-align-start",d3);const h3=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],o1=Se("toggle-left",h3);const p3=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],m3=Se("trash-2",p3);const g3=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],y3=Se("triangle-alert",g3);const v3=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],i1=Se("user",v3);const b3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Md=Se("x",b3);function s1(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=s1(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function a1(){for(var e,t,n=0,o="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=s1(e))&&(o&&(o+=" "),o+=t);return o}const w3=(e,t)=>{const n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},x3=(e,t)=>({classGroupId:e,validator:t}),l1=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Dd="-",_S=[],S3="arbitrary..",_3=e=>{const t=T3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return E3(u);const f=u.split(Dd),h=f[0]===""&&f.length>1?1:0;return c1(f,h,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const h=o[u],p=n[u];return h?p?w3(p,h):h:p||_S}return n[u]||_S}}},c1=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],c=n.nextPart.get(s);if(c){const p=c1(e,t+1,c);if(p)return p}const u=n.validators;if(u===null)return;const f=t===0?e.join(Dd):e.slice(t).join(Dd),h=u.length;for(let p=0;p<h;p++){const y=u[p];if(y.validator(f))return y.classGroupId}},E3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?S3+o:void 0})(),T3=e=>{const{theme:t,classGroups:n}=e;return C3(n,t)},C3=(e,t)=>{const n=l1();for(const o in e){const s=e[o];ay(s,n,o,t)}return n},ay=(e,t,n,o)=>{const s=e.length;for(let c=0;c<s;c++){const u=e[c];A3(u,t,n,o)}},A3=(e,t,n,o)=>{if(typeof e=="string"){R3(e,t,n);return}if(typeof e=="function"){N3(e,t,n,o);return}I3(e,t,n,o)},R3=(e,t,n)=>{const o=e===""?t:u1(t,e);o.classGroupId=n},N3=(e,t,n,o)=>{if(O3(e)){ay(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(x3(n,e))},I3=(e,t,n,o)=>{const s=Object.entries(e),c=s.length;for(let u=0;u<c;u++){const[f,h]=s[u];ay(h,u1(t,f),n,o)}},u1=(e,t)=>{let n=e;const o=t.split(Dd),s=o.length;for(let c=0;c<s;c++){const u=o[c];let f=n.nextPart.get(u);f||(f=l1(),n.nextPart.set(u,f)),n=f}return n},O3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,k3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const s=(c,u)=>{n[c]=u,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(c){let u=n[c];if(u!==void 0)return u;if((u=o[c])!==void 0)return s(c,u),u},set(c,u){c in n?n[c]=u:s(c,u)}}},lg="!",ES=":",M3=[],TS=(e,t,n,o,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:s}),D3=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=s=>{const c=[];let u=0,f=0,h=0,p;const y=s.length;for(let S=0;S<y;S++){const A=s[S];if(u===0&&f===0){if(A===ES){c.push(s.slice(h,S)),h=S+1;continue}if(A==="/"){p=S;continue}}A==="["?u++:A==="]"?u--:A==="("?f++:A===")"&&f--}const g=c.length===0?s:s.slice(h);let b=g,x=!1;g.endsWith(lg)?(b=g.slice(0,-1),x=!0):g.startsWith(lg)&&(b=g.slice(1),x=!0);const C=p&&p>h?p-h:void 0;return TS(c,x,b,C)};if(t){const s=t+ES,c=o;o=u=>u.startsWith(s)?c(u.slice(s.length)):TS(M3,!1,u,void 0,!0)}if(n){const s=o;o=c=>n({className:c,parseClassName:s})}return o},j3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{const o=[];let s=[];for(let c=0;c<n.length;c++){const u=n[c],f=u[0]==="[",h=t.has(u);f||h?(s.length>0&&(s.sort(),o.push(...s),s=[]),o.push(u)):s.push(u)}return s.length>0&&(s.sort(),o.push(...s)),o}},L3=e=>({cache:k3(e.cacheSize),parseClassName:D3(e),sortModifiers:j3(e),..._3(e)}),z3=/\s+/,P3=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:s,sortModifiers:c}=t,u=[],f=e.trim().split(z3);let h="";for(let p=f.length-1;p>=0;p-=1){const y=f[p],{isExternal:g,modifiers:b,hasImportantModifier:x,baseClassName:C,maybePostfixModifierPosition:S}=n(y);if(g){h=y+(h.length>0?" "+h:h);continue}let A=!!S,I=o(A?C.substring(0,S):C);if(!I){if(!A){h=y+(h.length>0?" "+h:h);continue}if(I=o(C),!I){h=y+(h.length>0?" "+h:h);continue}A=!1}const k=b.length===0?"":b.length===1?b[0]:c(b).join(":"),R=x?k+lg:k,N=R+I;if(u.indexOf(N)>-1)continue;u.push(N);const j=s(I,A);for(let B=0;B<j.length;++B){const P=j[B];u.push(R+P)}h=y+(h.length>0?" "+h:h)}return h},$3=(...e)=>{let t=0,n,o,s="";for(;t<e.length;)(n=e[t++])&&(o=d1(n))&&(s&&(s+=" "),s+=o);return s},d1=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=d1(e[o]))&&(n&&(n+=" "),n+=t);return n},F3=(e,...t)=>{let n,o,s,c;const u=h=>{const p=t.reduce((y,g)=>g(y),e());return n=L3(p),o=n.cache.get,s=n.cache.set,c=f,f(h)},f=h=>{const p=o(h);if(p)return p;const y=P3(h,n);return s(h,y),y};return c=u,(...h)=>c($3(...h))},B3=[],Pt=e=>{const t=n=>n[e]||B3;return t.isThemeGetter=!0,t},f1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,h1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q3=/^\d+\/\d+$/,U3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,V3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Q3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Z3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Hs=e=>q3.test(e),Me=e=>!!e&&!Number.isNaN(Number(e)),qo=e=>!!e&&Number.isInteger(Number(e)),Nm=e=>e.endsWith("%")&&Me(e.slice(0,-1)),lo=e=>U3.test(e),G3=()=>!0,Y3=e=>V3.test(e)&&!H3.test(e),p1=()=>!1,K3=e=>Q3.test(e),X3=e=>Z3.test(e),J3=e=>!pe(e)&&!me(e),W3=e=>wa(e,y1,p1),pe=e=>f1.test(e),Oi=e=>wa(e,v1,Y3),Im=e=>wa(e,o4,Me),CS=e=>wa(e,m1,p1),e4=e=>wa(e,g1,X3),Xu=e=>wa(e,b1,K3),me=e=>h1.test(e),kl=e=>xa(e,v1),t4=e=>xa(e,i4),AS=e=>xa(e,m1),n4=e=>xa(e,y1),r4=e=>xa(e,g1),Ju=e=>xa(e,b1,!0),wa=(e,t,n)=>{const o=f1.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},xa=(e,t,n=!1)=>{const o=h1.exec(e);return o?o[1]?t(o[1]):n:!1},m1=e=>e==="position"||e==="percentage",g1=e=>e==="image"||e==="url",y1=e=>e==="length"||e==="size"||e==="bg-size",v1=e=>e==="length",o4=e=>e==="number",i4=e=>e==="family-name",b1=e=>e==="shadow",s4=()=>{const e=Pt("color"),t=Pt("font"),n=Pt("text"),o=Pt("font-weight"),s=Pt("tracking"),c=Pt("leading"),u=Pt("breakpoint"),f=Pt("container"),h=Pt("spacing"),p=Pt("radius"),y=Pt("shadow"),g=Pt("inset-shadow"),b=Pt("text-shadow"),x=Pt("drop-shadow"),C=Pt("blur"),S=Pt("perspective"),A=Pt("aspect"),I=Pt("ease"),k=Pt("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...N(),me,pe],B=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],M=()=>[me,pe,h],U=()=>[Hs,"full","auto",...M()],ee=()=>[qo,"none","subgrid",me,pe],ae=()=>["auto",{span:["full",qo,me,pe]},qo,me,pe],re=()=>[qo,"auto",me,pe],ue=()=>["auto","min","max","fr",me,pe],ce=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],he=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...M()],X=()=>[Hs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],Z=()=>[e,me,pe],oe=()=>[...N(),AS,CS,{position:[me,pe]}],be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",n4,W3,{size:[me,pe]}],Y=()=>[Nm,kl,Oi],ie=()=>["","none","full",p,me,pe],se=()=>["",Me,kl,Oi],de=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Me,Nm,AS,CS],_e=()=>["","none",C,me,pe],Te=()=>["none",Me,me,pe],Ce=()=>["none",Me,me,pe],Ie=()=>[Me,me,pe],je=()=>[Hs,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[lo],breakpoint:[lo],color:[G3],container:[lo],"drop-shadow":[lo],ease:["in","out","in-out"],font:[J3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[lo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[lo],shadow:[lo],spacing:["px",Me],text:[lo],"text-shadow":[lo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Hs,pe,me,A]}],container:["container"],columns:[{columns:[Me,pe,me,f]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[qo,"auto",me,pe]}],basis:[{basis:[Hs,"full","auto",f,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Me,Hs,"auto","initial","none",pe]}],grow:[{grow:["",Me,me,pe]}],shrink:[{shrink:["",Me,me,pe]}],order:[{order:[qo,"first","last","none",me,pe]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:ae()}],"col-start":[{"col-start":re()}],"col-end":[{"col-end":re()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:ae()}],"row-start":[{"row-start":re()}],"row-end":[{"row-end":re()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...he(),"normal"]}],"justify-self":[{"justify-self":["auto",...he()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...he(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...he(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...he(),"baseline"]}],"place-self":[{"place-self":["auto",...he()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[f,"screen",...X()]}],"min-w":[{"min-w":[f,"screen","none",...X()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,kl,Oi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,me,Im]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Nm,pe]}],"font-family":[{font:[t4,pe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,me,pe]}],"line-clamp":[{"line-clamp":[Me,"none",me,Im]}],leading:[{leading:[c,...M()]}],"list-image":[{"list-image":["none",me,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Z()}],"text-color":[{text:Z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Me,"from-font","auto",me,Oi]}],"text-decoration-color":[{decoration:Z()}],"underline-offset":[{"underline-offset":[Me,"auto",me,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",me,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:be()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qo,me,pe],radial:["",me,pe],conic:[qo,me,pe]},r4,e4]}],"bg-color":[{bg:Z()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:Z()}],"gradient-via":[{via:Z()}],"gradient-to":[{to:Z()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:Z()}],"border-color-x":[{"border-x":Z()}],"border-color-y":[{"border-y":Z()}],"border-color-s":[{"border-s":Z()}],"border-color-e":[{"border-e":Z()}],"border-color-t":[{"border-t":Z()}],"border-color-r":[{"border-r":Z()}],"border-color-b":[{"border-b":Z()}],"border-color-l":[{"border-l":Z()}],"divide-color":[{divide:Z()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Me,me,pe]}],"outline-w":[{outline:["",Me,kl,Oi]}],"outline-color":[{outline:Z()}],shadow:[{shadow:["","none",y,Ju,Xu]}],"shadow-color":[{shadow:Z()}],"inset-shadow":[{"inset-shadow":["none",g,Ju,Xu]}],"inset-shadow-color":[{"inset-shadow":Z()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Z()}],"ring-offset-w":[{"ring-offset":[Me,Oi]}],"ring-offset-color":[{"ring-offset":Z()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":Z()}],"text-shadow":[{"text-shadow":["none",b,Ju,Xu]}],"text-shadow-color":[{"text-shadow":Z()}],opacity:[{opacity:[Me,me,pe]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Me]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":Z()}],"mask-image-linear-to-color":[{"mask-linear-to":Z()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":Z()}],"mask-image-t-to-color":[{"mask-t-to":Z()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":Z()}],"mask-image-r-to-color":[{"mask-r-to":Z()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":Z()}],"mask-image-b-to-color":[{"mask-b-to":Z()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":Z()}],"mask-image-l-to-color":[{"mask-l-to":Z()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":Z()}],"mask-image-x-to-color":[{"mask-x-to":Z()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":Z()}],"mask-image-y-to-color":[{"mask-y-to":Z()}],"mask-image-radial":[{"mask-radial":[me,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":Z()}],"mask-image-radial-to-color":[{"mask-radial-to":Z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Me]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":Z()}],"mask-image-conic-to-color":[{"mask-conic-to":Z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:be()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",me,pe]}],filter:[{filter:["","none",me,pe]}],blur:[{blur:_e()}],brightness:[{brightness:[Me,me,pe]}],contrast:[{contrast:[Me,me,pe]}],"drop-shadow":[{"drop-shadow":["","none",x,Ju,Xu]}],"drop-shadow-color":[{"drop-shadow":Z()}],grayscale:[{grayscale:["",Me,me,pe]}],"hue-rotate":[{"hue-rotate":[Me,me,pe]}],invert:[{invert:["",Me,me,pe]}],saturate:[{saturate:[Me,me,pe]}],sepia:[{sepia:["",Me,me,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",me,pe]}],"backdrop-blur":[{"backdrop-blur":_e()}],"backdrop-brightness":[{"backdrop-brightness":[Me,me,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Me,me,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Me,me,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Me,me,pe]}],"backdrop-invert":[{"backdrop-invert":["",Me,me,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Me,me,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Me,me,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Me,me,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",me,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Me,"initial",me,pe]}],ease:[{ease:["linear","initial",I,me,pe]}],delay:[{delay:[Me,me,pe]}],animate:[{animate:["none",k,me,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,me,pe]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:Te()}],"rotate-x":[{"rotate-x":Te()}],"rotate-y":[{"rotate-y":Te()}],"rotate-z":[{"rotate-z":Te()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[me,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:Z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",me,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",me,pe]}],fill:[{fill:["none",...Z()]}],"stroke-w":[{stroke:[Me,kl,Oi,Im]}],stroke:[{stroke:["none",...Z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},a4=F3(s4);function De(...e){return a4(a1(e))}function cg(e,t){if(typeof Convex>"u"||Convex.syscall===void 0)throw new Error("The Convex database and auth objects are being used outside of a Convex backend. Did you mean to use `useQuery` or `useMutation` to call a Convex function?");const n=Convex.syscall(e,JSON.stringify(t));return JSON.parse(n)}async function Jt(e,t){if(typeof Convex>"u"||Convex.asyncSyscall===void 0)throw new Error("The Convex database and auth objects are being used outside of a Convex backend. Did you mean to use `useQuery` or `useMutation` to call a Convex function?");let n;try{n=await Convex.asyncSyscall(e,JSON.stringify(t))}catch(o){if(o.data!==void 0){const s=new Id(o.message);throw s.data=Wt(o.data),s}throw new Error(o.message)}return JSON.parse(n)}function ft(e,t,n,o){if(e===void 0)throw new TypeError(`Must provide arg ${t} \`${o}\` to \`${n}\``)}function l4(e,t,n,o){if(!Number.isInteger(e)||e<0)throw new TypeError(`Arg ${t} \`${o}\` to \`${n}\` must be a non-negative integer`)}function w1(e){return{getUserIdentity:async()=>await Jt("1.0/getUserIdentity",{requestId:e})}}var c4=Object.defineProperty,u4=(e,t,n)=>t in e?c4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RS=(e,t,n)=>u4(e,typeof t!="symbol"?t+"":t,n);class d4{constructor(){RS(this,"_isExpression"),RS(this,"_value")}}var f4=Object.defineProperty,h4=(e,t,n)=>t in e?f4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p4=(e,t,n)=>h4(e,t+"",n);class Xt extends d4{constructor(t){super(),p4(this,"inner"),this.inner=t}serialize(){return this.inner}}function ot(e){return e instanceof Xt?e.serialize():{$literal:ki(e)}}const m4={eq(e,t){return new Xt({$eq:[ot(e),ot(t)]})},neq(e,t){return new Xt({$neq:[ot(e),ot(t)]})},lt(e,t){return new Xt({$lt:[ot(e),ot(t)]})},lte(e,t){return new Xt({$lte:[ot(e),ot(t)]})},gt(e,t){return new Xt({$gt:[ot(e),ot(t)]})},gte(e,t){return new Xt({$gte:[ot(e),ot(t)]})},add(e,t){return new Xt({$add:[ot(e),ot(t)]})},sub(e,t){return new Xt({$sub:[ot(e),ot(t)]})},mul(e,t){return new Xt({$mul:[ot(e),ot(t)]})},div(e,t){return new Xt({$div:[ot(e),ot(t)]})},mod(e,t){return new Xt({$mod:[ot(e),ot(t)]})},neg(e){return new Xt({$neg:ot(e)})},and(...e){return new Xt({$and:e.map(ot)})},or(...e){return new Xt({$or:e.map(ot)})},not(e){return new Xt({$not:ot(e)})},field(e){return new Xt({$field:e})}};var g4=Object.defineProperty,y4=(e,t,n)=>t in e?g4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v4=(e,t,n)=>y4(e,t+"",n);class b4{constructor(){v4(this,"_isIndexRange")}}var w4=Object.defineProperty,x4=(e,t,n)=>t in e?w4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NS=(e,t,n)=>x4(e,typeof t!="symbol"?t+"":t,n);class Ho extends b4{constructor(t){super(),NS(this,"rangeExpressions"),NS(this,"isConsumed"),this.rangeExpressions=t,this.isConsumed=!1}static new(){return new Ho([])}consume(){if(this.isConsumed)throw new Error("IndexRangeBuilder has already been used! Chain your method calls like `q => q.eq(...).eq(...)`. See https://docs.convex.dev/using/indexes");this.isConsumed=!0}eq(t,n){return this.consume(),new Ho(this.rangeExpressions.concat({type:"Eq",fieldPath:t,value:ki(n)}))}gt(t,n){return this.consume(),new Ho(this.rangeExpressions.concat({type:"Gt",fieldPath:t,value:ki(n)}))}gte(t,n){return this.consume(),new Ho(this.rangeExpressions.concat({type:"Gte",fieldPath:t,value:ki(n)}))}lt(t,n){return this.consume(),new Ho(this.rangeExpressions.concat({type:"Lt",fieldPath:t,value:ki(n)}))}lte(t,n){return this.consume(),new Ho(this.rangeExpressions.concat({type:"Lte",fieldPath:t,value:ki(n)}))}export(){return this.consume(),this.rangeExpressions}}var S4=Object.defineProperty,_4=(e,t,n)=>t in e?S4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E4=(e,t,n)=>_4(e,t+"",n);class T4{constructor(){E4(this,"_isSearchFilter")}}var C4=Object.defineProperty,A4=(e,t,n)=>t in e?C4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IS=(e,t,n)=>A4(e,typeof t!="symbol"?t+"":t,n);class Hl extends T4{constructor(t){super(),IS(this,"filters"),IS(this,"isConsumed"),this.filters=t,this.isConsumed=!1}static new(){return new Hl([])}consume(){if(this.isConsumed)throw new Error("SearchFilterBuilder has already been used! Chain your method calls like `q => q.search(...).eq(...)`.");this.isConsumed=!0}search(t,n){return ft(t,1,"search","fieldName"),ft(n,2,"search","query"),this.consume(),new Hl(this.filters.concat({type:"Search",fieldPath:t,value:n}))}eq(t,n){return ft(t,1,"eq","fieldName"),arguments.length!==2&&ft(n,2,"search","value"),this.consume(),new Hl(this.filters.concat({type:"Eq",fieldPath:t,value:ki(n)}))}export(){return this.consume(),this.filters}}var R4=Object.defineProperty,N4=(e,t,n)=>t in e?R4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ug=(e,t,n)=>N4(e,typeof t!="symbol"?t+"":t,n);const OS=256;class x1{constructor(t){ug(this,"tableName"),this.tableName=t}withIndex(t,n){ft(t,1,"withIndex","indexName");let o=Ho.new();return n!==void 0&&(o=n(o)),new Ko({source:{type:"IndexRange",indexName:this.tableName+"."+t,range:o.export(),order:null},operators:[]})}withSearchIndex(t,n){ft(t,1,"withSearchIndex","indexName"),ft(n,2,"withSearchIndex","searchFilter");const o=Hl.new();return new Ko({source:{type:"Search",indexName:this.tableName+"."+t,filters:n(o).export()},operators:[]})}fullTableScan(){return new Ko({source:{type:"FullTableScan",tableName:this.tableName,order:null},operators:[]})}order(t){return this.fullTableScan().order(t)}async count(){const t=await Jt("1.0/count",{table:this.tableName});return Wt(t)}filter(t){return this.fullTableScan().filter(t)}limit(t){return this.fullTableScan().limit(t)}collect(){return this.fullTableScan().collect()}take(t){return this.fullTableScan().take(t)}paginate(t){return this.fullTableScan().paginate(t)}first(){return this.fullTableScan().first()}unique(){return this.fullTableScan().unique()}[Symbol.asyncIterator](){return this.fullTableScan()[Symbol.asyncIterator]()}}function kS(e){throw new Error(e==="consumed"?"This query is closed and can't emit any more values.":"This query has been chained with another operator and can't be reused.")}class Ko{constructor(t){ug(this,"state"),ug(this,"tableNameForErrorMessages"),this.state={type:"preparing",query:t},t.source.type==="FullTableScan"?this.tableNameForErrorMessages=t.source.tableName:this.tableNameForErrorMessages=t.source.indexName.split(".")[0]}takeQuery(){if(this.state.type!=="preparing")throw new Error("A query can only be chained once and can't be chained after iteration begins.");const t=this.state.query;return this.state={type:"closed"},t}startQuery(){if(this.state.type==="executing")throw new Error("Iteration can only begin on a query once.");(this.state.type==="closed"||this.state.type==="consumed")&&kS(this.state.type);const t=this.state.query,{queryId:n}=cg("1.0/queryStream",{query:t,version:vr});return this.state={type:"executing",queryId:n},n}closeQuery(){if(this.state.type==="executing"){const t=this.state.queryId;cg("1.0/queryCleanup",{queryId:t})}this.state={type:"consumed"}}order(t){ft(t,1,"order","order");const n=this.takeQuery();if(n.source.type==="Search")throw new Error("Search queries must always be in relevance order. Can not set order manually.");if(n.source.order!==null)throw new Error("Queries may only specify order at most once");return n.source.order=t,new Ko(n)}filter(t){ft(t,1,"filter","predicate");const n=this.takeQuery();if(n.operators.length>=OS)throw new Error(`Can't construct query with more than ${OS} operators`);return n.operators.push({filter:ot(t(m4))}),new Ko(n)}limit(t){ft(t,1,"limit","n");const n=this.takeQuery();return n.operators.push({limit:t}),new Ko(n)}[Symbol.asyncIterator](){return this.startQuery(),this}async next(){(this.state.type==="closed"||this.state.type==="consumed")&&kS(this.state.type);const t=this.state.type==="preparing"?this.startQuery():this.state.queryId,{value:n,done:o}=await Jt("1.0/queryStreamNext",{queryId:t});return o&&this.closeQuery(),{value:Wt(n),done:o}}return(){return this.closeQuery(),Promise.resolve({done:!0,value:void 0})}async paginate(t){if(ft(t,1,"paginate","options"),typeof t?.numItems!="number"||t.numItems<0)throw new Error(`\`options.numItems\` must be a positive number. Received \`${t?.numItems}\`.`);const n=this.takeQuery(),o=t.numItems,s=t.cursor,c=t?.endCursor??null,u=t.maximumRowsRead??null,{page:f,isDone:h,continueCursor:p,splitCursor:y,pageStatus:g}=await Jt("1.0/queryPage",{query:n,cursor:s,endCursor:c,pageSize:o,maximumRowsRead:u,maximumBytesRead:t.maximumBytesRead,version:vr});return{page:f.map(b=>Wt(b)),isDone:h,continueCursor:p,splitCursor:y,pageStatus:g}}async collect(){const t=[];for await(const n of this)t.push(n);return t}async take(t){return ft(t,1,"take","n"),l4(t,1,"take","n"),this.limit(t).collect()}async first(){const t=await this.take(1);return t.length===0?null:t[0]}async unique(){const t=await this.take(2);if(t.length===0)return null;if(t.length===2)throw new Error(`unique() query returned more than one result from table ${this.tableNameForErrorMessages}:
20
+ [${t[0]._id}, ${t[1]._id}, ...]`);return t[0]}}async function dg(e,t,n){if(ft(t,1,"get","id"),typeof t!="string")throw new Error(`Invalid argument \`id\` for \`db.get\`, expected string but got '${typeof t}': ${t}`);const o={id:ut(t),isSystem:n,version:vr,table:e},s=await Jt("1.0/get",o);return Wt(s)}function S1(){const e=(s=!1)=>({get:async(c,u)=>u!==void 0?await dg(c,u,s):await dg(void 0,c,s),query:c=>new mg(c,s).query(),normalizeId:(c,u)=>{ft(c,1,"normalizeId","tableName"),ft(u,2,"normalizeId","id");const f=c.startsWith("_");if(f!==s)throw new Error(`${f?"System":"User"} tables can only be accessed from db.${s?"":"system."}normalizeId().`);const h=cg("1.0/db/normalizeId",{table:c,idString:u});return Wt(h).id},system:null,table:c=>new mg(c,s)}),{system:t,...n}=e(!0),o=e();return o.system=n,o}async function _1(e,t){if(e.startsWith("_"))throw new Error("System tables (prefixed with `_`) are read-only.");ft(e,1,"insert","table"),ft(t,2,"insert","value");const n=await Jt("1.0/insert",{table:e,value:ut(t)});return Wt(n)._id}async function fg(e,t,n){ft(t,1,"patch","id"),ft(n,2,"patch","value"),await Jt("1.0/shallowMerge",{id:ut(t),value:az(n),table:e})}async function hg(e,t,n){ft(t,1,"replace","id"),ft(n,2,"replace","value"),await Jt("1.0/replace",{id:ut(t),value:ut(n),table:e})}async function pg(e,t){ft(t,1,"delete","id"),await Jt("1.0/remove",{id:ut(t),table:e})}function I4(){const e=S1();return{get:e.get,query:e.query,normalizeId:e.normalizeId,system:e.system,insert:async(t,n)=>await _1(t,n),patch:async(t,n,o)=>o!==void 0?await fg(t,n,o):await fg(void 0,t,n),replace:async(t,n,o)=>o!==void 0?await hg(t,n,o):await hg(void 0,t,n),delete:async(t,n)=>n!==void 0?await pg(t,n):await pg(void 0,t),table:t=>new O4(t,!1)}}class mg{constructor(t,n){this.tableName=t,this.isSystem=n}async get(t){return dg(this.tableName,t,this.isSystem)}query(){const t=this.tableName.startsWith("_");if(t!==this.isSystem)throw new Error(`${t?"System":"User"} tables can only be accessed from db.${this.isSystem?"":"system."}query().`);return new x1(this.tableName)}}class O4 extends mg{async insert(t){return _1(this.tableName,t)}async patch(t,n){return fg(this.tableName,t,n)}async replace(t,n){return hg(this.tableName,t,n)}async delete(t){return pg(this.tableName,t)}}function k4(){return{runAfter:async(e,t,n)=>{const o=M4(e,t,n);return await Jt("1.0/schedule",o)},runAt:async(e,t,n)=>{const o=D4(e,t,n);return await Jt("1.0/schedule",o)},cancel:async e=>{ft(e,1,"cancel","id");const t={id:ut(e)};await Jt("1.0/cancel_job",t)}}}function M4(e,t,n){if(typeof e!="number")throw new Error("`delayMs` must be a number");if(!isFinite(e))throw new Error("`delayMs` must be a finite number");if(e<0)throw new Error("`delayMs` must be non-negative");const o=sr(n),s=lf(t),c=(Date.now()+e)/1e3;return{...s,ts:c,args:ut(o),version:vr}}function D4(e,t,n){let o;if(e instanceof Date)o=e.valueOf()/1e3;else if(typeof e=="number")o=e/1e3;else throw new Error("The invoke time must a Date or a timestamp");const s=lf(t),c=sr(n);return{...s,ts:o,args:ut(c),version:vr}}function E1(e){return{getUrl:async t=>(ft(t,1,"getUrl","storageId"),await Jt("1.0/storageGetUrl",{requestId:e,version:vr,storageId:t})),getMetadata:async t=>await Jt("1.0/storageGetMetadata",{requestId:e,version:vr,storageId:t})}}function j4(e){const t=E1(e);return{generateUploadUrl:async()=>await Jt("1.0/storageGenerateUploadUrl",{requestId:e,version:vr}),delete:async n=>{await Jt("1.0/storageDelete",{requestId:e,version:vr,storageId:n})},getUrl:t.getUrl,getMetadata:t.getMetadata}}async function T1(e,t){const o=Wt(JSON.parse(t)),s={db:I4(),auth:w1(""),storage:j4(""),scheduler:k4(),runQuery:(u,f)=>gg("query",u,f),runMutation:(u,f)=>gg("mutation",u,f)},c=await A1(e,s,o);return C1(c),JSON.stringify(ut(c===void 0?null:c))}function C1(e){if(e instanceof x1||e instanceof Ko)throw new Error("Return value is a Query. Results must be retrieved with `.collect()`, `.take(n), `.unique()`, or `.first()`.")}async function A1(e,t,n){let o;try{o=await Promise.resolve(e(t,...n))}catch(s){throw L4(s)}return o}function cf(e,t){return(n,o)=>(globalThis.console.warn(`Convex functions should not directly call other Convex functions. Consider calling a helper function instead. e.g. \`export const foo = ${e}(...); await foo(ctx);\` is not supported. See https://docs.convex.dev/production/best-practices/#use-helper-functions-to-write-shared-code`),t(n,o))}function L4(e){if(typeof e=="object"&&e!==null&&Symbol.for("ConvexError")in e){const t=e;return t.data=JSON.stringify(ut(t.data===void 0?null:t.data)),t.ConvexErrorSymbol=Symbol.for("ConvexError"),t}else return e}function uf(){if(typeof window>"u"||window.__convexAllowFunctionsInBrowser)return;(Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1)&&console.error("Convex functions should not be imported in the browser. This will throw an error in future versions of `convex`. If this is a false negative, please report it to Convex support.")}function R1(e,t){if(t===void 0)throw new Error(`A validator is undefined for field "${e}". This is often caused by circular imports. See https://docs.convex.dev/error#undefined-validator for details.`);return t}function df(e){return()=>{let t=a.any();return typeof e=="object"&&e.args!==void 0&&(t=MT(e.args)),JSON.stringify(t.json,R1)}}function ff(e){return()=>{let t;return typeof e=="object"&&e.returns!==void 0&&(t=MT(e.returns)),JSON.stringify(t?t.json:null,R1)}}const z4=(e=>{const t=typeof e=="function"?e:e.handler,n=cf("mutation",t);return uf(),n.isMutation=!0,n.isPublic=!0,n.invokeMutation=o=>T1(t,o),n.exportArgs=df(e),n.exportReturns=ff(e),n._handler=t,n}),P4=(e=>{const t=typeof e=="function"?e:e.handler,n=cf("internalMutation",t);return uf(),n.isMutation=!0,n.isInternal=!0,n.invokeMutation=o=>T1(t,o),n.exportArgs=df(e),n.exportReturns=ff(e),n._handler=t,n});async function N1(e,t){const o=Wt(JSON.parse(t)),s={db:S1(),auth:w1(""),storage:E1(""),runQuery:(u,f)=>gg("query",u,f)},c=await A1(e,s,o);return C1(c),JSON.stringify(ut(c===void 0?null:c))}const $4=(e=>{const t=typeof e=="function"?e:e.handler,n=cf("query",t);return uf(),n.isQuery=!0,n.isPublic=!0,n.invokeQuery=o=>N1(t,o),n.exportArgs=df(e),n.exportReturns=ff(e),n._handler=t,n}),F4=(e=>{const t=typeof e=="function"?e:e.handler,n=cf("internalQuery",t);return uf(),n.isQuery=!0,n.isInternal=!0,n.invokeQuery=o=>N1(t,o),n.exportArgs=df(e),n.exportReturns=ff(e),n._handler=t,n});async function gg(e,t,n){const o=sr(n),s={udfType:e,args:ut(o),...lf(t)},c=await Jt("1.0/runUdf",s);return Wt(c)}const Sa=a.object({numItems:a.number(),cursor:a.union(a.string(),a.null()),endCursor:a.optional(a.union(a.string(),a.null())),id:a.optional(a.number()),maximumRowsRead:a.optional(a.number()),maximumBytesRead:a.optional(a.number())});function I1(e,t){const n={get(o,s){if(typeof s=="string"){const c=[...t,s];return I1(e,c)}else if(s===FT){if(t.length<1){const c=[e,...t].join(".");throw new Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${c}\``)}return"_reference/childComponent/"+t.join("/")}else return}};return new Proxy({},n)}const O1=()=>I1("components",[]);var B4=Object.defineProperty,q4=(e,t,n)=>t in e?B4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rr=(e,t,n)=>q4(e,typeof t!="symbol"?t+"":t,n);class MS{constructor(t){Rr(this,"indexes"),Rr(this,"stagedDbIndexes"),Rr(this,"searchIndexes"),Rr(this,"stagedSearchIndexes"),Rr(this,"vectorIndexes"),Rr(this,"stagedVectorIndexes"),Rr(this,"validator"),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=t}" indexes"(){return this.indexes}index(t,n){return Array.isArray(n)?this.indexes.push({indexDescriptor:t,fields:n}):n.staged?this.stagedDbIndexes.push({indexDescriptor:t,fields:n.fields}):this.indexes.push({indexDescriptor:t,fields:n.fields}),this}searchIndex(t,n){return n.staged?this.stagedSearchIndexes.push({indexDescriptor:t,searchField:n.searchField,filterFields:n.filterFields||[]}):this.searchIndexes.push({indexDescriptor:t,searchField:n.searchField,filterFields:n.filterFields||[]}),this}vectorIndex(t,n){return n.staged?this.stagedVectorIndexes.push({indexDescriptor:t,vectorField:n.vectorField,dimensions:n.dimensions,filterFields:n.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:t,vectorField:n.vectorField,dimensions:n.dimensions,filterFields:n.filterFields||[]}),this}self(){return this}export(){const t=this.validator.json;if(typeof t!="object")throw new Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:t}}}function on(e){return kT(e)?new MS(e):new MS(a.object(e))}class U4{constructor(t,n){Rr(this,"tables"),Rr(this,"strictTableNameTypes"),Rr(this,"schemaValidation"),this.tables=t,this.schemaValidation=n?.schemaValidation===void 0?!0:n.schemaValidation}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([t,n])=>{const{indexes:o,stagedDbIndexes:s,searchIndexes:c,stagedSearchIndexes:u,vectorIndexes:f,stagedVectorIndexes:h,documentType:p}=n.export();return{tableName:t,indexes:o,stagedDbIndexes:s,searchIndexes:c,stagedSearchIndexes:u,vectorIndexes:f,stagedVectorIndexes:h,documentType:p}}),schemaValidation:this.schemaValidation})}}function k1(e,t){return new U4(e,t)}k1({_scheduled_functions:on({name:a.string(),args:a.array(a.any()),scheduledTime:a.float64(),completedTime:a.optional(a.float64()),state:a.union(a.object({kind:a.literal("pending")}),a.object({kind:a.literal("inProgress")}),a.object({kind:a.literal("success")}),a.object({kind:a.literal("failed"),error:a.string()}),a.object({kind:a.literal("canceled")}))}),_storage:on({sha256:a.string(),size:a.float64(),contentType:a.optional(a.string())})});const DS=["text","richText","number","boolean","date","datetime","reference","media","json","select","multiSelect","tags","category"],V4=a.union(a.literal("text"),a.literal("richText"),a.literal("number"),a.literal("boolean"),a.literal("date"),a.literal("datetime"),a.literal("reference"),a.literal("media"),a.literal("json"),a.literal("select"),a.literal("multiSelect"),a.literal("tags"),a.literal("category")),wt=a.string(),ly=a.union(a.literal("image"),a.literal("video"),a.literal("audio"),a.literal("document"),a.literal("other")),_a=a.union(a.literal("thumbnail"),a.literal("responsive"),a.literal("format")),cy=a.union(a.literal("pending"),a.literal("processing"),a.literal("completed"),a.literal("failed")),Rn={name:a.string(),label:a.string(),required:a.boolean(),searchable:a.optional(a.boolean()),localized:a.optional(a.boolean()),description:a.optional(a.string()),defaultValue:a.optional(a.any())},M1=a.object({...Rn,type:a.literal("text"),options:a.optional(a.object({minLength:a.optional(a.number()),maxLength:a.optional(a.number()),pattern:a.optional(a.string())}))}),D1=a.object({...Rn,type:a.literal("number"),options:a.optional(a.object({min:a.optional(a.number()),max:a.optional(a.number()),step:a.optional(a.number()),precision:a.optional(a.number())}))}),j1=a.object({...Rn,type:a.literal("boolean"),options:a.optional(a.object({trueLabel:a.optional(a.string()),falseLabel:a.optional(a.string())}))}),L1=a.object({...Rn,type:a.literal("richText"),options:a.optional(a.object({allowedBlocks:a.optional(a.array(a.string())),allowedMarks:a.optional(a.array(a.string()))}))}),z1=a.object({...Rn,type:a.literal("media"),options:a.optional(a.object({mediaType:a.optional(ly),allowedMimeTypes:a.optional(a.array(a.string())),maxFileSize:a.optional(a.number()),multiple:a.optional(a.boolean())}))}),P1=a.object({...Rn,type:a.literal("select"),options:a.optional(a.object({options:a.optional(a.array(a.object({value:a.string(),label:a.string()})))}))}),H4=a.object({...Rn,type:a.literal("tags"),options:a.optional(a.object({taxonomyId:a.optional(a.id("taxonomies")),allowCreate:a.optional(a.boolean()),maxTags:a.optional(a.number()),minTags:a.optional(a.number())}))}),$1=a.object({...Rn,type:a.literal("category"),options:a.optional(a.object({allowMultiple:a.optional(a.boolean())}))}),F1=a.object({...Rn,type:a.literal("json"),options:a.optional(a.object({schema:a.optional(a.any())}))}),B1=a.object({...Rn,type:a.literal("reference"),options:a.optional(a.object({allowedContentTypes:a.optional(a.array(a.string())),multiple:a.optional(a.boolean()),minItems:a.optional(a.number())}))}),q1=a.object({...Rn,type:a.literal("multiSelect"),options:a.optional(a.object({options:a.optional(a.array(a.object({value:a.string(),label:a.string()})))}))}),U1=a.object({...Rn,type:a.literal("date"),options:a.optional(a.object({min:a.optional(a.number()),max:a.optional(a.number())}))}),V1=a.object({...Rn,type:a.literal("datetime"),options:a.optional(a.object({min:a.optional(a.number()),max:a.optional(a.number())}))}),uy=a.union(M1,D1,j1,L1,z1,P1,q1,H4,$1,F1,U1,V1,B1),Q4={name:a.string(),displayName:a.string(),createdBy:a.string(),description:a.optional(a.string()),fields:a.array(uy),icon:a.optional(a.string()),singleton:a.optional(a.boolean()),slugField:a.optional(a.string()),titleField:a.optional(a.string()),sortOrder:a.optional(a.number()),isActive:a.boolean(),deletedAt:a.optional(a.number()),updatedBy:a.optional(a.string())},Z4={contentTypeName:a.string(),slug:a.string(),status:wt,data:a.any(),locale:a.optional(a.string()),primaryEntryId:a.optional(a.id("contentEntries")),version:a.number(),scheduledPublishAt:a.optional(a.number()),firstPublishedAt:a.optional(a.number()),lastPublishedAt:a.optional(a.number()),lockedBy:a.optional(a.string()),lockExpiresAt:a.optional(a.number()),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string()),updatedBy:a.optional(a.string()),searchText:a.optional(a.string())},G4={entryId:a.id("contentEntries"),versionNumber:a.number(),data:a.any(),slug:a.string(),status:wt,changeDescription:a.optional(a.string()),createdBy:a.optional(a.string()),wasPublished:a.boolean(),publishedAt:a.optional(a.number())},jd={name:a.string(),title:a.optional(a.string()),description:a.optional(a.string()),parentId:a.optional(a.id("mediaItems")),path:a.string(),tags:a.optional(a.array(a.string())),size:a.optional(a.number()),metadata:a.optional(a.record(a.string(),a.any())),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string()),updatedBy:a.optional(a.string()),searchText:a.optional(a.string())},H1={kind:a.literal("asset"),storageId:a.id("_storage"),mimeType:a.string(),width:a.optional(a.number()),height:a.optional(a.number()),duration:a.optional(a.number()),altText:a.optional(a.string())},Q1={kind:a.literal("folder"),sortOrder:a.optional(a.number())},hf=a.object({...jd,...H1}),Z1=a.object({...jd,...Q1});a.union(hf,Z1);const Y4={assetId:a.id("mediaItems"),storageId:a.id("_storage"),variantType:a.union(a.literal("thumbnail"),a.literal("responsive"),a.literal("format")),width:a.optional(a.number()),height:a.optional(a.number()),format:a.string(),mimeType:a.string(),size:a.number(),quality:a.optional(a.number()),preset:a.optional(a.string()),autoGenerated:a.boolean(),status:a.union(a.literal("pending"),a.literal("processing"),a.literal("completed"),a.literal("failed")),errorMessage:a.optional(a.string()),processingStartedAt:a.optional(a.number()),processingCompletedAt:a.optional(a.number()),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string())},K4={name:a.string(),displayName:a.string(),description:a.optional(a.string()),isHierarchical:a.boolean(),allowInlineCreation:a.boolean(),icon:a.optional(a.string()),sortOrder:a.optional(a.number()),isActive:a.boolean(),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string()),updatedBy:a.optional(a.string())},X4={taxonomyId:a.id("taxonomies"),slug:a.string(),name:a.string(),description:a.optional(a.string()),parentId:a.optional(a.id("taxonomyTerms")),path:a.optional(a.string()),depth:a.number(),color:a.optional(a.string()),icon:a.optional(a.string()),sortOrder:a.optional(a.number()),usageCount:a.number(),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string()),updatedBy:a.optional(a.string()),searchText:a.optional(a.string())},ln=k1({contentTypes:on({...Q4}).index("by_name",["name"]).index("by_active",["isActive"]).index("by_deleted",["deletedAt"]),contentEntries:on({...Z4}).index("by_content_type",["contentTypeName"]).index("by_content_type_and_slug",["contentTypeName","slug"]).index("by_status",["status"]).index("by_content_type_and_status",["contentTypeName","status"]).index("by_primary_entry",["primaryEntryId"]).index("by_locale",["locale"]).index("by_deleted",["deletedAt"]).index("by_scheduled_publish",["status","scheduledPublishAt"]).index("by_locked",["lockedBy"]).searchIndex("search_content",{searchField:"searchText",filterFields:["contentTypeName","status","locale"]}),contentVersions:on({...G4}).index("by_entry",["entryId"]).index("by_entry_and_version",["entryId","versionNumber"]).index("by_entry_and_published",["entryId","wasPublished"]),mediaItems:on(a.union(a.object({...jd,...H1}),a.object({...jd,...Q1}))).index("by_parent",["parentId"]).index("by_path",["path"]).index("by_kind",["kind"]).index("by_kind_and_parent",["kind","parentId"]).index("by_storage_id",["storageId"]).index("by_mime_type",["mimeType"]).index("by_deleted",["deletedAt"]).searchIndex("search_media",{searchField:"searchText"}),mediaVariants:on({...Y4}).index("by_asset",["assetId"]).index("by_asset_and_type",["assetId","variantType"]).index("by_asset_and_preset",["assetId","preset"]).index("by_asset_and_format",["assetId","format"]).index("by_status",["status"]).index("by_deleted",["deletedAt"]),taxonomies:on({...K4}).index("by_name",["name"]).index("by_active",["isActive"]).index("by_deleted",["deletedAt"]),taxonomyTerms:on({...X4}).index("by_taxonomy",["taxonomyId"]).index("by_taxonomy_and_slug",["taxonomyId","slug"]).index("by_parent",["parentId"]).index("by_taxonomy_and_path",["taxonomyId","path"]).index("by_deleted",["deletedAt"]).index("by_taxonomy_and_usage",["taxonomyId","usageCount"]).searchIndex("search_terms",{searchField:"searchText",filterFields:["taxonomyId"]}),contentEntryTags:on({entryId:a.id("contentEntries"),termId:a.id("taxonomyTerms"),taxonomyId:a.id("taxonomies"),fieldName:a.string(),sortOrder:a.optional(a.number())}).index("by_entry",["entryId"]).index("by_term",["termId"]).index("by_taxonomy",["taxonomyId"]).index("by_entry_and_field",["entryId","fieldName"]).index("by_taxonomy_and_term",["taxonomyId","termId"]),mediaAssetTags:on({mediaId:a.id("mediaItems"),termId:a.id("taxonomyTerms"),taxonomyId:a.id("taxonomies"),sortOrder:a.optional(a.number())}).index("by_media",["mediaId"]).index("by_term",["termId"]).index("by_taxonomy",["taxonomyId"]).index("by_media_and_taxonomy",["mediaId","taxonomyId"]).index("by_taxonomy_and_term",["taxonomyId","termId"]),trashConfig:on({retentionDays:a.number(),autoCleanupEnabled:a.boolean(),lastCleanupAt:a.optional(a.number()),lastCleanupCount:a.optional(a.number()),updatedBy:a.optional(a.string())}),cmsEvents:on({eventType:a.string(),resourceType:a.union(a.literal("contentEntry"),a.literal("contentType"),a.literal("mediaAsset"),a.literal("mediaFolder")),resourceId:a.string(),action:a.union(a.literal("created"),a.literal("updated"),a.literal("published"),a.literal("unpublished"),a.literal("deleted"),a.literal("restored"),a.literal("duplicated"),a.literal("scheduled")),payload:a.any(),userId:a.optional(a.string()),processed:a.boolean(),processedAt:a.optional(a.number()),correlationId:a.optional(a.string()),metadata:a.optional(a.any())}).index("by_event_type",["eventType"]).index("by_resource",["resourceType","resourceId"]).index("by_processed",["processed"]).index("by_user",["userId"]).index("by_correlation_id",["correlationId"]),webhookConfigs:on({name:a.string(),description:a.optional(a.string()),url:a.string(),secret:a.optional(a.string()),eventTypes:a.array(a.string()),resourceTypes:a.optional(a.array(a.union(a.literal("contentEntry"),a.literal("contentType"),a.literal("mediaAsset"),a.literal("mediaFolder")))),contentTypes:a.optional(a.array(a.string())),headers:a.optional(a.any()),enabled:a.boolean(),maxRetries:a.optional(a.number()),timeoutMs:a.optional(a.number()),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string()),updatedBy:a.optional(a.string())}).index("by_enabled",["enabled"]).index("by_deleted",["deletedAt"]),webhookDeliveries:on({webhookId:a.id("webhookConfigs"),eventId:a.id("cmsEvents"),eventType:a.string(),status:a.union(a.literal("pending"),a.literal("processing"),a.literal("delivered"),a.literal("failed"),a.literal("retrying")),attemptCount:a.number(),maxAttempts:a.number(),lastAttemptAt:a.optional(a.number()),nextRetryAt:a.optional(a.number()),lastStatusCode:a.optional(a.number()),lastError:a.optional(a.string()),lastResponseBody:a.optional(a.string()),lastDurationMs:a.optional(a.number()),payload:a.any(),deliveredAt:a.optional(a.number())}).index("by_webhook",["webhookId"]).index("by_event",["eventId"]).index("by_status",["status"]).index("by_next_retry",["status","nextRetryAt"]).index("by_webhook_and_status",["webhookId","status"]),cmsSettings:on({defaultLocale:a.string(),availableLocales:a.array(a.string()),updatedBy:a.optional(a.string())})}),{contentTypes:GK,contentEntries:YK,contentVersions:KK,mediaItems:XK,mediaVariants:JK,taxonomies:WK,taxonomyTerms:eX,contentEntryTags:tX,mediaAssetTags:nX,cmsEvents:rX,webhookConfigs:oX,webhookDeliveries:iX,cmsSettings:sX}=ln.tables;function hn(e,t){return Object.fromEntries(Object.entries(e).filter(([n])=>!t.includes(n)))}a.string();a.float64();a.float64();a.boolean();a.int64();a.int64();a.any();a.null();a.bytes();const J4=e=>({_id:a.id(e),_creationTime:a.number()}),Vn=(e,t)=>{function n(o){if(o.kind==="object")return a.object({...o.fields,...J4(t)});if(o.kind!=="union")throw new Error("Only object and union validators are supported for documents");return a.union(...o.members.map(n))}return n(e.tables[t].validator)};a.optional(a.any());const W4=a.object({name:a.string(),displayName:a.string(),createdBy:a.string(),description:a.optional(a.string()),fields:a.array(uy),icon:a.optional(a.string()),singleton:a.optional(a.boolean()),slugField:a.optional(a.string()),titleField:a.optional(a.string()),sortOrder:a.optional(a.number())}),eF=a.object({id:a.id("contentTypes"),displayName:a.optional(a.string()),description:a.optional(a.string()),fields:a.optional(a.array(uy)),icon:a.optional(a.string()),singleton:a.optional(a.boolean()),slugField:a.optional(a.string()),titleField:a.optional(a.string()),sortOrder:a.optional(a.number()),isActive:a.optional(a.boolean()),updatedBy:a.optional(a.string())}),tF=a.object({id:a.id("contentTypes"),cascade:a.optional(a.boolean()),hardDelete:a.optional(a.boolean()),deletedBy:a.optional(a.string())}),nF=a.object({contentTypeName:a.string(),slug:a.optional(a.string()),data:a.any(),locale:a.optional(a.string()),primaryEntryId:a.optional(a.id("contentEntries")),status:a.optional(wt),scheduledPublishAt:a.optional(a.number()),createdBy:a.optional(a.string())}),rF=a.object({id:a.id("contentEntries"),slug:a.optional(a.string()),data:a.optional(a.any()),status:a.optional(wt),scheduledPublishAt:a.optional(a.number()),updatedBy:a.optional(a.string()),regenerateSlug:a.optional(a.boolean())}),oF=a.object({id:a.id("contentEntries"),changeDescription:a.optional(a.string()),updatedBy:a.optional(a.string())});a.object({id:a.id("contentEntries"),publishAt:a.number(),updatedBy:a.optional(a.string())});a.object({id:a.id("contentEntries"),updatedBy:a.optional(a.string())});const iF=a.object({id:a.id("contentEntries"),deletedBy:a.optional(a.string()),hardDelete:a.optional(a.boolean())}),sF=a.object({sourceEntryId:a.id("contentEntries"),slug:a.optional(a.string()),copyMediaReferences:a.optional(a.boolean()),locale:a.optional(a.string()),createdBy:a.optional(a.string())});a.object({entryId:a.id("contentEntries"),paginationOpts:Sa});a.object({entryId:a.id("contentEntries"),versionId:a.optional(a.id("contentVersions")),versionNumber:a.optional(a.number())});a.object({entryId:a.id("contentEntries"),versionNumber:a.number(),updatedBy:a.optional(a.string())});a.object({entryId:a.id("contentEntries"),changeDescription:a.optional(a.string()),createdBy:a.optional(a.string()),wasPublished:a.optional(a.boolean())});const aF=a.object({entryId:a.id("contentEntries"),fromVersionNumber:a.number(),toVersionNumber:a.number()}),G1=a.object({field:a.string(),fromValue:a.optional(a.any()),toValue:a.optional(a.any()),changeType:a.union(a.literal("added"),a.literal("removed"),a.literal("modified"))}),lF=a.object({hasChanges:a.boolean(),fromVersion:a.object({versionNumber:a.number(),status:wt,slug:a.string(),wasPublished:a.boolean(),createdAt:a.number()}),toVersion:a.object({versionNumber:a.number(),status:wt,slug:a.string(),wasPublished:a.boolean(),createdAt:a.number()}),changedFields:a.array(a.string()),fieldDiffs:a.array(G1),slugChanged:a.boolean(),statusChanged:a.boolean(),changeSummary:a.string()}),cF=a.object({storageId:a.id("_storage"),mimeType:a.string(),name:a.string(),title:a.optional(a.string()),description:a.optional(a.string()),parentId:a.optional(a.id("mediaItems")),tags:a.optional(a.array(a.string())),size:a.optional(a.number()),metadata:a.optional(a.record(a.string(),a.any())),width:a.optional(a.number()),height:a.optional(a.number()),duration:a.optional(a.number()),altText:a.optional(a.string()),createdBy:a.optional(a.string())}),uF=a.object({id:a.id("mediaItems"),name:a.optional(a.string()),title:a.optional(a.string()),description:a.optional(a.string()),parentId:a.optional(a.id("mediaItems")),tags:a.optional(a.array(a.string())),metadata:a.optional(a.record(a.string(),a.any())),width:a.optional(a.number()),height:a.optional(a.number()),duration:a.optional(a.number()),altText:a.optional(a.string()),updatedBy:a.optional(a.string())}),dF=a.object({id:a.id("mediaItems"),deletedBy:a.optional(a.string()),hardDelete:a.optional(a.boolean()),forceDelete:a.optional(a.boolean())}),fF=a.object({id:a.id("mediaItems"),restoredBy:a.optional(a.string())});a.object({name:a.string(),title:a.optional(a.string()),description:a.optional(a.string()),parentId:a.optional(a.id("mediaItems")),tags:a.optional(a.array(a.string())),metadata:a.optional(a.record(a.string(),a.any())),sortOrder:a.optional(a.number()),createdBy:a.optional(a.string())});a.object({id:a.id("mediaItems"),name:a.optional(a.string()),title:a.optional(a.string()),description:a.optional(a.string()),parentId:a.optional(a.id("mediaItems")),tags:a.optional(a.array(a.string())),metadata:a.optional(a.record(a.string(),a.any())),sortOrder:a.optional(a.number()),updatedBy:a.optional(a.string())});a.object({id:a.id("mediaItems"),newParentId:a.optional(a.id("mediaItems")),updatedBy:a.optional(a.string())});a.object({id:a.id("mediaItems"),deletedBy:a.optional(a.string()),hardDelete:a.optional(a.boolean()),recursive:a.optional(a.boolean())});a.object({id:a.id("mediaItems"),restoredBy:a.optional(a.string()),recursive:a.optional(a.boolean())});const hF=a.object({assetIds:a.array(a.id("mediaItems")),targetFolderId:a.optional(a.id("mediaItems")),movedBy:a.optional(a.string())}),pF=a.object({id:a.id("mediaItems"),success:a.boolean(),error:a.optional(a.string()),previousFolderId:a.optional(a.id("mediaItems"))}),mF=a.object({total:a.number(),succeeded:a.number(),failed:a.number(),targetFolderId:a.optional(a.id("mediaItems")),targetFolderPath:a.optional(a.string()),results:a.array(pF)});a.object({assetId:a.id("mediaItems"),storageId:a.id("_storage"),variantType:_a,width:a.optional(a.number()),height:a.optional(a.number()),format:a.string(),mimeType:a.string(),size:a.number(),quality:a.optional(a.number()),preset:a.optional(a.string()),autoGenerated:a.optional(a.boolean()),createdBy:a.optional(a.string())});a.object({assetId:a.id("mediaItems"),variantType:_a,width:a.optional(a.number()),height:a.optional(a.number()),format:a.string(),quality:a.optional(a.number()),preset:a.optional(a.string()),requestedBy:a.optional(a.string())});a.object({id:a.id("mediaVariants"),status:cy,storageId:a.optional(a.id("_storage")),size:a.optional(a.number()),mimeType:a.optional(a.string()),width:a.optional(a.number()),height:a.optional(a.number()),errorMessage:a.optional(a.string())});a.object({id:a.id("mediaVariants"),hardDelete:a.optional(a.boolean()),deletedBy:a.optional(a.string())});a.object({assetId:a.id("mediaItems"),hardDelete:a.optional(a.boolean()),deletedBy:a.optional(a.string())});const gF=a.object({id:a.id("mediaVariants"),includeDeleted:a.optional(a.boolean())}),yF=a.object({assetId:a.id("mediaItems"),variantType:a.optional(_a),format:a.optional(a.string()),preset:a.optional(a.string()),status:a.optional(cy),includeDeleted:a.optional(a.boolean())}),vF=a.object({assetId:a.id("mediaItems"),targetWidth:a.optional(a.number()),targetHeight:a.optional(a.number()),preferredFormat:a.optional(a.string()),fallbackToOriginal:a.optional(a.boolean())}),Y1=Vn(ln,"mediaVariants"),Fi=a.object({...Y1.fields,url:a.union(a.string(),a.null())});a.object({name:a.string(),variantType:_a,width:a.optional(a.number()),height:a.optional(a.number()),format:a.string(),quality:a.optional(a.number()),description:a.optional(a.string())});a.object({total:a.number(),succeeded:a.number(),failed:a.number(),results:a.array(a.object({preset:a.string(),success:a.boolean(),variantId:a.optional(a.id("mediaVariants")),error:a.optional(a.string())}))});const bF=a.object({url:a.string(),descriptor:a.string(),width:a.number(),format:a.string()}),wF=a.object({src:a.union(a.string(),a.null()),srcset:a.string(),entries:a.array(bF),sizes:a.optional(a.string())});a.object({contentTypeName:a.optional(a.string()),status:a.optional(wt),statusIn:a.optional(a.array(wt)),locale:a.optional(a.string()),search:a.optional(a.string()),includeDeleted:a.optional(a.boolean()),cursor:a.optional(a.string()),limit:a.optional(a.number())});a.object({folderId:a.optional(a.id("mediaItems")),type:a.optional(ly),mimeType:a.optional(a.string()),search:a.optional(a.string()),tags:a.optional(a.array(a.string())),includeDeleted:a.optional(a.boolean()),cursor:a.optional(a.string()),limit:a.optional(a.number())});const xF=a.union(a.literal("asc"),a.literal("desc")),SF=a.union(a.literal("_creationTime"),a.literal("filename"),a.literal("size"),a.literal("type"),a.literal("mimeType"));a.object({folderId:a.optional(a.id("mediaItems")),includeRootLevel:a.optional(a.boolean()),type:a.optional(ly),mimeType:a.optional(a.string()),mimeTypePrefix:a.optional(a.string()),search:a.optional(a.string()),tags:a.optional(a.array(a.string())),includeDeleted:a.optional(a.boolean()),deletedOnly:a.optional(a.boolean()),sortField:a.optional(SF),sortDirection:a.optional(xF),paginationOpts:Sa});const Ea=Vn(ln,"contentTypes"),Ut=Vn(ln,"contentEntries"),pf=Vn(ln,"contentVersions"),dy=Vn(ln,"mediaItems"),_F=Vn(ln,"taxonomies"),EF=Vn(ln,"taxonomyTerms");Vn(ln,"contentEntryTags");Vn(ln,"webhookConfigs");Vn(ln,"webhookDeliveries");Vn(ln,"cmsSettings");a.object({versioning:a.boolean(),scheduling:a.boolean(),localization:a.boolean(),mediaManagement:a.boolean()});a.object({defaultLocale:a.optional(a.string()),availableLocales:a.optional(a.array(a.string())),updatedBy:a.optional(a.string())});const TF=a.object({entryId:a.id("contentEntries"),slug:a.string(),contentTypeName:a.string(),fields:a.array(a.string())}),jS=100;a.object({ids:a.array(a.id("contentEntries")),changeDescription:a.optional(a.string()),updatedBy:a.optional(a.string())});a.object({ids:a.array(a.id("contentEntries")),updatedBy:a.optional(a.string())});a.object({ids:a.array(a.id("contentEntries")),deletedBy:a.optional(a.string()),hardDelete:a.optional(a.boolean())});a.object({ids:a.array(a.id("contentEntries")),data:a.optional(a.any()),status:a.optional(wt),updatedBy:a.optional(a.string())});const CF=a.object({id:a.id("contentEntries"),success:a.boolean(),error:a.optional(a.string())});a.object({total:a.number(),succeeded:a.number(),failed:a.number(),results:a.array(CF)});const AF=Vn(ln,"trashConfig");a.object({retentionDays:a.optional(a.number()),autoCleanupEnabled:a.optional(a.boolean()),updatedBy:a.optional(a.string())});a.object({contentTypeName:a.optional(a.string()),search:a.optional(a.string()),paginationOpts:Sa});a.object({olderThanDays:a.optional(a.number()),contentTypeName:a.optional(a.string()),deletedBy:a.optional(a.string())});a.object({deletedCount:a.number(),deletedVersionsCount:a.number(),errors:a.array(a.object({id:a.id("contentEntries"),error:a.string()}))});a.object({...Ut.fields,deletedDaysAgo:a.number(),expiresAt:a.optional(a.number()),contentTypeName:a.optional(a.string())});const LS=1800*1e3,RF=14400*1e3,NF=a.object({id:a.id("contentEntries"),userId:a.string(),lockDuration:a.optional(a.number())}),IF=a.object({id:a.id("contentEntries"),userId:a.string()}),OF=a.object({id:a.id("contentEntries"),releasedBy:a.string()}),kF=a.object({id:a.id("contentEntries"),userId:a.string(),lockDuration:a.optional(a.number())}),MF=a.object({id:a.id("contentEntries")}),DF=a.object({contentTypeName:a.optional(a.string()),lockedBy:a.optional(a.string()),paginationOpts:Sa}),jF=a.object({isLocked:a.boolean(),lockedBy:a.optional(a.string()),lockExpiresAt:a.optional(a.number()),timeRemaining:a.optional(a.number()),isExpired:a.optional(a.boolean())}),LF=a.object({success:a.boolean(),entry:a.optional(Ut),error:a.optional(a.string()),currentLockHolder:a.optional(a.string()),currentLockExpiresAt:a.optional(a.number())}),mf=a.union(a.literal("contentEntry"),a.literal("contentType"),a.literal("mediaAsset"),a.literal("mediaFolder")),K1=a.union(a.literal("created"),a.literal("updated"),a.literal("published"),a.literal("unpublished"),a.literal("deleted"),a.literal("restored"),a.literal("duplicated"),a.literal("scheduled")),fy=Vn(ln,"cmsEvents");a.object({resourceType:a.optional(mf),action:a.optional(K1),processed:a.optional(a.boolean()),limit:a.optional(a.number()),cursor:a.optional(a.string())});a.object({resourceType:mf,resourceId:a.string(),limit:a.optional(a.number())});a.object({eventIds:a.array(a.id("cmsEvents"))});a.object({retentionDays:a.optional(a.number())});const pn=a.object({userId:a.string(),role:a.union(a.string(),a.null()),resourceOwnerId:a.optional(a.string())});function zF(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.keys(e);if(t.length===0||!t.some(s=>s.includes("-")))return!1;const o=/^[a-z]{2,3}(-[A-Z][a-z]{3})?(-[A-Z]{2})?$/;return t.every(s=>s.length>3&&!s.includes("-")?!1:o.test(s))}function PF(e,t){const n=[],{name:o,required:s,options:c}=t;return s&&(e==null||e==="")?(n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n):e==null||e===""?n:typeof e!="string"?(n.push({field:o,message:`${o} must be a string`,code:"INVALID_TYPE"}),n):(c?.minLength!==void 0&&e.length<c.minLength&&n.push({field:o,message:`${o} must be at least ${c.minLength} characters`,code:"MIN_LENGTH"}),c?.maxLength!==void 0&&e.length>c.maxLength&&n.push({field:o,message:`${o} must be at most ${c.maxLength} characters`,code:"MAX_LENGTH"}),c?.pattern!==void 0&&(new RegExp(c.pattern).test(e)||n.push({field:o,message:`${o} does not match the required pattern`,code:"PATTERN_MISMATCH"})),n)}function $F(e,t){const n=[],{name:o,required:s,options:c}=t;return s&&(e==null||e==="")?(n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n):e==null||e===""?n:typeof e!="string"?(n.push({field:o,message:`${o} must be a string`,code:"INVALID_TYPE"}),n):(c?.maxLength!==void 0&&e.replace(/<[^>]*>/g,"").length>c.maxLength&&n.push({field:o,message:`${o} content must be at most ${c.maxLength} characters`,code:"MAX_LENGTH"}),n)}function FF(e,t){const n=[],{name:o,required:s,options:c}=t;return s&&e==null?(n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n):e==null?n:typeof e!="number"||isNaN(e)?(n.push({field:o,message:`${o} must be a number`,code:"INVALID_TYPE"}),n):(c?.precision===0&&!Number.isInteger(e)&&n.push({field:o,message:`${o} must be a whole number`,code:"NOT_INTEGER"}),c?.min!==void 0&&e<c.min&&n.push({field:o,message:`${o} must be at least ${c.min}`,code:"MIN_VALUE"}),c?.max!==void 0&&e>c.max&&n.push({field:o,message:`${o} must be at most ${c.max}`,code:"MAX_VALUE"}),n)}function BF(e,t){const n=[],{name:o,required:s}=t;return s&&e==null?(n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n):(e==null||typeof e!="boolean"&&n.push({field:o,message:`${o} must be a boolean`,code:"INVALID_TYPE"}),n)}function qF(e,t){const n=[],{name:o,required:s,options:c}=t;return s&&e==null?(n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n):e==null?n:typeof e!="number"||isNaN(e)?(n.push({field:o,message:`${o} must be a valid timestamp`,code:"INVALID_TYPE"}),n):(c?.min!==void 0&&e<c.min&&n.push({field:o,message:`${o} must be on or after the minimum date`,code:"MIN_DATE"}),c?.max!==void 0&&e>c.max&&n.push({field:o,message:`${o} must be on or before the maximum date`,code:"MAX_DATE"}),n)}function UF(e,t){const n=[],{name:o,required:s,options:c}=t,u=c?.multiple??!1;if(s&&e==null)return n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n;if(e==null)return n;if(u){if(!Array.isArray(e))return n.push({field:o,message:`${o} must be an array of references`,code:"INVALID_TYPE"}),n;s&&e.length===0&&n.push({field:o,message:`${o} requires at least one reference`,code:"REQUIRED"});for(const f of e)if(typeof f!="string"){n.push({field:o,message:`${o} contains invalid reference IDs`,code:"INVALID_TYPE"});break}c?.minItems!==void 0&&e.length<c.minItems&&n.push({field:o,message:`${o} requires at least ${c.minItems} reference${c.minItems===1?"":"s"}`,code:"MIN_ITEMS"}),c?.max!==void 0&&e.length>c.max&&n.push({field:o,message:`${o} can have at most ${c.max} reference${c.max===1?"":"s"}`,code:"MAX_ITEMS"})}else typeof e!="string"&&n.push({field:o,message:`${o} must be a reference ID`,code:"INVALID_TYPE"});return n}function VF(e,t){const n=[],{name:o,required:s,options:c}=t,u=c?.multiple??!1;if(s&&e==null)return n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n;if(e==null)return n;if(u){if(!Array.isArray(e))return n.push({field:o,message:`${o} must be an array of media asset IDs`,code:"INVALID_TYPE"}),n;s&&e.length===0&&n.push({field:o,message:`${o} requires at least one media asset`,code:"REQUIRED"});for(const f of e)if(typeof f!="string"){n.push({field:o,message:`${o} contains invalid media asset IDs`,code:"INVALID_TYPE"});break}c?.minItems!==void 0&&e.length<c.minItems&&n.push({field:o,message:`${o} requires at least ${c.minItems} media asset${c.minItems===1?"":"s"}`,code:"MIN_ITEMS"}),c?.max!==void 0&&e.length>c.max&&n.push({field:o,message:`${o} can have at most ${c.max} media asset${c.max===1?"":"s"}`,code:"MAX_ITEMS"})}else typeof e!="string"&&n.push({field:o,message:`${o} must be a media asset ID`,code:"INVALID_TYPE"});return n}function HF(e,t){const n=[],{name:o,required:s,options:c}=t;return s&&(e==null||e==="")?(n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n):e==null||e===""?n:typeof e!="string"?(n.push({field:o,message:`${o} must be a string`,code:"INVALID_TYPE"}),n):(c?.options&&(c.options.map(f=>f.value).includes(e)||n.push({field:o,message:`${o} has an invalid value`,code:"INVALID_TYPE"})),n)}function QF(e,t){const n=[],{name:o,required:s,options:c}=t;if(s&&e==null)return n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n;if(e==null)return n;if(!Array.isArray(e))return n.push({field:o,message:`${o} must be an array`,code:"INVALID_TYPE"}),n;s&&e.length===0&&n.push({field:o,message:`${o} requires at least one selection`,code:"REQUIRED"});const u=c?.options?.map(f=>f.value)??[];for(const f of e){if(typeof f!="string"){n.push({field:o,message:`${o} contains invalid values`,code:"INVALID_TYPE"});break}if(u.length>0&&!u.includes(f)){n.push({field:o,message:`${o} contains an invalid option`,code:"INVALID_TYPE"});break}}return n}function ZF(e,t){const n=[],{name:o,required:s}=t;return s&&e==null&&n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n}function GF(e,t){const n=[],{name:o,required:s,options:c}=t;if(s&&e==null)return n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n;if(e==null)return n;if(!Array.isArray(e))return n.push({field:o,message:`${o} must be an array of tag IDs`,code:"INVALID_TYPE"}),n;if(s&&e.length===0)return n.push({field:o,message:`${o} requires at least one tag`,code:"REQUIRED"}),n;for(const h of e)if(typeof h!="string"){n.push({field:o,message:`${o} contains invalid tag IDs`,code:"INVALID_TYPE"});break}const u=c?.minTags;u!==void 0&&e.length<u&&n.push({field:o,message:`${o} requires at least ${u} tag${u===1?"":"s"}`,code:"MIN_ITEMS"});const f=c?.maxTags;return f!==void 0&&e.length>f&&n.push({field:o,message:`${o} can have at most ${f} tag${f===1?"":"s"}`,code:"MAX_ITEMS"}),n}function YF(e,t){const n=[],{name:o,required:s,options:c}=t,u=c?.allowMultiple??!1;if(s&&e==null)return n.push({field:o,message:`${o} is required`,code:"REQUIRED"}),n;if(e==null)return n;if(u){if(!Array.isArray(e))return n.push({field:o,message:`${o} must be an array of category IDs`,code:"INVALID_TYPE"}),n;s&&e.length===0&&n.push({field:o,message:`${o} requires at least one category`,code:"REQUIRED"});for(const f of e)if(typeof f!="string"){n.push({field:o,message:`${o} contains invalid category IDs`,code:"INVALID_TYPE"});break}}else typeof e!="string"&&n.push({field:o,message:`${o} must be a category ID`,code:"INVALID_TYPE"});return n}function yg(e,t){const{name:n,type:o}=t;switch(o){case"text":return PF(e,t);case"richText":return $F(e,t);case"number":return FF(e,t);case"boolean":return BF(e,t);case"date":case"datetime":return qF(e,t);case"reference":return UF(e,t);case"media":return VF(e,t);case"select":return HF(e,t);case"multiSelect":return QF(e,t);case"json":return ZF(e,t);case"tags":return GF(e,t);case"category":return YF(e,t);default:return[{field:n,message:`Unknown field type: ${o}`,code:"INVALID_TYPE"}]}}function KF(e,t,n={}){const o=[],{name:s,required:c}=t,{locale:u,requiredLocales:f}=n;if(e==null)return c&&o.push({field:s,message:`${s} is required`,code:"REQUIRED"}),o;if(!zF(e))return o.push({field:s,message:`${s} must be a localized field structure (object with locale codes as keys)`,code:"INVALID_LOCALIZED_STRUCTURE"}),o;const h=e,p=Object.keys(h);if(c&&p.length===0)return o.push({field:s,message:`${s} requires at least one locale value`,code:"REQUIRED"}),o;if(f&&f.length>0)for(const y of f)y in h||o.push({field:s,message:`${s} is missing required translation for locale: ${y}`,code:"MISSING_LOCALE"});if(u){if(u in h){const y={...t},g=yg(h[u],y);for(const b of g)o.push({...b,field:`${s}[${u}]`,message:`${s} (${u}): ${b.message.replace(`${s} `,"")}`})}}else for(const[y,g]of Object.entries(h)){const b={...t,required:!1},x=yg(g,b);for(const C of x)o.push({...C,field:`${s}[${y}]`,message:`${s} (${y}): ${C.message.replace(`${s} `,"")}`})}return o}function XF(e,t,n){return t.localized?KF(e,t,n):yg(e,t)}function fc(e,t,n={}){const o=[],s=new Map(t.fields.map(p=>[p.name,p])),{strictFields:c,locale:u,requiredLocales:f}=n,h={locale:u,requiredLocales:f};for(const p of t.fields){const y=e[p.name],g=XF(y,p,h);o.push(...g)}if(c)for(const p of Object.keys(e))s.has(p)||o.push({field:p,message:`Unknown field: ${p}`,code:"UNKNOWN_FIELD"});return o.length===0?{valid:!0,errors:[]}:{valid:!1,errors:o}}const JF={ä:"ae",ö:"oe",ü:"ue",ß:"ss",Ä:"ae",Ö:"oe",Ü:"ue",à:"a",â:"a",ç:"c",é:"e",è:"e",ê:"e",ë:"e",î:"i",ï:"i",ô:"o",ù:"u",û:"u",ÿ:"y",œ:"oe",æ:"ae",ñ:"n",Ñ:"n",ą:"a",Ą:"a",ć:"c",Ć:"c",ę:"e",Ę:"e",ł:"l",Ł:"l",ń:"n",Ń:"n",ó:"o",Ó:"o",ś:"s",Ś:"s",ź:"z",Ź:"z",ż:"z",Ż:"z",å:"a",Å:"a",ø:"o",Ø:"o",ð:"d",þ:"th","&":"and","@":"at","#":"hash","%":"percent","+":"plus","=":"equals","'":"","‘":"","’":"","“":"","”":""};function hy(e,t={}){const{maxLength:n=100,separator:o="-",lowercase:s=!0,customReplacements:c={}}=t;if(!e||typeof e!="string")return"";const u={...JF,...c};let f=e.trim();for(const[g,b]of Object.entries(u))f=f.split(g).join(b);f=f.normalize("NFD").replace(/[\u0300-\u036f]/g,""),s&&(f=f.toLowerCase());const h=new RegExp(`[^a-z0-9${Ll(o)}]`,"gi");f=f.replace(h,o);const p=new RegExp(`${Ll(o)}+`,"g");f=f.replace(p,o);const y=new RegExp(`^${Ll(o)}|${Ll(o)}$`,"g");return f=f.replace(y,""),f.length>n&&(f=WF(f,n,o)),f}function Ll(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function WF(e,t,n){if(e.length<=t)return e;const o=e.substring(0,t),s=o.lastIndexOf(n);return s>0?o.substring(0,s):o}function eB(e,t="-"){return!e||typeof e!="string"?!1:new RegExp(`^[a-z0-9]+(?:${Ll(t)}[a-z0-9]+)*$`).test(e)}async function tB(e,t,n=100){if(await t(e))return e;for(let s=1;s<=n;s++){const c=`${e}-${s}`;if(await t(c))return c}const o=Date.now().toString(36);return`${e}-${o}`}function $e(e){return e.deletedAt!==void 0}const nB=new Set(["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/avif","image/svg+xml","image/bmp","image/tiff","image/x-icon","image/ico","image/heic","image/heif"]),rB=new Set(["video/mp4","video/webm","video/ogg","video/quicktime","video/x-msvideo","video/mpeg","video/3gpp","video/x-matroska","video/x-flv"]),oB=new Set(["audio/mpeg","audio/mp3","audio/ogg","audio/wav","audio/webm","audio/aac","audio/flac","audio/x-m4a","audio/mp4","audio/x-wav"]),iB=new Set(["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/csv","text/markdown","application/rtf","application/json","application/xml","text/xml"]);function pa(e){const t=e.toLowerCase();return nB.has(t)?"image":rB.has(t)?"video":oB.has(t)?"audio":iB.has(t)?"document":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":(t.startsWith("text/")||t.startsWith("application/"))&&(t.includes("document")||t.includes("sheet")||t.includes("presentation"))?"document":"other"}function zS(e){return e==="gt"||e==="gte"?"gt":"lt"}function sB(e,t,n,o,s,c){const u=[];for(;n.length>0&&o.length>0&&af(n[0],o[0])===0;){const b=e[0];e=e.slice(1);const x=n[0];n=n.slice(1),o=o.slice(1),u.push(["eq",b,x])}const f=(b,x)=>{const C=u.slice();let S=0;for(;S<x.length-1;S++)C.push(["eq",e[S],x[S]]);return S<x.length&&C.push([b,e[S],x[S]]),C},h=[];for(;n.length>1;)h.push(f(s,n)),s=zS(s),n=n.slice(0,-1);const p=[];for(;o.length>1;)p.push(f(c,o)),c=zS(c),o=o.slice(0,-1);p.reverse();let y;if(o.length===0)y=f(s,n);else if(n.length===0)y=f(c,o);else{const b=n[0],x=o[0];y=u.slice(),y.push([s,e[0],b]),y.push([c,e[0],x])}const g=[...h,y,...p];return t==="desc"&&g.reverse(),g}function aB(e){return t=>{for(const[n,o,s]of e)t=t[n](o,s);return t}}function X1(e,t,n){const o=String(t??"by_creation_time");if(o==="by_creation_time")return["_creationTime","_id"];if(o==="by_id")return["_id"];if(!n)throw new Error("schema is required to infer index fields");const c=n.tables[e].indexes.find(f=>f.indexDescriptor===o);if(!c)throw new Error(`Index ${o} not found in table ${e}`);const u=c.fields.slice();return u.push("_creationTime"),u.push("_id"),u}function lB(e,t){const n=[];for(const o of t){let s=e;for(const c of o.split("."))s=s[c];n.push(s)}return n}function py(e,t){return new cB(e,t)}class Ta{filterWith(t){const n=this.getOrder();return new Ql(this,async o=>{const s=await t(o)?o:null;return new rc(s,n,[],[],[])},[])}map(t){const n=this.getOrder();return new Ql(this,async o=>{const s=await t(o);return new rc(s,n,[],[],[])},[])}flatMap(t,n){return vB(n),new Ql(this,t,n)}distinct(t){return new yy(this,t)}filter(t){throw new Error("Cannot call .filter() directly on a query stream. Use .filterWith() for filtering or .collect() if you want to convert the stream to an array first.")}async paginate(t){if(t.numItems===0){if(t.cursor===null)throw new Error(".paginate called with cursor of null and 0 for numItems. This is not supported, as null is not a valid continueCursor. Advice: avoid calling paginate entirely in these cases.");return{page:[],isDone:!1,continueCursor:t.cursor}}const n=this.getOrder();let o={key:[],inclusive:!0};t.cursor!==null&&(o={key:qS(t.cursor),inclusive:!1});let s={key:[],inclusive:!0};const c=t.maximumRowsRead,u=t.numItems+1;let f=t.numItems;t.endCursor&&(s={key:qS(t.endCursor),inclusive:!0},f=void 0);const h=n==="asc"?o:s,p=n==="asc"?s:o,y=this.narrow({lowerBound:h.key,lowerBoundInclusive:h.inclusive,upperBound:p.key,upperBoundInclusive:p.inclusive}),g=[],b=[];let x=t.endCursor&&t.endCursor!=="[]",C=t.endCursor??"[]";for await(const[I,k]of y.iterWithKeys())if(I!==null&&g.push(I),b.push(k),f!==void 0&&g.length>=f||c!==void 0&&b.length>=c){x=!0,C=BS(k);break}let S,A;return b.length===c?(S="SplitRequired",A=b[Math.floor((b.length-1)/2)]):b.length>=u&&(S="SplitRecommended",A=b[Math.floor((b.length-1)/2)]),{page:g,isDone:!x,continueCursor:C,pageStatus:S,splitCursor:A?BS(A):void 0}}async collect(){return await this.take(1/0)}async take(t){const n=[];for await(const[o,s]of this.iterWithKeys())if(o!==null&&(n.push(o),n.length===t))break;return n}async unique(){const t=await this.take(2);if(t.length===2)throw new Error("Query is not unique");return t[0]??null}async first(){return(await this.take(1))[0]??null}[Symbol.asyncIterator](){const t=this.iterWithKeys()[Symbol.asyncIterator]();return{async next(){const n=await t.next();return n.done?{done:!0,value:void 0}:{done:!1,value:n.value[0]}}}}}class cB{db;schema;system;constructor(t,n){this.db=t,this.schema=n,this.system=t.system}query(t){return new uB(this,t)}get(t){throw new Error("get() not supported for `paginator`")}normalizeId(t,n){throw new Error("normalizeId() not supported for `paginator`.")}}class my extends Ta{}class uB extends my{parent;table;constructor(t,n){super(),this.parent=t,this.table=n}fullTableScan(){return this.withIndex("by_creation_time")}withIndex(t,n){const o=X1(this.table,t,this.parent.schema),s=new pB(o);return n&&n(s),new dB(this,t,s,n)}withSearchIndex(t,n){throw new Error("Cannot paginate withSearchIndex")}inner(){return this.fullTableScan()}order(t){return this.inner().order(t)}reflect(){return this.inner().reflect()}iterWithKeys(){return this.inner().iterWithKeys()}getOrder(){return this.inner().getOrder()}getEqualityIndexFilter(){return this.inner().getEqualityIndexFilter()}getIndexFields(){return this.inner().getIndexFields()}narrow(t){return this.inner().narrow(t)}}class dB extends my{parent;index;q;indexRange;constructor(t,n,o,s){super(),this.parent=t,this.index=n,this.q=o,this.indexRange=s}order(t){return new fB(this,t)}inner(){return this.order("asc")}reflect(){return this.inner().reflect()}iterWithKeys(){return this.inner().iterWithKeys()}getOrder(){return this.inner().getOrder()}getEqualityIndexFilter(){return this.inner().getEqualityIndexFilter()}getIndexFields(){return this.inner().getIndexFields()}narrow(t){return this.inner().narrow(t)}}class fB extends my{parent;order;constructor(t,n){super(),this.parent=t,this.order=n}reflect(){return{db:this.parent.parent.parent.db,schema:this.parent.parent.parent.schema,table:this.parent.parent.table,index:this.parent.index,indexFields:this.parent.q.indexFields,order:this.order,bounds:{lowerBound:this.parent.q.lowerBoundIndexKey??[],lowerBoundInclusive:this.parent.q.lowerBoundInclusive,upperBound:this.parent.q.upperBoundIndexKey??[],upperBoundInclusive:this.parent.q.upperBoundInclusive},indexRange:this.parent.indexRange}}inner(){const{db:t,table:n,index:o,order:s,indexRange:c}=this.reflect();return t.query(n).withIndex(o,c).order(s)}iterWithKeys(){const{indexFields:t}=this.reflect(),n=this.inner();return{[Symbol.asyncIterator](){const o=n[Symbol.asyncIterator]();return{async next(){const s=await o.next();return s.done?{done:!0,value:void 0}:{done:!1,value:[s.value,lB(s.value,t)]}}}}}}getOrder(){return this.order}getEqualityIndexFilter(){return this.parent.q.equalityIndexFilter}getIndexFields(){return this.parent.q.indexFields}narrow(t){const{db:n,table:o,index:s,order:c,bounds:u,schema:f}=this.reflect();let h=u.lowerBound,p=u.lowerBoundInclusive;oc({value:t.lowerBound,kind:t.lowerBoundInclusive?"predecessor":"successor"},{value:u.lowerBound,kind:u.lowerBoundInclusive?"predecessor":"successor"})>0&&(h=t.lowerBound,p=t.lowerBoundInclusive);let y=u.upperBound,g=u.upperBoundInclusive;return oc({value:t.upperBound,kind:t.upperBoundInclusive?"successor":"predecessor"},{value:u.upperBound,kind:u.upperBoundInclusive?"successor":"predecessor"})<0&&(y=t.upperBound,g=t.upperBoundInclusive),hB(n,f,o,s,{lowerBound:h,lowerBoundInclusive:p,upperBound:y,upperBoundInclusive:g},c)}}function hB(e,t,n,o,s,c){const u=X1(n,o,t),h=sB(u,c,s.lowerBound,s.upperBound,s.lowerBoundInclusive?"gte":"gt",s.upperBoundInclusive?"lte":"lt").map(p=>py(e,t).query(n).withIndex(o,aB(p)).order(c));return new gy(...h)}class pB{indexFields;#e=!1;lowerBoundIndexKey=void 0;lowerBoundInclusive=!0;upperBoundIndexKey=void 0;upperBoundInclusive=!0;equalityIndexFilter=[];constructor(t){this.indexFields=t}eq(t,n){if(!this.#t(t)||!this.#n(t))throw new Error(`Cannot use eq on field '${t}'`);return this.lowerBoundIndexKey=this.lowerBoundIndexKey??[],this.lowerBoundIndexKey.push(n),this.upperBoundIndexKey=this.upperBoundIndexKey??[],this.upperBoundIndexKey.push(n),this.equalityIndexFilter.push(n),this}lt(t,n){if(!this.#n(t))throw new Error(`Cannot use lt on field '${t}'`);return this.upperBoundIndexKey=this.upperBoundIndexKey??[],this.upperBoundIndexKey.push(n),this.upperBoundInclusive=!1,this.#e=!0,this}lte(t,n){if(!this.#n(t))throw new Error(`Cannot use lte on field '${t}'`);return this.upperBoundIndexKey=this.upperBoundIndexKey??[],this.upperBoundIndexKey.push(n),this.#e=!0,this}gt(t,n){if(!this.#t(t))throw new Error(`Cannot use gt on field '${t}'`);return this.lowerBoundIndexKey=this.lowerBoundIndexKey??[],this.lowerBoundIndexKey.push(n),this.lowerBoundInclusive=!1,this.#e=!0,this}gte(t,n){if(!this.#t(t))throw new Error(`Cannot use gte on field '${t}'`);return this.lowerBoundIndexKey=this.lowerBoundIndexKey??[],this.lowerBoundIndexKey.push(n),this.#e=!0,this}#t(t){const n=this.lowerBoundIndexKey?.length??0,o=this.upperBoundIndexKey?.length??0;return n>o||n===o&&this.#e?!1:n<this.indexFields.length&&this.indexFields[n]===t}#n(t){const n=this.lowerBoundIndexKey?.length??0,o=this.upperBoundIndexKey?.length??0;return o>n||n===o&&this.#e?!1:o<this.indexFields.length&&this.indexFields[o]===t}}function PS(e,t){const n=e[0];for(const o of e)if(af(o,n))throw new Error(t);return n}function mB(e){let t=e[0];for(const n of e)for(let o=0;o<t.length;o++)if(o>=n.length||af(t[o],n[o])){t=t.slice(0,o);break}return t}class gy extends Ta{#e;#t;#n;#r;constructor(...t){if(super(),this.#t=t,t.length===0)throw new Error("Cannot concat empty array of streams");this.#e=PS(t.map(n=>n.getOrder()),"Cannot concat streams with different orders. Consider using .orderBy()"),this.#r=PS(t.map(n=>n.getIndexFields()),"Cannot concat streams with different index fields. Consider using .orderBy()"),this.#n=mB(t.map(n=>n.getEqualityIndexFilter()))}iterWithKeys(){const t=this.#t.map(s=>s.iterWithKeys()),n=this.#e==="asc"?1:-1;let o;return{[Symbol.asyncIterator](){const s=t.map(c=>c[Symbol.asyncIterator]());return{async next(){for(;s.length>0;){const c=await s[0].next();if(c.done)s.shift();else{const[u,f]=c.value;if(o!==void 0&&oc({value:o,kind:"exact"},{value:f,kind:"exact"})*n>0)throw new Error(`ConcatStreams in wrong order: ${JSON.stringify(o)}, ${JSON.stringify(f)}`);return o=f,c}}return{done:!0,value:void 0}}}}}}getOrder(){return this.#e}getEqualityIndexFilter(){return this.#n}getIndexFields(){return this.#r}narrow(t){return new gy(...this.#t.map(n=>n.narrow(t)))}}class gB{#e;#t;#n=null;#r;#o;constructor(t,n,o){this.#t=t.iterWithKeys()[Symbol.asyncIterator](),this.#e=t,this.#r=n,this.#o=o}singletonSkipInnerStream(){const t=this.#o.map(()=>null);return new rc(null,this.#e.getOrder(),this.#o,t,t)}async setCurrentOuterItem(t){const[n,o]=t;let s;if(n===null)s=this.singletonSkipInnerStream();else{if(s=await this.#r(n),!J1(s.getIndexFields(),this.#o))throw new Error(`FlatMapStream: inner stream has different index fields than expected: ${JSON.stringify(s.getIndexFields())} vs ${JSON.stringify(this.#o)}`);if(s.getOrder()!==this.#e.getOrder())throw new Error(`FlatMapStream: inner stream has different order than outer stream: ${s.getOrder()} vs ${this.#e.getOrder()}`)}this.#n={t:n,indexKey:o,innerIterator:s.iterWithKeys()[Symbol.asyncIterator](),count:0}}async next(){if(this.#n===null){const c=await this.#t.next();return c.done?{done:!0,value:void 0}:(await this.setCurrentOuterItem(c.value),await this.next())}const t=await this.#n.innerIterator.next();if(t.done)return this.#n.count>0?this.#n=null:this.#n.innerIterator=this.singletonSkipInnerStream().iterWithKeys()[Symbol.asyncIterator](),await this.next();const[n,o]=t.value;this.#n.count++;const s=[...this.#n.indexKey,...o];return{done:!1,value:[n,s]}}}class Ql extends Ta{#e;#t;#n;constructor(t,n,o){super(),this.#e=t,this.#t=n,this.#n=o}iterWithKeys(){const t=this.#e,n=this.#t,o=this.#n;return{[Symbol.asyncIterator](){return new gB(t,n,o)}}}getOrder(){return this.#e.getOrder()}getEqualityIndexFilter(){return this.#e.getEqualityIndexFilter()}getIndexFields(){return[...this.#e.getIndexFields(),...this.#n]}narrow(t){const n=this.#e.getIndexFields().length,o=t.lowerBound.slice(0,n),s=t.upperBound.slice(0,n),c=t.lowerBound.slice(n),u=t.upperBound.slice(n),f={lowerBound:o,lowerBoundInclusive:c.length===0?t.lowerBoundInclusive:!0,upperBound:s,upperBoundInclusive:u.length===0?t.upperBoundInclusive:!0},h={lowerBound:c,lowerBoundInclusive:c.length===0?!0:t.lowerBoundInclusive,upperBound:u,upperBoundInclusive:u.length===0?!0:t.upperBoundInclusive};return new Ql(this.#e.narrow(f),async p=>(await this.#t(p)).narrow(h),this.#n)}}class rc extends Ta{#e;#t;#n;#r;#o;constructor(t,n="asc",o,s,c){if(super(),this.#e=t,this.#t=n,this.#n=o,this.#r=s,this.#o=c,s.length!==o.length)throw new Error(`indexKey must have the same length as indexFields: ${JSON.stringify(s)} vs ${JSON.stringify(o)}`)}iterWithKeys(){const t=this.#e,n=this.#r;return{[Symbol.asyncIterator](){let o=!1;return{async next(){return o?{done:!0,value:void 0}:(o=!0,{done:!1,value:[t,n]})}}}}}getOrder(){return this.#t}getIndexFields(){return this.#n}getEqualityIndexFilter(){return this.#o}narrow(t){const n=oc({value:t.lowerBound,kind:t.lowerBoundInclusive?"exact":"successor"},{value:this.#r,kind:"exact"}),o=oc({value:this.#r,kind:"exact"},{value:t.upperBound,kind:t.upperBoundInclusive?"exact":"predecessor"});return n<=0&&o<=0?new rc(this.#e,this.#t,this.#n,this.#r,this.#o):new yB(this.#t,this.#n)}}class yB extends Ta{#e;#t;constructor(t,n){super(),this.#e=t,this.#t=n}iterWithKeys(){return{[Symbol.asyncIterator](){return{async next(){return{done:!0,value:void 0}}}}}}getOrder(){return this.#e}getIndexFields(){return this.#t}getEqualityIndexFilter(){return[]}narrow(t){return this}}function vB(e){e.includes("_creationTime")||(e.length!==1||e[0]!=="_id")&&e.push("_creationTime"),e.includes("_id")||e.push("_id")}function*bB(e){const t=e.getEqualityIndexFilter().length,n=e.getIndexFields();for(let o=0;o<=t;o++)yield n.slice(o)}class yy extends Ta{#e;#t;#n;constructor(t,n){super(),this.#t=t,this.#n=n;let o;for(const s of bB(t)){const c=s.slice(0,n.length);if(J1(c,n)){o=t.getIndexFields().length-s.length+n.length;break}}if(o===void 0)throw new Error(`distinctIndexFields must be a prefix of the stream's ordering index fields: ${JSON.stringify(n)}, ${JSON.stringify(t.getIndexFields())} (${t.getEqualityIndexFilter().length} equality fields)`);this.#e=o}iterWithKeys(){const t=this.#t,n=this.#e;return{[Symbol.asyncIterator](){let o=t,s=o.iterWithKeys()[Symbol.asyncIterator]();return{async next(){const c=await s.next();if(c.done)return{done:!0,value:void 0};const[u,f]=c.value;if(u===null)return{done:!1,value:[null,f]};const h=f.slice(0,n);return t.getOrder()==="asc"?o=o.narrow({lowerBound:h,lowerBoundInclusive:!1,upperBound:[],upperBoundInclusive:!0}):o=o.narrow({lowerBound:[],lowerBoundInclusive:!0,upperBound:h,upperBoundInclusive:!1}),s=o.iterWithKeys()[Symbol.asyncIterator](),c}}}}}narrow(t){const n={...t,lowerBound:t.lowerBound.slice(0,this.#e),upperBound:t.upperBound.slice(0,this.#e)};return new yy(this.#t.narrow(n),this.#n)}getOrder(){return this.#t.getOrder()}getIndexFields(){return this.#t.getIndexFields()}getEqualityIndexFilter(){return this.#t.getEqualityIndexFilter()}}function J1(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function $S(e,t){if(!(t>=e.length))return{kind:"found",value:e[t]}}function FS(e,t,n,o){if(e==="exact"&&t==="exact")throw new Error(`Exact keys are not the same length: ${JSON.stringify(n.value)}, ${JSON.stringify(o.value)}`);if(e==="exact")throw new Error(`Exact key is shorter than prefix: ${JSON.stringify(n.value)}, ${JSON.stringify(o.value)}`);if(e==="predecessor"&&t==="successor")return-1;if(e==="successor"&&t==="predecessor")return 1;if(e==="predecessor"&&t==="predecessor")return-1;if(e==="successor"&&t==="successor")return 1;if(e==="predecessor"&&t==="exact")return-1;if(e==="successor"&&t==="exact")return 1;throw new Error(`Unexpected key kinds: ${e}, ${t}`)}function oc(e,t){let n=0;for(;n<Math.max(e.value.length,t.value.length);){const o=$S(e.value,n),s=$S(t.value,n);if(o===void 0)return FS(e.kind,t.kind,e,t);if(s===void 0)return-1*FS(t.kind,e.kind,t,e);const c=af(o.value,s.value);if(c!==0)return c;n++}if(e.kind===t.kind)return 0;if(e.kind==="exact")return t.kind==="successor"?-1:1;if(e.kind==="predecessor")return-1;if(e.kind==="successor")return 1;throw new Error(`Unexpected key kind: ${e.kind}`)}function BS(e){return JSON.stringify(ut(e.map(t=>t===void 0?"undefined":typeof t=="string"&&t.endsWith("undefined")?"_"+t:t)))}function qS(e){return Wt(JSON.parse(e)).map(t=>{if(typeof t=="string"){if(t==="undefined")return;if(t.endsWith("undefined"))return t.slice(1)}return t})}const Ke=$4,gf=F4,st=z4,vy=P4,wB=a.union(a.literal("eq"),a.literal("ne"),a.literal("gt"),a.literal("gte"),a.literal("lt"),a.literal("lte"),a.literal("contains"),a.literal("startsWith"),a.literal("endsWith"),a.literal("in"),a.literal("notIn")),xB=a.object({field:a.string(),operator:wB,value:a.any()}),W1=a.union(a.literal("asc"),a.literal("desc"));a.union(a.literal("_creationTime"),a.literal("_id"),a.literal("firstPublishedAt"),a.literal("lastPublishedAt"),a.literal("scheduledPublishAt"),a.literal("version"));const eC=a.string();a.object({sortField:eC,sortDirection:W1});function SB(e,t){const{field:n,operator:o,value:s}=t,c=e[n];if(c==null)return o==="eq"?s==null:o==="ne"?s!=null:!1;switch(o){case"eq":return Di(c,s);case"ne":return!Di(c,s);case"gt":return typeof c=="number"&&typeof s=="number"?c>s:typeof c=="number"&&s instanceof Date?c>s.getTime():!1;case"gte":return typeof c=="number"&&typeof s=="number"?c>=s:typeof c=="number"&&s instanceof Date?c>=s.getTime():!1;case"lt":return typeof c=="number"&&typeof s=="number"?c<s:typeof c=="number"&&s instanceof Date?c<s.getTime():!1;case"lte":return typeof c=="number"&&typeof s=="number"?c<=s:typeof c=="number"&&s instanceof Date?c<=s.getTime():!1;case"contains":return typeof c=="string"&&typeof s=="string"?c.toLowerCase().includes(s.toLowerCase()):Array.isArray(c)?c.some(u=>Di(u,s)):!1;case"startsWith":return typeof c=="string"&&typeof s=="string"?c.toLowerCase().startsWith(s.toLowerCase()):!1;case"endsWith":return typeof c=="string"&&typeof s=="string"?c.toLowerCase().endsWith(s.toLowerCase()):!1;case"in":return Array.isArray(s)?s.some(u=>Di(c,u)):!1;case"notIn":return Array.isArray(s)?!s.some(u=>Di(c,u)):!0;default:return!1}}function by(e,t){return!t||t.length===0?!0:t.every(n=>SB(e,n))}function Di(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((n,o)=>Di(n,t[o]));if(typeof e=="object"&&typeof t=="object"){const n=e,o=t,s=Object.keys(n),c=Object.keys(o);return s.length!==c.length?!1:s.every(u=>Di(n[u],o[u]))}return!1}const _B=a.object({id:a.id("contentEntries"),includeVersion:a.optional(a.boolean())}),EB=a.object({...Ut.fields,latestVersion:a.optional(pf)});Ke({args:_B.fields,returns:a.union(EB,a.null()),handler:async(e,t)=>{const n=await e.db.get(t.id);if(!n||$e(n))return null;if(t.includeVersion){const o=await e.db.query("contentVersions").withIndex("by_entry_and_version",s=>s.eq("entryId",t.id).eq("versionNumber",n.version)).first();return{...n,latestVersion:o??void 0}}return{...n,latestVersion:void 0}}});const TB=a.object({contentTypeName:a.string(),slug:a.string(),status:a.optional(wt),includeDeleted:a.optional(a.boolean())});Ke({args:TB.fields,returns:a.union(Ut,a.null()),handler:async(e,t)=>{const{contentTypeName:n,slug:o,status:s,includeDeleted:c=!1}=t,u=await e.db.query("contentEntries").withIndex("by_content_type_and_slug",f=>f.eq("contentTypeName",n).eq("slug",o)).first();return!u||!c&&$e(u)||s!==void 0&&u.status!==s?null:u}});Ke({args:{contentTypeName:a.string(),slug:a.string(),status:a.optional(wt),includeDeleted:a.optional(a.boolean())},returns:a.union(Ut,a.null()),handler:async(e,t)=>{const{contentTypeName:n,slug:o,status:s,includeDeleted:c=!1}=t,u=await e.db.query("contentEntries").withIndex("by_content_type_and_slug",f=>f.eq("contentTypeName",n).eq("slug",o)).first();return!u||!c&&$e(u)||s!==void 0&&u.status!==s?null:u}});const tC=50,nC=250,CB=a.object({contentTypeName:a.optional(a.string()),status:a.optional(wt),statusIn:a.optional(a.array(wt)),locale:a.optional(a.string()),search:a.optional(a.string()),includeDeleted:a.optional(a.boolean()),fieldFilters:a.optional(a.array(xB)),sortField:a.optional(eC),sortDirection:a.optional(W1),paginationOpts:Sa}),AB=a.object({page:a.array(Ut),continueCursor:a.union(a.string(),a.null()),isDone:a.boolean()});Ke({args:CB.fields,returns:AB,handler:async(e,t)=>{const{contentTypeName:n,status:o,statusIn:s,locale:c,search:u,includeDeleted:f=!1,fieldFilters:h,sortField:p="_creationTime",sortDirection:y="desc",paginationOpts:g}=t,b=s?.length?s:o?[o]:void 0,x=Math.min(Math.max(1,g.numItems??tC),nC),C={...g,numItems:x},S={sortField:p,sortDirection:y};return u&&u.trim().length>0?NB(e,{search:u.trim(),contentTypeName:n,statuses:b,locale:c,includeDeleted:f,fieldFilters:h,sortOptions:S,paginationOpts:C}):IB(e,{contentTypeName:n,statuses:b,locale:c,includeDeleted:f,fieldFilters:h,sortOptions:S,paginationOpts:C})}});function US(e,t){if(t.startsWith("data.")){const n=t.slice(5);return e.data?.[n]}return e[t]}function RB(e,t,n){if(e==null)return n==="asc"?1:-1;if(t==null)return n==="asc"?-1:1;if(typeof e=="number"&&typeof t=="number")return n==="asc"?e-t:t-e;if(typeof e=="string"&&typeof t=="string"){const u=e.toLowerCase().localeCompare(t.toLowerCase());return n==="asc"?u:-u}if(typeof e=="boolean"&&typeof t=="boolean"){const u=e?1:0,f=t?1:0;return n==="asc"?u-f:f-u}const o=String(e),s=String(t),c=o.localeCompare(s);return n==="asc"?c:-c}function rC(e,t){return[...e].sort((n,o)=>{const s=US(n,t.sortField),c=US(o,t.sortField);return RB(s,c,t.sortDirection)})}async function NB(e,t){const{search:n,contentTypeName:o,statuses:s,locale:c,includeDeleted:u,fieldFilters:f,sortOptions:h,paginationOpts:p}=t,{numItems:y,cursor:g}=p,b=s?.length===1?s[0]:void 0,x=e.db.query("contentEntries").withSearchIndex("search_content",M=>{let U=M.search("searchText",n);return o&&(U=U.eq("contentTypeName",o)),b&&(U=U.eq("status",b)),c&&(U=U.eq("locale",c)),U}),C=f&&f.length>0,S=s&&s.length>1||!u||C?4:1;let I=await x.take((y+1)*S);u||(I=I.filter(M=>!$e(M))),s&&s.length>1&&(I=I.filter(M=>s.includes(M.status))),C&&(I=I.filter(M=>by(M.data||{},f)));const k=rC(I,h);let R=0;if(g){const M=k.findIndex(U=>U._id===g);M!==-1&&(R=M+1)}const N=k.slice(R,R+y+1),j=N.length<=y,B=j?N:N.slice(0,y),P=!j&&B.length>0?B[B.length-1]._id:null;return{page:B,continueCursor:P,isDone:j}}async function IB(e,t){const{contentTypeName:n,statuses:o,locale:s,includeDeleted:c,fieldFilters:u,sortOptions:f,paginationOpts:h}=t,p=o?.length===1?o[0]:void 0,y=py(e.db,ln);let g;n&&p?g=y.query("contentEntries").withIndex("by_content_type_and_status",R=>R.eq("contentTypeName",n).eq("status",p)):n?g=y.query("contentEntries").withIndex("by_content_type",R=>R.eq("contentTypeName",n)):p?g=y.query("contentEntries").withIndex("by_status",R=>R.eq("status",p)):s?g=y.query("contentEntries").withIndex("by_locale",R=>R.eq("locale",s)):g=y.query("contentEntries");const b=u&&u.length>0,x=f.sortField==="_creationTime",C=!x,S=!c||o&&o.length>1||s&&!n&&!p||b,A=x?f.sortDirection:"desc",I=g.order(A);if(C)return OB(e,{orderedQuery:I,statuses:o,locale:s,contentTypeName:n,singleStatus:p,includeDeleted:c,fieldFilters:u,sortOptions:f,paginationOpts:h});if(S){const R=I.filterWith(async B=>!(!c&&$e(B)||o&&o.length>1&&!o.includes(B.status)||s&&!n&&!p&&B.locale!==s||b&&!by(B.data||{},u))),N=b?20:10,j=await R.paginate({...h,maximumRowsRead:h.numItems*N});return{page:j.page,continueCursor:j.continueCursor,isDone:j.isDone}}const k=await I.paginate(h);return{page:k.page,continueCursor:k.continueCursor,isDone:k.isDone}}async function OB(e,t){const{orderedQuery:n,statuses:o,locale:s,contentTypeName:c,singleStatus:u,includeDeleted:f,fieldFilters:h,sortOptions:p,paginationOpts:y}=t,g=h&&h.length>0,{numItems:b,cursor:x}=y,C=g?20:10,S=(b+1)*C;let A=!1;const k=await n.filterWith(async ee=>!(!f&&$e(ee)||o&&o.length>1&&!o.includes(ee.status)||s&&!c&&!u&&ee.locale!==s||g&&!by(ee.data||{},h))).paginate({numItems:S,cursor:null,maximumRowsRead:S*2}),R=k.page;A=!k.isDone;const N=rC(R,p);let j=0;if(x){const ee=N.findIndex(ae=>ae._id===x);ee!==-1&&(j=ee+1)}const B=N.slice(j,j+b+1),P=B.length<=b&&!A,M=B.length>b?B.slice(0,b):B,U=M.length>0&&!P?M[M.length-1]._id:null;return{page:M,continueCursor:U,isDone:P||M.length<b}}const kB=a.object({entryId:a.id("contentEntries"),paginationOpts:Sa}),MB=a.object({page:a.array(pf),continueCursor:a.union(a.string(),a.null()),isDone:a.boolean()});Ke({args:kB.fields,returns:a.union(MB,a.null()),handler:async(e,t)=>{const{entryId:n,paginationOpts:o}=t,s=await e.db.get(n);if(!s||$e(s))return null;const c=Math.min(Math.max(1,o.numItems??tC),nC),u={...o,numItems:c},h=await py(e.db,ln).query("contentVersions").withIndex("by_entry",p=>p.eq("entryId",n)).order("desc").paginate(u);return{page:h.page,continueCursor:h.continueCursor,isDone:h.isDone}}});Ke({args:{entryId:a.id("contentEntries"),versionId:a.optional(a.id("contentVersions")),versionNumber:a.optional(a.number())},returns:a.union(pf,a.null()),handler:async(e,t)=>{const{entryId:n,versionId:o,versionNumber:s}=t;if(o===void 0&&s===void 0)return null;const c=await e.db.get(n);if(!c||$e(c))return null;if(o!==void 0){const u=await e.db.get(o);return!u||u.entryId!==n?null:u}return s!==void 0?await e.db.query("contentVersions").withIndex("by_entry_and_version",f=>f.eq("entryId",n).eq("versionNumber",s)).first()??null:null}});function DB(e,t){if(!e&&!t)return[];const n=e??{},o=t??{},s=[],c=new Set([...Object.keys(n),...Object.keys(o)]);for(const u of c){if(u.startsWith("_"))continue;const f=n[u],h=o[u];JSON.stringify(f)!==JSON.stringify(h)&&s.push(u)}return s}function jB(e,t,n){const o=n in e,s=n in t;return!o&&s?"added":o&&!s?"removed":"modified"}function LB(e,t,n){const o=[];return e.length>0&&(e.length<=3?o.push(`${e.length} field${e.length===1?"":"s"} changed: ${e.join(", ")}`):o.push(`${e.length} fields changed: ${e.slice(0,3).join(", ")} and ${e.length-3} more`)),t&&o.push("slug changed"),n&&o.push("status changed"),o.length===0?"No changes":o.join("; ")}Ke({args:aF.fields,returns:a.union(lF,a.null()),handler:async(e,t)=>{const{entryId:n,fromVersionNumber:o,toVersionNumber:s}=t,c=await e.db.get(n);if(!c||$e(c))return null;const[u,f]=await Promise.all([e.db.query("contentVersions").withIndex("by_entry_and_version",A=>A.eq("entryId",n).eq("versionNumber",o)).first(),e.db.query("contentVersions").withIndex("by_entry_and_version",A=>A.eq("entryId",n).eq("versionNumber",s)).first()]);if(!u||!f)return null;const h=u.data??{},p=f.data??{},y=DB(h,p),g=u.slug!==f.slug,b=u.status!==f.status,x=y.map(A=>({field:A,fromValue:h[A],toValue:p[A],changeType:jB(h,p,A)})),C=LB(y,g,b);return{hasChanges:y.length>0||g||b,fromVersion:{versionNumber:u.versionNumber,status:u.status,slug:u.slug,wasPublished:u.wasPublished,createdAt:u._creationTime},toVersion:{versionNumber:f.versionNumber,status:f.status,slug:f.slug,wasPublished:f.wasPublished,createdAt:f._creationTime},changedFields:y,fieldDiffs:x,slugChanged:g,statusChanged:b,changeSummary:C}}});const zB=a.object({contentTypeName:a.optional(a.string()),status:a.optional(wt),statusIn:a.optional(a.array(wt)),includeDeleted:a.optional(a.boolean())});Ke({args:zB.fields,returns:a.object({count:a.number()}),handler:async(e,t)=>{const{contentTypeName:n,status:o,statusIn:s,includeDeleted:c=!1}=t,u=s?.length?s:o?[o]:void 0,f=u?.length===1?u[0]:void 0;let h;n&&f?h=e.db.query("contentEntries").withIndex("by_content_type_and_status",y=>y.eq("contentTypeName",n).eq("status",f)):n?h=e.db.query("contentEntries").withIndex("by_content_type",y=>y.eq("contentTypeName",n)):f?h=e.db.query("contentEntries").withIndex("by_status",y=>y.eq("status",f)):h=e.db.query("contentEntries");let p=0;for await(const y of h)!c&&$e(y)||u&&u.length>1&&!u.includes(y.status)||p++;return{count:p}}});a.union(a.literal("admin"),a.literal("editor"),a.literal("author"),a.literal("viewer"));const PB=a.union(a.literal("contentTypes"),a.literal("contentEntries"),a.literal("mediaItems"),a.literal("settings")),$B=a.union(a.literal("create"),a.literal("read"),a.literal("update"),a.literal("delete"),a.literal("publish"),a.literal("unpublish"),a.literal("restore"),a.literal("manage"),a.literal("move"));a.object({resource:PB,action:$B,scope:a.optional(a.union(a.literal("all"),a.literal("own")))});function Zl(e,t="all"){return[{resource:e,action:"create",scope:t},{resource:e,action:"read",scope:t},{resource:e,action:"update",scope:t},{resource:e,action:"delete",scope:t}]}function la(e,t="all"){return[{resource:e,action:"read",scope:t}]}function oC(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const FB={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...Zl("contentTypes"),...Zl("contentEntries"),...oC(),{resource:"contentEntries",action:"restore"},...Zl("mediaItems"),{resource:"settings",action:"manage"},...la("settings")]},BB={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...la("contentTypes"),...Zl("contentEntries"),...oC(),{resource:"contentEntries",action:"restore"},...Zl("mediaItems")]},qB={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...la("contentTypes"),{resource:"contentEntries",action:"create"},{resource:"contentEntries",action:"read",scope:"own"},{resource:"contentEntries",action:"update",scope:"own"},{resource:"contentEntries",action:"delete",scope:"own"},{resource:"contentEntries",action:"publish",scope:"own"},{resource:"contentEntries",action:"unpublish",scope:"own"},{resource:"mediaItems",action:"create"},{resource:"mediaItems",action:"read",scope:"all"},{resource:"mediaItems",action:"update",scope:"own"},{resource:"mediaItems",action:"delete",scope:"own"}]},UB={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...la("contentTypes"),...la("contentEntries"),...la("mediaItems")]},wy={admin:FB,editor:BB,author:qB,viewer:UB};function VB(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const n=e.scope??"all",o=t.scope??"all";return n==="all"?!0:o==="own"}function vg(e,t,n){const o=wy[e]??n?.[e];return o?o.permissions.some(s=>VB(s,t)):!1}function HB(e,t){return(wy[e]??t?.[e])?.permissions??[]}function QB(e,t){return wy[e]??t?.[e]}function ZB(e,t,n){return HB(e,n).filter(o=>o.resource===t)}function aX(e,t,n){return ZB(e,t,n).length>0}async function ic(e,t,n={}){const{excludeEntryId:o,maxAttempts:s=100}=n;let c=e;return eB(c,n.separator)||(c=hy(c,{separator:n.separator})),c||(c="untitled"),tB(c,async f=>{const h=await t(f);return!!(!h||o&&h._id===o)},s)}const GB=a.optional(a.object({minLength:a.optional(a.number()),maxLength:a.optional(a.number()),pattern:a.optional(a.string()),min:a.optional(a.number()),max:a.optional(a.number()),step:a.optional(a.number()),precision:a.optional(a.number()),allowedContentTypes:a.optional(a.array(a.string())),multiple:a.optional(a.boolean()),minItems:a.optional(a.number()),allowedMimeTypes:a.optional(a.array(a.string())),maxFileSize:a.optional(a.number()),options:a.optional(a.array(a.object({value:a.string(),label:a.string()}))),allowedBlocks:a.optional(a.array(a.string())),allowedMarks:a.optional(a.array(a.string())),taxonomyId:a.optional(a.string()),allowCreate:a.optional(a.boolean()),maxTags:a.optional(a.number()),minTags:a.optional(a.number()),allowMultiple:a.optional(a.boolean())})),YB=a.object({name:a.string(),label:a.string(),type:V4,required:a.boolean(),searchable:a.optional(a.boolean()),localized:a.optional(a.boolean()),description:a.optional(a.string()),defaultValue:a.optional(a.any()),options:GB}),KB=a.object({_originalId:a.string(),contentTypeName:a.string(),slug:a.string(),status:wt,data:a.any(),locale:a.optional(a.string()),version:a.number(),firstPublishedAt:a.optional(a.number()),lastPublishedAt:a.optional(a.number()),scheduledPublishAt:a.optional(a.number()),createdBy:a.optional(a.string()),createdAt:a.number()}),XB=a.object({name:a.string(),displayName:a.string(),description:a.optional(a.string()),fields:a.array(YB),icon:a.optional(a.string()),singleton:a.optional(a.boolean()),slugField:a.optional(a.string()),titleField:a.optional(a.string())}),xy=a.object({version:a.literal("1.0"),exportedAt:a.number(),contentTypes:a.optional(a.array(XB)),entries:a.array(KB),metadata:a.optional(a.object({source:a.optional(a.string()),description:a.optional(a.string()),totalEntries:a.number(),entriesByType:a.optional(a.any())}))}),JB=a.union(a.literal("skip"),a.literal("update"),a.literal("error")),WB=a.object({originalId:a.string(),newId:a.optional(a.id("contentEntries")),action:a.union(a.literal("created"),a.literal("updated"),a.literal("skipped"),a.literal("failed")),error:a.optional(a.string()),slug:a.string(),contentTypeName:a.string()}),eq=a.object({success:a.boolean(),totalProcessed:a.number(),created:a.number(),updated:a.number(),skipped:a.number(),failed:a.number(),results:a.array(WB),idMapping:a.any(),validationErrors:a.optional(a.array(a.string()))}),tq=a.object({contentTypeId:a.optional(a.id("contentTypes")),contentTypeName:a.optional(a.string()),status:a.optional(wt),statusIn:a.optional(a.array(wt)),locale:a.optional(a.string()),includeContentTypes:a.optional(a.boolean()),includeDeleted:a.optional(a.boolean()),limit:a.optional(a.number()),description:a.optional(a.string()),source:a.optional(a.string())});Ke({args:tq.fields,returns:xy,handler:async(e,t)=>{const{contentTypeId:n,contentTypeName:o,status:s,statusIn:c,locale:u,includeContentTypes:f=!0,includeDeleted:h=!1,limit:p=1e3,description:y,source:g}=t,b=c?.length?c:s?[s]:void 0;let x=n;if(!x&&o){const M=await e.db.query("contentTypes").withIndex("by_name",U=>U.eq("name",o)).first();M&&(x=M._id)}let C;const S=x?await e.db.get(x):null;S?C=e.db.query("contentEntries").withIndex("by_content_type",M=>M.eq("contentTypeName",S.name)):C=e.db.query("contentEntries");let I=await C.take(p*2);h||(I=I.filter(M=>!$e(M))),b&&b.length>0&&(I=I.filter(M=>b.includes(M.status))),u&&(I=I.filter(M=>M.locale===u)),I=I.slice(0,p);const k=new Set;for(const M of I)k.add(M.contentTypeName);const R=Array.from(k),N=new Map;for(const M of R){const U=await e.db.query("contentTypes").withIndex("by_name",ee=>ee.eq("name",M)).first();U&&N.set(M,U)}const j=I.map(M=>{const U=N.get(M.contentTypeName);return{_originalId:M._id,contentTypeName:U?.name??"unknown",slug:M.slug,status:M.status,data:M.data,locale:M.locale,version:M.version,firstPublishedAt:M.firstPublishedAt,lastPublishedAt:M.lastPublishedAt,scheduledPublishAt:M.scheduledPublishAt,createdBy:M.createdBy,createdAt:M._creationTime}});let B;f&&(B=Array.from(N.values()).filter(M=>!M.deletedAt).map(M=>({name:M.name,displayName:M.displayName,description:M.description,fields:M.fields,icon:M.icon,singleton:M.singleton,slugField:M.slugField,titleField:M.titleField})));const P={};for(const M of j)P[M.contentTypeName]=(P[M.contentTypeName]??0)+1;return{version:"1.0",exportedAt:Date.now(),contentTypes:B,entries:j,metadata:{source:g,description:y,totalEntries:j.length,entriesByType:P}}}});const nq=a.object({data:xy,onConflict:a.optional(JB),preserveStatus:a.optional(a.boolean()),dryRun:a.optional(a.boolean()),importedBy:a.optional(a.string()),contentTypeFilter:a.optional(a.array(a.string()))});st({args:nq.fields,returns:eq,handler:async(e,t)=>{const{data:n,onConflict:o="skip",preserveStatus:s=!1,dryRun:c=!1,importedBy:u,contentTypeFilter:f}=t,h=[],p={},y=[];let g=0,b=0,x=0,C=0,S=n.entries;f&&f.length>0&&(S=S.filter(N=>f.includes(N.contentTypeName)));const A=new Map,I=new Set;for(const N of S)I.add(N.contentTypeName);const k=Array.from(I);for(const N of k){const j=await e.db.query("contentTypes").withIndex("by_name",B=>B.eq("name",N)).first();j&&!j.deletedAt&&j.isActive?A.set(N,j):y.push(`Content type "${N}" not found or not active`)}for(const N of S){const j=A.get(N.contentTypeName);if(!j){h.push({originalId:N._originalId,action:"failed",error:`Content type "${N.contentTypeName}" not found`,slug:N.slug,contentTypeName:N.contentTypeName}),C++;continue}const B={name:j.name,displayName:j.displayName,description:j.description,fields:j.fields,titleField:j.titleField,slugField:j.slugField,singleton:j.singleton},P=fc(N.data,B);if(!P.valid){const U=P.errors.map(ee=>`${ee.field}: ${ee.message}`).join("; ");y.push(`Entry "${N.slug}" (${N.contentTypeName}): ${U}`),h.push({originalId:N._originalId,action:"failed",error:`Validation failed: ${U}`,slug:N.slug,contentTypeName:N.contentTypeName}),C++;continue}const M=await e.db.query("contentEntries").withIndex("by_content_type_and_slug",U=>U.eq("contentTypeName",j.name).eq("slug",N.slug)).filter(U=>U.eq(U.field("deletedAt"),void 0)).first();if(M)switch(o){case"error":y.push(`Slug conflict: "${N.slug}" already exists for type "${N.contentTypeName}"`),h.push({originalId:N._originalId,action:"failed",error:`Slug "${N.slug}" already exists`,slug:N.slug,contentTypeName:N.contentTypeName}),C++;continue;case"skip":h.push({originalId:N._originalId,newId:M._id,action:"skipped",slug:N.slug,contentTypeName:N.contentTypeName}),p[N._originalId]=M._id,x++;continue;case"update":if(!c){const U=s?N.status:M.status;await e.db.patch(M._id,{data:N.data,status:U,version:M.version+1,updatedBy:u})}h.push({originalId:N._originalId,newId:M._id,action:"updated",slug:N.slug,contentTypeName:N.contentTypeName}),p[N._originalId]=M._id,b++;continue}if(c)h.push({originalId:N._originalId,action:"created",slug:N.slug,contentTypeName:N.contentTypeName}),g++;else{let U="";for(const ue of j.fields){const ce=N.data;if(ue.searchable&&ce[ue.name]){const he=ce[ue.name];typeof he=="string"&&(U+=` ${he}`)}}const ee=async ue=>await e.db.query("contentEntries").withIndex("by_content_type_and_slug",ce=>ce.eq("contentTypeName",j.name).eq("slug",ue)).filter(ce=>ce.eq(ce.field("deletedAt"),void 0)).first(),ae=await ic(N.slug,ee),re=await e.db.insert("contentEntries",{contentTypeName:j.name,slug:ae,status:s?N.status:"draft",data:N.data,locale:N.locale,version:1,createdBy:u??N.createdBy,updatedBy:u??N.createdBy,searchText:U.trim()||void 0,firstPublishedAt:s?N.firstPublishedAt:void 0,lastPublishedAt:s?N.lastPublishedAt:void 0,scheduledPublishAt:s?N.scheduledPublishAt:void 0});h.push({originalId:N._originalId,newId:re,action:"created",slug:ae,contentTypeName:N.contentTypeName}),p[N._originalId]=re,g++}}if(!c&&Object.keys(p).length>0){for(const N of h)if((N.action==="created"||N.action==="updated")&&N.newId){const j=await e.db.get(N.newId);if(!j)continue;const B=A.get(N.contentTypeName);if(!B)continue;const P=j.data;let M=!1;const U={...P};for(const ee of B.fields)if(ee.type==="reference"){const ae=P[ee.name];if(ee.options?.multiple&&Array.isArray(ae)){const re=ae.map(ue=>p[ue]??ue);JSON.stringify(re)!==JSON.stringify(ae)&&(U[ee.name]=re,M=!0)}else typeof ae=="string"&&p[ae]&&(U[ee.name]=p[ae],M=!0)}M&&await e.db.patch(N.newId,{data:U})}}return{success:C===0&&y.filter(N=>!N.includes("Slug conflict")).length===0,totalProcessed:S.length,created:g,updated:b,skipped:x,failed:C,results:h,idMapping:p,validationErrors:y.length>0?y:void 0}}});Ke({args:{contentTypeId:a.optional(a.id("contentTypes")),contentTypeName:a.optional(a.string()),status:a.optional(wt),statusIn:a.optional(a.array(wt)),locale:a.optional(a.string()),includeDeleted:a.optional(a.boolean())},returns:a.object({totalEntries:a.number(),entriesByType:a.any(),entriesByStatus:a.any(),contentTypes:a.array(a.string())}),handler:async(e,t)=>{const{contentTypeId:n,contentTypeName:o,status:s,statusIn:c,locale:u,includeDeleted:f=!1}=t,h=c?.length?c:s?[s]:void 0;let p=n;if(!p&&o){const k=await e.db.query("contentTypes").withIndex("by_name",R=>R.eq("name",o)).first();k&&(p=k._id)}const y=p?await e.db.get(p):null;let g;y?g=e.db.query("contentEntries").withIndex("by_content_type",k=>k.eq("contentTypeName",y.name)):g=e.db.query("contentEntries");let x=await g.collect();f||(x=x.filter(k=>!$e(k))),h&&h.length>0&&(x=x.filter(k=>h.includes(k.status))),u&&(x=x.filter(k=>k.locale===u));const C=new Set;for(const k of x)C.add(k.contentTypeName);const S=Array.from(C),A={};for(const k of x){const R=k.contentTypeName??"unknown";A[R]=(A[R]??0)+1}const I={};for(const k of x)I[k.status]=(I[k.status]??0)+1;return{totalEntries:x.length,entriesByType:A,entriesByStatus:I,contentTypes:S}}});Ke({args:{data:xy,contentTypeFilter:a.optional(a.array(a.string()))},returns:a.object({valid:a.boolean(),totalEntries:a.number(),validEntries:a.number(),invalidEntries:a.number(),missingContentTypes:a.array(a.string()),validationErrors:a.array(a.object({slug:a.string(),contentTypeName:a.string(),errors:a.array(a.string())}))}),handler:async(e,t)=>{const{data:n,contentTypeFilter:o}=t,s=[],c=[];let u=n.entries;o&&o.length>0&&(u=u.filter(b=>o.includes(b.contentTypeName)));const f=new Map,h=new Set;for(const b of u)h.add(b.contentTypeName);const p=Array.from(h);for(const b of p){const x=await e.db.query("contentTypes").withIndex("by_name",C=>C.eq("name",b)).first();x&&!x.deletedAt&&x.isActive?f.set(b,x):s.push(b)}let y=0,g=0;for(const b of u){const x=f.get(b.contentTypeName);if(!x){g++,c.push({slug:b.slug,contentTypeName:b.contentTypeName,errors:[`Content type "${b.contentTypeName}" not found`]});continue}const C={name:x.name,displayName:x.displayName,description:x.description,fields:x.fields,titleField:x.titleField,slugField:x.slugField,singleton:x.singleton},S=fc(b.data,C);S.valid?y++:(g++,c.push({slug:b.slug,contentTypeName:b.contentTypeName,errors:S.errors.map(A=>`${A.field}: ${A.message}`)}))}return{valid:g===0&&s.length===0,totalEntries:u.length,validEntries:y,invalidEntries:g,missingContentTypes:s,validationErrors:c}}});function hc(e){return e===void 0?!1:Date.now()<e}function iC(e){if(e===void 0)return 0;const t=e-Date.now();return t>0?t:0}function sC(e){const t=e??LS;return t<=0?LS:Math.min(t,RF)}Ke({args:MF.fields,returns:jF,handler:async(e,t)=>{const{id:n}=t,o=await e.db.get(n);if(!o)throw new Error(`Content entry not found: ${n}`);const s=o.lockedBy!==void 0&&o.lockExpiresAt!==void 0,c=s&&hc(o.lockExpiresAt),u=s&&!c,f=c?iC(o.lockExpiresAt):void 0;return{isLocked:c,lockedBy:c?o.lockedBy:void 0,lockExpiresAt:c?o.lockExpiresAt:void 0,timeRemaining:f,isExpired:u}}});Ke({args:DF.fields,returns:a.object({page:a.array(a.object({...Ut.fields,timeRemaining:a.optional(a.number())})),continueCursor:a.union(a.string(),a.null()),isDone:a.boolean()}),handler:async(e,t)=>{const{contentTypeName:n,lockedBy:o,paginationOpts:s}=t,f=(await e.db.query("contentEntries").withIndex("by_locked").collect()).filter(S=>!(S.lockedBy===void 0||S.lockExpiresAt===void 0||!hc(S.lockExpiresAt)||$e(S)||n&&S.contentTypeName!==n||o&&S.lockedBy!==o)),h=s.numItems??50,p=s.cursor;let y=0;if(p){const S=f.findIndex(A=>A._id===p);S!==-1&&(y=S+1)}const g=f.slice(y,y+h),b=y+h<f.length,x=b?g[g.length-1]?._id??null:null;return{page:g.map(S=>({...S,timeRemaining:iC(S.lockExpiresAt)})),continueCursor:x,isDone:!b}}});st({args:NF.fields,returns:LF,handler:async(e,t)=>{const{id:n,userId:o,lockDuration:s}=t,c=await e.db.get(n);if(!c)return{success:!1,error:`Content entry not found: ${n}`};if($e(c))return{success:!1,error:`Content entry has been deleted: ${n}`};const u=sC(s),h=Date.now()+u,y=c.lockedBy!==void 0&&c.lockExpiresAt!==void 0&&hc(c.lockExpiresAt),g=c.lockedBy===o;if(y&&!g)return{success:!1,error:"Entry is locked by another user",currentLockHolder:c.lockedBy,currentLockExpiresAt:c.lockExpiresAt};await e.db.patch(n,{lockedBy:o,lockExpiresAt:h});const b=await e.db.get(n);return b?{success:!0,entry:b}:{success:!1,error:"Failed to retrieve updated entry"}}});st({args:IF.fields,returns:Ut,handler:async(e,t)=>{const{id:n,userId:o}=t,s=await e.db.get(n);if(!s)throw new Error(`Content entry not found: ${n}`);if(s.lockedBy!==o)throw s.lockedBy===void 0?new Error(`Content entry is not locked: ${n}`):new Error("Cannot release lock: entry is locked by another user");await e.db.patch(n,{lockedBy:void 0,lockExpiresAt:void 0});const c=await e.db.get(n);if(!c)throw new Error("Failed to retrieve updated entry");return c}});st({args:OF.fields,returns:Ut,handler:async(e,t)=>{const{id:n,releasedBy:o}=t,s=await e.db.get(n);if(!s)throw new Error(`Content entry not found: ${n}`);if(s.lockedBy===void 0)throw new Error(`Content entry is not locked: ${n}`);await e.db.patch(n,{lockedBy:void 0,lockExpiresAt:void 0,updatedBy:o});const c=await e.db.get(n);if(!c)throw new Error("Failed to retrieve updated entry");return c}});st({args:kF.fields,returns:Ut,handler:async(e,t)=>{const{id:n,userId:o,lockDuration:s}=t,c=await e.db.get(n);if(!c)throw new Error(`Content entry not found: ${n}`);if(c.lockedBy!==o)throw c.lockedBy===void 0?new Error(`Content entry is not locked: ${n}`):new Error("Cannot renew lock: entry is locked by another user");if(!hc(c.lockExpiresAt))throw new Error("Lock has expired and cannot be renewed. Please acquire a new lock.");const u=sC(s),h=Date.now()+u;await e.db.patch(n,{lockExpiresAt:h});const p=await e.db.get(n);if(!p)throw new Error("Failed to retrieve updated entry");return p}});function rq(e,t){return e.lockedBy===void 0||e.lockExpiresAt===void 0?{isAllowed:!0}:hc(e.lockExpiresAt)?t&&e.lockedBy===t?{isAllowed:!0}:{isAllowed:!1,error:`Cannot update: entry is locked by user ${e.lockedBy}. Lock expires at ${new Date(e.lockExpiresAt).toISOString()}`}:{isAllowed:!0}}async function en(e,t){const{eventType:n,resourceType:o,resourceId:s,action:c,payload:u,userId:f,correlationId:h,metadata:p}=t;return await e.db.insert("cmsEvents",{eventType:n,resourceType:o,resourceId:s,action:c,payload:u,userId:f,processed:!1,correlationId:h,metadata:p})}Ke({args:{resourceType:a.optional(mf),action:a.optional(K1),processed:a.optional(a.boolean()),limit:a.optional(a.number()),cursor:a.optional(a.string())},returns:a.object({events:a.array(fy),hasMore:a.boolean()}),handler:async(e,t)=>{const{resourceType:n,action:o,processed:s,limit:c=50}=t;let u;s!==void 0?u=await e.db.query("cmsEvents").withIndex("by_processed",p=>p.eq("processed",s)).order("desc").take(c*2):u=await e.db.query("cmsEvents").order("desc").take(c*2),n!==void 0&&(u=u.filter(p=>p.resourceType===n)),o!==void 0&&(u=u.filter(p=>p.action===o));const f=u.slice(0,c),h=u.length>c;return{events:f,hasMore:h}}});Ke({args:{resourceType:mf,resourceId:a.string(),limit:a.optional(a.number())},returns:a.array(fy),handler:async(e,t)=>{const{resourceType:n,resourceId:o,limit:s=50}=t;return await e.db.query("cmsEvents").withIndex("by_resource",u=>u.eq("resourceType",n).eq("resourceId",o)).order("desc").take(s)}});Ke({args:{limit:a.optional(a.number())},returns:a.array(fy),handler:async(e,t)=>{const{limit:n=100}=t;return await e.db.query("cmsEvents").withIndex("by_processed",s=>s.eq("processed",!1)).order("asc").take(n)}});st({args:{eventIds:a.array(a.id("cmsEvents"))},returns:a.object({processedCount:a.number()}),handler:async(e,t)=>{const{eventIds:n}=t,o=Date.now();let s=0;for(const c of n){const u=await e.db.get(c);u&&!u.processed&&(await e.db.patch(c,{processed:!0,processedAt:o}),s++)}return{processedCount:s}}});vy({args:{eventType:a.string(),resourceType:a.union(a.literal("contentEntry"),a.literal("contentType"),a.literal("mediaAsset"),a.literal("mediaFolder")),resourceId:a.string(),action:a.union(a.literal("created"),a.literal("updated"),a.literal("published"),a.literal("unpublished"),a.literal("deleted"),a.literal("restored"),a.literal("duplicated"),a.literal("scheduled")),payload:a.any(),userId:a.optional(a.string()),correlationId:a.optional(a.string()),metadata:a.optional(a.any())},returns:a.id("cmsEvents"),handler:async(e,t)=>await e.db.insert("cmsEvents",{eventType:t.eventType,resourceType:t.resourceType,resourceId:t.resourceId,action:t.action,payload:t.payload,userId:t.userId,processed:!1,correlationId:t.correlationId,metadata:t.metadata})});st({args:{retentionDays:a.optional(a.number())},returns:a.object({deletedCount:a.number()}),handler:async(e,t)=>{const{retentionDays:n=30}=t,o=Date.now()-n*24*60*60*1e3;let s=0;const c=await e.db.query("cmsEvents").withIndex("by_processed",u=>u.eq("processed",!0)).filter(u=>u.lt(u.field("_creationTime"),o)).take(1e3);for(const u of c)await e.db.delete(u._id),s++;return{deletedCount:s}}});function Jo(e){return`contentEntry.${e}`}function Sy(e){return`contentType.${e}`}function ma(e){return`mediaAsset.${e}`}function oq(e){if(e==null||e==="")return null;if(typeof e=="number")return e;if(typeof e=="string"){const n=e.trim().replace(/[,$]/g,""),o=parseFloat(n);return isNaN(o)?null:o}return null}function iq(e){return e==null?null:typeof e=="string"?e:typeof e=="number"?String(e):null}function sq(e){if(e==null)return null;if(typeof e=="boolean")return e;if(typeof e=="string"){const t=e.toLowerCase().trim();return["true","yes","1","on","enabled"].includes(t)?!0:["false","no","0","off","disabled",""].includes(t)?!1:null}return typeof e=="number"?e!==0:null}function aq(e){return e==null?null:typeof e=="string"?e:typeof e=="boolean"?e?"true":"false":null}function lq(e){if(e==null||e==="")return null;if(typeof e=="number")return e;if(typeof e=="string"){const t=Date.parse(e);return isNaN(t)?null:t}return null}function cq(e){return e==null?null:typeof e=="string"?e:typeof e=="number"?new Date(e).toISOString():null}function uq(e){if(e==null||e==="")return null;if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(e)}catch{return{value:e}}return{value:e}}function dq(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}function fq(e){return e==null?[]:Array.isArray(e)?e:[e]}function hq(e){return e==null?null:Array.isArray(e)?e.length>0?e[0]:null:e}function pq(e,t){return e==null?null:Array.isArray(e)?e.map(n=>typeof n=="string"&&n in t?t[n]:n):typeof e=="string"&&e in t?t[e]:e}function mq(e,t,n){switch(t){case"TEXT_TO_NUMBER":return oq(e);case"NUMBER_TO_TEXT":return iq(e);case"TEXT_TO_BOOLEAN":return sq(e);case"BOOLEAN_TO_TEXT":return aq(e);case"TEXT_TO_DATE":return lq(e);case"DATE_TO_TEXT":return cq(e);case"TEXT_TO_JSON":return uq(e);case"JSON_TO_TEXT":return dq(e);case"SINGLE_TO_ARRAY":return fq(e);case"ARRAY_TO_SINGLE":return hq(e);case"SELECT_VALUE_REMAP":return pq(e,n??{});default:return e}}function aC(e,t){const n={...e},o=[];for(const s of t)switch(s.type){case"ADD_FIELD":{if(!s.fieldName)continue;const c=s.fieldName,u=n[c];if((u==null||u==="")&&!s.preserveEmpty){const h=s.defaultValue;h!==void 0&&(o.push({fieldName:c,operation:"ADD_FIELD",oldValue:u,newValue:h}),n[c]=h)}break}case"REMOVE_FIELD":{if(!s.fieldName)continue;const c=s.fieldName;c in n&&(o.push({fieldName:c,operation:"REMOVE_FIELD",oldValue:n[c],newValue:void 0}),delete n[c]);break}case"RENAME_FIELD":{if(!s.oldFieldName||!s.newFieldName)continue;const{oldFieldName:c,newFieldName:u}=s;if(c in n){const f=n[c];o.push({fieldName:c,operation:"RENAME_FIELD",oldValue:f,newValue:f}),delete n[c],n[u]=f}break}case"TRANSFORM_FIELD":{if(!s.fieldName)continue;const c=s.fieldName;if(c in n&&s.transformation){const u=n[c],f=mq(u,s.transformation,s.valueMap);JSON.stringify(u)!==JSON.stringify(f)&&(o.push({fieldName:c,operation:"TRANSFORM_FIELD",oldValue:u,newValue:f}),n[c]=f)}break}case"SET_DEFAULT":{if(!s.fieldName)continue;const c=s.fieldName,u=n[c];(u==null||u==="")&&!s.preserveEmpty&&s.defaultValue!==void 0&&(o.push({fieldName:c,operation:"SET_DEFAULT",oldValue:u,newValue:s.defaultValue}),n[c]=s.defaultValue);break}}return{migratedData:n,changes:o}}const lC=a.union(a.literal("ADD_FIELD"),a.literal("REMOVE_FIELD"),a.literal("RENAME_FIELD"),a.literal("TRANSFORM_FIELD"),a.literal("SET_DEFAULT")),gq=a.union(a.literal("TEXT_TO_NUMBER"),a.literal("NUMBER_TO_TEXT"),a.literal("TEXT_TO_BOOLEAN"),a.literal("BOOLEAN_TO_TEXT"),a.literal("TEXT_TO_DATE"),a.literal("DATE_TO_TEXT"),a.literal("TEXT_TO_JSON"),a.literal("JSON_TO_TEXT"),a.literal("SINGLE_TO_ARRAY"),a.literal("ARRAY_TO_SINGLE"),a.literal("SELECT_VALUE_REMAP")),cC=a.object({type:lC,fieldName:a.optional(a.string()),oldFieldName:a.optional(a.string()),newFieldName:a.optional(a.string()),defaultValue:a.optional(a.any()),transformation:a.optional(gq),customTransformation:a.optional(a.string()),valueMap:a.optional(a.any()),preserveEmpty:a.optional(a.boolean())}),yq=a.object({contentTypeId:a.id("contentTypes"),migrations:a.array(cC),dryRun:a.optional(a.boolean()),createVersionSnapshots:a.optional(a.boolean()),statusFilter:a.optional(a.array(a.union(a.literal("draft"),a.literal("published"),a.literal("archived"),a.literal("scheduled")))),entryIds:a.optional(a.array(a.id("contentEntries"))),migratedBy:a.optional(a.string()),changeDescription:a.optional(a.string())}),vq=a.object({fieldName:a.string(),operation:lC,oldValue:a.optional(a.any()),newValue:a.optional(a.any())}),uC=a.object({entryId:a.id("contentEntries"),slug:a.string(),success:a.boolean(),error:a.optional(a.string()),changes:a.optional(a.array(vq))}),bq=a.object({dryRun:a.boolean(),totalEntries:a.number(),successCount:a.number(),failureCount:a.number(),skippedCount:a.number(),results:a.array(uC),versionSnapshotsCreated:a.number()});st({args:yq.fields,returns:bq,handler:async(e,t)=>{const{contentTypeId:n,migrations:o,dryRun:s=!1,createVersionSnapshots:c=!0,statusFilter:u,entryIds:f,migratedBy:h,changeDescription:p="Content type migration"}=t,y=await e.db.get(n);if(!y)throw new Error(`Content type not found: ${n}`);if($e(y))throw new Error(`Content type has been deleted: ${y.name}`);for(const R of o){if(R.type==="RENAME_FIELD"&&(!R.oldFieldName||!R.newFieldName))throw new Error("RENAME_FIELD operation requires both oldFieldName and newFieldName");if((R.type==="ADD_FIELD"||R.type==="REMOVE_FIELD"||R.type==="TRANSFORM_FIELD"||R.type==="SET_DEFAULT")&&!R.fieldName)throw new Error(`${R.type} operation requires fieldName`);if(R.type==="TRANSFORM_FIELD"&&!R.transformation)throw new Error("TRANSFORM_FIELD operation requires transformation type")}let x=await e.db.query("contentEntries").withIndex("by_content_type",R=>R.eq("contentTypeName",y.name)).filter(R=>R.eq(R.field("deletedAt"),void 0)).collect();if(u&&u.length>0&&(x=x.filter(R=>u.includes(R.status))),f&&f.length>0){const R=new Set(f.map(N=>N.toString()));x=x.filter(N=>R.has(N._id.toString()))}const C=[];let S=0,A=0,I=0,k=0;for(const R of x)try{const N=R.data,{migratedData:j,changes:B}=aC(N,o);if(B.length===0){C.push({entryId:R._id,slug:R.slug,success:!0,changes:[]}),I++;continue}s?(C.push({entryId:R._id,slug:R.slug,success:!0,changes:B}),S++):(c&&(await e.db.insert("contentVersions",{entryId:R._id,versionNumber:R.version,data:R.data,slug:R.slug,status:R.status,changeDescription:`Pre-migration snapshot: ${p}`,createdBy:h,wasPublished:R.status==="published",publishedAt:R.status==="published"?R.lastPublishedAt:void 0}),k++),await e.db.patch(R._id,{data:j,version:R.version+1,updatedBy:h}),C.push({entryId:R._id,slug:R.slug,success:!0,changes:B}),S++)}catch(N){C.push({entryId:R._id,slug:R.slug,success:!1,error:N instanceof Error?N.message:"Unknown error"}),A++}return{dryRun:s,totalEntries:x.length,successCount:S,failureCount:A,skippedCount:I,results:C,versionSnapshotsCreated:k}}});Ke({args:{contentTypeId:a.id("contentTypes"),migrations:a.array(cC),statusFilter:a.optional(a.array(a.union(a.literal("draft"),a.literal("published"),a.literal("archived"),a.literal("scheduled")))),entryIds:a.optional(a.array(a.id("contentEntries"))),limit:a.optional(a.number())},returns:a.object({totalEntries:a.number(),previewedEntries:a.number(),results:a.array(uC),summary:a.object({entriesWithChanges:a.number(),entriesWithoutChanges:a.number(),operationCounts:a.any()})}),handler:async(e,t)=>{const{contentTypeId:n,migrations:o,statusFilter:s,entryIds:c,limit:u=10}=t,f=await e.db.get(n);if(!f)throw new Error(`Content type not found: ${n}`);let h=await e.db.query("contentEntries").withIndex("by_content_type",S=>S.eq("contentTypeName",f.name)).filter(S=>S.eq(S.field("deletedAt"),void 0)).collect();const p=h.length;if(s&&s.length>0&&(h=h.filter(S=>s.includes(S.status))),c&&c.length>0){const S=new Set(c.map(A=>A.toString()));h=h.filter(A=>S.has(A._id.toString()))}const y=h.slice(0,u),g=[],b={};let x=0,C=0;for(const S of y){const A=S.data,{changes:I}=aC(A,o);if(I.length>0){x++;for(const k of I)b[k.operation]=(b[k.operation]||0)+1}else C++;g.push({entryId:S._id,slug:S.slug,success:!0,changes:I})}return{totalEntries:p,previewedEntries:y.length,results:g,summary:{entriesWithChanges:x,entriesWithoutChanges:C,operationCounts:b}}}});Ke({args:{},returns:a.array(a.object({type:a.string(),description:a.string(),fromType:a.string(),toType:a.string()})),handler:async()=>[{type:"TEXT_TO_NUMBER",description:"Convert text strings to numbers (handles currency formatting)",fromType:"text",toType:"number"},{type:"NUMBER_TO_TEXT",description:"Convert numbers to text strings",fromType:"number",toType:"text"},{type:"TEXT_TO_BOOLEAN",description:"Convert text to boolean (true/false, yes/no, 1/0, on/off, enabled/disabled)",fromType:"text",toType:"boolean"},{type:"BOOLEAN_TO_TEXT",description:'Convert boolean to "true" or "false" strings',fromType:"boolean",toType:"text"},{type:"TEXT_TO_DATE",description:"Convert date strings to timestamps (ISO 8601 and common formats)",fromType:"text",toType:"date/datetime"},{type:"DATE_TO_TEXT",description:"Convert timestamps to ISO 8601 date strings",fromType:"date/datetime",toType:"text"},{type:"TEXT_TO_JSON",description:"Parse JSON strings to objects",fromType:"text",toType:"json"},{type:"JSON_TO_TEXT",description:"Stringify JSON objects to text",fromType:"json",toType:"text"},{type:"SINGLE_TO_ARRAY",description:"Wrap single values in an array (for multiple references)",fromType:"any",toType:"array"},{type:"ARRAY_TO_SINGLE",description:"Extract first element from array (for single references)",fromType:"array",toType:"any"},{type:"SELECT_VALUE_REMAP",description:"Remap select/multiSelect values using a provided mapping",fromType:"select/multiSelect",toType:"select/multiSelect"}]});const wq={thumbnail:{name:"thumbnail",variantType:"thumbnail",width:150,height:150,format:"webp",quality:80,description:"Small square thumbnail for previews and lists"},small:{name:"small",variantType:"responsive",width:480,format:"webp",quality:80,description:"Small responsive image (480px wide)"},medium:{name:"medium",variantType:"responsive",width:768,format:"webp",quality:80,description:"Medium responsive image (768px wide)"},large:{name:"large",variantType:"responsive",width:1024,format:"webp",quality:80,description:"Large responsive image (1024px wide)"},xlarge:{name:"xlarge",variantType:"responsive",width:1440,format:"webp",quality:85,description:"Extra large responsive image (1440px wide)"},webp:{name:"webp",variantType:"format",format:"webp",quality:85,description:"WebP format conversion (same dimensions)"},avif:{name:"avif",variantType:"format",format:"avif",quality:80,description:"AVIF format conversion (same dimensions)"}};Ke({args:gF.fields,returns:a.union(Fi,a.null()),handler:async(e,t)=>{const{id:n,includeDeleted:o=!1}=t,s=await e.db.get(n);if(!s||!o&&$e(s))return null;const c=await e.storage.getUrl(s.storageId);return{...s,url:c}}});Ke({args:yF.fields,returns:a.array(Fi),handler:async(e,t)=>{const{assetId:n,variantType:o,format:s,preset:c,status:u,includeDeleted:f=!1}=t;let h;o?h=await e.db.query("mediaVariants").withIndex("by_asset_and_type",g=>g.eq("assetId",n).eq("variantType",o)).collect():c?h=await e.db.query("mediaVariants").withIndex("by_asset_and_preset",g=>g.eq("assetId",n).eq("preset",c)).collect():s?h=await e.db.query("mediaVariants").withIndex("by_asset_and_format",g=>g.eq("assetId",n).eq("format",s)).collect():h=await e.db.query("mediaVariants").withIndex("by_asset",g=>g.eq("assetId",n)).collect();let p=h;return f||(p=p.filter(g=>!$e(g))),s&&!c&&o&&(p=p.filter(g=>g.format===s)),c&&!s&&o&&(p=p.filter(g=>g.preset===c)),u&&(p=p.filter(g=>g.status===u)),await Promise.all(p.map(async g=>{const b=await e.storage.getUrl(g.storageId);return{...g,url:b}}))}});Ke({args:vF.fields,returns:a.union(a.object({...Fi.fields,isOriginal:a.boolean()}),a.null()),handler:async(e,t)=>{const{assetId:n,targetWidth:o,targetHeight:s,preferredFormat:c,fallbackToOriginal:u=!0}=t,f=await e.db.query("mediaVariants").withIndex("by_asset",g=>g.eq("assetId",n)).filter(g=>g.and(g.eq(g.field("status"),"completed"),g.eq(g.field("deletedAt"),void 0))).collect();if(f.length===0){if(u){const g=await e.db.get(n);if(g&&g.kind==="asset"&&!$e(g)){const b=g,x=await e.storage.getUrl(b.storageId);return{_id:b._id,_creationTime:b._creationTime,assetId:b._id,storageId:b.storageId,variantType:"format",width:b.width,height:b.height,format:xq(b.mimeType),mimeType:b.mimeType,size:b.size??0,quality:void 0,preset:void 0,autoGenerated:!1,status:"completed",errorMessage:void 0,processingStartedAt:void 0,processingCompletedAt:void 0,deletedAt:void 0,createdBy:b.createdBy,url:x,isOriginal:!0}}}return null}const h=f.map(g=>{let b=0;if(c&&g.format===c&&(b+=10),o&&g.width)if(g.width>=o){const x=g.width/o;b+=5-Math.min(4,x-1)}else{const x=g.width/o;b+=x*2}if(s&&g.height)if(g.height>=s){const x=g.height/s;b+=5-Math.min(4,x-1)}else{const x=g.height/s;b+=x*2}return b-=g.size/1e6,{variant:g,score:b}});h.sort((g,b)=>b.score-g.score);const p=h[0].variant,y=await e.storage.getUrl(p.storageId);return{...p,url:y,isOriginal:!1}}});Ke({args:{assetId:a.id("mediaItems"),format:a.optional(a.string())},returns:wF,handler:async(e,t)=>{const{assetId:n,format:o}=t,s=await e.db.get(n);if(!s||s.kind!=="asset"||$e(s))return{src:null,srcset:"",entries:[],sizes:void 0};const c=s,u=await e.storage.getUrl(c.storageId);let f;o?f=await e.db.query("mediaVariants").withIndex("by_asset_and_format",g=>g.eq("assetId",n).eq("format",o)).filter(g=>g.and(g.eq(g.field("status"),"completed"),g.eq(g.field("deletedAt"),void 0),g.or(g.eq(g.field("variantType"),"responsive"),g.eq(g.field("variantType"),"format")))).collect():f=await e.db.query("mediaVariants").withIndex("by_asset",g=>g.eq("assetId",n)).filter(g=>g.and(g.eq(g.field("status"),"completed"),g.eq(g.field("deletedAt"),void 0),g.or(g.eq(g.field("variantType"),"responsive"),g.eq(g.field("variantType"),"format")))).collect();const h=[];for(const g of f)if(g.width){const b=await e.storage.getUrl(g.storageId);b&&h.push({url:b,descriptor:`${g.width}w`,width:g.width,format:g.format})}h.sort((g,b)=>g.width-b.width);const p=h.map(g=>`${g.url} ${g.descriptor}`).join(", ");let y;if(h.length>0){const g=h[h.length-1].width;y=`(max-width: ${g}px) 100vw, ${g}px`}return{src:u,srcset:p,entries:h,sizes:y}}});Ke({args:{},returns:a.array(a.object({name:a.string(),variantType:_a,width:a.optional(a.number()),height:a.optional(a.number()),format:a.string(),quality:a.optional(a.number()),description:a.optional(a.string())})),handler:async()=>Object.values(wq)});Ke({args:{status:a.optional(a.union(a.literal("pending"),a.literal("processing"))),limit:a.optional(a.number())},returns:a.array(Y1),handler:async(e,t)=>{const{status:n,limit:o=100}=t;let s;if(n)s=await e.db.query("mediaVariants").withIndex("by_status",c=>c.eq("status",n)).order("asc").take(o);else{const c=await e.db.query("mediaVariants").withIndex("by_status",f=>f.eq("status","pending")).order("asc").take(o),u=await e.db.query("mediaVariants").withIndex("by_status",f=>f.eq("status","processing")).order("asc").take(o);s=[...c,...u].slice(0,o)}return s}});Ke({args:{assetId:a.id("mediaItems")},returns:a.union(a.object({original:a.object({_id:a.id("mediaItems"),_creationTime:a.number(),name:a.string(),mimeType:a.string(),size:a.number(),width:a.optional(a.number()),height:a.optional(a.number()),url:a.union(a.string(),a.null())}),variants:a.array(Fi),variantsByType:a.object({thumbnail:a.optional(Fi),responsive:a.array(Fi),format:a.array(Fi)})}),a.null()),handler:async(e,t)=>{const{assetId:n}=t,o=await e.db.get(n);if(!o||o.kind!=="asset"||$e(o))return null;const s=o,c=await e.storage.getUrl(s.storageId),u=await e.db.query("mediaVariants").withIndex("by_asset",g=>g.eq("assetId",n)).filter(g=>g.and(g.eq(g.field("status"),"completed"),g.eq(g.field("deletedAt"),void 0))).collect(),f=await Promise.all(u.map(async g=>{const b=await e.storage.getUrl(g.storageId);return{...g,url:b}})),h=f.find(g=>g.variantType==="thumbnail"),p=f.filter(g=>g.variantType==="responsive").sort((g,b)=>(g.width||0)-(b.width||0)),y=f.filter(g=>g.variantType==="format");return{original:{_id:s._id,_creationTime:s._creationTime,name:s.name,mimeType:s.mimeType,size:s.size??0,width:s.width,height:s.height,url:c},variants:f,variantsByType:{thumbnail:h,responsive:p,format:y}}}});function xq(e){return{"image/jpeg":"jpeg","image/jpg":"jpg","image/png":"png","image/webp":"webp","image/avif":"avif","image/gif":"gif","image/svg+xml":"svg"}[e]||e.split("/")[1]||"unknown"}const Sq=UT;O1();const dC={minLines:1,minCharsSoftLimit:100,maxCharsSoftLimit:1e3,maxCharsHardLimit:4e3,delimiter:`
21
+
22
+ `,fallbackDelimiters:[`
23
+ `,". ",", "],preserveHeadingContext:!0,overlapChars:50},fC={includeMetadata:!0,includeFields:[],excludeFields:[],extractRichText:!0,extractJson:!0,includeReferenceContext:!0,chunkOptions:dC,chunkPrefix:"",chunkSuffix:"",createSummaryChunk:!1,summaryFields:[]};function hC(e){if(e==null)return"";if(typeof e=="string")return Eq(e);if(typeof e=="object"&&e!==null){const t=e;if(t.type==="doc"&&Array.isArray(t.content))return Ld(t);if(Array.isArray(e))return e.map(n=>hC(n)).join(`
24
+
25
+ `);if("text"in t&&typeof t.text=="string")return t.text;if("content"in t&&typeof t.content=="string")return t.content}return""}function Ld(e){const t=e.content;if(!Array.isArray(t))return"";const n=[];for(const o of t){if(typeof o!="object"||o===null)continue;const s=o;switch(s.type){case"paragraph":case"heading":n.push(pC(s));break;case"bulletList":case"orderedList":n.push(_q(s));break;case"blockquote":{const u=Ld(s);n.push(`"${u}"`);break}case"codeBlock":if(s.content&&Array.isArray(s.content)){const u=s.content.map(f=>f.text||"").join("");n.push(u)}break;case"horizontalRule":break;default:s.content&&n.push(Ld(s))}}return n.filter(Boolean).join(`
26
+
27
+ `)}function pC(e){const t=e.content;return Array.isArray(t)?t.map(n=>{if(typeof n!="object"||n===null)return"";const o=n;return o.type==="text"?o.text||"":o.content?pC(o):""}).join(""):""}function _q(e){const t=e.content;return Array.isArray(t)?t.map((n,o)=>typeof n!="object"||n===null?"":`- ${Ld(n)}`).join(`
28
+ `):""}function Eq(e){if(!e)return"";let t=e.replace(/<\/?(p|div|br|h[1-6]|li|tr)[^>]*>/gi,`
29
+ `).replace(/<\/?(ul|ol|table|blockquote)[^>]*>/gi,`
30
+
31
+ `);return t=t.replace(/<[^>]*>/g,""),t=t.replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&mdash;/g,"—").replace(/&ndash;/g,"–"),t=t.split(`
32
+ `).map(n=>n.trim()).join(`
33
+ `).replace(/\n{3,}/g,`
34
+
35
+ `).trim(),t}function hd(e,t=5){if(t<=0||e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(n=>hd(n,t-1)).filter(Boolean).join(", ");if(typeof e=="object"){const n=e,o=[],s=["text","content","value","label","title","name","description"],c=new Set;for(const u of s)if(u in n){const f=hd(n[u],t-1);f&&(o.push(f),c.add(u))}for(const[u,f]of Object.entries(n)){if(c.has(u)||u.startsWith("_")||u.startsWith("$"))continue;const h=hd(f,t-1);h&&o.push(h)}return o.join(" ")}return""}function Tq(e){return e==null?"":typeof e=="string"?e:Array.isArray(e)?e.filter(t=>typeof t=="string").join(", "):""}function Cq(e,t,n={},o){const s={...fC,...n},c=e.data||{},u={},f=[],h=[],p=[];let y;const g=t.fields.filter(x=>!(s.includeFields&&s.includeFields.length>0&&!s.includeFields.includes(x.name)||s.excludeFields&&s.excludeFields.length>0&&s.excludeFields.includes(x.name)));for(const x of g){const C=c[x.name];if(C==null)continue;let S="";switch(x.type){case"text":S=typeof C=="string"?C:String(C);break;case"richText":s.extractRichText&&(S=hC(C));break;case"json":s.extractJson&&(S=hd(C));break;case"select":case"multiSelect":S=Tq(C);break;case"reference":{const A=Aq(C,x);h.push(...A);break}case"media":{const A=Rq(C,x);p.push(...A);break}case"number":case"boolean":case"date":case"datetime":S=Nq(C,x.type);break;default:typeof C=="string"&&(S=C)}S&&(u[x.name]=S,f.push({fieldName:x.name,fieldLabel:x.label,fieldType:x.type,charCount:S.length}),x.name===t.titleField&&(y=S))}const b=[];y&&b.push(y);for(const x of g){if(x.name===t.titleField)continue;const C=u[x.name];C&&b.push(C)}return{fullText:b.join(`
36
+
37
+ `),fieldTexts:u,title:y,referencedEntryIds:h,referencedMediaIds:p,sourceInfo:f}}function Aq(e,t){return e==null?[]:t.options?.multiple===!0&&Array.isArray(e)?e.filter(o=>typeof o=="string"):typeof e=="string"?[e]:[]}function Rq(e,t){return e==null?[]:t.options?.multiple===!0&&Array.isArray(e)?e.filter(o=>typeof o=="string"):typeof e=="string"?[e]:[]}function Nq(e,t){if(e==null)return"";switch(t){case"number":return typeof e=="number"?e.toString():String(e);case"boolean":return e?"Yes":"No";case"date":case"datetime":return typeof e=="string"?e:typeof e=="number"?new Date(e).toISOString():String(e);default:return String(e)}}function Iq(e,t={}){const n={...dC,...t};if(!e||e.trim().length===0)return[];if(e.length<=n.maxCharsSoftLimit)return[e.trim()];const o=[];let s=null,c=e.split(n.delimiter);if(c.length<=2&&e.length>n.maxCharsSoftLimit)for(const f of n.fallbackDelimiters){const h=e.split(f);if(h.length>c.length){c=h;break}}let u="";for(const f of c){const h=f.trim();if(!h)continue;const p=Oq(h);p&&n.preserveHeadingContext&&(s=h);const y=u?`${u}
38
+
39
+ ${h}`:h;if(y.length>n.maxCharsSoftLimit&&u?(o.push(VS(u)),n.preserveHeadingContext&&s&&!p?u=`${s}
40
+
41
+ ${h}`:u=h):u=y,u.length>n.maxCharsHardLimit){const g=kq(u,n);o.push(...g.slice(0,-1)),u=g[g.length-1]||""}}return u.trim()&&o.push(VS(u)),o}function Oq(e){const t=e.trim();return!!(t.length<100&&!t.match(/[.!?]$/)&&(t.match(/^#{1,6}\s/)||t.match(/^[A-Z][\w\s]+:?$/)||t.match(/^\d+\.\s+[A-Z]/)))}function VS(e,t,n){return e.trim()}function kq(e,t){const n=[];let o=e;for(;o.length>t.maxCharsHardLimit;){let s=t.maxCharsSoftLimit;const c=o.lastIndexOf(". ",s);if(c>t.minCharsSoftLimit)s=c+1;else{const u=o.lastIndexOf(" ",s);u>t.minCharsSoftLimit&&(s=u)}n.push(o.slice(0,s).trim()),o=o.slice(s).trim()}return o&&n.push(o),n}function mC(e,t,n={},o){const s={...fC,...n},c=Cq(e,t,s);if(!c.fullText)return[];let u=c.fullText;s.chunkPrefix&&(u=`${s.chunkPrefix.replace("{contentType}",t.displayName).replace("{title}",c.title||e.slug).replace("{slug}",e.slug)}
42
+
43
+ ${u}`),s.chunkSuffix&&(u=`${u}
44
+
45
+ ${s.chunkSuffix}`);const f=Iq(u,s.chunkOptions),h=f.map((p,y)=>{const g={entryId:e._id,contentType:t.name,contentTypeDisplayName:t.displayName,slug:e.slug,status:e.status,locale:e.locale,sourceFields:c.sourceInfo.map(b=>b.fieldName),chunkIndex:y,totalChunks:f.length,title:c.title,createdAt:new Date(e._creationTime).toISOString(),firstPublishedAt:e.firstPublishedAt?new Date(e.firstPublishedAt).toISOString():void 0,lastPublishedAt:e.lastPublishedAt?new Date(e.lastPublishedAt).toISOString():void 0,version:e.version,referencedEntryIds:c.referencedEntryIds.length>0?c.referencedEntryIds:void 0,referencedMediaIds:c.referencedMediaIds.length>0?c.referencedMediaIds:void 0,semanticType:Mq(p)};return s.includeMetadata?{text:p,metadata:g}:{text:p,metadata:g}});if(s.createSummaryChunk&&h.length>0){const p=Dq(e,t,c,h.length);h.unshift(p),h.forEach((y,g)=>{y.metadata.chunkIndex=g,y.metadata.totalChunks=h.length})}return h}function Mq(e){const t=e.trim();if(t.match(/^#{1,6}\s/)||t.length<100&&!t.includes(`
46
+ `)){const n=t.split(`
47
+ `);if(n.length===1&&!t.match(/[.!?]$/))return n[0].length<20?"title":"heading"}return t.match(/^[-*]\s/m)||t.match(/^\d+\.\s/m)?"list":t.startsWith('"')||t.startsWith(">")?"quote":t.startsWith("```")||t.match(/^\s{4}/m)?"code":t.includes(`
48
+
49
+ `)?"mixed":"paragraph"}function Dq(e,t,n,o){const s=[];n.title&&s.push(`Title: ${n.title}`),s.push(`Type: ${t.displayName}`),s.push(`Status: ${e.status}`),e.lastPublishedAt&&s.push(`Published: ${new Date(e.lastPublishedAt).toLocaleDateString()}`);const c=Object.keys(n.fieldTexts)[0];if(c&&n.fieldTexts[c]){const u=n.fieldTexts[c].slice(0,200);s.push(`Summary: ${u}${u.length>=200?"...":""}`)}return{text:s.join(`
50
+ `),metadata:{entryId:e._id,contentType:t.name,contentTypeDisplayName:t.displayName,slug:e.slug,status:e.status,locale:e.locale,sourceFields:["_summary"],chunkIndex:0,totalChunks:o+1,title:n.title,createdAt:new Date(e._creationTime).toISOString(),firstPublishedAt:e.firstPublishedAt?new Date(e.firstPublishedAt).toISOString():void 0,lastPublishedAt:e.lastPublishedAt?new Date(e.lastPublishedAt).toISOString():void 0,version:e.version,semanticType:"field_value"}}}const gC={autoIndexOnPublish:!0,autoRemoveOnUnpublish:!0,autoRemoveOnDelete:!0,batchSize:50,pollingIntervalMs:6e4,extractionOptions:{},includeContentTypes:[],excludeContentTypes:[],namespacePrefix:"cms"};gf({args:{limit:a.optional(a.number()),includeContentTypes:a.optional(a.array(a.string())),excludeContentTypes:a.optional(a.array(a.string()))},handler:async(e,t)=>{const{limit:n=50,includeContentTypes:o=[],excludeContentTypes:s=[]}=t,c=await e.db.query("cmsEvents").withIndex("by_processed",h=>h.eq("processed",!1)).order("asc").take(n*2),u=["published","unpublished","deleted","restored"];return c.filter(h=>{if(h.resourceType!=="contentEntry"||!u.includes(h.action))return!1;const y=h.payload?.contentTypeName;return!(y&&(o.length>0&&!o.includes(y)||s.length>0&&s.includes(y)))}).slice(0,n)}});gf({args:{entryId:a.id("contentEntries")},handler:async(e,t)=>{const n=await e.db.get(t.entryId);if(!n)return null;const o=await e.db.query("contentTypes").withIndex("by_name",s=>s.eq("name",n.contentTypeName)).first();return o?{entry:n,contentType:o}:null}});gf({args:{entryIds:a.array(a.id("contentEntries"))},handler:async(e,t)=>{const n=[],o=new Map;for(const s of t.entryIds){const c=await e.db.get(s);if(!c){n.push(null);continue}let u=o.get(c.contentTypeName);if(!u){const f=await e.db.query("contentTypes").withIndex("by_name",h=>h.eq("name",c.contentTypeName)).first();f&&(u=f,o.set(c.contentTypeName,f))}if(!u){n.push(null);continue}n.push({entry:c,contentType:u})}return n}});Ke({args:{},returns:a.object({totalPublished:a.number(),pendingIndexing:a.number(),pendingRemoval:a.number(),byContentType:a.any()}),handler:async e=>{const t=await e.db.query("contentEntries").withIndex("by_status",u=>u.eq("status","published")).filter(u=>u.eq(u.field("deletedAt"),void 0)).collect(),n=await e.db.query("cmsEvents").withIndex("by_processed",u=>u.eq("processed",!1)).filter(u=>u.eq(u.field("resourceType"),"contentEntry")).collect(),o=n.filter(u=>u.action==="published").length,s=n.filter(u=>["unpublished","deleted"].includes(u.action)).length,c={};for(const u of t){const f=u.contentTypeName||"unknown";c[f]||(c[f]={published:0,pending:0}),c[f].published++}for(const u of n){if(u.action!=="published")continue;const h=u.payload?.contentTypeName||"unknown";c[h]||(c[h]={published:0,pending:0}),c[h].pending++}return{totalPublished:t.length,pendingIndexing:o,pendingRemoval:s,byContentType:c}}});Ke({args:{entryId:a.id("contentEntries")},returns:a.boolean(),handler:async(e,t)=>await e.db.query("cmsEvents").withIndex("by_resource",o=>o.eq("resourceType","contentEntry").eq("resourceId",t.entryId)).filter(o=>o.eq(o.field("processed"),!1)).first()!==null});Ke({args:{entryId:a.id("contentEntries"),options:a.optional(a.object({includeFields:a.optional(a.array(a.string())),excludeFields:a.optional(a.array(a.string())),maxCharsSoftLimit:a.optional(a.number()),namespacePrefix:a.optional(a.string())}))},returns:a.union(a.object({entryId:a.string(),chunks:a.array(a.object({text:a.string(),metadata:a.any()})),metadata:a.object({entryId:a.string(),contentType:a.string(),contentTypeDisplayName:a.string(),slug:a.string(),locale:a.optional(a.string()),version:a.number(),title:a.optional(a.string()),publishedAt:a.optional(a.number()),namespace:a.string()})}),a.null()),handler:async(e,t)=>{const{entryId:n,options:o={}}=t,s=await e.db.get(n);if(!s||s.status!=="published")return null;const c=await e.db.query("contentTypes").withIndex("by_name",x=>x.eq("name",s.contentTypeName)).first();if(!c)return null;const u={includeMetadata:!0,includeFields:o.includeFields,excludeFields:o.excludeFields,chunkOptions:{maxCharsSoftLimit:o.maxCharsSoftLimit??1e3}},f={_id:s._id,contentTypeName:s.contentTypeName,slug:s.slug,status:s.status,data:s.data,locale:s.locale,version:s.version,_creationTime:s._creationTime,firstPublishedAt:s.firstPublishedAt,lastPublishedAt:s.lastPublishedAt},h={_id:c._id,name:c.name,displayName:c.displayName,fields:c.fields,titleField:c.titleField,slugField:c.slugField},p=mC(f,h,u),y=o.namespacePrefix??"cms",g=s.locale?`${y}:${c.name}:${s.locale}`:`${y}:${c.name}`,b=p[0]?.metadata?.title||s.data?.title;return{entryId:s._id,chunks:p.map(x=>({text:x.text,metadata:x.metadata})),metadata:{entryId:s._id,contentType:c.name,contentTypeDisplayName:c.displayName,slug:s.slug,locale:s.locale,version:s.version,title:b,publishedAt:s.lastPublishedAt,namespace:g}}}});st({args:{eventIds:a.array(a.id("cmsEvents"))},returns:a.object({processedCount:a.number()}),handler:async(e,t)=>{const{eventIds:n}=t,o=Date.now();let s=0;for(const c of n){const u=await e.db.get(c);u&&!u.processed&&(await e.db.patch(c,{processed:!0,processedAt:o}),s++)}return{processedCount:s}}});vy({args:{entryId:a.id("contentEntries"),userId:a.optional(a.string())},handler:async(e,t)=>{const{entryId:n,userId:o}=t,s=await e.db.get(n);if(!s)throw new Error(`Entry not found: ${n}`);if(s.status!=="published")throw new Error(`Entry is not published: ${n}`);return await e.db.insert("cmsEvents",{eventType:"contentEntry.published",resourceType:"contentEntry",resourceId:n,action:"published",payload:{slug:s.slug,contentTypeName:s.contentTypeName,status:s.status,version:s.version,locale:s.locale,changeDescription:"Reindex requested"},userId:o,processed:!1,metadata:{reindexRequest:!0}}),{success:!0}}});st({args:{entryId:a.id("contentEntries"),userId:a.optional(a.string())},returns:a.object({success:a.boolean(),message:a.string()}),handler:async(e,t)=>{const{entryId:n,userId:o}=t,s=await e.db.get(n);return s?s.status!=="published"?{success:!1,message:"Entry is not published"}:(await e.db.insert("cmsEvents",{eventType:"contentEntry.published",resourceType:"contentEntry",resourceId:n,action:"published",payload:{slug:s.slug,contentTypeName:s.contentTypeName,status:s.status,version:s.version,locale:s.locale,changeDescription:"Reindex requested"},userId:o,processed:!1,metadata:{reindexRequest:!0}}),{success:!0,message:"Reindex event created"}):{success:!1,message:"Entry not found"}}});st({args:{contentTypeId:a.optional(a.id("contentTypes")),batchSize:a.optional(a.number()),cursor:a.optional(a.string()),userId:a.optional(a.string())},returns:a.object({eventsCreated:a.number(),hasMore:a.boolean(),nextCursor:a.optional(a.string())}),handler:async(e,t)=>{const{contentTypeId:n,batchSize:o=100,userId:s}=t,u=await e.db.query("contentEntries").withIndex("by_status",b=>b.eq("status","published")).filter(b=>b.eq(b.field("deletedAt"),void 0)).take(o+1),f=u.length>o,h=u.slice(0,o);let p=h;if(n){const b=await e.db.get(n);b?p=h.filter(x=>x.contentTypeName===b.name):p=[]}let y=0;for(const b of p)await e.db.insert("cmsEvents",{eventType:"contentEntry.published",resourceType:"contentEntry",resourceId:b._id,action:"published",payload:{slug:b.slug,contentTypeName:b.contentTypeName,status:b.status,version:b.version,locale:b.locale,changeDescription:"Bulk reindex requested"},userId:s,processed:!1,metadata:{bulkReindex:!0}}),y++;const g=f?h[h.length-1]?._id:void 0;return{eventsCreated:y,hasMore:f,nextCursor:g}}});gf({args:{config:a.optional(a.object({batchSize:a.optional(a.number()),includeContentTypes:a.optional(a.array(a.string())),excludeContentTypes:a.optional(a.array(a.string())),namespacePrefix:a.optional(a.string())}))},handler:async(e,t)=>{const n={...gC,...t.config||{}},o=await e.db.query("cmsEvents").withIndex("by_processed",h=>h.eq("processed",!1)).order("asc").take(n.batchSize*2),s=["published","unpublished","deleted","restored"],c=o.filter(h=>{if(h.resourceType!=="contentEntry"||!s.includes(h.action))return!1;const y=h.payload?.contentTypeName;return!(y&&(n.includeContentTypes.length>0&&!n.includeContentTypes.includes(y)||n.excludeContentTypes.length>0&&n.excludeContentTypes.includes(y)))}).slice(0,n.batchSize),u=[],f=[];for(const h of c){const p={eventId:h._id,entryId:h.resourceId};h.action==="published"||h.action==="restored"?u.push(p):(h.action==="unpublished"||h.action==="deleted")&&f.push(p)}return{toIndex:u,toRemove:f,hasMore:o.length>n.batchSize}}});st({args:{delayMs:a.optional(a.number())},returns:a.object({scheduledAt:a.number()}),handler:async(e,t)=>{const n=t.delayMs??gC.pollingIntervalMs,o=Date.now()+n;return await e.scheduler.runAt(o,Sq.ragContentIndexer.triggerIndexingCheck,{}),{scheduledAt:o}}});vy({args:{},handler:async e=>{const n=await e.db.query("cmsEvents").withIndex("by_processed",o=>o.eq("processed",!1)).filter(o=>o.and(o.eq(o.field("resourceType"),"contentEntry"),o.or(o.eq(o.field("action"),"published"),o.eq(o.field("action"),"unpublished"),o.eq(o.field("action"),"deleted"),o.eq(o.field("action"),"restored")))).first()!==null;return n&&console.log("RAG Indexer: Pending events detected, processing needed"),{hasPendingEvents:n}}});Ke({args:{entryIds:a.array(a.id("contentEntries")),options:a.optional(a.object({includeFields:a.optional(a.array(a.string())),excludeFields:a.optional(a.array(a.string())),maxCharsSoftLimit:a.optional(a.number()),namespacePrefix:a.optional(a.string())}))},returns:a.array(a.union(a.object({entryId:a.string(),chunks:a.array(a.object({text:a.string(),metadata:a.any()})),metadata:a.object({entryId:a.string(),contentType:a.string(),contentTypeDisplayName:a.string(),slug:a.string(),locale:a.optional(a.string()),version:a.number(),title:a.optional(a.string()),publishedAt:a.optional(a.number()),namespace:a.string()})}),a.null())),handler:async(e,t)=>{const{entryIds:n,options:o={}}=t,s=[],c=new Map;for(const u of n){const f=await e.db.get(u);if(!f||f.status!=="published"){s.push(null);continue}let h=c.get(f.contentTypeName);if(!h){const A=await e.db.query("contentTypes").withIndex("by_name",I=>I.eq("name",f.contentTypeName)).first();A&&(h=A,c.set(f.contentTypeName,A))}if(!h){s.push(null);continue}const p={includeMetadata:!0,includeFields:o.includeFields,excludeFields:o.excludeFields,chunkOptions:{maxCharsSoftLimit:o.maxCharsSoftLimit??1e3}},y={_id:f._id,contentTypeName:f.contentTypeName,slug:f.slug,status:f.status,data:f.data,locale:f.locale,version:f.version,_creationTime:f._creationTime,firstPublishedAt:f.firstPublishedAt,lastPublishedAt:f.lastPublishedAt},g={_id:h._id,name:h.name,displayName:h.displayName,fields:h.fields,titleField:h.titleField,slugField:h.slugField},b=mC(y,g,p),x=o.namespacePrefix??"cms",C=f.locale?`${x}:${h.name}:${f.locale}`:`${x}:${h.name}`,S=b[0]?.metadata?.title||f.data?.title;s.push({entryId:f._id,chunks:b.map(A=>({text:A.text,metadata:A.metadata})),metadata:{entryId:f._id,contentType:h.name,contentTypeDisplayName:h.displayName,slug:f.slug,locale:f.locale,version:f.version,title:S,publishedAt:f.lastPublishedAt,namespace:C}})}return s}});const yC=_.createContext(null);function jq({children:e,getUser:t,getUserRole:n,onLogout:o,autoRedirectToLogin:s=!1,loginUrl:c="/login"}){const[u,f]=_.useState(null),[h,p]=_.useState(null),[y,g]=_.useState("loading"),[b,x]=_.useState(null),C=_.useCallback(async()=>{g("loading"),x(null);try{const R=await t();if(!R){f(null),p(null),g("unauthenticated"),s&&typeof window<"u"&&(window.location.href=c);return}const N=await n({userId:R.id});f(R),p(N),g("authenticated")}catch(R){console.error("Authentication error:",R),f(null),p(null),x(R instanceof Error?R.message:"Authentication failed"),g("error")}},[t,n,s,c]);_.useEffect(()=>{C()},[C]);const S=_.useCallback(R=>h?vg(h,R):!1,[h]),A=_.useCallback(async()=>{try{o&&await o(),f(null),p(null),g("unauthenticated"),s&&typeof window<"u"&&(window.location.href=c)}catch(R){console.error("Logout error:",R),x(R instanceof Error?R.message:"Logout failed")}},[o,s,c]),I=_.useCallback(async()=>{await C()},[C]),k={user:u,role:h,authState:y,isLoading:y==="loading",isAuthenticated:y==="authenticated",error:b,checkPermission:S,logout:A,refresh:I};return w.jsx(yC.Provider,{value:k,children:e})}function vC(){const e=_.useContext(yC);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const bC=_.createContext(null),wC="convex-cms-theme";function HS(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function QS(){if(typeof window>"u")return"system";const e=localStorage.getItem(wC);return e==="light"||e==="dark"||e==="system"?e:"system"}function Om(){return typeof window>"u"?!1:document.documentElement.classList.contains("dark")}function Lq({children:e,themeMode:t="isolated",darkModeControl:n="independent"}){const o=t==="isolated"||n==="independent",s=t==="inherit"&&n==="follow-parent",[c,u]=_.useState(()=>s?Om()?"dark":"light":QS()),[f,h]=_.useState(()=>{if(s)return Om()?"dark":"light";const g=QS();return g==="system"?HS():g}),p=_.useCallback(g=>{const b=g==="system"?HS():g;if(h(b),o){const x=document.documentElement;x.classList.remove("light","dark"),x.classList.add(b)}},[o]),y=_.useCallback(g=>{o&&(u(g),localStorage.setItem(wC,g),p(g))},[p,o]);return _.useEffect(()=>{s||p(c)},[c,p,s]),_.useEffect(()=>{if(!s){const g=window.matchMedia("(prefers-color-scheme: dark)"),b=()=>{c==="system"&&p("system")};return g.addEventListener("change",b),()=>g.removeEventListener("change",b)}},[c,p,s]),_.useEffect(()=>{if(!s)return;const g=()=>{const C=Om()?"dark":"light";u(C),h(C)};g();const b=new MutationObserver(x=>{for(const C of x)if(C.type==="attributes"&&C.attributeName==="class"){g();break}});return b.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>b.disconnect()},[s]),w.jsx(bC.Provider,{value:{theme:c,resolvedTheme:f,setTheme:y,canToggleDarkMode:o},children:e})}function lX(){const e=_.useContext(bC);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function te(e,t,n){function o(f,h){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,h);const p=u.prototype,y=Object.keys(p);for(let g=0;g<y.length;g++){const b=y[g];b in f||(f[b]=p[b].bind(f))}}const s=n?.Parent??Object;class c extends s{}Object.defineProperty(c,"name",{value:e});function u(f){var h;const p=n?.Parent?new c:this;o(p,f),(h=p._zod).deferred??(h.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(u,"init",{value:o}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class ca extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const SC={};function Wo(e){return SC}function _C(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,s])=>t.indexOf(+o)===-1).map(([o,s])=>s)}function bg(e,t){return typeof t=="bigint"?t.toString():t}function _y(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ey(e){return e==null}function Ty(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function zq(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let s=(o.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(o)){const h=o.match(/\d?e-(\d?)/);h?.[1]&&(s=Number.parseInt(h[1]))}const c=n>s?n:s,u=Number.parseInt(e.toFixed(c).replace(".","")),f=Number.parseInt(t.toFixed(c).replace(".",""));return u%f/10**c}const ZS=Symbol("evaluating");function We(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==ZS)return o===void 0&&(o=ZS,o=n()),o},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function ns(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ai(...e){const t={};for(const n of e){const o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function GS(e){return JSON.stringify(e)}function Pq(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const EC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const $q=_y(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ga(e){if(zd(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(zd(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function TC(e){return ga(e)?{...e}:Array.isArray(e)?[...e]:e}const Fq=new Set(["string","number","symbol"]);function yf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function li(e,t,n){const o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function xe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Bq(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const qq={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Uq(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c=ai(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=n.shape[f])}return ns(this,"shape",u),u},checks:[]});return li(e,c)}function Vq(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=ai(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return ns(this,"shape",u),u},checks:[]});return li(e,c)}function Hq(e,t){if(!ga(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const c=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(c,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=ai(e._zod.def,{get shape(){const c={...e._zod.def.shape,...t};return ns(this,"shape",c),c}});return li(e,s)}function Qq(e,t){if(!ga(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ai(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return ns(this,"shape",o),o}});return li(e,n)}function Zq(e,t){const n=ai(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return ns(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return li(e,n)}function Gq(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=ai(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(n)for(const p in n){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(h[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)h[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return ns(this,"shape",h),h},checks:[]});return li(t,u)}function Yq(e,t,n){const o=ai(t._zod.def,{get shape(){const s=t._zod.def.shape,c={...s};if(n)for(const u in n){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=new e({type:"nonoptional",innerType:s[u]}))}else for(const u in s)c[u]=new e({type:"nonoptional",innerType:s[u]});return ns(this,"shape",c),c}});return li(t,o)}function Ws(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ea(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Wu(e){return typeof e=="string"?e:e?.message}function ei(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const s=Wu(e.inst?._zod.def?.error?.(e))??Wu(t?.error?.(e))??Wu(n.customError?.(e))??Wu(n.localeError?.(e))??"Invalid input";o.message=s}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Cy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function sc(...e){const[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}const CC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},AC=te("$ZodError",CC),RC=te("$ZodError",CC,{Parent:Error});function Kq(e,t=n=>n.message){const n={},o=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):o.push(t(s));return{formErrors:o,fieldErrors:n}}function Xq(e,t=n=>n.message){const n={_errors:[]},o=s=>{for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u}));else if(c.code==="invalid_key")o({issues:c.issues});else if(c.code==="invalid_element")o({issues:c.issues});else if(c.path.length===0)n._errors.push(t(c));else{let u=n,f=0;for(;f<c.path.length;){const h=c.path[f];f===c.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(c))):u[h]=u[h]||{_errors:[]},u=u[h],f++}}};return o(e),n}const Ay=e=>(t,n,o,s)=>{const c=o?Object.assign(o,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new ca;if(u.issues.length){const f=new(s?.Err??e)(u.issues.map(h=>ei(h,c,Wo())));throw EC(f,s?.callee),f}return u.value},Ry=e=>async(t,n,o,s)=>{const c=o?Object.assign(o,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(s?.Err??e)(u.issues.map(h=>ei(h,c,Wo())));throw EC(f,s?.callee),f}return u.value},vf=e=>(t,n,o)=>{const s=o?{...o,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new ca;return c.issues.length?{success:!1,error:new(e??AC)(c.issues.map(u=>ei(u,s,Wo())))}:{success:!0,data:c.value}},Jq=vf(RC),bf=e=>async(t,n,o)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},s);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>ei(u,s,Wo())))}:{success:!0,data:c.value}},Wq=bf(RC),e5=e=>(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ay(e)(t,n,s)},t5=e=>(t,n,o)=>Ay(e)(t,n,o),n5=e=>async(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ry(e)(t,n,s)},r5=e=>async(t,n,o)=>Ry(e)(t,n,o),o5=e=>(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return vf(e)(t,n,s)},i5=e=>(t,n,o)=>vf(e)(t,n,o),s5=e=>async(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return bf(e)(t,n,s)},a5=e=>async(t,n,o)=>bf(e)(t,n,o),l5=/^[cC][^\s-]{8,}$/,c5=/^[0-9a-z]+$/,u5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,d5=/^[0-9a-vA-V]{20}$/,f5=/^[A-Za-z0-9]{27}$/,h5=/^[a-zA-Z0-9_-]{21}$/,p5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,m5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,YS=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,g5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,y5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function v5(){return new RegExp(y5,"u")}const b5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,w5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,x5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,S5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,NC=/^[A-Za-z0-9_-]*$/,E5=/^\+[1-9]\d{6,14}$/,IC="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",T5=new RegExp(`^${IC}$`);function OC(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function C5(e){return new RegExp(`^${OC(e)}$`)}function A5(e){const t=OC({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${IC}T(?:${o})$`)}const R5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},N5=/^-?\d+$/,kC=/^-?\d+(?:\.\d+)?$/,I5=/^(?:true|false)$/i,O5=/^[^A-Z]*$/,k5=/^[^a-z]*$/,Nn=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),MC={number:"number",bigint:"bigint",object:"date"},DC=te("$ZodCheckLessThan",(e,t)=>{Nn.init(e,t);const n=MC[typeof t.value];e._zod.onattach.push(o=>{const s=o._zod.bag,c=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jC=te("$ZodCheckGreaterThan",(e,t)=>{Nn.init(e,t);const n=MC[typeof t.value];e._zod.onattach.push(o=>{const s=o._zod.bag,c=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),M5=te("$ZodCheckMultipleOf",(e,t)=>{Nn.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):zq(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),D5=te("$ZodCheckNumberFormat",(e,t)=>{Nn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[s,c]=qq[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=s,f.maximum=c,n&&(f.pattern=N5)}),e._zod.check=u=>{const f=u.value;if(n){if(!Number.isInteger(f)){u.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}f<s&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),f>c&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!t.abort})}}),j5=te("$ZodCheckMaxLength",(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=o=>{const s=o.value;return!Ey(s)&&s.length!==void 0}),e._zod.onattach.push(o=>{const s=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const s=o.value;if(s.length<=t.maximum)return;const u=Cy(s);o.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),L5=te("$ZodCheckMinLength",(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=o=>{const s=o.value;return!Ey(s)&&s.length!==void 0}),e._zod.onattach.push(o=>{const s=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const s=o.value;if(s.length>=t.minimum)return;const u=Cy(s);o.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),z5=te("$ZodCheckLengthEquals",(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=o=>{const s=o.value;return!Ey(s)&&s.length!==void 0}),e._zod.onattach.push(o=>{const s=o._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=o=>{const s=o.value,c=s.length;if(c===t.length)return;const u=Cy(s),f=c>t.length;o.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),wf=te("$ZodCheckStringFormat",(e,t)=>{var n,o;Nn.init(e,t),e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),P5=te("$ZodCheckRegex",(e,t)=>{wf.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),$5=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=O5),wf.init(e,t)}),F5=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=k5),wf.init(e,t)}),B5=te("$ZodCheckIncludes",(e,t)=>{Nn.init(e,t);const n=yf(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(s=>{const c=s._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(o)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),q5=te("$ZodCheckStartsWith",(e,t)=>{Nn.init(e,t);const n=new RegExp(`^${yf(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),U5=te("$ZodCheckEndsWith",(e,t)=>{Nn.init(e,t);const n=new RegExp(`.*${yf(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),V5=te("$ZodCheckOverwrite",(e,t)=>{Nn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class H5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(`
51
+ `).filter(u=>u),s=Math.min(...o.map(u=>u.length-u.trimStart().length)),c=o.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of c)this.content.push(u)}compile(){const t=Function,n=this?.args,s=[...(this?.content??[""]).map(c=>` ${c}`)];return new t(...n,s.join(`
52
+ `))}}const Q5={major:4,minor:3,patch:6},xt=te("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Q5;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const s of o)for(const c of s._zod.onattach)c(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,f,h)=>{let p=Ws(u),y;for(const g of f){if(g._zod.def.when){if(!g._zod.def.when(u))continue}else if(p)continue;const b=u.issues.length,x=g._zod.check(u);if(x instanceof Promise&&h?.async===!1)throw new ca;if(y||x instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(p||(p=Ws(u,b)))});else{if(u.issues.length===b)continue;p||(p=Ws(u,b))}}return y?y.then(()=>u):u},c=(u,f,h)=>{if(Ws(u))return u.aborted=!0,u;const p=s(f,o,h);if(p instanceof Promise){if(h.async===!1)throw new ca;return p.then(y=>e._zod.parse(y,h))}return e._zod.parse(p,h)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return p instanceof Promise?p.then(y=>c(y,u,f)):c(p,u,f)}const h=e._zod.parse(u,f);if(h instanceof Promise){if(f.async===!1)throw new ca;return h.then(p=>s(p,o,f))}return s(h,o,f)}}We(e,"~standard",()=>({validate:s=>{try{const c=Jq(e,s);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return Wq(e,s).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Ny=te("$ZodString",(e,t)=>{xt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??R5(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),pt=te("$ZodStringFormat",(e,t)=>{wf.init(e,t),Ny.init(e,t)}),Z5=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=m5),pt.init(e,t)}),G5=te("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=YS(o))}else t.pattern??(t.pattern=YS());pt.init(e,t)}),Y5=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=g5),pt.init(e,t)}),K5=te("$ZodURL",(e,t)=>{pt.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),s=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),X5=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=v5()),pt.init(e,t)}),J5=te("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=h5),pt.init(e,t)}),W5=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=l5),pt.init(e,t)}),e6=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=c5),pt.init(e,t)}),t6=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=u5),pt.init(e,t)}),n6=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=d5),pt.init(e,t)}),r6=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=f5),pt.init(e,t)}),o6=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=A5(t)),pt.init(e,t)}),i6=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=T5),pt.init(e,t)}),s6=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=C5(t)),pt.init(e,t)}),a6=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=p5),pt.init(e,t)}),l6=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=b5),pt.init(e,t),e._zod.bag.format="ipv4"}),c6=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=w5),pt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),u6=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=x5),pt.init(e,t)}),d6=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=S5),pt.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(o.length!==2)throw new Error;const[s,c]=o;if(!c)throw new Error;const u=Number(c);if(`${u}`!==c)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function LC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const f6=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_5),pt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{LC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function h6(e){if(!NC.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return LC(n)}const p6=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=NC),pt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{h6(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),m6=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=E5),pt.init(e,t)});function g6(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[o]=n;if(!o)return!1;const s=JSON.parse(atob(o));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const y6=te("$ZodJWT",(e,t)=>{pt.init(e,t),e._zod.check=n=>{g6(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),zC=te("$ZodNumber",(e,t)=>{xt.init(e,t),e._zod.pattern=e._zod.bag.pattern??kC,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const c=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...c?{received:c}:{}}),n}}),v6=te("$ZodNumberFormat",(e,t)=>{D5.init(e,t),zC.init(e,t)}),b6=te("$ZodBoolean",(e,t)=>{xt.init(e,t),e._zod.pattern=I5,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),w6=te("$ZodUnknown",(e,t)=>{xt.init(e,t),e._zod.parse=n=>n}),x6=te("$ZodNever",(e,t)=>{xt.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function KS(e,t,n){e.issues.length&&t.issues.push(...ea(n,e.issues)),t.value[n]=e.value}const S6=te("$ZodArray",(e,t)=>{xt.init(e,t),e._zod.parse=(n,o)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const c=[];for(let u=0;u<s.length;u++){const f=s[u],h=t.element._zod.run({value:f,issues:[]},o);h instanceof Promise?c.push(h.then(p=>KS(p,n,u))):KS(h,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function Pd(e,t,n,o,s){if(e.issues.length){if(s&&!(n in o))return;t.issues.push(...ea(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function PC(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=Bq(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function $C(e,t,n,o,s,c){const u=[],f=s.keySet,h=s.catchall._zod,p=h.def.type,y=h.optout==="optional";for(const g in t){if(f.has(g))continue;if(p==="never"){u.push(g);continue}const b=h.run({value:t[g],issues:[]},o);b instanceof Promise?e.push(b.then(x=>Pd(x,n,g,t,y))):Pd(b,n,g,t,y)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:c}),e.length?Promise.all(e).then(()=>n):n}const _6=te("$ZodObject",(e,t)=>{if(xt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const h={...f};return Object.defineProperty(t,"shape",{value:h}),h}})}const o=_y(()=>PC(t));We(e._zod,"propValues",()=>{const f=t.shape,h={};for(const p in f){const y=f[p]._zod;if(y.values){h[p]??(h[p]=new Set);for(const g of y.values)h[p].add(g)}}return h});const s=zd,c=t.catchall;let u;e._zod.parse=(f,h)=>{u??(u=o.value);const p=f.value;if(!s(p))return f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f;f.value={};const y=[],g=u.shape;for(const b of u.keys){const x=g[b],C=x._zod.optout==="optional",S=x._zod.run({value:p[b],issues:[]},h);S instanceof Promise?y.push(S.then(A=>Pd(A,f,b,p,C))):Pd(S,f,b,p,C)}return c?$C(y,p,f,h,o.value,e):y.length?Promise.all(y).then(()=>f):f}}),E6=te("$ZodObjectJIT",(e,t)=>{_6.init(e,t);const n=e._zod.parse,o=_y(()=>PC(t)),s=b=>{const x=new H5(["shape","payload","ctx"]),C=o.value,S=R=>{const N=GS(R);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};x.write("const input = payload.value;");const A=Object.create(null);let I=0;for(const R of C.keys)A[R]=`key_${I++}`;x.write("const newResult = {};");for(const R of C.keys){const N=A[R],j=GS(R),P=b[R]?._zod?.optout==="optional";x.write(`const ${N} = ${S(R)};`),P?x.write(`
53
+ if (${N}.issues.length) {
54
+ if (${j} in input) {
55
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
56
+ ...iss,
57
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
58
+ })));
59
+ }
60
+ }
61
+
62
+ if (${N}.value === undefined) {
63
+ if (${j} in input) {
64
+ newResult[${j}] = undefined;
65
+ }
66
+ } else {
67
+ newResult[${j}] = ${N}.value;
68
+ }
69
+
70
+ `):x.write(`
71
+ if (${N}.issues.length) {
72
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
73
+ ...iss,
74
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
75
+ })));
76
+ }
77
+
78
+ if (${N}.value === undefined) {
79
+ if (${j} in input) {
80
+ newResult[${j}] = undefined;
81
+ }
82
+ } else {
83
+ newResult[${j}] = ${N}.value;
84
+ }
85
+
86
+ `)}x.write("payload.value = newResult;"),x.write("return payload;");const k=x.compile();return(R,N)=>k(b,R,N)};let c;const u=zd,f=!SC.jitless,p=f&&$q.value,y=t.catchall;let g;e._zod.parse=(b,x)=>{g??(g=o.value);const C=b.value;return u(C)?f&&p&&x?.async===!1&&x.jitless!==!0?(c||(c=s(t.shape)),b=c(b,x),y?$C([],C,b,x,g,e):b):n(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:C,inst:e}),b)}});function XS(e,t,n,o){for(const c of e)if(c.issues.length===0)return t.value=c.value,t;const s=e.filter(c=>!Ws(c));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(c=>c.issues.map(u=>ei(u,o,Wo())))}),t)}const T6=te("$ZodUnion",(e,t)=>{xt.init(e,t),We(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),We(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),We(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),We(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(c=>c._zod.pattern);return new RegExp(`^(${s.map(c=>Ty(c.source)).join("|")})$`)}});const n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(s,c)=>{if(n)return o(s,c);let u=!1;const f=[];for(const h of t.options){const p=h._zod.run({value:s.value,issues:[]},c);if(p instanceof Promise)f.push(p),u=!0;else{if(p.issues.length===0)return p;f.push(p)}}return u?Promise.all(f).then(h=>XS(h,s,e,c)):XS(f,s,e,c)}}),C6=te("$ZodIntersection",(e,t)=>{xt.init(e,t),e._zod.parse=(n,o)=>{const s=n.value,c=t.left._zod.run({value:s,issues:[]},o),u=t.right._zod.run({value:s,issues:[]},o);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([h,p])=>JS(n,h,p)):JS(n,c,u)}});function wg(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ga(e)&&ga(t)){const n=Object.keys(t),o=Object.keys(e).filter(c=>n.indexOf(c)!==-1),s={...e,...t};for(const c of o){const u=wg(e[c],t[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};s[c]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const s=e[o],c=t[o],u=wg(s,c);if(!u.valid)return{valid:!1,mergeErrorPath:[o,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function JS(e,t,n){const o=new Map;let s;for(const f of t.issues)if(f.code==="unrecognized_keys"){s??(s=f);for(const h of f.keys)o.has(h)||o.set(h,{}),o.get(h).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const h of f.keys)o.has(h)||o.set(h,{}),o.get(h).r=!0;else e.issues.push(f);const c=[...o].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(c.length&&s&&e.issues.push({...s,keys:c}),Ws(e))return e;const u=wg(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const A6=te("$ZodRecord",(e,t)=>{xt.init(e,t),e._zod.parse=(n,o)=>{const s=n.value;if(!ga(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const c=[],u=t.keyType._zod.values;if(u){n.value={};const f=new Set;for(const p of u)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){f.add(typeof p=="number"?p.toString():p);const y=t.valueType._zod.run({value:s[p],issues:[]},o);y instanceof Promise?c.push(y.then(g=>{g.issues.length&&n.issues.push(...ea(p,g.issues)),n.value[p]=g.value})):(y.issues.length&&n.issues.push(...ea(p,y.issues)),n.value[p]=y.value)}let h;for(const p in s)f.has(p)||(h=h??[],h.push(p));h&&h.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:h})}else{n.value={};for(const f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let h=t.keyType._zod.run({value:f,issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&kC.test(f)&&h.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(h=g)}if(h.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(g=>ei(g,o,Wo())),input:f,path:[f],inst:e});continue}const y=t.valueType._zod.run({value:s[f],issues:[]},o);y instanceof Promise?c.push(y.then(g=>{g.issues.length&&n.issues.push(...ea(f,g.issues)),n.value[h.value]=g.value})):(y.issues.length&&n.issues.push(...ea(f,y.issues)),n.value[h.value]=y.value)}}return c.length?Promise.all(c).then(()=>n):n}}),R6=te("$ZodEnum",(e,t)=>{xt.init(e,t);const n=_C(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(s=>Fq.has(typeof s)).map(s=>typeof s=="string"?yf(s):s.toString()).join("|")})$`),e._zod.parse=(s,c)=>{const u=s.value;return o.has(u)||s.issues.push({code:"invalid_value",values:n,input:u,inst:e}),s}}),N6=te("$ZodTransform",(e,t)=>{xt.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new xC(e.constructor.name);const s=t.transform(n.value,n);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(n.value=u,n));if(s instanceof Promise)throw new ca;return n.value=s,n}});function WS(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const FC=te("$ZodOptional",(e,t)=>{xt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",We(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),We(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ty(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(c=>WS(c,n.value)):WS(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),I6=te("$ZodExactOptional",(e,t)=>{FC.init(e,t),We(e._zod,"values",()=>t.innerType._zod.values),We(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),O6=te("$ZodNullable",(e,t)=>{xt.init(e,t),We(e._zod,"optin",()=>t.innerType._zod.optin),We(e._zod,"optout",()=>t.innerType._zod.optout),We(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ty(n.source)}|null)$`):void 0}),We(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),k6=te("$ZodDefault",(e,t)=>{xt.init(e,t),e._zod.optin="optional",We(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(c=>e_(c,t)):e_(s,t)}});function e_(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const M6=te("$ZodPrefault",(e,t)=>{xt.init(e,t),e._zod.optin="optional",We(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),D6=te("$ZodNonOptional",(e,t)=>{xt.init(e,t),We(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(c=>t_(c,e)):t_(s,e)}});function t_(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const j6=te("$ZodCatch",(e,t)=>{xt.init(e,t),We(e._zod,"optin",()=>t.innerType._zod.optin),We(e._zod,"optout",()=>t.innerType._zod.optout),We(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(c=>(n.value=c.value,c.issues.length&&(n.value=t.catchValue({...n,error:{issues:c.issues.map(u=>ei(u,o,Wo()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>ei(c,o,Wo()))},input:n.value}),n.issues=[]),n)}}),L6=te("$ZodPipe",(e,t)=>{xt.init(e,t),We(e._zod,"values",()=>t.in._zod.values),We(e._zod,"optin",()=>t.in._zod.optin),We(e._zod,"optout",()=>t.out._zod.optout),We(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){const c=t.out._zod.run(n,o);return c instanceof Promise?c.then(u=>ed(u,t.in,o)):ed(c,t.in,o)}const s=t.in._zod.run(n,o);return s instanceof Promise?s.then(c=>ed(c,t.out,o)):ed(s,t.out,o)}});function ed(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const z6=te("$ZodReadonly",(e,t)=>{xt.init(e,t),We(e._zod,"propValues",()=>t.innerType._zod.propValues),We(e._zod,"values",()=>t.innerType._zod.values),We(e._zod,"optin",()=>t.innerType?._zod?.optin),We(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(n_):n_(s)}});function n_(e){return e.value=Object.freeze(e.value),e}const P6=te("$ZodCustom",(e,t)=>{Nn.init(e,t),xt.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{const o=n.value,s=t.fn(o);if(s instanceof Promise)return s.then(c=>r_(c,n,o,e));r_(s,n,o,e)}});function r_(e,t,n,o){if(!e){const s={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(s.params=o._zod.def.params),t.issues.push(sc(s))}}var o_;class $6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const o={...this.get(n)??{}};delete o.id;const s={...o,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function F6(){return new $6}(o_=globalThis).__zod_globalRegistry??(o_.__zod_globalRegistry=F6());const zl=globalThis.__zod_globalRegistry;function B6(e,t){return new e({type:"string",...xe(t)})}function q6(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...xe(t)})}function i_(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...xe(t)})}function U6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...xe(t)})}function V6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...xe(t)})}function H6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...xe(t)})}function Q6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...xe(t)})}function Z6(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...xe(t)})}function G6(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...xe(t)})}function Y6(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...xe(t)})}function K6(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...xe(t)})}function X6(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...xe(t)})}function J6(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...xe(t)})}function W6(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...xe(t)})}function eU(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...xe(t)})}function tU(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...xe(t)})}function nU(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...xe(t)})}function rU(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...xe(t)})}function oU(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...xe(t)})}function iU(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...xe(t)})}function sU(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...xe(t)})}function aU(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...xe(t)})}function lU(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...xe(t)})}function cU(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...xe(t)})}function uU(e,t){return new e({type:"string",format:"date",check:"string_format",...xe(t)})}function dU(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...xe(t)})}function fU(e,t){return new e({type:"string",format:"duration",check:"string_format",...xe(t)})}function hU(e,t){return new e({type:"number",checks:[],...xe(t)})}function pU(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...xe(t)})}function mU(e,t){return new e({type:"boolean",...xe(t)})}function gU(e){return new e({type:"unknown"})}function yU(e,t){return new e({type:"never",...xe(t)})}function s_(e,t){return new DC({check:"less_than",...xe(t),value:e,inclusive:!1})}function km(e,t){return new DC({check:"less_than",...xe(t),value:e,inclusive:!0})}function a_(e,t){return new jC({check:"greater_than",...xe(t),value:e,inclusive:!1})}function Mm(e,t){return new jC({check:"greater_than",...xe(t),value:e,inclusive:!0})}function l_(e,t){return new M5({check:"multiple_of",...xe(t),value:e})}function BC(e,t){return new j5({check:"max_length",...xe(t),maximum:e})}function $d(e,t){return new L5({check:"min_length",...xe(t),minimum:e})}function qC(e,t){return new z5({check:"length_equals",...xe(t),length:e})}function vU(e,t){return new P5({check:"string_format",format:"regex",...xe(t),pattern:e})}function bU(e){return new $5({check:"string_format",format:"lowercase",...xe(e)})}function wU(e){return new F5({check:"string_format",format:"uppercase",...xe(e)})}function xU(e,t){return new B5({check:"string_format",format:"includes",...xe(t),includes:e})}function SU(e,t){return new q5({check:"string_format",format:"starts_with",...xe(t),prefix:e})}function _U(e,t){return new U5({check:"string_format",format:"ends_with",...xe(t),suffix:e})}function Ca(e){return new V5({check:"overwrite",tx:e})}function EU(e){return Ca(t=>t.normalize(e))}function TU(){return Ca(e=>e.trim())}function CU(){return Ca(e=>e.toLowerCase())}function AU(){return Ca(e=>e.toUpperCase())}function RU(){return Ca(e=>Pq(e))}function NU(e,t,n){return new e({type:"array",element:t,...xe(n)})}function IU(e,t,n){return new e({type:"custom",check:"custom",fn:t,...xe(n)})}function OU(e){const t=kU(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(sc(o,n.value,t._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(sc(s))}},e(n.value,n)));return t}function kU(e,t){const n=new Nn({check:"custom",...xe(t)});return n._zod.check=e,n}function UC(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??zl,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Dt(e,t,n={path:[],schemaPath:[]}){var o;const s=e._zod.def,c=t.seen.get(e);if(c)return c.count++,n.schemaPath.includes(e)&&(c.cycle=n.path),c.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const y={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,y);else{const b=u.schema,x=t.processors[s.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);x(e,t,b,y)}const g=e._zod.parent;g&&(u.ref||(u.ref=g),Dt(g,t,y),t.seen.get(g).isParent=!0)}const h=t.metadataRegistry.get(e);return h&&Object.assign(u.schema,h),t.io==="input"&&dn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((o=u.schema).default??(o.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function VC(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const h=o.get(f);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(f,u[0])}}const s=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(u[0])?.id,b=e.external.uri??(C=>C);if(g)return{ref:b(g)};const x=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=x,{defId:x,ref:`${b("__shared")}#/${f}/${x}`}}if(u[1]===n)return{ref:"#"};const p=`#/${f}/`,y=u[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:p+y}},c=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:h,defId:p}=s(u);f.def={...f.schema},p&&(f.defId=p);const y=f.schema;for(const g in y)delete y[g];y.$ref=h};if(e.cycles==="throw")for(const u of e.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
87
+
88
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(t===u[0]){c(u);continue}if(e.external){const p=e.external.registry.get(u[0])?.id;if(t!==u[0]&&p){c(u);continue}}if(e.metadataRegistry.get(u[0])?.id){c(u);continue}if(f.cycle){c(u);continue}if(f.count>1&&e.reused==="ref"){c(u);continue}}}function HC(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=u=>{const f=e.seen.get(u);if(f.ref===null)return;const h=f.def??f.schema,p={...h},y=f.ref;if(f.ref=null,y){o(y);const b=e.seen.get(y),x=b.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(x)):Object.assign(h,x),Object.assign(h,p),u._zod.parent===y)for(const S in h)S==="$ref"||S==="allOf"||S in p||delete h[S];if(x.$ref&&b.def)for(const S in h)S==="$ref"||S==="allOf"||S in b.def&&JSON.stringify(h[S])===JSON.stringify(b.def[S])&&delete h[S]}const g=u._zod.parent;if(g&&g!==y){o(g);const b=e.seen.get(g);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const x in h)x==="$ref"||x==="allOf"||x in b.def&&JSON.stringify(h[x])===JSON.stringify(b.def[x])&&delete h[x]}e.override({zodSchema:u,jsonSchema:h,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())o(u[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(u)}Object.assign(s,n.def??n.schema);const c=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(c[f.defId]=f.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?s.$defs=c:s.definitions=c);try{const u=JSON.parse(JSON.stringify(s));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Fd(t,"input",e.processors),output:Fd(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function dn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return dn(o.element,n);if(o.type==="set")return dn(o.valueType,n);if(o.type==="lazy")return dn(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return dn(o.innerType,n);if(o.type==="intersection")return dn(o.left,n)||dn(o.right,n);if(o.type==="record"||o.type==="map")return dn(o.keyType,n)||dn(o.valueType,n);if(o.type==="pipe")return dn(o.in,n)||dn(o.out,n);if(o.type==="object"){for(const s in o.shape)if(dn(o.shape[s],n))return!0;return!1}if(o.type==="union"){for(const s of o.options)if(dn(s,n))return!0;return!1}if(o.type==="tuple"){for(const s of o.items)if(dn(s,n))return!0;return!!(o.rest&&dn(o.rest,n))}return!1}const MU=(e,t={})=>n=>{const o=UC({...n,processors:t});return Dt(e,o),VC(o,e),HC(o,e)},Fd=(e,t,n={})=>o=>{const{libraryOptions:s,target:c}=o??{},u=UC({...s??{},target:c,io:t,processors:n});return Dt(e,u),VC(u,e),HC(u,e)},DU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jU=(e,t,n,o)=>{const s=n;s.type="string";const{minimum:c,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof c=="number"&&(s.minLength=c),typeof u=="number"&&(s.maxLength=u),f&&(s.format=DU[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),p&&(s.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?s.pattern=y[0].source:y.length>1&&(s.allOf=[...y.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},LU=(e,t,n,o)=>{const s=n,{minimum:c,maximum:u,format:f,multipleOf:h,exclusiveMaximum:p,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=y,s.exclusiveMinimum=!0):s.exclusiveMinimum=y),typeof c=="number"&&(s.minimum=c,typeof y=="number"&&t.target!=="draft-04"&&(y>=c?delete s.minimum:delete s.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=p,s.exclusiveMaximum=!0):s.exclusiveMaximum=p),typeof u=="number"&&(s.maximum=u,typeof p=="number"&&t.target!=="draft-04"&&(p<=u?delete s.maximum:delete s.exclusiveMaximum)),typeof h=="number"&&(s.multipleOf=h)},zU=(e,t,n,o)=>{n.type="boolean"},PU=(e,t,n,o)=>{n.not={}},$U=(e,t,n,o)=>{},FU=(e,t,n,o)=>{const s=e._zod.def,c=_C(s.entries);c.every(u=>typeof u=="number")&&(n.type="number"),c.every(u=>typeof u=="string")&&(n.type="string"),n.enum=c},BU=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},qU=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},UU=(e,t,n,o)=>{const s=n,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(s.minItems=u),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=Dt(c.element,t,{...o,path:[...o.path,"items"]})},VU=(e,t,n,o)=>{const s=n,c=e._zod.def;s.type="object",s.properties={};const u=c.shape;for(const p in u)s.properties[p]=Dt(u[p],t,{...o,path:[...o.path,"properties",p]});const f=new Set(Object.keys(u)),h=new Set([...f].filter(p=>{const y=c.shape[p]._zod;return t.io==="input"?y.optin===void 0:y.optout===void 0}));h.size>0&&(s.required=Array.from(h)),c.catchall?._zod.def.type==="never"?s.additionalProperties=!1:c.catchall?c.catchall&&(s.additionalProperties=Dt(c.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},HU=(e,t,n,o)=>{const s=e._zod.def,c=s.inclusive===!1,u=s.options.map((f,h)=>Dt(f,t,{...o,path:[...o.path,c?"oneOf":"anyOf",h]}));c?n.oneOf=u:n.anyOf=u},QU=(e,t,n,o)=>{const s=e._zod.def,c=Dt(s.left,t,{...o,path:[...o.path,"allOf",0]}),u=Dt(s.right,t,{...o,path:[...o.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];n.allOf=h},ZU=(e,t,n,o)=>{const s=n,c=e._zod.def;s.type="object";const u=c.keyType,h=u._zod.bag?.patterns;if(c.mode==="loose"&&h&&h.size>0){const y=Dt(c.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});s.patternProperties={};for(const g of h)s.patternProperties[g.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=Dt(c.keyType,t,{...o,path:[...o.path,"propertyNames"]})),s.additionalProperties=Dt(c.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const p=u._zod.values;if(p){const y=[...p].filter(g=>typeof g=="string"||typeof g=="number");y.length>0&&(s.required=y)}},GU=(e,t,n,o)=>{const s=e._zod.def,c=Dt(s.innerType,t,o),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=s.innerType,n.nullable=!0):n.anyOf=[c,{type:"null"}]},YU=(e,t,n,o)=>{const s=e._zod.def;Dt(s.innerType,t,o);const c=t.seen.get(e);c.ref=s.innerType},KU=(e,t,n,o)=>{const s=e._zod.def;Dt(s.innerType,t,o);const c=t.seen.get(e);c.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},XU=(e,t,n,o)=>{const s=e._zod.def;Dt(s.innerType,t,o);const c=t.seen.get(e);c.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},JU=(e,t,n,o)=>{const s=e._zod.def;Dt(s.innerType,t,o);const c=t.seen.get(e);c.ref=s.innerType;let u;try{u=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},WU=(e,t,n,o)=>{const s=e._zod.def,c=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Dt(c,t,o);const u=t.seen.get(e);u.ref=c},eV=(e,t,n,o)=>{const s=e._zod.def;Dt(s.innerType,t,o);const c=t.seen.get(e);c.ref=s.innerType,n.readOnly=!0},QC=(e,t,n,o)=>{const s=e._zod.def;Dt(s.innerType,t,o);const c=t.seen.get(e);c.ref=s.innerType},tV=te("ZodISODateTime",(e,t)=>{o6.init(e,t),mt.init(e,t)});function nV(e){return cU(tV,e)}const rV=te("ZodISODate",(e,t)=>{i6.init(e,t),mt.init(e,t)});function oV(e){return uU(rV,e)}const iV=te("ZodISOTime",(e,t)=>{s6.init(e,t),mt.init(e,t)});function sV(e){return dU(iV,e)}const aV=te("ZodISODuration",(e,t)=>{a6.init(e,t),mt.init(e,t)});function lV(e){return fU(aV,e)}const cV=(e,t)=>{AC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Xq(e,n)},flatten:{value:n=>Kq(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bg,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bg,2)}},isEmpty:{get(){return e.issues.length===0}}})},cr=te("ZodError",cV,{Parent:Error}),uV=Ay(cr),dV=Ry(cr),fV=vf(cr),hV=bf(cr),pV=e5(cr),mV=t5(cr),gV=n5(cr),yV=r5(cr),vV=o5(cr),bV=i5(cr),wV=s5(cr),xV=a5(cr),St=te("ZodType",(e,t)=>(xt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Fd(e,"input"),output:Fd(e,"output")}}),e.toJSONSchema=MU(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ai(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>li(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>uV(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>fV(e,n,o),e.parseAsync=async(n,o)=>dV(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>hV(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>pV(e,n,o),e.decode=(n,o)=>mV(e,n,o),e.encodeAsync=async(n,o)=>gV(e,n,o),e.decodeAsync=async(n,o)=>yV(e,n,o),e.safeEncode=(n,o)=>vV(e,n,o),e.safeDecode=(n,o)=>bV(e,n,o),e.safeEncodeAsync=async(n,o)=>wV(e,n,o),e.safeDecodeAsync=async(n,o)=>xV(e,n,o),e.refine=(n,o)=>e.check(p8(n,o)),e.superRefine=n=>e.check(m8(n)),e.overwrite=n=>e.check(Ca(n)),e.optional=()=>f_(e),e.exactOptional=()=>t8(e),e.nullable=()=>h_(e),e.nullish=()=>f_(h_(e)),e.nonoptional=n=>a8(e,n),e.array=()=>Iy(e),e.or=n=>GV([e,n]),e.and=n=>KV(e,n),e.transform=n=>p_(e,WV(n)),e.default=n=>o8(e,n),e.prefault=n=>s8(e,n),e.catch=n=>c8(e,n),e.pipe=n=>p_(e,n),e.readonly=()=>f8(e),e.describe=n=>{const o=e.clone();return zl.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return zl.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return zl.get(e);const o=e.clone();return zl.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),ZC=te("_ZodString",(e,t)=>{Ny.init(e,t),St.init(e,t),e._zod.processJSONSchema=(o,s,c)=>jU(e,o,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(vU(...o)),e.includes=(...o)=>e.check(xU(...o)),e.startsWith=(...o)=>e.check(SU(...o)),e.endsWith=(...o)=>e.check(_U(...o)),e.min=(...o)=>e.check($d(...o)),e.max=(...o)=>e.check(BC(...o)),e.length=(...o)=>e.check(qC(...o)),e.nonempty=(...o)=>e.check($d(1,...o)),e.lowercase=o=>e.check(bU(o)),e.uppercase=o=>e.check(wU(o)),e.trim=()=>e.check(TU()),e.normalize=(...o)=>e.check(EU(...o)),e.toLowerCase=()=>e.check(CU()),e.toUpperCase=()=>e.check(AU()),e.slugify=()=>e.check(RU())}),SV=te("ZodString",(e,t)=>{Ny.init(e,t),ZC.init(e,t),e.email=n=>e.check(q6(_V,n)),e.url=n=>e.check(Z6(EV,n)),e.jwt=n=>e.check(lU($V,n)),e.emoji=n=>e.check(G6(TV,n)),e.guid=n=>e.check(i_(c_,n)),e.uuid=n=>e.check(U6(td,n)),e.uuidv4=n=>e.check(V6(td,n)),e.uuidv6=n=>e.check(H6(td,n)),e.uuidv7=n=>e.check(Q6(td,n)),e.nanoid=n=>e.check(Y6(CV,n)),e.guid=n=>e.check(i_(c_,n)),e.cuid=n=>e.check(K6(AV,n)),e.cuid2=n=>e.check(X6(RV,n)),e.ulid=n=>e.check(J6(NV,n)),e.base64=n=>e.check(iU(LV,n)),e.base64url=n=>e.check(sU(zV,n)),e.xid=n=>e.check(W6(IV,n)),e.ksuid=n=>e.check(eU(OV,n)),e.ipv4=n=>e.check(tU(kV,n)),e.ipv6=n=>e.check(nU(MV,n)),e.cidrv4=n=>e.check(rU(DV,n)),e.cidrv6=n=>e.check(oU(jV,n)),e.e164=n=>e.check(aU(PV,n)),e.datetime=n=>e.check(nV(n)),e.date=n=>e.check(oV(n)),e.time=n=>e.check(sV(n)),e.duration=n=>e.check(lV(n))});function Mt(e){return B6(SV,e)}const mt=te("ZodStringFormat",(e,t)=>{pt.init(e,t),ZC.init(e,t)}),_V=te("ZodEmail",(e,t)=>{Y5.init(e,t),mt.init(e,t)}),c_=te("ZodGUID",(e,t)=>{Z5.init(e,t),mt.init(e,t)}),td=te("ZodUUID",(e,t)=>{G5.init(e,t),mt.init(e,t)}),EV=te("ZodURL",(e,t)=>{K5.init(e,t),mt.init(e,t)}),TV=te("ZodEmoji",(e,t)=>{X5.init(e,t),mt.init(e,t)}),CV=te("ZodNanoID",(e,t)=>{J5.init(e,t),mt.init(e,t)}),AV=te("ZodCUID",(e,t)=>{W5.init(e,t),mt.init(e,t)}),RV=te("ZodCUID2",(e,t)=>{e6.init(e,t),mt.init(e,t)}),NV=te("ZodULID",(e,t)=>{t6.init(e,t),mt.init(e,t)}),IV=te("ZodXID",(e,t)=>{n6.init(e,t),mt.init(e,t)}),OV=te("ZodKSUID",(e,t)=>{r6.init(e,t),mt.init(e,t)}),kV=te("ZodIPv4",(e,t)=>{l6.init(e,t),mt.init(e,t)}),MV=te("ZodIPv6",(e,t)=>{c6.init(e,t),mt.init(e,t)}),DV=te("ZodCIDRv4",(e,t)=>{u6.init(e,t),mt.init(e,t)}),jV=te("ZodCIDRv6",(e,t)=>{d6.init(e,t),mt.init(e,t)}),LV=te("ZodBase64",(e,t)=>{f6.init(e,t),mt.init(e,t)}),zV=te("ZodBase64URL",(e,t)=>{p6.init(e,t),mt.init(e,t)}),PV=te("ZodE164",(e,t)=>{m6.init(e,t),mt.init(e,t)}),$V=te("ZodJWT",(e,t)=>{y6.init(e,t),mt.init(e,t)}),GC=te("ZodNumber",(e,t)=>{zC.init(e,t),St.init(e,t),e._zod.processJSONSchema=(o,s,c)=>LU(e,o,s),e.gt=(o,s)=>e.check(a_(o,s)),e.gte=(o,s)=>e.check(Mm(o,s)),e.min=(o,s)=>e.check(Mm(o,s)),e.lt=(o,s)=>e.check(s_(o,s)),e.lte=(o,s)=>e.check(km(o,s)),e.max=(o,s)=>e.check(km(o,s)),e.int=o=>e.check(u_(o)),e.safe=o=>e.check(u_(o)),e.positive=o=>e.check(a_(0,o)),e.nonnegative=o=>e.check(Mm(0,o)),e.negative=o=>e.check(s_(0,o)),e.nonpositive=o=>e.check(km(0,o)),e.multipleOf=(o,s)=>e.check(l_(o,s)),e.step=(o,s)=>e.check(l_(o,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function YC(e){return hU(GC,e)}const FV=te("ZodNumberFormat",(e,t)=>{v6.init(e,t),GC.init(e,t)});function u_(e){return pU(FV,e)}const BV=te("ZodBoolean",(e,t)=>{b6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>zU(e,n,o)});function bt(e){return mU(BV,e)}const qV=te("ZodUnknown",(e,t)=>{w6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>$U()});function d_(){return gU(qV)}const UV=te("ZodNever",(e,t)=>{x6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>PU(e,n,o)});function VV(e){return yU(UV,e)}const HV=te("ZodArray",(e,t)=>{S6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>UU(e,n,o,s),e.element=t.element,e.min=(n,o)=>e.check($d(n,o)),e.nonempty=n=>e.check($d(1,n)),e.max=(n,o)=>e.check(BC(n,o)),e.length=(n,o)=>e.check(qC(n,o)),e.unwrap=()=>e.element});function Iy(e,t){return NU(HV,e,t)}const QV=te("ZodObject",(e,t)=>{E6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>VU(e,n,o,s),We(e,"shape",()=>t.shape),e.keyof=()=>pc(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:d_()}),e.loose=()=>e.clone({...e._zod.def,catchall:d_()}),e.strict=()=>e.clone({...e._zod.def,catchall:VV()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Hq(e,n),e.safeExtend=n=>Qq(e,n),e.merge=n=>Zq(e,n),e.pick=n=>Uq(e,n),e.omit=n=>Vq(e,n),e.partial=(...n)=>Gq(XC,e,n[0]),e.required=(...n)=>Yq(JC,e,n[0])});function ur(e,t){const n={type:"object",shape:e??{},...xe(t)};return new QV(n)}const ZV=te("ZodUnion",(e,t)=>{T6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>HU(e,n,o,s),e.options=t.options});function GV(e,t){return new ZV({type:"union",options:e,...xe(t)})}const YV=te("ZodIntersection",(e,t)=>{C6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>QU(e,n,o,s)});function KV(e,t){return new YV({type:"intersection",left:e,right:t})}const XV=te("ZodRecord",(e,t)=>{A6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>ZU(e,n,o,s),e.keyType=t.keyType,e.valueType=t.valueType});function KC(e,t,n){return new XV({type:"record",keyType:e,valueType:t,...xe(n)})}const xg=te("ZodEnum",(e,t)=>{R6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(o,s,c)=>FU(e,o,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(o,s)=>{const c={};for(const u of o)if(n.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new xg({...t,checks:[],...xe(s),entries:c})},e.exclude=(o,s)=>{const c={...t.entries};for(const u of o)if(n.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new xg({...t,checks:[],...xe(s),entries:c})}});function pc(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new xg({type:"enum",entries:n,...xe(t)})}const JV=te("ZodTransform",(e,t)=>{N6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>qU(e,n),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new xC(e.constructor.name);n.addIssue=c=>{if(typeof c=="string")n.issues.push(sc(c,n.value,t));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(sc(u))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(c=>(n.value=c,n)):(n.value=s,n)}});function WV(e){return new JV({type:"transform",transform:e})}const XC=te("ZodOptional",(e,t)=>{FC.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>QC(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function f_(e){return new XC({type:"optional",innerType:e})}const e8=te("ZodExactOptional",(e,t)=>{I6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>QC(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function t8(e){return new e8({type:"optional",innerType:e})}const n8=te("ZodNullable",(e,t)=>{O6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>GU(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function h_(e){return new n8({type:"nullable",innerType:e})}const r8=te("ZodDefault",(e,t)=>{k6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>KU(e,n,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function o8(e,t){return new r8({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():TC(t)}})}const i8=te("ZodPrefault",(e,t)=>{M6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>XU(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function s8(e,t){return new i8({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():TC(t)}})}const JC=te("ZodNonOptional",(e,t)=>{D6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>YU(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function a8(e,t){return new JC({type:"nonoptional",innerType:e,...xe(t)})}const l8=te("ZodCatch",(e,t)=>{j6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>JU(e,n,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function c8(e,t){return new l8({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const u8=te("ZodPipe",(e,t)=>{L6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>WU(e,n,o,s),e.in=t.in,e.out=t.out});function p_(e,t){return new u8({type:"pipe",in:e,out:t})}const d8=te("ZodReadonly",(e,t)=>{z6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>eV(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function f8(e){return new d8({type:"readonly",innerType:e})}const h8=te("ZodCustom",(e,t)=>{P6.init(e,t),St.init(e,t),e._zod.processJSONSchema=(n,o,s)=>BU(e,n)});function p8(e,t={}){return IU(h8,e,t)}function m8(e){return OU(e)}const g8=ur({id:Mt(),path:Mt(),label:Mt(),icon:Mt(),visible:bt().default(!0),section:pc(["main","config"]).default("main"),badge:Mt().optional(),exact:bt().optional()}),m_=ur({appName:Mt().default("Convex CMS"),logo:Mt().optional(),favicon:Mt().optional()}),g_=ur({sidebarWidth:YC().min(200).max(400).default(256),sidebarCollapsible:bt().default(!1)}),y_=ur({showDashboard:bt().default(!0),showContent:bt().default(!0),showMedia:bt().default(!0),showTaxonomies:bt().default(!0),showContentTypes:bt().default(!0),showTrash:bt().default(!0),showSettings:bt().default(!0),customItems:Iy(g8).default([])}),v_=ur({mode:pc(["light","dark","system"]).default("system"),allowModeSwitch:bt().default(!0),tokens:KC(Mt(),Mt()).optional()}),y8=ur({branding:m_.default(()=>m_.parse({})),layout:g_.default(()=>g_.parse({})),navigation:y_.default(()=>y_.parse({})),theme:v_.default(()=>v_.parse({}))}),v8=[{id:"dashboard",path:"/",label:"Dashboard",icon:"LayoutDashboard",section:"main",exact:!0},{id:"content",path:"/content",label:"Content",icon:"FileText",section:"main"},{id:"media",path:"/media",label:"Media",icon:"Image",section:"main"},{id:"taxonomies",path:"/taxonomies",label:"Taxonomies",icon:"Tags",section:"main"},{id:"content-types",path:"/content-types",label:"Content Types",icon:"Layers",section:"config"},{id:"trash",path:"/trash",label:"Trash",icon:"Trash2",section:"config"},{id:"settings",path:"/settings",label:"Settings",icon:"Settings",section:"config"}];function b8(e){return y8.parse(e??{})}function w8(e){const t={dashboard:e.navigation.showDashboard,content:e.navigation.showContent,media:e.navigation.showMedia,taxonomies:e.navigation.showTaxonomies,"content-types":e.navigation.showContentTypes,trash:e.navigation.showTrash,settings:e.navigation.showSettings},o=[...v8.filter(s=>t[s.id]!==!1),...e.navigation.customItems.filter(s=>s.visible!==!1)];return{main:o.filter(s=>s.section==="main"),config:o.filter(s=>s.section==="config")}}const WC=_.createContext(null);function eA({config:e,children:t}){const n=w8(e),o={...e,navItems:n};return w.jsx(WC.Provider,{value:o,children:t})}function Oy(){const e=_.useContext(WC);if(!e)throw new Error("useAdminConfig must be used within AdminConfigProvider");return e}const ky=_.createContext(null);function x8({baseConfig:e,children:t,api:n}){const o=ZT(n.getSettings,{})??void 0,s=_.useMemo(()=>o?{...e,navigation:{...e.navigation,showMedia:e.navigation.showMedia&&o.features.mediaManagement}}:e,[e,o]),c=_.useMemo(()=>({baseConfig:e,settings:o}),[e,o]);return w.jsx(ky.Provider,{value:c,children:w.jsx(eA,{config:s,children:t})})}function S8({baseConfig:e,children:t}){const n=_.useMemo(()=>({baseConfig:e,settings:void 0}),[e]);return w.jsx(ky.Provider,{value:n,children:w.jsx(eA,{config:e,children:t})})}function _8({baseConfig:e,children:t,api:n}){return n?w.jsx(x8,{baseConfig:e,api:n,children:t}):w.jsx(S8,{baseConfig:e,children:t})}function cX(){const e=_.useContext(ky);if(!e)throw new Error("useSettingsConfig must be used within SettingsConfigProvider");return e}const tA=_.createContext(null);function E8({children:e}){const[t,n]=_.useState(new Map),o=_.useCallback((u,f)=>{n(h=>{const p=new Map(h);return p.set(u,f),p})},[]),s=_.useCallback(u=>{n(f=>{const h=new Map(f);return h.delete(u),h})},[]),c=_.useMemo(()=>({overrides:t,setOverride:o,clearOverride:s}),[t,o,s]);return w.jsx(tA.Provider,{value:c,children:e})}function T8(){const e=_.useContext(tA);if(!e)throw new Error("useBreadcrumbContext must be used within a BreadcrumbProvider");return e}const C8={LayoutDashboard:N$,FileText:d$,Image:t1,Layers:n1,Tags:u3,FileCode:c$,Settings:e3,Trash2:m3,HelpCircle:JT,Home:e1,User:i1,Bell:sg,Lock:$$,Globe:x$,Calendar:ag,Clock:XP,Link:M$,Hash:WT,ToggleLeft:o1,ChevronDown:ts,CheckSquare:n3,Braces:YT,Folder:b$,MapPin:H$,DollarSign:r$,Mail:U$,Phone:X$,Package:Y$,Star:s3,Heart:E$,Flag:m$,Bookmark:$P,Archive:DP,Edit:o3,Eye:a$,AlertCircle:GP};function b_({name:e,className:t="size-5"}){const n=C8[e];return n?w.jsx(n,{className:t}):null}const nA=_.createContext(null);function A8({api:e,children:t}){return w.jsx(nA.Provider,{value:e,children:t})}function rA(){const e=_.useContext(nA);if(!e)throw new Error("useApi must be used within ApiProvider");return e}function ge(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function R8(e,t){const n=_.createContext(t),o=c=>{const{children:u,...f}=c,h=_.useMemo(()=>f,Object.values(f));return w.jsx(n.Provider,{value:h,children:u})};o.displayName=e+"Provider";function s(c){const u=_.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[o,s]}function zr(e,t=[]){let n=[];function o(c,u){const f=_.createContext(u),h=n.length;n=[...n,u];const p=g=>{const{scope:b,children:x,...C}=g,S=b?.[e]?.[h]||f,A=_.useMemo(()=>C,Object.values(C));return w.jsx(S.Provider,{value:A,children:x})};p.displayName=c+"Provider";function y(g,b){const x=b?.[e]?.[h]||f,C=_.useContext(x);if(C)return C;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${c}\``)}return[p,y]}const s=()=>{const c=n.map(u=>_.createContext(u));return function(f){const h=f?.[e]||c;return _.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return s.scopeName=e,[o,N8(s,...t)]}function N8(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(c){const u=o.reduce((f,{useScope:h,scopeName:p})=>{const g=h(c)[`__scope${p}`];return{...f,...g}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var jt=globalThis?.document?_.useLayoutEffect:()=>{},I8=Kd[" useInsertionEffect ".trim().toString()]||jt;function ti({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[s,c,u]=O8({defaultProp:t,onChange:n}),f=e!==void 0,h=f?e:s;{const y=_.useRef(e!==void 0);_.useEffect(()=>{const g=y.current;g!==f&&console.warn(`${o} is changing from ${g?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=f},[f,o])}const p=_.useCallback(y=>{if(f){const g=k8(y)?y(e):y;g!==e&&u.current?.(g)}else c(y)},[f,e,c,u]);return[h,p]}function O8({defaultProp:e,onChange:t}){const[n,o]=_.useState(e),s=_.useRef(n),c=_.useRef(t);return I8(()=>{c.current=t},[t]),_.useEffect(()=>{s.current!==n&&(c.current?.(n),s.current=n)},[n,s]),[n,o,c]}function k8(e){return typeof e=="function"}function w_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mc(...e){return t=>{let n=!1;const o=e.map(s=>{const c=w_(s,t);return!n&&typeof c=="function"&&(n=!0),c});if(n)return()=>{for(let s=0;s<o.length;s++){const c=o[s];typeof c=="function"?c():w_(e[s],null)}}}}function Ze(...e){return _.useCallback(mc(...e),e)}function Gi(e){const t=M8(e),n=_.forwardRef((o,s)=>{const{children:c,...u}=o,f=_.Children.toArray(c),h=f.find(j8);if(h){const p=h.props.children,y=f.map(g=>g===h?_.Children.count(p)>1?_.Children.only(null):_.isValidElement(p)?p.props.children:null:g);return w.jsx(t,{...u,ref:s,children:_.isValidElement(p)?_.cloneElement(p,void 0,y):null})}return w.jsx(t,{...u,ref:s,children:c})});return n.displayName=`${e}.Slot`,n}function M8(e){const t=_.forwardRef((n,o)=>{const{children:s,...c}=n;if(_.isValidElement(s)){const u=z8(s),f=L8(c,s.props);return s.type!==_.Fragment&&(f.ref=o?mc(o,u):u),_.cloneElement(s,f)}return _.Children.count(s)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var D8=Symbol("radix.slottable");function j8(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===D8}function L8(e,t){const n={...t};for(const o in t){const s=e[o],c=t[o];/^on[A-Z]/.test(o)?s&&c?n[o]=(...f)=>{const h=c(...f);return s(...f),h}:s&&(n[o]=s):o==="style"?n[o]={...s,...c}:o==="className"&&(n[o]=[s,c].filter(Boolean).join(" "))}return{...e,...n}}function z8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var P8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=P8.reduce((e,t)=>{const n=Gi(`Primitive.${t}`),o=_.forwardRef((s,c)=>{const{asChild:u,...f}=s,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(h,{...f,ref:c})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function oA(e,t){e&&ba.flushSync(()=>e.dispatchEvent(t))}function $8(e,t){return _.useReducer((n,o)=>t[n][o]??n,e)}var dr=e=>{const{present:t,children:n}=e,o=F8(t),s=typeof n=="function"?n({present:o.isPresent}):_.Children.only(n),c=Ze(o.ref,B8(s));return typeof n=="function"||o.isPresent?_.cloneElement(s,{ref:c}):null};dr.displayName="Presence";function F8(e){const[t,n]=_.useState(),o=_.useRef(null),s=_.useRef(e),c=_.useRef("none"),u=e?"mounted":"unmounted",[f,h]=$8(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const p=nd(o.current);c.current=f==="mounted"?p:"none"},[f]),jt(()=>{const p=o.current,y=s.current;if(y!==e){const b=c.current,x=nd(p);e?h("MOUNT"):x==="none"||p?.display==="none"?h("UNMOUNT"):h(y&&b!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),jt(()=>{if(t){let p;const y=t.ownerDocument.defaultView??window,g=x=>{const S=nd(o.current).includes(CSS.escape(x.animationName));if(x.target===t&&S&&(h("ANIMATION_END"),!s.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",p=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},b=x=>{x.target===t&&(c.current=nd(o.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{y.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:_.useCallback(p=>{o.current=p?getComputedStyle(p):null,n(p)},[])}}function nd(e){return e?.animationName||"none"}function B8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var q8=Kd[" useId ".trim().toString()]||(()=>{}),U8=0;function yr(e){const[t,n]=_.useState(q8());return jt(()=>{n(o=>o??String(U8++))},[e]),e||(t?`radix-${t}`:"")}var xf="Collapsible",[V8]=zr(xf),[H8,My]=V8(xf),iA=_.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:s,disabled:c,onOpenChange:u,...f}=e,[h,p]=ti({prop:o,defaultProp:s??!1,onChange:u,caller:xf});return w.jsx(H8,{scope:n,disabled:c,contentId:yr(),open:h,onOpenToggle:_.useCallback(()=>p(y=>!y),[p]),children:w.jsx(Ne.div,{"data-state":jy(h),"data-disabled":c?"":void 0,...f,ref:t})})});iA.displayName=xf;var sA="CollapsibleTrigger",aA=_.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,s=My(sA,n);return w.jsx(Ne.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":jy(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...o,ref:t,onClick:ge(e.onClick,s.onOpenToggle)})});aA.displayName=sA;var Dy="CollapsibleContent",lA=_.forwardRef((e,t)=>{const{forceMount:n,...o}=e,s=My(Dy,e.__scopeCollapsible);return w.jsx(dr,{present:n||s.open,children:({present:c})=>w.jsx(Q8,{...o,ref:t,present:c})})});lA.displayName=Dy;var Q8=_.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:s,...c}=e,u=My(Dy,n),[f,h]=_.useState(o),p=_.useRef(null),y=Ze(t,p),g=_.useRef(0),b=g.current,x=_.useRef(0),C=x.current,S=u.open||f,A=_.useRef(S),I=_.useRef(void 0);return _.useEffect(()=>{const k=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(k)},[]),jt(()=>{const k=p.current;if(k){I.current=I.current||{transitionDuration:k.style.transitionDuration,animationName:k.style.animationName},k.style.transitionDuration="0s",k.style.animationName="none";const R=k.getBoundingClientRect();g.current=R.height,x.current=R.width,A.current||(k.style.transitionDuration=I.current.transitionDuration,k.style.animationName=I.current.animationName),h(o)}},[u.open,o]),w.jsx(Ne.div,{"data-state":jy(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!S,...c,ref:y,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...e.style},children:S&&s})});function jy(e){return e?"open":"closed"}var Z8=iA;const G8=Z8,Y8=aA,K8=lA;function br(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>t.current?.(...n),[])}function X8(e,t=globalThis?.document){const n=br(e);_.useEffect(()=>{const o=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var J8="DismissableLayer",Sg="dismissableLayer.update",W8="dismissableLayer.pointerDownOutside",e9="dismissableLayer.focusOutside",x_,cA=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gc=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...h}=e,p=_.useContext(cA),[y,g]=_.useState(null),b=y?.ownerDocument??globalThis?.document,[,x]=_.useState({}),C=Ze(t,P=>g(P)),S=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),I=S.indexOf(A),k=y?S.indexOf(y):-1,R=p.layersWithOutsidePointerEventsDisabled.size>0,N=k>=I,j=r9(P=>{const M=P.target,U=[...p.branches].some(ee=>ee.contains(M));!N||U||(s?.(P),u?.(P),P.defaultPrevented||f?.())},b),B=o9(P=>{const M=P.target;[...p.branches].some(ee=>ee.contains(M))||(c?.(P),u?.(P),P.defaultPrevented||f?.())},b);return X8(P=>{k===p.layers.size-1&&(o?.(P),!P.defaultPrevented&&f&&(P.preventDefault(),f()))},b),_.useEffect(()=>{if(y)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(x_=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),S_(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=x_)}},[y,b,n,p]),_.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),S_())},[y,p]),_.useEffect(()=>{const P=()=>x({});return document.addEventListener(Sg,P),()=>document.removeEventListener(Sg,P)},[]),w.jsx(Ne.div,{...h,ref:C,style:{pointerEvents:R?N?"auto":"none":void 0,...e.style},onFocusCapture:ge(e.onFocusCapture,B.onFocusCapture),onBlurCapture:ge(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:ge(e.onPointerDownCapture,j.onPointerDownCapture)})});gc.displayName=J8;var t9="DismissableLayerBranch",n9=_.forwardRef((e,t)=>{const n=_.useContext(cA),o=_.useRef(null),s=Ze(t,o);return _.useEffect(()=>{const c=o.current;if(c)return n.branches.add(c),()=>{n.branches.delete(c)}},[n.branches]),w.jsx(Ne.div,{...e,ref:s})});n9.displayName=t9;function r9(e,t=globalThis?.document){const n=br(e),o=_.useRef(!1),s=_.useRef(()=>{});return _.useEffect(()=>{const c=f=>{if(f.target&&!o.current){let h=function(){uA(W8,n,p,{discrete:!0})};const p={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=h,t.addEventListener("click",s.current,{once:!0})):h()}else t.removeEventListener("click",s.current);o.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function o9(e,t=globalThis?.document){const n=br(e),o=_.useRef(!1);return _.useEffect(()=>{const s=c=>{c.target&&!o.current&&uA(e9,n,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function S_(){const e=new CustomEvent(Sg);document.dispatchEvent(e)}function uA(e,t,n,{discrete:o}){const s=n.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),o?oA(s,c):s.dispatchEvent(c)}var Dm="focusScope.autoFocusOnMount",jm="focusScope.autoFocusOnUnmount",__={bubbles:!1,cancelable:!0},i9="FocusScope",yc=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:c,...u}=e,[f,h]=_.useState(null),p=br(s),y=br(c),g=_.useRef(null),b=Ze(t,S=>h(S)),x=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(o){let S=function(R){if(x.paused||!f)return;const N=R.target;f.contains(N)?g.current=N:Uo(g.current,{select:!0})},A=function(R){if(x.paused||!f)return;const N=R.relatedTarget;N!==null&&(f.contains(N)||Uo(g.current,{select:!0}))},I=function(R){if(document.activeElement===document.body)for(const j of R)j.removedNodes.length>0&&Uo(f)};document.addEventListener("focusin",S),document.addEventListener("focusout",A);const k=new MutationObserver(I);return f&&k.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",A),k.disconnect()}}},[o,f,x.paused]),_.useEffect(()=>{if(f){T_.add(x);const S=document.activeElement;if(!f.contains(S)){const I=new CustomEvent(Dm,__);f.addEventListener(Dm,p),f.dispatchEvent(I),I.defaultPrevented||(s9(d9(dA(f)),{select:!0}),document.activeElement===S&&Uo(f))}return()=>{f.removeEventListener(Dm,p),setTimeout(()=>{const I=new CustomEvent(jm,__);f.addEventListener(jm,y),f.dispatchEvent(I),I.defaultPrevented||Uo(S??document.body,{select:!0}),f.removeEventListener(jm,y),T_.remove(x)},0)}}},[f,p,y,x]);const C=_.useCallback(S=>{if(!n&&!o||x.paused)return;const A=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,I=document.activeElement;if(A&&I){const k=S.currentTarget,[R,N]=a9(k);R&&N?!S.shiftKey&&I===N?(S.preventDefault(),n&&Uo(R,{select:!0})):S.shiftKey&&I===R&&(S.preventDefault(),n&&Uo(N,{select:!0})):I===k&&S.preventDefault()}},[n,o,x.paused]);return w.jsx(Ne.div,{tabIndex:-1,...u,ref:b,onKeyDown:C})});yc.displayName=i9;function s9(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(Uo(o,{select:t}),document.activeElement!==n)return}function a9(e){const t=dA(e),n=E_(t,e),o=E_(t.reverse(),e);return[n,o]}function dA(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const s=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||s?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function E_(e,t){for(const n of e)if(!l9(n,{upTo:t}))return n}function l9(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function c9(e){return e instanceof HTMLInputElement&&"select"in e}function Uo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&c9(e)&&t&&e.select()}}var T_=u9();function u9(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=C_(e,t),e.unshift(t)},remove(t){e=C_(e,t),e[0]?.resume()}}}function C_(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function d9(e){return e.filter(t=>t.tagName!=="A")}var f9="Portal",vc=_.forwardRef((e,t)=>{const{container:n,...o}=e,[s,c]=_.useState(!1);jt(()=>c(!0),[]);const u=n||s&&globalThis?.document?.body;return u?Kj.createPortal(w.jsx(Ne.div,{...o,ref:t}),u):null});vc.displayName=f9;var Lm=0;function Sf(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??A_()),document.body.insertAdjacentElement("beforeend",e[1]??A_()),Lm++,()=>{Lm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Lm--}},[])}function A_(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Or=function(){return Or=Object.assign||function(t){for(var n,o=1,s=arguments.length;o<s;o++){n=arguments[o];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(t[c]=n[c])}return t},Or.apply(this,arguments)};function fA(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(e);s<o.length;s++)t.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(n[o[s]]=e[o[s]]);return n}function h9(e,t,n){if(n||arguments.length===2)for(var o=0,s=t.length,c;o<s;o++)(c||!(o in t))&&(c||(c=Array.prototype.slice.call(t,0,o)),c[o]=t[o]);return e.concat(c||Array.prototype.slice.call(t))}var pd="right-scroll-bar-position",md="width-before-scroll-bar",p9="with-scroll-bars-hidden",m9="--removed-body-scroll-bar-size";function zm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function g9(e,t){var n=_.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(o){var s=n.value;s!==o&&(n.value=o,n.callback(o,s))}}}})[0];return n.callback=t,n.facade}var y9=typeof window<"u"?_.useLayoutEffect:_.useEffect,R_=new WeakMap;function v9(e,t){var n=g9(null,function(o){return e.forEach(function(s){return zm(s,o)})});return y9(function(){var o=R_.get(n);if(o){var s=new Set(o),c=new Set(e),u=n.current;s.forEach(function(f){c.has(f)||zm(f,null)}),c.forEach(function(f){s.has(f)||zm(f,u)})}R_.set(n,e)},[e]),n}function b9(e){return e}function w9(e,t){t===void 0&&(t=b9);var n=[],o=!1,s={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(c){var u=t(c,o);return n.push(u),function(){n=n.filter(function(f){return f!==u})}},assignSyncMedium:function(c){for(o=!0;n.length;){var u=n;n=[],u.forEach(c)}n={push:function(f){return c(f)},filter:function(){return n}}},assignMedium:function(c){o=!0;var u=[];if(n.length){var f=n;n=[],f.forEach(c),u=n}var h=function(){var y=u;u=[],y.forEach(c)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(y){u.push(y),p()},filter:function(y){return u=u.filter(y),n}}}};return s}function x9(e){e===void 0&&(e={});var t=w9(null);return t.options=Or({async:!0,ssr:!1},e),t}var hA=function(e){var t=e.sideCar,n=fA(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return _.createElement(o,Or({},n))};hA.isSideCarExport=!0;function S9(e,t){return e.useMedium(t),hA}var pA=x9(),Pm=function(){},_f=_.forwardRef(function(e,t){var n=_.useRef(null),o=_.useState({onScrollCapture:Pm,onWheelCapture:Pm,onTouchMoveCapture:Pm}),s=o[0],c=o[1],u=e.forwardProps,f=e.children,h=e.className,p=e.removeScrollBar,y=e.enabled,g=e.shards,b=e.sideCar,x=e.noRelative,C=e.noIsolation,S=e.inert,A=e.allowPinchZoom,I=e.as,k=I===void 0?"div":I,R=e.gapMode,N=fA(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=b,B=v9([n,t]),P=Or(Or({},N),s);return _.createElement(_.Fragment,null,y&&_.createElement(j,{sideCar:pA,removeScrollBar:p,shards:g,noRelative:x,noIsolation:C,inert:S,setCallbacks:c,allowPinchZoom:!!A,lockRef:n,gapMode:R}),u?_.cloneElement(_.Children.only(f),Or(Or({},P),{ref:B})):_.createElement(k,Or({},P,{className:h,ref:B}),f))});_f.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_f.classNames={fullWidth:md,zeroRight:pd};var _9=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function E9(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=_9();return t&&e.setAttribute("nonce",t),e}function T9(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function C9(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var A9=function(){var e=0,t=null;return{add:function(n){e==0&&(t=E9())&&(T9(t,n),C9(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},R9=function(){var e=A9();return function(t,n){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mA=function(){var e=R9(),t=function(n){var o=n.styles,s=n.dynamic;return e(o,s),null};return t},N9={left:0,top:0,right:0,gap:0},$m=function(e){return parseInt(e||"",10)||0},I9=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[$m(n),$m(o),$m(s)]},O9=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return N9;var t=I9(e),n=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-n+t[2]-t[0])}},k9=mA(),ua="data-scroll-locked",M9=function(e,t,n,o){var s=e.left,c=e.top,u=e.right,f=e.gap;return n===void 0&&(n="margin"),`
89
+ .`.concat(p9,` {
90
+ overflow: hidden `).concat(o,`;
91
+ padding-right: `).concat(f,"px ").concat(o,`;
92
+ }
93
+ body[`).concat(ua,`] {
94
+ overflow: hidden `).concat(o,`;
95
+ overscroll-behavior: contain;
96
+ `).concat([t&&"position: relative ".concat(o,";"),n==="margin"&&`
97
+ padding-left: `.concat(s,`px;
98
+ padding-top: `).concat(c,`px;
99
+ padding-right: `).concat(u,`px;
100
+ margin-left:0;
101
+ margin-top:0;
102
+ margin-right: `).concat(f,"px ").concat(o,`;
103
+ `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(o,";")].filter(Boolean).join(""),`
104
+ }
105
+
106
+ .`).concat(pd,` {
107
+ right: `).concat(f,"px ").concat(o,`;
108
+ }
109
+
110
+ .`).concat(md,` {
111
+ margin-right: `).concat(f,"px ").concat(o,`;
112
+ }
113
+
114
+ .`).concat(pd," .").concat(pd,` {
115
+ right: 0 `).concat(o,`;
116
+ }
117
+
118
+ .`).concat(md," .").concat(md,` {
119
+ margin-right: 0 `).concat(o,`;
120
+ }
121
+
122
+ body[`).concat(ua,`] {
123
+ `).concat(m9,": ").concat(f,`px;
124
+ }
125
+ `)},N_=function(){var e=parseInt(document.body.getAttribute(ua)||"0",10);return isFinite(e)?e:0},D9=function(){_.useEffect(function(){return document.body.setAttribute(ua,(N_()+1).toString()),function(){var e=N_()-1;e<=0?document.body.removeAttribute(ua):document.body.setAttribute(ua,e.toString())}},[])},j9=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,s=o===void 0?"margin":o;D9();var c=_.useMemo(function(){return O9(s)},[s]);return _.createElement(k9,{styles:M9(c,!t,s,n?"":"!important")})},_g=!1;if(typeof window<"u")try{var rd=Object.defineProperty({},"passive",{get:function(){return _g=!0,!0}});window.addEventListener("test",rd,rd),window.removeEventListener("test",rd,rd)}catch{_g=!1}var Qs=_g?{passive:!1}:!1,L9=function(e){return e.tagName==="TEXTAREA"},gA=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!L9(e)&&n[t]==="visible")},z9=function(e){return gA(e,"overflowY")},P9=function(e){return gA(e,"overflowX")},I_=function(e,t){var n=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var s=yA(e,o);if(s){var c=vA(e,o),u=c[1],f=c[2];if(u>f)return!0}o=o.parentNode}while(o&&o!==n.body);return!1},$9=function(e){var t=e.scrollTop,n=e.scrollHeight,o=e.clientHeight;return[t,n,o]},F9=function(e){var t=e.scrollLeft,n=e.scrollWidth,o=e.clientWidth;return[t,n,o]},yA=function(e,t){return e==="v"?z9(t):P9(t)},vA=function(e,t){return e==="v"?$9(t):F9(t)},B9=function(e,t){return e==="h"&&t==="rtl"?-1:1},q9=function(e,t,n,o,s){var c=B9(e,window.getComputedStyle(t).direction),u=c*o,f=n.target,h=t.contains(f),p=!1,y=u>0,g=0,b=0;do{if(!f)break;var x=vA(e,f),C=x[0],S=x[1],A=x[2],I=S-A-c*C;(C||I)&&yA(e,f)&&(g+=I,b+=C);var k=f.parentNode;f=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!h&&f!==document.body||h&&(t.contains(f)||t===f));return(y&&Math.abs(g)<1||!y&&Math.abs(b)<1)&&(p=!0),p},od=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},O_=function(e){return[e.deltaX,e.deltaY]},k_=function(e){return e&&"current"in e?e.current:e},U9=function(e,t){return e[0]===t[0]&&e[1]===t[1]},V9=function(e){return`
126
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
127
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
128
+ `)},H9=0,Zs=[];function Q9(e){var t=_.useRef([]),n=_.useRef([0,0]),o=_.useRef(),s=_.useState(H9++)[0],c=_.useState(mA)[0],u=_.useRef(e);_.useEffect(function(){u.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=h9([e.lockRef.current],(e.shards||[]).map(k_),!0).filter(Boolean);return S.forEach(function(A){return A.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=_.useCallback(function(S,A){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var I=od(S),k=n.current,R="deltaX"in S?S.deltaX:k[0]-I[0],N="deltaY"in S?S.deltaY:k[1]-I[1],j,B=S.target,P=Math.abs(R)>Math.abs(N)?"h":"v";if("touches"in S&&P==="h"&&B.type==="range")return!1;var M=window.getSelection(),U=M&&M.anchorNode,ee=U?U===B||U.contains(B):!1;if(ee)return!1;var ae=I_(P,B);if(!ae)return!0;if(ae?j=P:(j=P==="v"?"h":"v",ae=I_(P,B)),!ae)return!1;if(!o.current&&"changedTouches"in S&&(R||N)&&(o.current=j),!j)return!0;var re=o.current||j;return q9(re,A,S,re==="h"?R:N)},[]),h=_.useCallback(function(S){var A=S;if(!(!Zs.length||Zs[Zs.length-1]!==c)){var I="deltaY"in A?O_(A):od(A),k=t.current.filter(function(j){return j.name===A.type&&(j.target===A.target||A.target===j.shadowParent)&&U9(j.delta,I)})[0];if(k&&k.should){A.cancelable&&A.preventDefault();return}if(!k){var R=(u.current.shards||[]).map(k_).filter(Boolean).filter(function(j){return j.contains(A.target)}),N=R.length>0?f(A,R[0]):!u.current.noIsolation;N&&A.cancelable&&A.preventDefault()}}},[]),p=_.useCallback(function(S,A,I,k){var R={name:S,delta:A,target:I,should:k,shadowParent:Z9(I)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(N){return N!==R})},1)},[]),y=_.useCallback(function(S){n.current=od(S),o.current=void 0},[]),g=_.useCallback(function(S){p(S.type,O_(S),S.target,f(S,e.lockRef.current))},[]),b=_.useCallback(function(S){p(S.type,od(S),S.target,f(S,e.lockRef.current))},[]);_.useEffect(function(){return Zs.push(c),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:b}),document.addEventListener("wheel",h,Qs),document.addEventListener("touchmove",h,Qs),document.addEventListener("touchstart",y,Qs),function(){Zs=Zs.filter(function(S){return S!==c}),document.removeEventListener("wheel",h,Qs),document.removeEventListener("touchmove",h,Qs),document.removeEventListener("touchstart",y,Qs)}},[]);var x=e.removeScrollBar,C=e.inert;return _.createElement(_.Fragment,null,C?_.createElement(c,{styles:V9(s)}):null,x?_.createElement(j9,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Z9(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const G9=S9(pA,Q9);var bc=_.forwardRef(function(e,t){return _.createElement(_f,Or({},e,{ref:t,sideCar:G9}))});bc.classNames=_f.classNames;var Y9=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Gs=new WeakMap,id=new WeakMap,sd={},Fm=0,bA=function(e){return e&&(e.host||bA(e.parentNode))},K9=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=bA(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},X9=function(e,t,n,o){var s=K9(t,Array.isArray(e)?e:[e]);sd[n]||(sd[n]=new WeakMap);var c=sd[n],u=[],f=new Set,h=new Set(s),p=function(g){!g||f.has(g)||(f.add(g),p(g.parentNode))};s.forEach(p);var y=function(g){!g||h.has(g)||Array.prototype.forEach.call(g.children,function(b){if(f.has(b))y(b);else try{var x=b.getAttribute(o),C=x!==null&&x!=="false",S=(Gs.get(b)||0)+1,A=(c.get(b)||0)+1;Gs.set(b,S),c.set(b,A),u.push(b),S===1&&C&&id.set(b,!0),A===1&&b.setAttribute(n,"true"),C||b.setAttribute(o,"true")}catch(I){console.error("aria-hidden: cannot operate on ",b,I)}})};return y(t),f.clear(),Fm++,function(){u.forEach(function(g){var b=Gs.get(g)-1,x=c.get(g)-1;Gs.set(g,b),c.set(g,x),b||(id.has(g)||g.removeAttribute(o),id.delete(g)),x||g.removeAttribute(n)}),Fm--,Fm||(Gs=new WeakMap,Gs=new WeakMap,id=new WeakMap,sd={})}},Ef=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),s=Y9(e);return s?(o.push.apply(o,Array.from(s.querySelectorAll("[aria-live], script"))),X9(o,s,n,"aria-hidden")):function(){return null}},Tf="Dialog",[wA]=zr(Tf),[J9,Sr]=wA(Tf),xA=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:s,onOpenChange:c,modal:u=!0}=e,f=_.useRef(null),h=_.useRef(null),[p,y]=ti({prop:o,defaultProp:s??!1,onChange:c,caller:Tf});return w.jsx(J9,{scope:t,triggerRef:f,contentRef:h,contentId:yr(),titleId:yr(),descriptionId:yr(),open:p,onOpenChange:y,onOpenToggle:_.useCallback(()=>y(g=>!g),[y]),modal:u,children:n})};xA.displayName=Tf;var SA="DialogTrigger",W9=_.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,s=Sr(SA,n),c=Ze(t,s.triggerRef);return w.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Py(s.open),...o,ref:c,onClick:ge(e.onClick,s.onOpenToggle)})});W9.displayName=SA;var Ly="DialogPortal",[eH,_A]=wA(Ly,{forceMount:void 0}),EA=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:s}=e,c=Sr(Ly,t);return w.jsx(eH,{scope:t,forceMount:n,children:_.Children.map(o,u=>w.jsx(dr,{present:n||c.open,children:w.jsx(vc,{asChild:!0,container:s,children:u})}))})};EA.displayName=Ly;var Bd="DialogOverlay",TA=_.forwardRef((e,t)=>{const n=_A(Bd,e.__scopeDialog),{forceMount:o=n.forceMount,...s}=e,c=Sr(Bd,e.__scopeDialog);return c.modal?w.jsx(dr,{present:o||c.open,children:w.jsx(nH,{...s,ref:t})}):null});TA.displayName=Bd;var tH=Gi("DialogOverlay.RemoveScroll"),nH=_.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,s=Sr(Bd,n);return w.jsx(bc,{as:tH,allowPinchZoom:!0,shards:[s.contentRef],children:w.jsx(Ne.div,{"data-state":Py(s.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Yi="DialogContent",CA=_.forwardRef((e,t)=>{const n=_A(Yi,e.__scopeDialog),{forceMount:o=n.forceMount,...s}=e,c=Sr(Yi,e.__scopeDialog);return w.jsx(dr,{present:o||c.open,children:c.modal?w.jsx(rH,{...s,ref:t}):w.jsx(oH,{...s,ref:t})})});CA.displayName=Yi;var rH=_.forwardRef((e,t)=>{const n=Sr(Yi,e.__scopeDialog),o=_.useRef(null),s=Ze(t,n.contentRef,o);return _.useEffect(()=>{const c=o.current;if(c)return Ef(c)},[]),w.jsx(AA,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,c=>{c.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&c.preventDefault()}),onFocusOutside:ge(e.onFocusOutside,c=>c.preventDefault())})}),oH=_.forwardRef((e,t)=>{const n=Sr(Yi,e.__scopeDialog),o=_.useRef(!1),s=_.useRef(!1);return w.jsx(AA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(o.current||n.triggerRef.current?.focus(),c.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(o.current=!0,c.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=c.target;n.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.current&&c.preventDefault()}})}),AA=_.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:c,...u}=e,f=Sr(Yi,n),h=_.useRef(null),p=Ze(t,h);return Sf(),w.jsxs(w.Fragment,{children:[w.jsx(yc,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:c,children:w.jsx(gc,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Py(f.open),...u,ref:p,onDismiss:()=>f.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(iH,{titleId:f.titleId}),w.jsx(aH,{contentRef:h,descriptionId:f.descriptionId})]})]})}),zy="DialogTitle",RA=_.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,s=Sr(zy,n);return w.jsx(Ne.h2,{id:s.titleId,...o,ref:t})});RA.displayName=zy;var NA="DialogDescription",IA=_.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,s=Sr(NA,n);return w.jsx(Ne.p,{id:s.descriptionId,...o,ref:t})});IA.displayName=NA;var OA="DialogClose",kA=_.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,s=Sr(OA,n);return w.jsx(Ne.button,{type:"button",...o,ref:t,onClick:ge(e.onClick,()=>s.onOpenChange(!1))})});kA.displayName=OA;function Py(e){return e?"open":"closed"}var MA="DialogTitleWarning",[uX,DA]=R8(MA,{contentName:Yi,titleName:zy,docsSlug:"dialog"}),iH=({titleId:e})=>{const t=DA(MA),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
129
+
130
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
131
+
132
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},sH="DialogDescriptionWarning",aH=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${DA(sH).contentName}}.`;return _.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},lH=xA,cH=EA,uH=TA,dH=CA,fH=RA,hH=IA,pH=kA;function mH({...e}){return w.jsx(lH,{"data-slot":"dialog",...e})}function gH({...e}){return w.jsx(cH,{"data-slot":"dialog-portal",...e})}function yH({className:e,...t}){return w.jsx(uH,{"data-slot":"dialog-overlay",className:De("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function vH({className:e,children:t,showCloseButton:n=!0,...o}){return w.jsxs(gH,{"data-slot":"dialog-portal",children:[w.jsx(yH,{}),w.jsxs(dH,{"data-slot":"dialog-content",className:De("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",e),...o,children:[t,n&&w.jsxs(pH,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[w.jsx(Md,{}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function bH({className:e,...t}){return w.jsx("div",{"data-slot":"dialog-header",className:De("flex flex-col gap-2 text-center sm:text-left",e),...t})}function wH({className:e,...t}){return w.jsx("div",{"data-slot":"dialog-footer",className:De("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function xH({className:e,...t}){return w.jsx(fH,{"data-slot":"dialog-title",className:De("text-lg leading-none font-semibold",e),...t})}function SH({className:e,...t}){return w.jsx(hH,{"data-slot":"dialog-description",className:De("text-muted-foreground text-sm",e),...t})}var _H=Symbol.for("react.lazy"),qd=Kd[" use ".trim().toString()];function EH(e){return typeof e=="object"&&e!==null&&"then"in e}function jA(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===_H&&"_payload"in e&&EH(e._payload)}function LA(e){const t=TH(e),n=_.forwardRef((o,s)=>{let{children:c,...u}=o;jA(c)&&typeof qd=="function"&&(c=qd(c._payload));const f=_.Children.toArray(c),h=f.find(AH);if(h){const p=h.props.children,y=f.map(g=>g===h?_.Children.count(p)>1?_.Children.only(null):_.isValidElement(p)?p.props.children:null:g);return w.jsx(t,{...u,ref:s,children:_.isValidElement(p)?_.cloneElement(p,void 0,y):null})}return w.jsx(t,{...u,ref:s,children:c})});return n.displayName=`${e}.Slot`,n}var zA=LA("Slot");function TH(e){const t=_.forwardRef((n,o)=>{let{children:s,...c}=n;if(jA(s)&&typeof qd=="function"&&(s=qd(s._payload)),_.isValidElement(s)){const u=NH(s),f=RH(c,s.props);return s.type!==_.Fragment&&(f.ref=o?mc(o,u):u),_.cloneElement(s,f)}return _.Children.count(s)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var CH=Symbol("radix.slottable");function AH(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===CH}function RH(e,t){const n={...t};for(const o in t){const s=e[o],c=t[o];/^on[A-Z]/.test(o)?s&&c?n[o]=(...f)=>{const h=c(...f);return s(...f),h}:s&&(n[o]=s):o==="style"?n[o]={...s,...c}:o==="className"&&(n[o]=[s,c].filter(Boolean).join(" "))}return{...e,...n}}function NH(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const M_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,D_=a1,IH=(e,t)=>n=>{var o;if(t?.variants==null)return D_(e,n?.class,n?.className);const{variants:s,defaultVariants:c}=t,u=Object.keys(s).map(p=>{const y=n?.[p],g=c?.[p];if(y===null)return null;const b=M_(y)||M_(g);return s[p][b]}),f=n&&Object.entries(n).reduce((p,y)=>{let[g,b]=y;return b===void 0||(p[g]=b),p},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((p,y)=>{let{class:g,className:b,...x}=y;return Object.entries(x).every(C=>{let[S,A]=C;return Array.isArray(A)?A.includes({...c,...f}[S]):{...c,...f}[S]===A})?[...p,g,b]:p},[]);return D_(e,u,h,n?.class,n?.className)},OH=IH("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Gl({className:e,variant:t="default",size:n="default",asChild:o=!1,...s}){const c=o?zA:"button";return w.jsx(c,{"data-slot":"button","data-variant":t,"data-size":n,className:De(OH({variant:t,size:n,className:e})),...s})}const j_={fast:"duration-100 ease-out"},kH={primary:"default",secondary:"secondary",danger:"destructive",ghost:"ghost",outline:"outline",link:"link",success:"default",warning:"default"},MH={success:"bg-success text-success-foreground hover:bg-success/90 focus-visible:ring-success",warning:"bg-warning text-warning-foreground hover:bg-warning/90 focus-visible:ring-warning"},DH=()=>w.jsxs("svg",{className:"size-4 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[w.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),w.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]});function uo({variant:e="primary",loading:t,disabled:n,children:o,className:s,asChild:c,...u}){const f=kH[e],h=MH[e];return c?w.jsx(Gl,{variant:f,disabled:n||t,className:De(j_.fast,h,s),asChild:!0,...u,children:o}):w.jsxs(Gl,{variant:f,disabled:n||t,className:De(j_.fast,h,s),...u,children:[t&&w.jsx(DH,{}),o]})}const jH={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"};function $y({open:e,onOpenChange:t,title:n,description:o,children:s,footer:c,size:u="md",className:f}){return w.jsx(mH,{open:e,onOpenChange:t,children:w.jsxs(vH,{className:De("flex max-h-[85vh] flex-col overflow-hidden",jH[u],f),children:[w.jsxs(bH,{className:"shrink-0",children:[w.jsx(xH,{children:n}),o&&w.jsx(SH,{children:o})]}),w.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-4 [&::-webkit-scrollbar]:hidden",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s}),c&&w.jsx(wH,{className:"shrink-0 border-t pt-4",children:c})]})})}function dX({open:e,onOpenChange:t,title:n,description:o,confirmLabel:s="Confirm",cancelLabel:c="Cancel",onConfirm:u,onCancel:f,variant:h="default",loading:p,isLoading:y,error:g}){const b=p??y??!1,x=()=>{f?.(),t(!1)},C=()=>{u()},S=()=>h==="danger"?"danger":h==="warning"?"warning":"primary";return w.jsx($y,{open:e,onOpenChange:t,title:n,size:"sm",footer:w.jsxs(w.Fragment,{children:[w.jsx(uo,{variant:"outline",onClick:x,disabled:b,children:c}),w.jsx(uo,{variant:S(),onClick:C,loading:b,children:s})]}),children:w.jsxs("div",{className:"space-y-3",children:[w.jsx("p",{className:"text-sm text-muted-foreground",children:o}),g&&w.jsx("p",{className:"text-sm text-destructive",children:g})]})})}function ji({className:e,type:t,...n}){return w.jsx("input",{type:t,"data-slot":"input",className:De("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}var LH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Cf=LH.reduce((e,t)=>{const n=LA(`Primitive.${t}`),o=_.forwardRef((s,c)=>{const{asChild:u,...f}=s,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(h,{...f,ref:c})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),zH="Label",PA=_.forwardRef((e,t)=>w.jsx(Cf.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));PA.displayName=zH;var PH=PA;function rr({className:e,...t}){return w.jsx(PH,{"data-slot":"label",className:De("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function $H({className:e,...t}){return w.jsx("textarea",{"data-slot":"textarea",className:De("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function $A(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function FA(e){const[t,n]=_.useState(void 0);return jt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const c=s[0];let u,f;if("borderBoxSize"in c){const h=c.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,f=p.blockSize}else u=e.offsetWidth,f=e.offsetHeight;n({width:u,height:f})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Af="Checkbox",[FH]=zr(Af),[BH,Fy]=FH(Af);function qH(e){const{__scopeCheckbox:t,checked:n,children:o,defaultChecked:s,disabled:c,form:u,name:f,onCheckedChange:h,required:p,value:y="on",internal_do_not_use_render:g}=e,[b,x]=ti({prop:n,defaultProp:s??!1,onChange:h,caller:Af}),[C,S]=_.useState(null),[A,I]=_.useState(null),k=_.useRef(!1),R=C?!!u||!!C.closest("form"):!0,N={checked:b,disabled:c,setChecked:x,control:C,setControl:S,name:f,form:u,value:y,hasConsumerStoppedPropagationRef:k,required:p,defaultChecked:Xo(s)?!1:s,isFormControl:R,bubbleInput:A,setBubbleInput:I};return w.jsx(BH,{scope:t,...N,children:UH(g)?g(N):o})}var BA="CheckboxTrigger",qA=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...o},s)=>{const{control:c,value:u,disabled:f,checked:h,required:p,setControl:y,setChecked:g,hasConsumerStoppedPropagationRef:b,isFormControl:x,bubbleInput:C}=Fy(BA,e),S=Ze(s,y),A=_.useRef(h);return _.useEffect(()=>{const I=c?.form;if(I){const k=()=>g(A.current);return I.addEventListener("reset",k),()=>I.removeEventListener("reset",k)}},[c,g]),w.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":Xo(h)?"mixed":h,"aria-required":p,"data-state":GA(h),"data-disabled":f?"":void 0,disabled:f,value:u,...o,ref:S,onKeyDown:ge(t,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:ge(n,I=>{g(k=>Xo(k)?!0:!k),C&&x&&(b.current=I.isPropagationStopped(),b.current||I.stopPropagation())})})});qA.displayName=BA;var UA=_.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:s,defaultChecked:c,required:u,disabled:f,value:h,onCheckedChange:p,form:y,...g}=e;return w.jsx(qH,{__scopeCheckbox:n,checked:s,defaultChecked:c,disabled:f,required:u,onCheckedChange:p,name:o,form:y,value:h,internal_do_not_use_render:({isFormControl:b})=>w.jsxs(w.Fragment,{children:[w.jsx(qA,{...g,ref:t,__scopeCheckbox:n}),b&&w.jsx(ZA,{__scopeCheckbox:n})]})})});UA.displayName=Af;var VA="CheckboxIndicator",HA=_.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...s}=e,c=Fy(VA,n);return w.jsx(dr,{present:o||Xo(c.checked)||c.checked===!0,children:w.jsx(Ne.span,{"data-state":GA(c.checked),"data-disabled":c.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});HA.displayName=VA;var QA="CheckboxBubbleInput",ZA=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:o,hasConsumerStoppedPropagationRef:s,checked:c,defaultChecked:u,required:f,disabled:h,name:p,value:y,form:g,bubbleInput:b,setBubbleInput:x}=Fy(QA,e),C=Ze(n,x),S=$A(c),A=FA(o);_.useEffect(()=>{const k=b;if(!k)return;const R=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(R,"checked").set,B=!s.current;if(S!==c&&j){const P=new Event("click",{bubbles:B});k.indeterminate=Xo(c),j.call(k,Xo(c)?!1:c),k.dispatchEvent(P)}},[b,S,c,s]);const I=_.useRef(Xo(c)?!1:c);return w.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??I.current,required:f,disabled:h,name:p,value:y,form:g,...t,tabIndex:-1,ref:C,style:{...t.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});ZA.displayName=QA;function UH(e){return typeof e=="function"}function Xo(e){return e==="indeterminate"}function GA(e){return Xo(e)?"indeterminate":e?"checked":"unchecked"}function L_({className:e,...t}){return w.jsx(UA,{"data-slot":"checkbox",className:De("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:w.jsx(HA,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:w.jsx(KT,{className:"size-3.5"})})})}function z_(e,[t,n]){return Math.min(n,Math.max(t,e))}function By(e){const t=e+"CollectionProvider",[n,o]=zr(t),[s,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:A,children:I}=S,k=sn.useRef(null),R=sn.useRef(new Map).current;return w.jsx(s,{scope:A,itemMap:R,collectionRef:k,children:I})};u.displayName=t;const f=e+"CollectionSlot",h=Gi(f),p=sn.forwardRef((S,A)=>{const{scope:I,children:k}=S,R=c(f,I),N=Ze(A,R.collectionRef);return w.jsx(h,{ref:N,children:k})});p.displayName=f;const y=e+"CollectionItemSlot",g="data-radix-collection-item",b=Gi(y),x=sn.forwardRef((S,A)=>{const{scope:I,children:k,...R}=S,N=sn.useRef(null),j=Ze(A,N),B=c(y,I);return sn.useEffect(()=>(B.itemMap.set(N,{ref:N,...R}),()=>{B.itemMap.delete(N)})),w.jsx(b,{[g]:"",ref:j,children:k})});x.displayName=y;function C(S){const A=c(e+"CollectionConsumer",S);return sn.useCallback(()=>{const k=A.collectionRef.current;if(!k)return[];const R=Array.from(k.querySelectorAll(`[${g}]`));return Array.from(A.itemMap.values()).sort((B,P)=>R.indexOf(B.ref.current)-R.indexOf(P.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:u,Slot:p,ItemSlot:x},C,o]}var VH=_.createContext(void 0);function qy(e){const t=_.useContext(VH);return e||t||"ltr"}const HH=["top","right","bottom","left"],ni=Math.min,Fn=Math.max,Ud=Math.round,ad=Math.floor,Mr=e=>({x:e,y:e}),QH={left:"right",right:"left",bottom:"top",top:"bottom"},ZH={start:"end",end:"start"};function Eg(e,t,n){return Fn(e,ni(t,n))}function po(e,t){return typeof e=="function"?e(t):e}function mo(e){return e.split("-")[0]}function Aa(e){return e.split("-")[1]}function Uy(e){return e==="x"?"y":"x"}function Vy(e){return e==="y"?"height":"width"}const GH=new Set(["top","bottom"]);function kr(e){return GH.has(mo(e))?"y":"x"}function Hy(e){return Uy(kr(e))}function YH(e,t,n){n===void 0&&(n=!1);const o=Aa(e),s=Hy(e),c=Vy(s);let u=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Vd(u)),[u,Vd(u)]}function KH(e){const t=Vd(e);return[Tg(e),t,Tg(t)]}function Tg(e){return e.replace(/start|end/g,t=>ZH[t])}const P_=["left","right"],$_=["right","left"],XH=["top","bottom"],JH=["bottom","top"];function WH(e,t,n){switch(e){case"top":case"bottom":return n?t?$_:P_:t?P_:$_;case"left":case"right":return t?XH:JH;default:return[]}}function e7(e,t,n,o){const s=Aa(e);let c=WH(mo(e),n==="start",o);return s&&(c=c.map(u=>u+"-"+s),t&&(c=c.concat(c.map(Tg)))),c}function Vd(e){return e.replace(/left|right|bottom|top/g,t=>QH[t])}function t7(e){return{top:0,right:0,bottom:0,left:0,...e}}function YA(e){return typeof e!="number"?t7(e):{top:e,right:e,bottom:e,left:e}}function Hd(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function F_(e,t,n){let{reference:o,floating:s}=e;const c=kr(t),u=Hy(t),f=Vy(u),h=mo(t),p=c==="y",y=o.x+o.width/2-s.width/2,g=o.y+o.height/2-s.height/2,b=o[f]/2-s[f]/2;let x;switch(h){case"top":x={x:y,y:o.y-s.height};break;case"bottom":x={x:y,y:o.y+o.height};break;case"right":x={x:o.x+o.width,y:g};break;case"left":x={x:o.x-s.width,y:g};break;default:x={x:o.x,y:o.y}}switch(Aa(t)){case"start":x[u]-=b*(n&&p?-1:1);break;case"end":x[u]+=b*(n&&p?-1:1);break}return x}async function n7(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:c,rects:u,elements:f,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:b=!1,padding:x=0}=po(t,e),C=YA(x),A=f[b?g==="floating"?"reference":"floating":g],I=Hd(await c.getClippingRect({element:(n=await(c.isElement==null?void 0:c.isElement(A)))==null||n?A:A.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:p,rootBoundary:y,strategy:h})),k=g==="floating"?{x:o,y:s,width:u.floating.width,height:u.floating.height}:u.reference,R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),N=await(c.isElement==null?void 0:c.isElement(R))?await(c.getScale==null?void 0:c.getScale(R))||{x:1,y:1}:{x:1,y:1},j=Hd(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:k,offsetParent:R,strategy:h}):k);return{top:(I.top-j.top+C.top)/N.y,bottom:(j.bottom-I.bottom+C.bottom)/N.y,left:(I.left-j.left+C.left)/N.x,right:(j.right-I.right+C.right)/N.x}}const r7=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:c=[],platform:u}=n,f=c.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:s}),{x:y,y:g}=F_(p,o,h),b=o,x={},C=0;for(let A=0;A<f.length;A++){var S;const{name:I,fn:k}=f[A],{x:R,y:N,data:j,reset:B}=await k({x:y,y:g,initialPlacement:o,placement:b,strategy:s,middlewareData:x,rects:p,platform:{...u,detectOverflow:(S=u.detectOverflow)!=null?S:n7},elements:{reference:e,floating:t}});y=R??y,g=N??g,x={...x,[I]:{...x[I],...j}},B&&C<=50&&(C++,typeof B=="object"&&(B.placement&&(b=B.placement),B.rects&&(p=B.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:s}):B.rects),{x:y,y:g}=F_(p,b,h)),A=-1)}return{x:y,y:g,placement:b,strategy:s,middlewareData:x}},o7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:c,platform:u,elements:f,middlewareData:h}=t,{element:p,padding:y=0}=po(e,t)||{};if(p==null)return{};const g=YA(y),b={x:n,y:o},x=Hy(s),C=Vy(x),S=await u.getDimensions(p),A=x==="y",I=A?"top":"left",k=A?"bottom":"right",R=A?"clientHeight":"clientWidth",N=c.reference[C]+c.reference[x]-b[x]-c.floating[C],j=b[x]-c.reference[x],B=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let P=B?B[R]:0;(!P||!await(u.isElement==null?void 0:u.isElement(B)))&&(P=f.floating[R]||c.floating[C]);const M=N/2-j/2,U=P/2-S[C]/2-1,ee=ni(g[I],U),ae=ni(g[k],U),re=ee,ue=P-S[C]-ae,ce=P/2-S[C]/2+M,he=Eg(re,ce,ue),F=!h.arrow&&Aa(s)!=null&&ce!==he&&c.reference[C]/2-(ce<re?ee:ae)-S[C]/2<0,X=F?ce<re?ce-re:ce-ue:0;return{[x]:b[x]+X,data:{[x]:he,centerOffset:ce-he-X,...F&&{alignmentOffset:X}},reset:F}}}),i7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:c,rects:u,initialPlacement:f,platform:h,elements:p}=t,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:S=!0,...A}=po(e,t);if((n=c.arrow)!=null&&n.alignmentOffset)return{};const I=mo(s),k=kr(f),R=mo(f)===f,N=await(h.isRTL==null?void 0:h.isRTL(p.floating)),j=b||(R||!S?[Vd(f)]:KH(f)),B=C!=="none";!b&&B&&j.push(...e7(f,S,C,N));const P=[f,...j],M=await h.detectOverflow(t,A),U=[];let ee=((o=c.flip)==null?void 0:o.overflows)||[];if(y&&U.push(M[I]),g){const ce=YH(s,u,N);U.push(M[ce[0]],M[ce[1]])}if(ee=[...ee,{placement:s,overflows:U}],!U.every(ce=>ce<=0)){var ae,re;const ce=(((ae=c.flip)==null?void 0:ae.index)||0)+1,he=P[ce];if(he&&(!(g==="alignment"?k!==kr(he):!1)||ee.every(Z=>kr(Z.placement)===k?Z.overflows[0]>0:!0)))return{data:{index:ce,overflows:ee},reset:{placement:he}};let F=(re=ee.filter(X=>X.overflows[0]<=0).sort((X,Z)=>X.overflows[1]-Z.overflows[1])[0])==null?void 0:re.placement;if(!F)switch(x){case"bestFit":{var ue;const X=(ue=ee.filter(Z=>{if(B){const oe=kr(Z.placement);return oe===k||oe==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(oe=>oe>0).reduce((oe,be)=>oe+be,0)]).sort((Z,oe)=>Z[1]-oe[1])[0])==null?void 0:ue[0];X&&(F=X);break}case"initialPlacement":F=f;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function B_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function q_(e){return HH.some(t=>e[t]>=0)}const s7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:s="referenceHidden",...c}=po(e,t);switch(s){case"referenceHidden":{const u=await o.detectOverflow(t,{...c,elementContext:"reference"}),f=B_(u,n.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:q_(f)}}}case"escaped":{const u=await o.detectOverflow(t,{...c,altBoundary:!0}),f=B_(u,n.floating);return{data:{escapedOffsets:f,escaped:q_(f)}}}default:return{}}}}},KA=new Set(["left","top"]);async function a7(e,t){const{placement:n,platform:o,elements:s}=e,c=await(o.isRTL==null?void 0:o.isRTL(s.floating)),u=mo(n),f=Aa(n),h=kr(n)==="y",p=KA.has(u)?-1:1,y=c&&h?-1:1,g=po(t,e);let{mainAxis:b,crossAxis:x,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return f&&typeof C=="number"&&(x=f==="end"?C*-1:C),h?{x:x*y,y:b*p}:{x:b*p,y:x*y}}const l7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:c,placement:u,middlewareData:f}=t,h=await a7(t,e);return u===((n=f.offset)==null?void 0:n.placement)&&(o=f.arrow)!=null&&o.alignmentOffset?{}:{x:s+h.x,y:c+h.y,data:{...h,placement:u}}}}},c7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s,platform:c}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:h={fn:I=>{let{x:k,y:R}=I;return{x:k,y:R}}},...p}=po(e,t),y={x:n,y:o},g=await c.detectOverflow(t,p),b=kr(mo(s)),x=Uy(b);let C=y[x],S=y[b];if(u){const I=x==="y"?"top":"left",k=x==="y"?"bottom":"right",R=C+g[I],N=C-g[k];C=Eg(R,C,N)}if(f){const I=b==="y"?"top":"left",k=b==="y"?"bottom":"right",R=S+g[I],N=S-g[k];S=Eg(R,S,N)}const A=h.fn({...t,[x]:C,[b]:S});return{...A,data:{x:A.x-n,y:A.y-o,enabled:{[x]:u,[b]:f}}}}}},u7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:s,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:h=!0,crossAxis:p=!0}=po(e,t),y={x:n,y:o},g=kr(s),b=Uy(g);let x=y[b],C=y[g];const S=po(f,t),A=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const R=b==="y"?"height":"width",N=c.reference[b]-c.floating[R]+A.mainAxis,j=c.reference[b]+c.reference[R]-A.mainAxis;x<N?x=N:x>j&&(x=j)}if(p){var I,k;const R=b==="y"?"width":"height",N=KA.has(mo(s)),j=c.reference[g]-c.floating[R]+(N&&((I=u.offset)==null?void 0:I[g])||0)+(N?0:A.crossAxis),B=c.reference[g]+c.reference[R]+(N?0:((k=u.offset)==null?void 0:k[g])||0)-(N?A.crossAxis:0);C<j?C=j:C>B&&(C=B)}return{[b]:x,[g]:C}}}},d7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:c,platform:u,elements:f}=t,{apply:h=()=>{},...p}=po(e,t),y=await u.detectOverflow(t,p),g=mo(s),b=Aa(s),x=kr(s)==="y",{width:C,height:S}=c.floating;let A,I;g==="top"||g==="bottom"?(A=g,I=b===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(I=g,A=b==="end"?"top":"bottom");const k=S-y.top-y.bottom,R=C-y.left-y.right,N=ni(S-y[A],k),j=ni(C-y[I],R),B=!t.middlewareData.shift;let P=N,M=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=R),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(P=k),B&&!b){const ee=Fn(y.left,0),ae=Fn(y.right,0),re=Fn(y.top,0),ue=Fn(y.bottom,0);x?M=C-2*(ee!==0||ae!==0?ee+ae:Fn(y.left,y.right)):P=S-2*(re!==0||ue!==0?re+ue:Fn(y.top,y.bottom))}await h({...t,availableWidth:M,availableHeight:P});const U=await u.getDimensions(f.floating);return C!==U.width||S!==U.height?{reset:{rects:!0}}:{}}}};function Rf(){return typeof window<"u"}function Ra(e){return XA(e)?(e.nodeName||"").toLowerCase():"#document"}function qn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pr(e){var t;return(t=(XA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function XA(e){return Rf()?e instanceof Node||e instanceof qn(e).Node:!1}function wr(e){return Rf()?e instanceof Element||e instanceof qn(e).Element:!1}function jr(e){return Rf()?e instanceof HTMLElement||e instanceof qn(e).HTMLElement:!1}function U_(e){return!Rf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof qn(e).ShadowRoot}const f7=new Set(["inline","contents"]);function wc(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!f7.has(s)}const h7=new Set(["table","td","th"]);function p7(e){return h7.has(Ra(e))}const m7=[":popover-open",":modal"];function Nf(e){return m7.some(t=>{try{return e.matches(t)}catch{return!1}})}const g7=["transform","translate","scale","rotate","perspective"],y7=["transform","translate","scale","rotate","perspective","filter"],v7=["paint","layout","strict","content"];function Qy(e){const t=Zy(),n=wr(e)?xr(e):e;return g7.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||y7.some(o=>(n.willChange||"").includes(o))||v7.some(o=>(n.contain||"").includes(o))}function b7(e){let t=ri(e);for(;jr(t)&&!ya(t);){if(Qy(t))return t;if(Nf(t))return null;t=ri(t)}return null}function Zy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const w7=new Set(["html","body","#document"]);function ya(e){return w7.has(Ra(e))}function xr(e){return qn(e).getComputedStyle(e)}function If(e){return wr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ri(e){if(Ra(e)==="html")return e;const t=e.assignedSlot||e.parentNode||U_(e)&&e.host||Pr(e);return U_(t)?t.host:t}function JA(e){const t=ri(e);return ya(t)?e.ownerDocument?e.ownerDocument.body:e.body:jr(t)&&wc(t)?t:JA(t)}function ac(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=JA(e),c=s===((o=e.ownerDocument)==null?void 0:o.body),u=qn(s);if(c){const f=Cg(u);return t.concat(u,u.visualViewport||[],wc(s)?s:[],f&&n?ac(f):[])}return t.concat(s,ac(s,[],n))}function Cg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function WA(e){const t=xr(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=jr(e),c=s?e.offsetWidth:n,u=s?e.offsetHeight:o,f=Ud(n)!==c||Ud(o)!==u;return f&&(n=c,o=u),{width:n,height:o,$:f}}function Gy(e){return wr(e)?e:e.contextElement}function da(e){const t=Gy(e);if(!jr(t))return Mr(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:c}=WA(t);let u=(c?Ud(n.width):n.width)/o,f=(c?Ud(n.height):n.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const x7=Mr(0);function eR(e){const t=qn(e);return!Zy()||!t.visualViewport?x7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function S7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==qn(e)?!1:t}function Ki(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),c=Gy(e);let u=Mr(1);t&&(o?wr(o)&&(u=da(o)):u=da(e));const f=S7(c,n,o)?eR(c):Mr(0);let h=(s.left+f.x)/u.x,p=(s.top+f.y)/u.y,y=s.width/u.x,g=s.height/u.y;if(c){const b=qn(c),x=o&&wr(o)?qn(o):o;let C=b,S=Cg(C);for(;S&&o&&x!==C;){const A=da(S),I=S.getBoundingClientRect(),k=xr(S),R=I.left+(S.clientLeft+parseFloat(k.paddingLeft))*A.x,N=I.top+(S.clientTop+parseFloat(k.paddingTop))*A.y;h*=A.x,p*=A.y,y*=A.x,g*=A.y,h+=R,p+=N,C=qn(S),S=Cg(C)}}return Hd({width:y,height:g,x:h,y:p})}function Of(e,t){const n=If(e).scrollLeft;return t?t.left+n:Ki(Pr(e)).left+n}function tR(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Of(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function _7(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const c=s==="fixed",u=Pr(o),f=t?Nf(t.floating):!1;if(o===u||f&&c)return n;let h={scrollLeft:0,scrollTop:0},p=Mr(1);const y=Mr(0),g=jr(o);if((g||!g&&!c)&&((Ra(o)!=="body"||wc(u))&&(h=If(o)),jr(o))){const x=Ki(o);p=da(o),y.x=x.x+o.clientLeft,y.y=x.y+o.clientTop}const b=u&&!g&&!c?tR(u,h):Mr(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+y.x+b.x,y:n.y*p.y-h.scrollTop*p.y+y.y+b.y}}function E7(e){return Array.from(e.getClientRects())}function T7(e){const t=Pr(e),n=If(e),o=e.ownerDocument.body,s=Fn(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=Fn(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let u=-n.scrollLeft+Of(e);const f=-n.scrollTop;return xr(o).direction==="rtl"&&(u+=Fn(t.clientWidth,o.clientWidth)-s),{width:s,height:c,x:u,y:f}}const V_=25;function C7(e,t){const n=qn(e),o=Pr(e),s=n.visualViewport;let c=o.clientWidth,u=o.clientHeight,f=0,h=0;if(s){c=s.width,u=s.height;const y=Zy();(!y||y&&t==="fixed")&&(f=s.offsetLeft,h=s.offsetTop)}const p=Of(o);if(p<=0){const y=o.ownerDocument,g=y.body,b=getComputedStyle(g),x=y.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,C=Math.abs(o.clientWidth-g.clientWidth-x);C<=V_&&(c-=C)}else p<=V_&&(c+=p);return{width:c,height:u,x:f,y:h}}const A7=new Set(["absolute","fixed"]);function R7(e,t){const n=Ki(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,c=jr(e)?da(e):Mr(1),u=e.clientWidth*c.x,f=e.clientHeight*c.y,h=s*c.x,p=o*c.y;return{width:u,height:f,x:h,y:p}}function H_(e,t,n){let o;if(t==="viewport")o=C7(e,n);else if(t==="document")o=T7(Pr(e));else if(wr(t))o=R7(t,n);else{const s=eR(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Hd(o)}function nR(e,t){const n=ri(e);return n===t||!wr(n)||ya(n)?!1:xr(n).position==="fixed"||nR(n,t)}function N7(e,t){const n=t.get(e);if(n)return n;let o=ac(e,[],!1).filter(f=>wr(f)&&Ra(f)!=="body"),s=null;const c=xr(e).position==="fixed";let u=c?ri(e):e;for(;wr(u)&&!ya(u);){const f=xr(u),h=Qy(u);!h&&f.position==="fixed"&&(s=null),(c?!h&&!s:!h&&f.position==="static"&&!!s&&A7.has(s.position)||wc(u)&&!h&&nR(e,u))?o=o.filter(y=>y!==u):s=f,u=ri(u)}return t.set(e,o),o}function I7(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const u=[...n==="clippingAncestors"?Nf(t)?[]:N7(t,this._c):[].concat(n),o],f=u[0],h=u.reduce((p,y)=>{const g=H_(t,y,s);return p.top=Fn(g.top,p.top),p.right=ni(g.right,p.right),p.bottom=ni(g.bottom,p.bottom),p.left=Fn(g.left,p.left),p},H_(t,f,s));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function O7(e){const{width:t,height:n}=WA(e);return{width:t,height:n}}function k7(e,t,n){const o=jr(t),s=Pr(t),c=n==="fixed",u=Ki(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const h=Mr(0);function p(){h.x=Of(s)}if(o||!o&&!c)if((Ra(t)!=="body"||wc(s))&&(f=If(t)),o){const x=Ki(t,!0,c,t);h.x=x.x+t.clientLeft,h.y=x.y+t.clientTop}else s&&p();c&&!o&&s&&p();const y=s&&!o&&!c?tR(s,f):Mr(0),g=u.left+f.scrollLeft-h.x-y.x,b=u.top+f.scrollTop-h.y-y.y;return{x:g,y:b,width:u.width,height:u.height}}function Bm(e){return xr(e).position==="static"}function Q_(e,t){if(!jr(e)||xr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pr(e)===n&&(n=n.ownerDocument.body),n}function rR(e,t){const n=qn(e);if(Nf(e))return n;if(!jr(e)){let s=ri(e);for(;s&&!ya(s);){if(wr(s)&&!Bm(s))return s;s=ri(s)}return n}let o=Q_(e,t);for(;o&&p7(o)&&Bm(o);)o=Q_(o,t);return o&&ya(o)&&Bm(o)&&!Qy(o)?n:o||b7(e)||n}const M7=async function(e){const t=this.getOffsetParent||rR,n=this.getDimensions,o=await n(e.floating);return{reference:k7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function D7(e){return xr(e).direction==="rtl"}const j7={convertOffsetParentRelativeRectToViewportRelativeRect:_7,getDocumentElement:Pr,getClippingRect:I7,getOffsetParent:rR,getElementRects:M7,getClientRects:E7,getDimensions:O7,getScale:da,isElement:wr,isRTL:D7};function oR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function L7(e,t){let n=null,o;const s=Pr(e);function c(){var f;clearTimeout(o),(f=n)==null||f.disconnect(),n=null}function u(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),c();const p=e.getBoundingClientRect(),{left:y,top:g,width:b,height:x}=p;if(f||t(),!b||!x)return;const C=ad(g),S=ad(s.clientWidth-(y+b)),A=ad(s.clientHeight-(g+x)),I=ad(y),R={rootMargin:-C+"px "+-S+"px "+-A+"px "+-I+"px",threshold:Fn(0,ni(1,h))||1};let N=!0;function j(B){const P=B[0].intersectionRatio;if(P!==h){if(!N)return u();P?u(!1,P):o=setTimeout(()=>{u(!1,1e-7)},1e3)}P===1&&!oR(p,e.getBoundingClientRect())&&u(),N=!1}try{n=new IntersectionObserver(j,{...R,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,R)}n.observe(e)}return u(!0),c}function z7(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,p=Gy(e),y=s||c?[...p?ac(p):[],...ac(t)]:[];y.forEach(I=>{s&&I.addEventListener("scroll",n,{passive:!0}),c&&I.addEventListener("resize",n)});const g=p&&f?L7(p,n):null;let b=-1,x=null;u&&(x=new ResizeObserver(I=>{let[k]=I;k&&k.target===p&&x&&(x.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var R;(R=x)==null||R.observe(t)})),n()}),p&&!h&&x.observe(p),x.observe(t));let C,S=h?Ki(e):null;h&&A();function A(){const I=Ki(e);S&&!oR(S,I)&&n(),S=I,C=requestAnimationFrame(A)}return n(),()=>{var I;y.forEach(k=>{s&&k.removeEventListener("scroll",n),c&&k.removeEventListener("resize",n)}),g?.(),(I=x)==null||I.disconnect(),x=null,h&&cancelAnimationFrame(C)}}const P7=l7,$7=c7,F7=i7,B7=d7,q7=s7,Z_=o7,U7=u7,V7=(e,t,n)=>{const o=new Map,s={platform:j7,...n},c={...s.platform,_c:o};return r7(e,t,{...s,platform:c})};var H7=typeof document<"u",Q7=function(){},gd=H7?_.useLayoutEffect:Q7;function Qd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Qd(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const c=s[o];if(!(c==="_owner"&&e.$$typeof)&&!Qd(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function iR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G_(e,t){const n=iR(e);return Math.round(t*n)/n}function qm(e){const t=_.useRef(e);return gd(()=>{t.current=e}),t}function Z7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:h,open:p}=e,[y,g]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,x]=_.useState(o);Qd(b,o)||x(o);const[C,S]=_.useState(null),[A,I]=_.useState(null),k=_.useCallback(Z=>{Z!==B.current&&(B.current=Z,S(Z))},[]),R=_.useCallback(Z=>{Z!==P.current&&(P.current=Z,I(Z))},[]),N=c||C,j=u||A,B=_.useRef(null),P=_.useRef(null),M=_.useRef(y),U=h!=null,ee=qm(h),ae=qm(s),re=qm(p),ue=_.useCallback(()=>{if(!B.current||!P.current)return;const Z={placement:t,strategy:n,middleware:b};ae.current&&(Z.platform=ae.current),V7(B.current,P.current,Z).then(oe=>{const be={...oe,isPositioned:re.current!==!1};ce.current&&!Qd(M.current,be)&&(M.current=be,ba.flushSync(()=>{g(be)}))})},[b,t,n,ae,re]);gd(()=>{p===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,g(Z=>({...Z,isPositioned:!1})))},[p]);const ce=_.useRef(!1);gd(()=>(ce.current=!0,()=>{ce.current=!1}),[]),gd(()=>{if(N&&(B.current=N),j&&(P.current=j),N&&j){if(ee.current)return ee.current(N,j,ue);ue()}},[N,j,ue,ee,U]);const he=_.useMemo(()=>({reference:B,floating:P,setReference:k,setFloating:R}),[k,R]),F=_.useMemo(()=>({reference:N,floating:j}),[N,j]),X=_.useMemo(()=>{const Z={position:n,left:0,top:0};if(!F.floating)return Z;const oe=G_(F.floating,y.x),be=G_(F.floating,y.y);return f?{...Z,transform:"translate("+oe+"px, "+be+"px)",...iR(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:oe,top:be}},[n,f,F.floating,y.x,y.y]);return _.useMemo(()=>({...y,update:ue,refs:he,elements:F,floatingStyles:X}),[y,ue,he,F,X])}const G7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:s}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?Z_({element:o.current,padding:s}).fn(n):{}:o?Z_({element:o,padding:s}).fn(n):{}}}},Y7=(e,t)=>({...P7(e),options:[e,t]}),K7=(e,t)=>({...$7(e),options:[e,t]}),X7=(e,t)=>({...U7(e),options:[e,t]}),J7=(e,t)=>({...F7(e),options:[e,t]}),W7=(e,t)=>({...B7(e),options:[e,t]}),eQ=(e,t)=>({...q7(e),options:[e,t]}),tQ=(e,t)=>({...G7(e),options:[e,t]});var nQ="Arrow",sR=_.forwardRef((e,t)=>{const{children:n,width:o=10,height:s=5,...c}=e;return w.jsx(Ne.svg,{...c,ref:t,width:o,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:w.jsx("polygon",{points:"0,0 30,0 15,10"})})});sR.displayName=nQ;var rQ=sR,Yy="Popper",[aR,Na]=zr(Yy),[oQ,lR]=aR(Yy),cR=e=>{const{__scopePopper:t,children:n}=e,[o,s]=_.useState(null);return w.jsx(oQ,{scope:t,anchor:o,onAnchorChange:s,children:n})};cR.displayName=Yy;var uR="PopperAnchor",dR=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...s}=e,c=lR(uR,n),u=_.useRef(null),f=Ze(t,u),h=_.useRef(null);return _.useEffect(()=>{const p=h.current;h.current=o?.current||u.current,p!==h.current&&c.onAnchorChange(h.current)}),o?null:w.jsx(Ne.div,{...s,ref:f})});dR.displayName=uR;var Ky="PopperContent",[iQ,sQ]=aR(Ky),fR=_.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:s=0,align:c="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:g="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:C,...S}=e,A=lR(Ky,n),[I,k]=_.useState(null),R=Ze(t,J=>k(J)),[N,j]=_.useState(null),B=FA(N),P=B?.width??0,M=B?.height??0,U=o+(c!=="center"?"-"+c:""),ee=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ae=Array.isArray(p)?p:[p],re=ae.length>0,ue={padding:ee,boundary:ae.filter(lQ),altBoundary:re},{refs:ce,floatingStyles:he,placement:F,isPositioned:X,middlewareData:Z}=Z7({strategy:"fixed",placement:U,whileElementsMounted:(...J)=>z7(...J,{animationFrame:x==="always"}),elements:{reference:A.anchor},middleware:[Y7({mainAxis:s+M,alignmentAxis:u}),h&&K7({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?X7():void 0,...ue}),h&&J7({...ue}),W7({...ue,apply:({elements:J,rects:_e,availableWidth:Te,availableHeight:Ce})=>{const{width:Ie,height:je}=_e.reference,gt=J.floating.style;gt.setProperty("--radix-popper-available-width",`${Te}px`),gt.setProperty("--radix-popper-available-height",`${Ce}px`),gt.setProperty("--radix-popper-anchor-width",`${Ie}px`),gt.setProperty("--radix-popper-anchor-height",`${je}px`)}}),N&&tQ({element:N,padding:f}),cQ({arrowWidth:P,arrowHeight:M}),b&&eQ({strategy:"referenceHidden",...ue})]}),[oe,be]=mR(F),z=br(C);jt(()=>{X&&z?.()},[X,z]);const Y=Z.arrow?.x,ie=Z.arrow?.y,se=Z.arrow?.centerOffset!==0,[de,ve]=_.useState();return jt(()=>{I&&ve(window.getComputedStyle(I).zIndex)},[I]),w.jsx("div",{ref:ce.setFloating,"data-radix-popper-content-wrapper":"",style:{...he,transform:X?he.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:w.jsx(iQ,{scope:n,placedSide:oe,onArrowChange:j,arrowX:Y,arrowY:ie,shouldHideArrow:se,children:w.jsx(Ne.div,{"data-side":oe,"data-align":be,...S,ref:R,style:{...S.style,animation:X?void 0:"none"}})})})});fR.displayName=Ky;var hR="PopperArrow",aQ={top:"bottom",right:"left",bottom:"top",left:"right"},pR=_.forwardRef(function(t,n){const{__scopePopper:o,...s}=t,c=sQ(hR,o),u=aQ[c.placedSide];return w.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:w.jsx(rQ,{...s,ref:n,style:{...s.style,display:"block"}})})});pR.displayName=hR;function lQ(e){return e!==null}var cQ=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:s}=t,u=s.arrow?.centerOffset!==0,f=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[p,y]=mR(n),g={start:"0%",center:"50%",end:"100%"}[y],b=(s.arrow?.x??0)+f/2,x=(s.arrow?.y??0)+h/2;let C="",S="";return p==="bottom"?(C=u?g:`${b}px`,S=`${-h}px`):p==="top"?(C=u?g:`${b}px`,S=`${o.floating.height+h}px`):p==="right"?(C=`${-h}px`,S=u?g:`${x}px`):p==="left"&&(C=`${o.floating.width+h}px`,S=u?g:`${x}px`),{data:{x:C,y:S}}}});function mR(e){const[t,n="center"]=e.split("-");return[t,n]}var Xy=cR,kf=dR,Jy=fR,Wy=pR,gR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),uQ="VisuallyHidden",dQ=_.forwardRef((e,t)=>w.jsx(Ne.span,{...e,ref:t,style:{...gR,...e.style}}));dQ.displayName=uQ;var fQ=[" ","Enter","ArrowUp","ArrowDown"],hQ=[" ","Enter"],Xi="Select",[Mf,Df,pQ]=By(Xi),[Ia]=zr(Xi,[pQ,Na]),jf=Na(),[mQ,ci]=Ia(Xi),[gQ,yQ]=Ia(Xi),yR=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:s,onOpenChange:c,value:u,defaultValue:f,onValueChange:h,dir:p,name:y,autoComplete:g,disabled:b,required:x,form:C}=e,S=jf(t),[A,I]=_.useState(null),[k,R]=_.useState(null),[N,j]=_.useState(!1),B=qy(p),[P,M]=ti({prop:o,defaultProp:s??!1,onChange:c,caller:Xi}),[U,ee]=ti({prop:u,defaultProp:f,onChange:h,caller:Xi}),ae=_.useRef(null),re=A?C||!!A.closest("form"):!0,[ue,ce]=_.useState(new Set),he=Array.from(ue).map(F=>F.props.value).join(";");return w.jsx(Xy,{...S,children:w.jsxs(mQ,{required:x,scope:t,trigger:A,onTriggerChange:I,valueNode:k,onValueNodeChange:R,valueNodeHasChildren:N,onValueNodeHasChildrenChange:j,contentId:yr(),value:U,onValueChange:ee,open:P,onOpenChange:M,dir:B,triggerPointerDownPosRef:ae,disabled:b,children:[w.jsx(Mf.Provider,{scope:t,children:w.jsx(gQ,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(F=>{ce(X=>new Set(X).add(F))},[]),onNativeOptionRemove:_.useCallback(F=>{ce(X=>{const Z=new Set(X);return Z.delete(F),Z})},[]),children:n})}),re?w.jsxs($R,{"aria-hidden":!0,required:x,tabIndex:-1,name:y,autoComplete:g,value:U,onChange:F=>ee(F.target.value),disabled:b,form:C,children:[U===void 0?w.jsx("option",{value:""}):null,Array.from(ue)]},he):null]})})};yR.displayName=Xi;var vR="SelectTrigger",bR=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...s}=e,c=jf(n),u=ci(vR,n),f=u.disabled||o,h=Ze(t,u.onTriggerChange),p=Df(n),y=_.useRef("touch"),[g,b,x]=BR(S=>{const A=p().filter(R=>!R.disabled),I=A.find(R=>R.value===u.value),k=qR(A,S,I);k!==void 0&&u.onValueChange(k.value)}),C=S=>{f||(u.onOpenChange(!0),x()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return w.jsx(kf,{asChild:!0,...c,children:w.jsx(Ne.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":FR(u.value)?"":void 0,...s,ref:h,onClick:ge(s.onClick,S=>{S.currentTarget.focus(),y.current!=="mouse"&&C(S)}),onPointerDown:ge(s.onPointerDown,S=>{y.current=S.pointerType;const A=S.target;A.hasPointerCapture(S.pointerId)&&A.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(C(S),S.preventDefault())}),onKeyDown:ge(s.onKeyDown,S=>{const A=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&b(S.key),!(A&&S.key===" ")&&fQ.includes(S.key)&&(C(),S.preventDefault())})})})});bR.displayName=vR;var wR="SelectValue",xR=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,children:c,placeholder:u="",...f}=e,h=ci(wR,n),{onValueNodeHasChildrenChange:p}=h,y=c!==void 0,g=Ze(t,h.onValueNodeChange);return jt(()=>{p(y)},[p,y]),w.jsx(Ne.span,{...f,ref:g,style:{pointerEvents:"none"},children:FR(h.value)?w.jsx(w.Fragment,{children:u}):c})});xR.displayName=wR;var vQ="SelectIcon",SR=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...s}=e;return w.jsx(Ne.span,{"aria-hidden":!0,...s,ref:t,children:o||"▼"})});SR.displayName=vQ;var bQ="SelectPortal",_R=e=>w.jsx(vc,{asChild:!0,...e});_R.displayName=bQ;var Ji="SelectContent",ER=_.forwardRef((e,t)=>{const n=ci(Ji,e.__scopeSelect),[o,s]=_.useState();if(jt(()=>{s(new DocumentFragment)},[]),!n.open){const c=o;return c?ba.createPortal(w.jsx(TR,{scope:e.__scopeSelect,children:w.jsx(Mf.Slot,{scope:e.__scopeSelect,children:w.jsx("div",{children:e.children})})}),c):null}return w.jsx(CR,{...e,ref:t})});ER.displayName=Ji;var gr=10,[TR,ui]=Ia(Ji),wQ="SelectContentImpl",xQ=Gi("SelectContent.RemoveScroll"),CR=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:c,onPointerDownOutside:u,side:f,sideOffset:h,align:p,alignOffset:y,arrowPadding:g,collisionBoundary:b,collisionPadding:x,sticky:C,hideWhenDetached:S,avoidCollisions:A,...I}=e,k=ci(Ji,n),[R,N]=_.useState(null),[j,B]=_.useState(null),P=Ze(t,J=>N(J)),[M,U]=_.useState(null),[ee,ae]=_.useState(null),re=Df(n),[ue,ce]=_.useState(!1),he=_.useRef(!1);_.useEffect(()=>{if(R)return Ef(R)},[R]),Sf();const F=_.useCallback(J=>{const[_e,...Te]=re().map(je=>je.ref.current),[Ce]=Te.slice(-1),Ie=document.activeElement;for(const je of J)if(je===Ie||(je?.scrollIntoView({block:"nearest"}),je===_e&&j&&(j.scrollTop=0),je===Ce&&j&&(j.scrollTop=j.scrollHeight),je?.focus(),document.activeElement!==Ie))return},[re,j]),X=_.useCallback(()=>F([M,R]),[F,M,R]);_.useEffect(()=>{ue&&X()},[ue,X]);const{onOpenChange:Z,triggerPointerDownPosRef:oe}=k;_.useEffect(()=>{if(R){let J={x:0,y:0};const _e=Ce=>{J={x:Math.abs(Math.round(Ce.pageX)-(oe.current?.x??0)),y:Math.abs(Math.round(Ce.pageY)-(oe.current?.y??0))}},Te=Ce=>{J.x<=10&&J.y<=10?Ce.preventDefault():R.contains(Ce.target)||Z(!1),document.removeEventListener("pointermove",_e),oe.current=null};return oe.current!==null&&(document.addEventListener("pointermove",_e),document.addEventListener("pointerup",Te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",Te,{capture:!0})}}},[R,Z,oe]),_.useEffect(()=>{const J=()=>Z(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[Z]);const[be,z]=BR(J=>{const _e=re().filter(Ie=>!Ie.disabled),Te=_e.find(Ie=>Ie.ref.current===document.activeElement),Ce=qR(_e,J,Te);Ce&&setTimeout(()=>Ce.ref.current.focus())}),Y=_.useCallback((J,_e,Te)=>{const Ce=!he.current&&!Te;(k.value!==void 0&&k.value===_e||Ce)&&(U(J),Ce&&(he.current=!0))},[k.value]),ie=_.useCallback(()=>R?.focus(),[R]),se=_.useCallback((J,_e,Te)=>{const Ce=!he.current&&!Te;(k.value!==void 0&&k.value===_e||Ce)&&ae(J)},[k.value]),de=o==="popper"?Ag:AR,ve=de===Ag?{side:f,sideOffset:h,align:p,alignOffset:y,arrowPadding:g,collisionBoundary:b,collisionPadding:x,sticky:C,hideWhenDetached:S,avoidCollisions:A}:{};return w.jsx(TR,{scope:n,content:R,viewport:j,onViewportChange:B,itemRefCallback:Y,selectedItem:M,onItemLeave:ie,itemTextRefCallback:se,focusSelectedItem:X,selectedItemText:ee,position:o,isPositioned:ue,searchRef:be,children:w.jsx(bc,{as:xQ,allowPinchZoom:!0,children:w.jsx(yc,{asChild:!0,trapped:k.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:ge(s,J=>{k.trigger?.focus({preventScroll:!0}),J.preventDefault()}),children:w.jsx(gc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>k.onOpenChange(!1),children:w.jsx(de,{role:"listbox",id:k.contentId,"data-state":k.open?"open":"closed",dir:k.dir,onContextMenu:J=>J.preventDefault(),...I,...ve,onPlaced:()=>ce(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:ge(I.onKeyDown,J=>{const _e=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!_e&&J.key.length===1&&z(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let Ce=re().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(J.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Ie=J.target,je=Ce.indexOf(Ie);Ce=Ce.slice(je+1)}setTimeout(()=>F(Ce)),J.preventDefault()}})})})})})})});CR.displayName=wQ;var SQ="SelectItemAlignedPosition",AR=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...s}=e,c=ci(Ji,n),u=ui(Ji,n),[f,h]=_.useState(null),[p,y]=_.useState(null),g=Ze(t,P=>y(P)),b=Df(n),x=_.useRef(!1),C=_.useRef(!0),{viewport:S,selectedItem:A,selectedItemText:I,focusSelectedItem:k}=u,R=_.useCallback(()=>{if(c.trigger&&c.valueNode&&f&&p&&S&&A&&I){const P=c.trigger.getBoundingClientRect(),M=p.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),ee=I.getBoundingClientRect();if(c.dir!=="rtl"){const Ie=ee.left-M.left,je=U.left-Ie,gt=P.left-je,Lt=P.width+gt,In=Math.max(Lt,M.width),Hn=window.innerWidth-gr,tn=z_(je,[gr,Math.max(gr,Hn-In)]);f.style.minWidth=Lt+"px",f.style.left=tn+"px"}else{const Ie=M.right-ee.right,je=window.innerWidth-U.right-Ie,gt=window.innerWidth-P.right-je,Lt=P.width+gt,In=Math.max(Lt,M.width),Hn=window.innerWidth-gr,tn=z_(je,[gr,Math.max(gr,Hn-In)]);f.style.minWidth=Lt+"px",f.style.right=tn+"px"}const ae=b(),re=window.innerHeight-gr*2,ue=S.scrollHeight,ce=window.getComputedStyle(p),he=parseInt(ce.borderTopWidth,10),F=parseInt(ce.paddingTop,10),X=parseInt(ce.borderBottomWidth,10),Z=parseInt(ce.paddingBottom,10),oe=he+F+ue+Z+X,be=Math.min(A.offsetHeight*5,oe),z=window.getComputedStyle(S),Y=parseInt(z.paddingTop,10),ie=parseInt(z.paddingBottom,10),se=P.top+P.height/2-gr,de=re-se,ve=A.offsetHeight/2,J=A.offsetTop+ve,_e=he+F+J,Te=oe-_e;if(_e<=se){const Ie=ae.length>0&&A===ae[ae.length-1].ref.current;f.style.bottom="0px";const je=p.clientHeight-S.offsetTop-S.offsetHeight,gt=Math.max(de,ve+(Ie?ie:0)+je+X),Lt=_e+gt;f.style.height=Lt+"px"}else{const Ie=ae.length>0&&A===ae[0].ref.current;f.style.top="0px";const gt=Math.max(se,he+S.offsetTop+(Ie?Y:0)+ve)+Te;f.style.height=gt+"px",S.scrollTop=_e-se+S.offsetTop}f.style.margin=`${gr}px 0`,f.style.minHeight=be+"px",f.style.maxHeight=re+"px",o?.(),requestAnimationFrame(()=>x.current=!0)}},[b,c.trigger,c.valueNode,f,p,S,A,I,c.dir,o]);jt(()=>R(),[R]);const[N,j]=_.useState();jt(()=>{p&&j(window.getComputedStyle(p).zIndex)},[p]);const B=_.useCallback(P=>{P&&C.current===!0&&(R(),k?.(),C.current=!1)},[R,k]);return w.jsx(EQ,{scope:n,contentWrapper:f,shouldExpandOnScrollRef:x,onScrollButtonChange:B,children:w.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:w.jsx(Ne.div,{...s,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});AR.displayName=SQ;var _Q="SelectPopperPosition",Ag=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:s=gr,...c}=e,u=jf(n);return w.jsx(Jy,{...u,...c,ref:t,align:o,collisionPadding:s,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ag.displayName=_Q;var[EQ,ev]=Ia(Ji,{}),Rg="SelectViewport",RR=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...s}=e,c=ui(Rg,n),u=ev(Rg,n),f=Ze(t,c.onViewportChange),h=_.useRef(0);return w.jsxs(w.Fragment,{children:[w.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),w.jsx(Mf.Slot,{scope:n,children:w.jsx(Ne.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ge(s.onScroll,p=>{const y=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:b}=u;if(b?.current&&g){const x=Math.abs(h.current-y.scrollTop);if(x>0){const C=window.innerHeight-gr*2,S=parseFloat(g.style.minHeight),A=parseFloat(g.style.height),I=Math.max(S,A);if(I<C){const k=I+x,R=Math.min(C,k),N=k-R;g.style.height=R+"px",g.style.bottom==="0px"&&(y.scrollTop=N>0?N:0,g.style.justifyContent="flex-end")}}}h.current=y.scrollTop})})})]})});RR.displayName=Rg;var NR="SelectGroup",[TQ,CQ]=Ia(NR),AQ=_.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=yr();return w.jsx(TQ,{scope:n,id:s,children:w.jsx(Ne.div,{role:"group","aria-labelledby":s,...o,ref:t})})});AQ.displayName=NR;var IR="SelectLabel",RQ=_.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=CQ(IR,n);return w.jsx(Ne.div,{id:s.id,...o,ref:t})});RQ.displayName=IR;var Zd="SelectItem",[NQ,OR]=Ia(Zd),kR=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:c,...u}=e,f=ci(Zd,n),h=ui(Zd,n),p=f.value===o,[y,g]=_.useState(c??""),[b,x]=_.useState(!1),C=Ze(t,k=>h.itemRefCallback?.(k,o,s)),S=yr(),A=_.useRef("touch"),I=()=>{s||(f.onValueChange(o),f.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return w.jsx(NQ,{scope:n,value:o,disabled:s,textId:S,isSelected:p,onItemTextChange:_.useCallback(k=>{g(R=>R||(k?.textContent??"").trim())},[]),children:w.jsx(Mf.ItemSlot,{scope:n,value:o,disabled:s,textValue:y,children:w.jsx(Ne.div,{role:"option","aria-labelledby":S,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:C,onFocus:ge(u.onFocus,()=>x(!0)),onBlur:ge(u.onBlur,()=>x(!1)),onClick:ge(u.onClick,()=>{A.current!=="mouse"&&I()}),onPointerUp:ge(u.onPointerUp,()=>{A.current==="mouse"&&I()}),onPointerDown:ge(u.onPointerDown,k=>{A.current=k.pointerType}),onPointerMove:ge(u.onPointerMove,k=>{A.current=k.pointerType,s?h.onItemLeave?.():A.current==="mouse"&&k.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(u.onPointerLeave,k=>{k.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:ge(u.onKeyDown,k=>{h.searchRef?.current!==""&&k.key===" "||(hQ.includes(k.key)&&I(),k.key===" "&&k.preventDefault())})})})})});kR.displayName=Zd;var Pl="SelectItemText",MR=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:s,...c}=e,u=ci(Pl,n),f=ui(Pl,n),h=OR(Pl,n),p=yQ(Pl,n),[y,g]=_.useState(null),b=Ze(t,I=>g(I),h.onItemTextChange,I=>f.itemTextRefCallback?.(I,h.value,h.disabled)),x=y?.textContent,C=_.useMemo(()=>w.jsx("option",{value:h.value,disabled:h.disabled,children:x},h.value),[h.disabled,h.value,x]),{onNativeOptionAdd:S,onNativeOptionRemove:A}=p;return jt(()=>(S(C),()=>A(C)),[S,A,C]),w.jsxs(w.Fragment,{children:[w.jsx(Ne.span,{id:h.textId,...c,ref:b}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?ba.createPortal(c.children,u.valueNode):null]})});MR.displayName=Pl;var DR="SelectItemIndicator",jR=_.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return OR(DR,n).isSelected?w.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t}):null});jR.displayName=DR;var Ng="SelectScrollUpButton",LR=_.forwardRef((e,t)=>{const n=ui(Ng,e.__scopeSelect),o=ev(Ng,e.__scopeSelect),[s,c]=_.useState(!1),u=Ze(t,o.onScrollButtonChange);return jt(()=>{if(n.viewport&&n.isPositioned){let f=function(){const p=h.scrollTop>0;c(p)};const h=n.viewport;return f(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,n.isPositioned]),s?w.jsx(PR,{...e,ref:u,onAutoScroll:()=>{const{viewport:f,selectedItem:h}=n;f&&h&&(f.scrollTop=f.scrollTop-h.offsetHeight)}}):null});LR.displayName=Ng;var Ig="SelectScrollDownButton",zR=_.forwardRef((e,t)=>{const n=ui(Ig,e.__scopeSelect),o=ev(Ig,e.__scopeSelect),[s,c]=_.useState(!1),u=Ze(t,o.onScrollButtonChange);return jt(()=>{if(n.viewport&&n.isPositioned){let f=function(){const p=h.scrollHeight-h.clientHeight,y=Math.ceil(h.scrollTop)<p;c(y)};const h=n.viewport;return f(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,n.isPositioned]),s?w.jsx(PR,{...e,ref:u,onAutoScroll:()=>{const{viewport:f,selectedItem:h}=n;f&&h&&(f.scrollTop=f.scrollTop+h.offsetHeight)}}):null});zR.displayName=Ig;var PR=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=e,c=ui("SelectScrollButton",n),u=_.useRef(null),f=Df(n),h=_.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return _.useEffect(()=>()=>h(),[h]),jt(()=>{f().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[f]),w.jsx(Ne.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ge(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(o,50))}),onPointerMove:ge(s.onPointerMove,()=>{c.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(o,50))}),onPointerLeave:ge(s.onPointerLeave,()=>{h()})})}),IQ="SelectSeparator",OQ=_.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return w.jsx(Ne.div,{"aria-hidden":!0,...o,ref:t})});OQ.displayName=IQ;var Og="SelectArrow",kQ=_.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,s=jf(n),c=ci(Og,n),u=ui(Og,n);return c.open&&u.position==="popper"?w.jsx(Wy,{...s,...o,ref:t}):null});kQ.displayName=Og;var MQ="SelectBubbleInput",$R=_.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const s=_.useRef(null),c=Ze(o,s),u=$A(t);return _.useEffect(()=>{const f=s.current;if(!f)return;const h=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&y){const g=new Event("change",{bubbles:!0});y.call(f,t),f.dispatchEvent(g)}},[u,t]),w.jsx(Ne.select,{...n,style:{...gR,...n.style},ref:c,defaultValue:t})});$R.displayName=MQ;function FR(e){return e===""||e===void 0}function BR(e){const t=br(e),n=_.useRef(""),o=_.useRef(0),s=_.useCallback(u=>{const f=n.current+u;t(f),(function h(p){n.current=p,window.clearTimeout(o.current),p!==""&&(o.current=window.setTimeout(()=>h(""),1e3))})(f)},[t]),c=_.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,s,c]}function qR(e,t,n){const s=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,c=n?e.indexOf(n):-1;let u=DQ(e,Math.max(c,0));s.length===1&&(u=u.filter(p=>p!==n));const h=u.find(p=>p.textValue.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function DQ(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var jQ=yR,LQ=bR,zQ=xR,PQ=SR,$Q=_R,FQ=ER,BQ=RR,qQ=kR,UQ=MR,VQ=jR,HQ=LR,QQ=zR;function Um({...e}){return w.jsx(jQ,{"data-slot":"select",...e})}function Vm({...e}){return w.jsx(zQ,{"data-slot":"select-value",...e})}function Hm({className:e,size:t="default",children:n,...o}){return w.jsxs(LQ,{"data-slot":"select-trigger","data-size":t,className:De("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[n,w.jsx(PQ,{asChild:!0,children:w.jsx(ts,{className:"size-4 opacity-50"})})]})}function Qm({className:e,children:t,position:n="item-aligned",align:o="center",...s}){return w.jsx($Q,{children:w.jsxs(FQ,{"data-slot":"select-content",className:De("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:o,...s,children:[w.jsx(ZQ,{}),w.jsx(BQ,{className:De("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),w.jsx(GQ,{})]})})}function Ml({className:e,children:t,...n}){return w.jsxs(qQ,{"data-slot":"select-item",className:De("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[w.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:w.jsx(VQ,{children:w.jsx(KT,{className:"size-4"})})}),w.jsx(UQ,{children:t})]})}function ZQ({className:e,...t}){return w.jsx(HQ,{"data-slot":"select-scroll-up-button",className:De("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(XT,{className:"size-4"})})}function GQ({className:e,...t}){return w.jsx(QQ,{"data-slot":"select-scroll-down-button",className:De("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(ts,{className:"size-4"})})}function YQ({isOpen:e,onClose:t,breakingChanges:n,onForceUpdate:o,onCancel:s,isLoading:c}){const u=()=>{s(),t()};return w.jsx($y,{open:e,onOpenChange:f=>!f&&!c&&u(),title:"Breaking Changes Detected",size:"lg",footer:w.jsxs(w.Fragment,{children:[w.jsx(uo,{variant:"outline",onClick:u,disabled:c,children:"Cancel"}),w.jsx(uo,{variant:"danger",onClick:o,loading:c,children:"Force Update"})]}),children:w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"diff-modified flex items-start gap-3 rounded-lg border p-3",children:[w.jsx(y3,{className:"mt-0.5 size-5 shrink-0 text-diff-modified"}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("p",{className:"text-sm font-medium text-diff-modified",children:"These changes may affect existing content"}),w.jsx("p",{className:"text-sm text-diff-modified-foreground",children:"The following changes could cause data loss or validation errors for existing entries. Review carefully before proceeding."})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("p",{className:"text-sm font-medium text-foreground",children:[n.length," breaking change",n.length!==1?"s":""," detected:"]}),w.jsx("ul",{className:"space-y-2",children:n.map((f,h)=>w.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[w.jsx("span",{className:"mt-0.5 size-1.5 shrink-0 rounded-full bg-warning"}),w.jsx("span",{className:"text-muted-foreground",children:f})]},h))})]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:'Click "Force Update" to apply these changes anyway, or "Cancel" to go back and modify your changes.'})]})})}const Zm={text:{label:"Text",icon:w.jsx(f3,{className:"size-4"}),description:"Single line text input"},richText:{label:"Rich Text",icon:w.jsx(h$,{className:"size-4"}),description:"Multi-line formatted text"},number:{label:"Number",icon:w.jsx(WT,{className:"size-4"}),description:"Numeric value"},boolean:{label:"Boolean",icon:w.jsx(o1,{className:"size-4"}),description:"True/false toggle"},date:{label:"Date",icon:w.jsx(ag,{className:"size-4"}),description:"Date picker"},datetime:{label:"Date & Time",icon:w.jsx(ag,{className:"size-4"}),description:"Date and time picker"},reference:{label:"Reference",icon:w.jsx(O$,{className:"size-4"}),description:"Link to another content entry"},media:{label:"Media",icon:w.jsx(t1,{className:"size-4"}),description:"Image, video, or file"},json:{label:"JSON",icon:w.jsx(YT,{className:"size-4"}),description:"Custom JSON data"},select:{label:"Select",icon:w.jsx(ts,{className:"size-4"}),description:"Dropdown selection"},multiSelect:{label:"Multi-Select",icon:w.jsx(j$,{className:"size-4"}),description:"Multiple selections"},tags:{label:"Tags",icon:w.jsx(l3,{className:"size-4"}),description:"Free-form tag list"},category:{label:"Category",icon:w.jsx(y$,{className:"size-4"}),description:"Taxonomy category selection"}};function Y_(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^[0-9]/,"_$&").slice(0,64)}function K_(e){return/^[a-z][a-z0-9_]{0,63}$/.test(e)}function KQ({isOpen:e,onClose:t,onCreated:n,onUpdated:o,contentType:s}){const c=!!s,u=s?.source==="code",f=u,[h,p]=_.useState(""),[y,g]=_.useState(""),[b,x]=_.useState(!1),[C,S]=_.useState(""),[A,I]=_.useState(!1),[k,R]=_.useState([{name:"title",label:"Title",type:"text",required:!0}]),[N,j]=_.useState("title"),[B,P]=_.useState("title"),[M,U]=_.useState(!1),[ee,ae]=_.useState(null),[re,ue]=_.useState(null),[ce,he]=_.useState(!1),[F,X]=_.useState([]),[Z,oe]=_.useState(!1),[be,z]=_.useState(!1),Y=rA(),ie=xS(Y.createContentType),se=xS(Y.updateContentType);_.useEffect(()=>{s&&e&&(p(s.displayName),g(s.name),x(!0),S(s.description||""),I(s.singleton||!1),R(s.fields),j(s.titleField||""),P(s.slugField||""))},[s,e]);const de=_.useCallback(()=>{p(""),g(""),x(!1),S(""),I(!1),R([{name:"title",label:"Title",type:"text",required:!0}]),j("title"),P("title"),U(!1),ae(null),ue(null),he(!1),X([]),oe(!1),z(!1)},[]),ve=_.useCallback(le=>{p(le),b||g(Y_(le))},[b]),J=_.useCallback(le=>{x(!0),g(le.toLowerCase().replace(/[^a-z0-9_]/g,""))},[]),_e=_.useCallback(()=>{const le=`field_${k.length+1}`;R(Oe=>[...Oe,{name:le,label:`Field ${Oe.length+1}`,type:"text",required:!1}]),ue(k.length),he(!0)},[k.length]),Te=_.useCallback(le=>{const Oe=k[le];if(R(qe=>qe.filter((Le,Vt)=>Vt!==le)),N===Oe.name){const qe=k.find((Le,Vt)=>Vt!==le&&Le.type==="text");j(qe?.name||"")}if(B===Oe.name){const qe=k.find((Le,Vt)=>Vt!==le&&Le.type==="text");P(qe?.name||"")}re===le?(ue(null),he(!1)):re!==null&&re>le&&ue(re-1)},[k,re,N,B]),Ce=_.useCallback((le,Oe)=>{R(qe=>qe.map((Le,Vt)=>Vt===le?{...Le,...Oe}:Le))},[]),Ie=_.useCallback((le,Oe)=>{R(qe=>{const Le=[...qe],[Vt]=Le.splice(le,1);return Le.splice(Oe,0,Vt),Le}),ue(Oe)},[]),je=_.useMemo(()=>{const le=[];h.trim()||le.push("Display name is required"),y.trim()?K_(y)||le.push("System Name must start with a letter and contain only lowercase letters, numbers, and underscores"):le.push("System Name is required"),k.length===0&&le.push("At least one field is required");const Oe=k.map(Le=>Le.name),qe=Oe.filter((Le,Vt)=>Oe.indexOf(Le)!==Vt);qe.length>0&&le.push(`Duplicate field names: ${[...new Set(qe)].join(", ")}`);for(const Le of k)Le.name.trim()?/^[a-z][a-z0-9_]{0,63}$/.test(Le.name)||le.push(`Field "${Le.name}" has an invalid name format`):le.push(`Field "${Le.label}" has an empty name`),Le.label.trim()||le.push(`Field with name "${Le.name}" has an empty label`),(Le.type==="select"||Le.type==="multiSelect")&&(!Le.options?.options||Le.options.options.length===0)&&le.push(`${Le.type} field "${Le.label}" requires at least one option`);return le},[h,y,k]),gt=_.useMemo(()=>k.filter(le=>le.type==="text"),[k]),Lt=le=>le.split(`
133
+ `).filter(qe=>qe.trim().startsWith("-")).map(qe=>qe.trim().substring(2)),In=_.useCallback(async(le,Oe=!1)=>{if(le.preventDefault(),je.length>0){ae(je.join(". "));return}U(!0),ae(null);try{if(c&&s){const qe=await se({id:s._id,displayName:h.trim(),description:C.trim()||void 0,fields:k,singleton:A,titleField:N||void 0,slugField:B||void 0,force:Oe});o?.(qe),de(),t()}else{const qe=await ie({name:y,displayName:h.trim(),description:C.trim()||void 0,fields:k,singleton:A,titleField:N||void 0,slugField:B||void 0});n?.(qe),de(),t()}}catch(qe){const Le=qe instanceof Error?qe.message:c?"Failed to update content type":"Failed to create content type";if(c&&!Oe&&Le.includes("breaking change")){const Vt=Lt(Le);X(Vt),oe(!0)}else ae(Le)}finally{U(!1)}},[je,c,s,ie,se,y,h,C,k,A,N,B,n,o,de,t]),Hn=_.useCallback(async()=>{z(!0);try{if(s){const le=await se({id:s._id,displayName:h.trim(),description:C.trim()||void 0,fields:k,singleton:A,titleField:N||void 0,slugField:B||void 0,force:!0});o?.(le),de(),oe(!1),t()}}catch(le){const Oe=le instanceof Error?le.message:"Failed to update content type";ae(Oe),oe(!1)}finally{z(!1)}},[s,se,h,C,k,A,N,B,o,de,t]),tn=_.useCallback(()=>{M||(de(),t())},[M,de,t]);if(!e)return null;const Ct=re!==null?k[re]:null;return w.jsxs(w.Fragment,{children:[w.jsx($y,{open:e,onOpenChange:le=>!le&&tn(),title:u?"View Content Type":c?"Edit Content Type":"Create Content Type",size:"2xl",footer:f?w.jsx(uo,{variant:"outline",onClick:tn,children:"Close"}):w.jsxs(w.Fragment,{children:[w.jsx(uo,{variant:"outline",onClick:tn,disabled:M,children:"Cancel"}),w.jsx(uo,{variant:"primary",onClick:In,disabled:je.length>0,loading:M,"data-testid":c?"update-content-type-submit":"create-content-type-submit",children:c?"Save Changes":"Create Content Type"})]}),children:w.jsxs("form",{onSubmit:In,className:"space-y-6",children:[u&&w.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-violet-200 bg-violet-50 p-3",children:[w.jsx(WP,{className:"mt-0.5 size-5 shrink-0 text-violet-600"}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("p",{className:"text-sm font-medium text-violet-900",children:"Managed by Code"}),w.jsx("p",{className:"text-sm text-violet-700",children:"This content type is defined in your codebase and cannot be edited through the admin interface. To make changes, update the definition in your code."})]})]}),w.jsxs("div",{className:"space-y-4",children:[w.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Basic Information"}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(rr,{htmlFor:"displayName",children:["Display Name ",w.jsx("span",{className:"text-destructive",children:"*"})]}),w.jsx(ji,{id:"displayName",value:h,onChange:le=>ve(le.target.value),placeholder:"e.g., Blog Post",disabled:M||f,autoFocus:!f,"data-testid":"display-name-input"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(rr,{htmlFor:"machineName",children:["System Name ",w.jsx("span",{className:"text-destructive",children:"*"})]}),w.jsx(ji,{id:"machineName",value:y,onChange:le=>J(le.target.value),placeholder:"e.g., blog_post",disabled:M||c||f,className:De(!K_(y)&&y&&"border-destructive"),"data-testid":"machine-name-input"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:c?"System name cannot be changed after creation":"Lowercase letters, numbers, and underscores only. Used in API queries."})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx(rr,{htmlFor:"description",children:"Description"}),w.jsx($H,{id:"description",value:C,onChange:le=>S(le.target.value),placeholder:"Optional description of this content type",disabled:M||f,rows:2})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(L_,{id:"singleton",checked:A,onCheckedChange:le=>I(le),disabled:M||f}),w.jsx(rr,{htmlFor:"singleton",className:"cursor-pointer",children:"Singleton (only one entry allowed)"})]})]}),w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Fields"}),!f&&w.jsxs(uo,{type:"button",variant:"secondary",size:"sm",onClick:_e,disabled:M,"data-testid":"add-field-button",children:[w.jsx(r1,{className:"size-3.5"}),"Add Field"]})]}),w.jsx("div",{className:"space-y-2",children:k.map((le,Oe)=>w.jsxs("div",{className:De("flex items-center gap-2 rounded-lg border p-2 transition-colors",!f&&"cursor-pointer hover:bg-muted/50",re===Oe&&"border-primary bg-primary/5"),onClick:()=>{f||(ue(Oe),he(!0))},"data-testid":`field-item-${Oe}`,children:[!f&&w.jsxs("div",{className:"flex flex-col gap-0.5",children:[Oe>0&&w.jsx("button",{type:"button",onClick:qe=>{qe.stopPropagation(),Ie(Oe,Oe-1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:w.jsx(XT,{className:"size-3"})}),Oe<k.length-1&&w.jsx("button",{type:"button",onClick:qe=>{qe.stopPropagation(),Ie(Oe,Oe+1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:w.jsx(ts,{className:"size-3"})})]}),w.jsx("div",{className:"flex size-8 items-center justify-center rounded bg-muted text-muted-foreground",children:Zm[le.type].icon}),w.jsxs("div",{className:"min-w-0 flex-1",children:[w.jsx("p",{className:"truncate text-sm font-medium",children:le.label}),w.jsxs("p",{className:"text-xs text-muted-foreground",children:[Zm[le.type].label,le.required&&" *"]})]}),!f&&w.jsx("button",{type:"button",onClick:qe=>{qe.stopPropagation(),Te(Oe)},disabled:M||k.length===1,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-50",children:w.jsx(Md,{className:"size-4"})})]},Oe))}),!f&&ce&&Ct&&re!==null&&w.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4","data-testid":"field-editor",children:[w.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[w.jsxs("h5",{className:"font-medium",children:["Edit Field: ",Ct.label]}),w.jsx("button",{type:"button",onClick:()=>{he(!1),ue(null)},className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:w.jsx(Md,{className:"size-4"})})]}),w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs(rr,{htmlFor:"fieldLabel",children:["Label ",w.jsx("span",{className:"text-destructive",children:"*"})]}),w.jsx(ji,{id:"fieldLabel",value:Ct.label,onChange:le=>Ce(re,{label:le.target.value,name:b?Ct.name:Y_(le.target.value)||Ct.name}),disabled:M,"data-testid":"field-label-input"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(rr,{htmlFor:"fieldName",children:["Name ",w.jsx("span",{className:"text-destructive",children:"*"})]}),w.jsx(ji,{id:"fieldName",value:Ct.name,onChange:le=>Ce(re,{name:le.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),disabled:M,"data-testid":"field-name-input"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs(rr,{htmlFor:"fieldType",children:["Type ",w.jsx("span",{className:"text-destructive",children:"*"})]}),w.jsxs(Um,{value:Ct.type,onValueChange:le=>Ce(re,{type:le,options:void 0}),disabled:M,children:[w.jsx(Hm,{"data-testid":"field-type-select",children:w.jsx(Vm,{})}),w.jsx(Qm,{children:Object.entries(Zm).map(([le,Oe])=>w.jsx(Ml,{value:le,children:w.jsxs("div",{className:"flex items-center gap-2",children:[Oe.icon,w.jsx("span",{children:Oe.label}),w.jsxs("span",{className:"text-muted-foreground",children:["- ",Oe.description]})]})},le))})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(L_,{id:"fieldRequired",checked:Ct.required,onCheckedChange:le=>Ce(re,{required:le}),disabled:M}),w.jsx(rr,{htmlFor:"fieldRequired",className:"cursor-pointer",children:"Required"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx(rr,{htmlFor:"fieldDescription",children:"Help Text"}),w.jsx(ji,{id:"fieldDescription",value:Ct.description||"",onChange:le=>Ce(re,{description:le.target.value||void 0}),placeholder:"Help text shown below the field",disabled:M})]}),(Ct.type==="select"||Ct.type==="multiSelect")&&w.jsx(XQ,{options:Ct.options?.options||[],onChange:le=>Ce(re,{options:{...Ct.options,options:le}}),disabled:M})]})]})]}),gt.length>0&&w.jsxs("div",{className:"space-y-4",children:[w.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Display Settings"}),w.jsxs("div",{className:"space-y-2",children:[w.jsx(rr,{htmlFor:"titleField",children:"Title Field"}),w.jsxs(Um,{value:N||"none",onValueChange:le=>j(le==="none"?"":le),disabled:M,children:[w.jsx(Hm,{children:w.jsx(Vm,{placeholder:"None"})}),w.jsxs(Qm,{children:[w.jsx(Ml,{value:"none",children:"None"}),gt.map(le=>w.jsx(Ml,{value:le.name,children:le.label},le.name))]})]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to display as the entry title in lists"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx(rr,{htmlFor:"slugField",children:"Slug Field"}),w.jsxs(Um,{value:B||"none",onValueChange:le=>P(le==="none"?"":le),disabled:M,children:[w.jsx(Hm,{children:w.jsx(Vm,{placeholder:"None (auto-generate)"})}),w.jsxs(Qm,{children:[w.jsx(Ml,{value:"none",children:"None (auto-generate)"}),gt.map(le=>w.jsx(Ml,{value:le.name,children:le.label},le.name))]})]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to use for generating URL-friendly slugs"})]})]}),ee&&w.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",role:"alert","data-testid":"submit-error",children:ee})]})}),w.jsx(YQ,{isOpen:Z,onClose:()=>oe(!1),breakingChanges:F,onForceUpdate:Hn,onCancel:()=>{oe(!1),X([])},isLoading:be})]})}function XQ({options:e,onChange:t,disabled:n}){const o=()=>{t([...e,{value:`option_${e.length+1}`,label:""}])},s=u=>{t(e.filter((f,h)=>h!==u))},c=(u,f)=>{t(e.map((h,p)=>p===u?{...h,...f}:h))};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs(rr,{children:["Options ",w.jsx("span",{className:"text-destructive",children:"*"})]}),w.jsx("div",{className:"space-y-2",children:e.map((u,f)=>w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(ji,{value:u.label,onChange:h=>{const p=h.target.value,y=p.toLowerCase().replace(/[^a-z0-9]/g,"_").replace(/^_+|_+$/g,"");c(f,{label:p,value:y})},placeholder:"Option label",disabled:n,className:"flex-1"}),w.jsx(ji,{value:u.value,onChange:h=>c(f,{value:h.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),placeholder:"value",disabled:n,className:"w-32"}),w.jsx("button",{type:"button",onClick:()=>s(f),disabled:n,className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:w.jsx(Md,{className:"size-4"})})]},f))}),w.jsxs(uo,{type:"button",variant:"secondary",size:"sm",onClick:o,disabled:n,children:[w.jsx(r1,{className:"size-3.5"}),"Add Option"]})]})}function JQ(){const t=Tt().location.pathname,n=Oy(),{navItems:o,branding:s,layout:c}=n,u=rA(),[f,h]=_.useState(!1),p=ZT(u.listContentTypes,{isActive:!0}),y=p?.page??[],g=(A,I)=>I?t===A:t.startsWith(A),b=t==="/content"||t.startsWith("/entries/type/")||t.startsWith("/entries/new/")||t.startsWith("/entries/"),x=A=>A.id==="content"?C(A):w.jsxs($i,{to:A.path,className:De("flex items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",g(A.path,A.exact)?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground"),children:[w.jsx(b_,{name:A.icon,className:"size-5"}),w.jsx("span",{className:"flex-1",children:A.label}),A.badge&&w.jsx("span",{className:"rounded-full bg-sidebar-primary px-2 py-0.5 text-xs text-sidebar-primary-foreground",children:A.badge})]},A.id),C=A=>w.jsxs(G8,{defaultOpen:b,children:[w.jsxs(Y8,{className:De("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",b?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground","group"),children:[w.jsx(b_,{name:A.icon,className:"size-5"}),w.jsx("span",{className:"flex-1 text-left",children:A.label}),w.jsx(ts,{className:"size-4 transition-transform duration-200 group-data-[state=open]:rotate-180"})]}),w.jsx(K8,{children:w.jsxs("div",{className:"ml-5 mt-1 space-y-1 border-l border-sidebar-border pl-3",children:[w.jsx($i,{to:"/content",className:De("flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",t==="/content"?"bg-sidebar-accent/60 text-sidebar-accent-foreground":"text-sidebar-foreground/80 hover:bg-sidebar-accent/30 hover:text-sidebar-accent-foreground"),children:"All Entries"}),y.map(I=>w.jsx($i,{to:"/entries/type/$contentTypeId",params:{contentTypeId:I._id},className:De("flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",t===`/entries/type/${I._id}`?"bg-sidebar-accent/60 text-sidebar-accent-foreground":"text-sidebar-foreground/80 hover:bg-sidebar-accent/30 hover:text-sidebar-accent-foreground"),children:I.displayName},I._id)),y.length===0&&p!==void 0&&w.jsx("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-sidebar-foreground/60 hover:bg-sidebar-accent/30 hover:text-sidebar-accent-foreground",children:"+ Create content type"})]})})]},A.id),S=c.sidebarWidth;return w.jsxs(w.Fragment,{children:[w.jsxs("aside",{className:"fixed inset-y-0 left-0 z-50 flex flex-col border-r border-sidebar-border bg-sidebar",style:{width:S},children:[w.jsx("div",{className:"flex h-14 items-center gap-2 border-b border-sidebar-border px-4",children:w.jsxs($i,{to:"/",className:"flex items-center gap-2 font-semibold text-sidebar-foreground",children:[s.logo?w.jsx("img",{src:s.logo,alt:s.appName,className:"size-8"}):w.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:w.jsx(n1,{className:"size-4"})}),w.jsx("span",{className:"text-base",children:s.appName})]})}),w.jsxs("nav",{className:"flex-1 space-y-6 overflow-y-auto p-4",children:[o.main.length>0&&w.jsxs("div",{className:"space-y-1",children:[w.jsx("span",{className:"px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60",children:"Main"}),w.jsx("div",{className:"space-y-1 pt-2",children:o.main.map(x)})]}),o.config.length>0&&w.jsxs("div",{className:"space-y-1",children:[w.jsx("span",{className:"px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60",children:"Configuration"}),w.jsx("div",{className:"space-y-1 pt-2",children:o.config.map(x)})]})]}),w.jsx("div",{className:"border-t border-sidebar-border p-4",children:w.jsxs("div",{className:"flex items-center justify-between text-xs text-sidebar-foreground/60",children:[w.jsx("span",{children:"Version"}),w.jsx("span",{className:"font-mono",children:"0.1.0"})]})})]}),w.jsx(KQ,{isOpen:f,onClose:()=>h(!1)})]})}const WQ="modulepreload",eZ=function(e){return"/"+e},X_={},$r=function(t,n,o){let s=Promise.resolve();if(n&&n.length>0){let h=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");s=h(n.map(p=>{if(p=eZ(p),p in X_)return;X_[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":WQ,y||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((x,C)=>{b.addEventListener("load",x),b.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return s.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},Fr={NOT_FOUND:"CONTENT_TYPE_NOT_FOUND",DELETED:"CONTENT_TYPE_DELETED",INACTIVE:"CONTENT_TYPE_INACTIVE",NAME_INVALID:"CONTENT_TYPE_NAME_INVALID",NAME_DUPLICATE:"CONTENT_TYPE_NAME_DUPLICATE",FIELD_VALIDATION_FAILED:"CONTENT_TYPE_FIELD_VALIDATION_FAILED",SLUG_FIELD_INVALID:"CONTENT_TYPE_SLUG_FIELD_INVALID",TITLE_FIELD_INVALID:"CONTENT_TYPE_TITLE_FIELD_INVALID",HAS_ENTRIES:"CONTENT_TYPE_HAS_ENTRIES",BREAKING_CHANGE:"CONTENT_TYPE_BREAKING_CHANGE"},Br={NOT_FOUND:"CONTENT_ENTRY_NOT_FOUND",DELETED:"CONTENT_ENTRY_DELETED",NOT_DELETED:"CONTENT_ENTRY_NOT_DELETED",ALREADY_PUBLISHED:"CONTENT_ENTRY_ALREADY_PUBLISHED",NOT_PUBLISHED:"CONTENT_ENTRY_NOT_PUBLISHED",ARCHIVED:"CONTENT_ENTRY_ARCHIVED",VALIDATION_FAILED:"CONTENT_ENTRY_VALIDATION_FAILED",LOCKED:"CONTENT_ENTRY_LOCKED",CREATE_FAILED:"CONTENT_ENTRY_CREATE_FAILED",UPDATE_FAILED:"CONTENT_ENTRY_UPDATE_FAILED"},Oa={NOT_FOUND:"MEDIA_ASSET_NOT_FOUND",DELETED:"MEDIA_ASSET_DELETED",NOT_DELETED:"MEDIA_ASSET_NOT_DELETED",HAS_REFERENCES:"MEDIA_ASSET_HAS_REFERENCES",CREATE_FAILED:"MEDIA_ASSET_CREATE_FAILED",UPDATE_FAILED:"MEDIA_ASSET_UPDATE_FAILED"},UR={NOT_FOUND:"MEDIA_FOLDER_NOT_FOUND",DELETED:"MEDIA_FOLDER_DELETED"},tv={BATCH_SIZE_EXCEEDED:"BATCH_SIZE_EXCEEDED",PERMISSION_DENIED:"PERMISSION_DENIED",INTERNAL_ERROR:"INTERNAL_ERROR"};class Ve extends Error{code;category;context;constructor(t,n,o,s){const c=`[${t}] ${o}`;super(c),this.name="CMSError",this.code=t,this.category=n,this.context=s,Error.captureStackTrace&&Error.captureStackTrace(this,Ve)}toJSON(){return{name:this.name,code:this.code,category:this.category,message:this.message,context:this.context}}}function xc(e){return new Ve(Fr.NOT_FOUND,"NOT_FOUND",`Content type not found. The content type with ID "${e}" does not exist.`,{resourceType:"contentType",resourceId:e})}function Sc(e,t){const n=t?`"${t}" (${e})`:`"${e}"`;return new Ve(Fr.DELETED,"DELETED",`Content type ${n} has been deleted. Restore it first to perform this operation.`,{resourceType:"contentType",resourceId:e,resourceName:t,currentState:"deleted"})}function VR(e,t){const n=t?`"${t}"`:`"${e}"`;return new Ve(Fr.INACTIVE,"INACTIVE",`Content type ${n} is not active. Activate it first to create entries.`,{resourceType:"contentType",resourceId:e,resourceName:t,currentState:"inactive"})}function tZ(e){return new Ve(Fr.NAME_INVALID,"VALIDATION",`Invalid content type name "${e}". Name must start with a lowercase letter and contain only lowercase letters, numbers, and underscores (1-64 characters).`,{details:`Provided name: "${e}"`})}function nZ(e){return new Ve(Fr.NAME_DUPLICATE,"STATE_CONFLICT",`A content type with name "${e}" already exists. Please choose a different name.`,{resourceType:"contentType",resourceName:e})}function HR(e){const t=e.map(n=>`${n.fieldName}: ${n.message}`).join("; ");return new Ve(Fr.FIELD_VALIDATION_FAILED,"VALIDATION",`Invalid field definitions: ${t}`,{fields:e.map(n=>({field:n.fieldName,message:n.message,code:n.code}))})}function QR(e,t){return new Ve(Fr.SLUG_FIELD_INVALID,"VALIDATION",`slugField "${e}" does not reference an existing field. Available fields: ${t.join(", ")}`,{details:`Invalid slugField: "${e}"`})}function ZR(e,t){return new Ve(Fr.TITLE_FIELD_INVALID,"VALIDATION",`titleField "${e}" does not reference an existing field. Available fields: ${t.join(", ")}`,{details:`Invalid titleField: "${e}"`})}function rZ(e,t,n){return new Ve(Fr.HAS_ENTRIES,"REFERENCE_CONFLICT",`Cannot delete content type "${t}": it has ${n} content ${n===1?"entry":"entries"}. Delete all entries first or use force delete.`,{resourceType:"contentType",resourceId:e,resourceName:t,referenceCount:n})}function oZ(e){const t=e.map(n=>`- ${n.fieldName}: ${n.message} (affects ${n.affectedEntriesCount} entries)`).join(`
134
+ `);return new Ve(Fr.BREAKING_CHANGE,"STATE_CONFLICT",`Cannot update content type due to breaking changes:
135
+ ${t}
136
+
137
+ Use allowBreakingChanges: true to force the update.`,{details:t})}function ka(e){return new Ve(Br.NOT_FOUND,"NOT_FOUND",`Content entry not found. The entry with ID "${e}" does not exist.`,{resourceType:"contentEntry",resourceId:e})}function _c(e){return new Ve(Br.DELETED,"DELETED",`Content entry "${e}" has been deleted. Restore it from trash first to perform this operation.`,{resourceType:"contentEntry",resourceId:e,currentState:"deleted"})}function iZ(e){return new Ve(Br.NOT_DELETED,"STATE_CONFLICT",`Content entry "${e}" is not deleted. Only deleted entries can be restored.`,{resourceType:"contentEntry",resourceId:e,currentState:"active",expectedState:"deleted"})}function sZ(e){return new Ve(Br.ALREADY_PUBLISHED,"STATE_CONFLICT",`Content entry "${e}" is already published. Use update instead if you want to modify it.`,{resourceType:"contentEntry",resourceId:e,currentState:"published",expectedState:"draft"})}function aZ(e,t){return new Ve(Br.NOT_PUBLISHED,"STATE_CONFLICT",`Content entry "${e}" is not published. Current status: "${t}". Only published entries can be unpublished.`,{resourceType:"contentEntry",resourceId:e,currentState:t,expectedState:"published"})}function lZ(e){return new Ve(Br.ARCHIVED,"STATE_CONFLICT",`Cannot publish archived content entry "${e}". Restore it from archive first.`,{resourceType:"contentEntry",resourceId:e,currentState:"archived"})}function nv(e){const t=e.map(n=>`${n.field}: ${n.message}`).join("; ");return new Ve(Br.VALIDATION_FAILED,"VALIDATION",`Content validation failed: ${t}`,{fields:e})}function J_(e,t,n,o){const s=new Date(n).toISOString();return new Ve(Br.LOCKED,"LOCK_CONFLICT",`Content entry "${e}" is locked by user "${t}" since ${s}. Only the lock holder can modify this entry.`,{lockedBy:t,lockedAt:n,currentUser:o})}function GR(e){return new Ve(Br.CREATE_FAILED,"INTERNAL",`Failed to create content entry for content type "${e}". The entry was not persisted.`,{resourceType:"contentEntry"})}function rv(e){return new Ve(Br.UPDATE_FAILED,"INTERNAL",`Failed to retrieve content entry "${e}" after update. The update may have failed.`,{resourceType:"contentEntry",resourceId:e})}function ov(e){return new Ve(Oa.NOT_FOUND,"NOT_FOUND",`Media asset not found. The asset with ID "${e}" does not exist.`,{resourceType:"mediaAsset",resourceId:e})}function YR(e){return new Ve(Oa.DELETED,"DELETED",`Media asset "${e}" has been deleted. Restore it first to perform this operation.`,{resourceType:"mediaAsset",resourceId:e,currentState:"deleted"})}function cZ(e){return new Ve(Oa.NOT_DELETED,"STATE_CONFLICT",`Media asset "${e}" is not deleted. Only deleted assets can be restored.`,{resourceType:"mediaAsset",resourceId:e,currentState:"active",expectedState:"deleted"})}function uZ(e,t){const n=t.slice(0,5).map(s=>`${s.type}: ${s.name||s.id}`).join(", "),o=t.length>5?` and ${t.length-5} more`:"";return new Ve(Oa.HAS_REFERENCES,"REFERENCE_CONFLICT",`Cannot delete media asset "${e}": it is referenced by ${t.length} ${t.length===1?"resource":"resources"} (${n}${o}). Remove references first or use force delete.`,{referencingResources:t,referenceCount:t.length})}function dZ(){return new Ve(Oa.CREATE_FAILED,"INTERNAL","Failed to create media asset. The asset was not persisted.",{resourceType:"mediaAsset"})}function fZ(e){return new Ve(Oa.UPDATE_FAILED,"INTERNAL",`Failed to retrieve media asset "${e}" after update. The update may have failed.`,{resourceType:"mediaAsset",resourceId:e})}function iv(e){return new Ve(UR.NOT_FOUND,"NOT_FOUND",`Media folder not found. The folder with ID "${e}" does not exist.`,{resourceType:"mediaFolder",resourceId:e})}function sv(e){return new Ve(UR.DELETED,"DELETED",`Media folder "${e}" has been deleted. Restore it first to perform this operation.`,{resourceType:"mediaFolder",resourceId:e,currentState:"deleted"})}function hZ(e,t){return new Ve(tv.BATCH_SIZE_EXCEEDED,"LIMIT_EXCEEDED",`Batch size exceeds limit. Maximum ${e} items per batch, but ${t} were requested.`,{details:`Max: ${e}, requested: ${t}`})}function Gm(e,t){return new Ve(tv.PERMISSION_DENIED,"PERMISSION",`Permission denied: you do not have access to ${e} ${t}.`,{details:`Action: ${e}, resource: ${t}`})}function av(e){return new Ve(tv.INTERNAL_ERROR,"INTERNAL",`Internal error: ${e}`,{details:e})}function mn(e,t,n,o){if(!e)return;const{userId:s,role:c,resourceOwnerId:u}=e;if(!c)throw Gm(n,t);if(vg(c,{resource:t,action:n,scope:"all"},o?.customRoles))return;if(vg(c,{resource:t,action:n,scope:"own"},o?.customRoles)){if(u&&u===s||n==="create")return;throw Gm(`${n} other users'`,t)}throw Gm(n,t)}function di(e,t){if(e)return{...e,resourceOwnerId:t}}function KR(e){return/^[a-z][a-zA-Z0-9_]{0,63}$/.test(e)}function pZ(e,t,n){const o=[],s=new Map(e.map(u=>[u.name,u])),c=new Map(t.map(u=>[u.name,u]));for(const u of e)if(!c.has(u.name)){const f=n.filter(h=>{const p=h.data[u.name];return p!=null&&p!==""}).length;f>0&&o.push({type:"FIELD_REMOVED",fieldName:u.name,message:`Removing field "${u.name}" will delete data from ${f} existing entries`,affectedEntriesCount:f})}for(const u of t){const f=s.get(u.name);if(f){if(f.type!==u.type){const h=n.filter(p=>{const y=p.data[u.name];return y!=null}).length;h>0&&o.push({type:"FIELD_TYPE_CHANGED",fieldName:u.name,message:`Changing field "${u.name}" type from "${f.type}" to "${u.type}" may invalidate ${h} existing entries`,affectedEntriesCount:h})}if(!f.required&&u.required){const h=n.filter(p=>{const y=p.data[u.name];return y==null||y===""}).length;h>0&&o.push({type:"FIELD_MADE_REQUIRED",fieldName:u.name,message:`Making field "${u.name}" required will invalidate ${h} entries with missing values`,affectedEntriesCount:h})}if((f.type==="select"||f.type==="multiSelect")&&f.options?.options&&u.options?.options){const h=new Set(f.options.options.map(g=>g.value)),p=new Set(u.options.options.map(g=>g.value)),y=[...h].filter(g=>!p.has(g));if(y.length>0){const g=n.filter(b=>{const x=b.data[u.name];return f.type==="select"?y.includes(x):x?.some(S=>y.includes(S))}).length;g>0&&o.push({type:"SELECT_OPTIONS_REMOVED",fieldName:u.name,message:`Removing options [${y.join(", ")}] from "${u.name}" will invalidate ${g} entries using those values`,affectedEntriesCount:g})}}if(f.type==="reference"&&u.type==="reference"&&f.options?.allowedContentTypes&&u.options?.allowedContentTypes){const h=new Set(f.options.allowedContentTypes),p=new Set(u.options.allowedContentTypes),y=[...h].filter(g=>!p.has(g));y.length>0&&o.push({type:"REFERENCE_TYPES_RESTRICTED",fieldName:u.name,message:`Restricting allowed content types for "${u.name}" by removing [${y.join(", ")}] may invalidate existing references`,affectedEntriesCount:n.length})}if(f.type==="text"&&u.type==="text"&&f.options&&u.options){const h=[];if(u.options.minLength!==void 0&&(f.options.minLength===void 0||u.options.minLength>f.options.minLength)&&h.push(`minLength increased to ${u.options.minLength}`),u.options.maxLength!==void 0&&f.options.maxLength!==void 0&&u.options.maxLength<f.options.maxLength&&h.push(`maxLength decreased to ${u.options.maxLength}`),h.length>0){const p=n.filter(y=>{const g=y.data[u.name];return typeof g!="string"?!1:u.options?.minLength!==void 0&&g.length<u.options.minLength||u.options?.maxLength!==void 0&&g.length>u.options.maxLength}).length;p>0&&o.push({type:"VALIDATION_TIGHTENED",fieldName:u.name,message:`Tightening validation for "${u.name}" (${h.join(", ")}) will invalidate ${p} entries`,affectedEntriesCount:p})}}}}return o}function XR(e){const t=[],n=new Set;for(const o of e){if(!o.name||typeof o.name!="string"){t.push({fieldName:o.name||"(unnamed)",message:"Field must have a name property",code:"MISSING_REQUIRED_PROPERTY"});continue}(!o.label||typeof o.label!="string")&&t.push({fieldName:o.name,message:`Field "${o.name}" must have a label property`,code:"MISSING_REQUIRED_PROPERTY"}),(!o.type||typeof o.type!="string")&&t.push({fieldName:o.name,message:`Field "${o.name}" must have a type property`,code:"MISSING_REQUIRED_PROPERTY"}),typeof o.required!="boolean"&&t.push({fieldName:o.name,message:`Field "${o.name}" must have a required property (boolean)`,code:"MISSING_REQUIRED_PROPERTY"}),o.name&&!KR(o.name)&&t.push({fieldName:o.name,message:`Field name "${o.name}" must start with a lowercase letter and contain only letters, numbers, and underscores (max 64 chars)`,code:"INVALID_FIELD_NAME"}),n.has(o.name)&&t.push({fieldName:o.name,message:`Duplicate field name: "${o.name}"`,code:"DUPLICATE_FIELD_NAME"}),n.add(o.name),o.type&&!DS.includes(o.type)&&t.push({fieldName:o.name,message:`Invalid field type "${o.type}". Must be one of: ${DS.join(", ")}`,code:"INVALID_FIELD_TYPE"}),(o.type==="select"||o.type==="multiSelect")&&(!o.options?.options||o.options.options.length===0)&&t.push({fieldName:o.name,message:`${o.type} field "${o.name}" must have options defined`,code:"INVALID_SELECT_OPTIONS"})}return t}st({args:{...W4.fields,_auth:a.optional(pn)},returns:Ea,handler:async(e,t)=>{const{name:n,displayName:o,description:s,fields:c,icon:u,singleton:f,slugField:h,titleField:p,sortOrder:y,createdBy:g,_auth:b}=t;if(mn(b,"contentTypes","create"),!KR(n))throw tZ(n);if(await e.db.query("contentTypes").withIndex("by_name",k=>k.eq("name",n)).first())throw nZ(n);const C=XR(c);if(C.length>0)throw HR(C);const S=c.map(k=>k.name);if(h&&!c.some(R=>R.name===h))throw QR(h,S);if(p&&!c.some(R=>R.name===p))throw ZR(p,S);const A=await e.db.insert("contentTypes",{name:n,displayName:o,description:s,fields:c,icon:u,singleton:f,slugField:h,titleField:p,sortOrder:y,isActive:!0,createdBy:g}),I=await e.db.get(A);if(!I)throw av("Failed to retrieve created content type");return await en(e,{eventType:Sy("created"),resourceType:"contentType",resourceId:A,action:"created",payload:{name:n,displayName:o,fieldCount:c.length,isActive:!0},userId:g}),I}});const mZ=a.object({type:a.union(a.literal("FIELD_REMOVED"),a.literal("FIELD_TYPE_CHANGED"),a.literal("FIELD_MADE_REQUIRED"),a.literal("SELECT_OPTIONS_REMOVED"),a.literal("REFERENCE_TYPES_RESTRICTED"),a.literal("VALIDATION_TIGHTENED")),fieldName:a.string(),message:a.string(),affectedEntriesCount:a.number()}),gZ=a.object({...Ea.fields,breakingChanges:a.optional(a.array(mZ))});st({args:{...eF.fields,force:a.optional(a.boolean()),_auth:a.optional(pn)},returns:gZ,handler:async(e,t)=>{const{id:n,displayName:o,description:s,fields:c,icon:u,singleton:f,slugField:h,titleField:p,sortOrder:y,isActive:g,updatedBy:b,force:x=!1,_auth:C}=t;mn(C,"contentTypes","update");const S=await e.db.get(n);if(!S)throw xc(n);if($e(S))throw Sc(n,S.name);const A={updatedBy:b};o!==void 0&&(A.displayName=o),s!==void 0&&(A.description=s),u!==void 0&&(A.icon=u),f!==void 0&&(A.singleton=f),y!==void 0&&(A.sortOrder=y),g!==void 0&&(A.isActive=g);let I=[];if(c!==void 0){const M=XR(c);if(M.length>0)throw HR(M);const U=await e.db.query("contentEntries").withIndex("by_content_type",ee=>ee.eq("contentTypeName",S.name)).filter(ee=>ee.eq(ee.field("deletedAt"),void 0)).collect();if(U.length>0&&(I=pZ(S.fields,c,U.map(ee=>({data:ee.data}))),I.length>0&&!x))throw oZ(I);A.fields=c}const k=c??S.fields,R=h!==void 0?h:S.slugField,N=p!==void 0?p:S.titleField,j=k.map(M=>M.name);if(R){if(!k.some(U=>U.name===R))throw QR(R,j);h!==void 0&&(A.slugField=h)}else h!==void 0&&(A.slugField=h);if(N){if(!k.some(U=>U.name===N))throw ZR(N,j);p!==void 0&&(A.titleField=p)}else p!==void 0&&(A.titleField=p);await e.db.patch(n,A);const B=await e.db.get(n);if(!B)throw av("Failed to retrieve updated content type");const P=Object.keys(A).filter(M=>M!=="updatedBy");return await en(e,{eventType:Sy("updated"),resourceType:"contentType",resourceId:n,action:"updated",payload:{name:B.name,displayName:B.displayName,fieldCount:B.fields.length,isActive:B.isActive,changedFields:P},userId:b}),{...B,breakingChanges:I.length>0?I:void 0}}});const JR=a.object({success:a.boolean(),deletedId:a.id("contentTypes"),deletedEntriesCount:a.number(),deletedVersionsCount:a.number(),wasHardDelete:a.boolean()});st({args:{...tF.fields,_auth:a.optional(pn)},returns:JR,handler:async(e,t)=>{const{id:n,cascade:o=!1,hardDelete:s=!1,deletedBy:c,_auth:u}=t;mn(u,"contentTypes","delete");const f=await e.db.get(n);if(!f)throw xc(n);if($e(f))throw Sc(n,f.name);const h=await e.db.query("contentEntries").withIndex("by_content_type",x=>x.eq("contentTypeName",f.name)).filter(x=>x.eq(x.field("deletedAt"),void 0)).collect(),p=h.length;if(p>0&&!o)throw rZ(n,f.name,p);let y=0,g=0;const b=Date.now();if(o&&p>0)if(s)for(const x of h){const C=await e.db.query("contentVersions").withIndex("by_entry",S=>S.eq("entryId",x._id)).collect();for(const S of C)await e.db.delete(S._id),g++;await e.db.delete(x._id),y++}else for(const x of h)await e.db.patch(x._id,{deletedAt:b,updatedBy:c}),y++;return s?await e.db.delete(n):await e.db.patch(n,{deletedAt:b,isActive:!1,updatedBy:c}),await en(e,{eventType:Sy("deleted"),resourceType:"contentType",resourceId:n,action:"deleted",payload:{name:f.name,displayName:f.displayName,fieldCount:f.fields.length,isActive:!1},userId:c,metadata:{hardDelete:s,cascade:o,deletedEntriesCount:y,deletedVersionsCount:g}}),{success:!0,deletedId:n,deletedEntriesCount:y,deletedVersionsCount:g,wasHardDelete:s}}});st({args:{...nF.fields,_auth:a.optional(pn)},returns:Ut,handler:async(e,t)=>{const{contentTypeName:n,data:o,locale:s,primaryEntryId:c,createdBy:u,_auth:f}=t;mn(f,"contentEntries","create");const h=await e.db.query("contentTypes").withIndex("by_name",N=>N.eq("name",n)).first();if(!h)throw xc(n);if(!h.isActive)throw VR(n,h.displayName);if($e(h))throw Sc(n,h.displayName);const p=h.slugField??"title",y=o,g={name:h.name,displayName:h.displayName,description:h.description,fields:h.fields,titleField:h.titleField,slugField:h.slugField,singleton:h.singleton},b=fc(y,g);if(!b.valid)throw nv(b.errors);let x=t.slug;if(!x){const N=y[p];typeof N=="string"&&N.trim()?x=hy(N):x="untitled"}const S=await ic(x,async N=>await e.db.query("contentEntries").withIndex("by_content_type_and_slug",j=>j.eq("contentTypeName",n).eq("slug",N)).filter(j=>j.eq(j.field("deletedAt"),void 0)).first()),A=t.status??"draft";let I="";for(const N of h.fields)if(N.searchable&&y[N.name]){const j=y[N.name];typeof j=="string"&&(I+=` ${j}`)}I=I.trim()||void 0;const k=await e.db.insert("contentEntries",{contentTypeName:n,slug:S,status:A,data:o,locale:s,primaryEntryId:c,version:1,createdBy:u,updatedBy:u,searchText:I}),R=await e.db.get(k);if(!R)throw GR(n);return await en(e,{eventType:Jo("created"),resourceType:"contentEntry",resourceId:k,action:"created",payload:{slug:S,contentTypeName:n,status:A,version:1,locale:s},userId:u}),R}});st({args:{...rF.fields,_auth:a.optional(pn)},returns:Ut,handler:async(e,t)=>{const{id:n,slug:o,data:s,status:c,scheduledPublishAt:u,updatedBy:f,regenerateSlug:h,_auth:p}=t,y=await e.db.get(n);if(!y)throw ka(n);if($e(y))throw _c(n);if(mn(di(p,y.createdBy),"contentEntries","update"),!rq(y,f).isAllowed)throw y.lockedBy&&y.lockExpiresAt?J_(n,y.lockedBy,y.lockExpiresAt,f):J_(n,"unknown",Date.now(),f);const b=await e.db.query("contentTypes").withIndex("by_name",R=>R.eq("name",y.contentTypeName)).first();if(!b)throw xc(y.contentTypeName);if($e(b))throw Sc(y.contentTypeName,b.displayName);const x={updatedBy:f};let C;if(s!==void 0?C={...y.data,...s}:C=y.data,s!==void 0){const R={name:b.name,displayName:b.displayName,description:b.description,fields:b.fields,titleField:b.titleField,slugField:b.slugField,singleton:b.singleton},N=fc(C,R);if(!N.valid)throw nv(N.errors);x.data=C}const S=async R=>{const N=await e.db.query("contentEntries").withIndex("by_content_type_and_slug",j=>j.eq("contentTypeName",y.contentTypeName).eq("slug",R)).filter(j=>j.eq(j.field("deletedAt"),void 0)).first();return N&&N._id!==n?N:null};if(o!==void 0&&o!==y.slug){const R=await ic(o,S,{excludeEntryId:n});x.slug=R}else if(h&&s!==void 0){const R=b.slugField??"title",N=C[R];if(typeof N=="string"&&N.trim()){const j=hy(N);if(j!==y.slug){const B=await ic(j,S,{excludeEntryId:n});x.slug=B}}}if(s!==void 0){let R="";for(const N of b.fields)if(N.searchable&&C[N.name]){const j=C[N.name];typeof j=="string"&&(R+=` ${j}`)}x.searchText=R.trim()||void 0}c!==void 0&&(x.status=c),u!==void 0&&(x.scheduledPublishAt=u);const A=s!==void 0&&JSON.stringify(y.data)!==JSON.stringify(C),I=x.slug!==void 0;(A||I)&&await e.db.insert("contentVersions",{entryId:n,versionNumber:y.version,data:y.data,slug:y.slug,status:y.status,changeDescription:"Draft saved",createdBy:f,wasPublished:!1}),x.version=y.version+1,await e.db.patch(n,x);const k=await e.db.get(n);if(!k)throw rv(n);return await en(e,{eventType:Jo("updated"),resourceType:"contentEntry",resourceId:n,action:"updated",payload:{slug:k.slug,contentTypeName:y.contentTypeName,status:k.status,version:k.version,locale:k.locale},userId:f}),k}});st({args:{...oF.fields,_auth:a.optional(pn)},returns:Ut,handler:async(e,t)=>{const{id:n,changeDescription:o,updatedBy:s,_auth:c}=t,u=await e.db.get(n);if(!u)throw ka(n);if($e(u))throw _c(n);if(mn(di(c,u.createdBy),"contentEntries","publish"),u.status==="published")throw sZ(n);if(u.status==="archived")throw lZ(n);const f=Date.now();await e.db.insert("contentVersions",{entryId:n,versionNumber:u.version,data:u.data,slug:u.slug,status:u.status,changeDescription:o,createdBy:s,wasPublished:!0,publishedAt:f});const h={status:"published",lastPublishedAt:f,version:u.version+1,updatedBy:s,scheduledPublishAt:void 0};u.firstPublishedAt===void 0&&(h.firstPublishedAt=f),await e.db.patch(n,h);const p=await e.db.get(n);if(!p)throw rv(n);return await en(e,{eventType:Jo("published"),resourceType:"contentEntry",resourceId:n,action:"published",payload:{slug:p.slug,contentTypeName:u.contentTypeName,status:"published",version:p.version,locale:p.locale,changeDescription:o},userId:s}),p}});st({args:{id:a.id("contentEntries"),updatedBy:a.optional(a.string()),_auth:a.optional(pn)},returns:Ut,handler:async(e,t)=>{const{id:n,updatedBy:o,_auth:s}=t,c=await e.db.get(n);if(!c)throw ka(n);if($e(c))throw _c(n);if(mn(di(s,c.createdBy),"contentEntries","unpublish"),c.status!=="published")throw aZ(n,c.status);await e.db.patch(n,{status:"draft",version:c.version+1,updatedBy:o});const u=await e.db.get(n);if(!u)throw rv(n);return await en(e,{eventType:Jo("unpublished"),resourceType:"contentEntry",resourceId:n,action:"unpublished",payload:{slug:u.slug,contentTypeName:c.contentTypeName,status:"draft",version:u.version,locale:u.locale},userId:o}),u}});const WR=a.object({...Ut.fields,deletedVersionsCount:a.optional(a.number())});st({args:{...iF.fields,_auth:a.optional(pn)},returns:WR,handler:async(e,t)=>{const{id:n,deletedBy:o,hardDelete:s=!1,_auth:c}=t,u=await e.db.get(n);if(!u)throw ka(n);if(mn(di(c,u.createdBy),"contentEntries","delete"),!s&&$e(u))throw _c(n);const f=await e.db.query("contentVersions").withIndex("by_entry",p=>p.eq("entryId",n)).collect(),h=f.length;if(s){for(const p of f)await e.db.delete(p._id);return await e.db.delete(n),await en(e,{eventType:Jo("deleted"),resourceType:"contentEntry",resourceId:n,action:"deleted",payload:{slug:u.slug,contentTypeName:u.contentTypeName,status:u.status,version:u.version,locale:u.locale},userId:o,metadata:{hardDelete:!0}}),{...u,deletedAt:Date.now(),updatedBy:o,deletedVersionsCount:h}}else{const p=Date.now();return await e.db.patch(n,{deletedAt:p,updatedBy:o}),await en(e,{eventType:Jo("deleted"),resourceType:"contentEntry",resourceId:n,action:"deleted",payload:{slug:u.slug,contentTypeName:u.contentTypeName,status:u.status,version:u.version,locale:u.locale},userId:o,metadata:{hardDelete:!1}}),{...u,deletedAt:p,updatedBy:o??u.updatedBy,deletedVersionsCount:h}}}});st({args:{id:a.id("contentEntries"),restoredBy:a.optional(a.string()),_auth:a.optional(pn)},returns:Ut,handler:async(e,t)=>{const{id:n,restoredBy:o,_auth:s}=t,c=await e.db.get(n);if(!c)throw ka(n);if(mn(di(s,c.createdBy),"contentEntries","restore"),!$e(c))throw iZ(n);return await e.db.patch(n,{deletedAt:void 0,updatedBy:o}),await en(e,{eventType:Jo("restored"),resourceType:"contentEntry",resourceId:n,action:"restored",payload:{slug:c.slug,contentTypeName:c.contentTypeName,status:c.status,version:c.version,locale:c.locale},userId:o}),{...c,deletedAt:void 0,updatedBy:o??c.updatedBy}}});st({args:{...sF.fields,_auth:a.optional(pn)},returns:Ut,handler:async(e,t)=>{const{sourceEntryId:n,slug:o,copyMediaReferences:s=!0,locale:c,createdBy:u,_auth:f}=t;mn(f,"contentEntries","create");const h=await e.db.get(n);if(!h)throw ka(n);if($e(h))throw _c(n);const p=await e.db.query("contentTypes").withIndex("by_name",R=>R.eq("name",h.contentTypeName)).first();if(!p)throw xc(h.contentTypeName);if(!p.isActive)throw VR(h.contentTypeName,p.displayName);if($e(p))throw Sc(h.contentTypeName,p.displayName);const y=JSON.parse(JSON.stringify(h.data));if(!s){const R=p.fields;for(const N of R)if(N.type==="media"&&y[N.name]!==void 0){const j=N.options?.multiple;y[N.name]=j?[]:null}}const g={name:p.name,displayName:p.displayName,description:p.description,fields:p.fields,titleField:p.titleField,slugField:p.slugField,singleton:p.singleton},b=fc(y,g);if(!b.valid)throw nv(b.errors);let x=o;x||(x=h.slug);const S=await ic(x,async R=>await e.db.query("contentEntries").withIndex("by_content_type_and_slug",N=>N.eq("contentTypeName",h.contentTypeName).eq("slug",R)).filter(N=>N.eq(N.field("deletedAt"),void 0)).first());let A="";for(const R of p.fields)if(R.searchable&&y[R.name]){const N=y[R.name];typeof N=="string"&&(A+=` ${N}`)}A=A.trim()||void 0;const I=await e.db.insert("contentEntries",{contentTypeName:h.contentTypeName,slug:S,status:"draft",data:y,locale:c??h.locale,version:1,firstPublishedAt:void 0,lastPublishedAt:void 0,scheduledPublishAt:void 0,lockedBy:void 0,lockExpiresAt:void 0,createdBy:u,updatedBy:u,searchText:A}),k=await e.db.get(I);if(!k)throw GR(h.contentTypeName);return await en(e,{eventType:Jo("duplicated"),resourceType:"contentEntry",resourceId:I,action:"duplicated",payload:{slug:S,contentTypeName:h.contentTypeName,status:"draft",version:1,locale:c??h.locale,sourceEntryId:n},userId:u}),k}});const eN=a.object({...hf.fields,_id:a.id("mediaItems"),_creationTime:a.number(),deletedAt:a.optional(a.number()),storageFileDeleted:a.optional(a.boolean())});st({args:{...cF.fields,_auth:a.optional(pn)},returns:dy,handler:async(e,t)=>{const{storageId:n,name:o,mimeType:s,size:c,title:u,description:f,altText:h,parentId:p,width:y,height:g,duration:b,metadata:x,tags:C,createdBy:S,_auth:A}=t;if(mn(A,"mediaItems","create"),p!==void 0){const P=await e.db.get(p);if(!P)throw iv(p);if($e(P))throw sv(p)}const I=[];I.push(o),u&&I.push(u),f&&I.push(f),C&&C.length>0&&I.push(...C);const k=I.join(" ").trim()||void 0;let R="/";if(p){const P=await e.db.get(p);P&&P.kind==="folder"?R=P.path+o:R="/"+o}else R="/"+o;const N=await e.db.insert("mediaItems",{kind:"asset",storageId:n,name:o,mimeType:s,size:c,title:u,description:f,altText:h,parentId:p,path:R,width:y,height:g,duration:b,metadata:x,tags:C,createdBy:S,searchText:k}),j=await e.db.get(N);if(!j)throw dZ();let B;if(p){const P=await e.db.get(p);P&&P.kind==="folder"&&(B=P.path)}return await en(e,{eventType:ma("created"),resourceType:"mediaAsset",resourceId:N,action:"created",payload:{name:o,mimeType:s,type:pa(s),size:c??0,parentId:p,path:B},userId:S}),j}});st({args:{...uF.fields,_auth:a.optional(pn)},returns:dy,handler:async(e,t)=>{const{id:n,name:o,title:s,description:c,altText:u,parentId:f,tags:h,_auth:p}=t,y=await e.db.get(n);if(!y||y.kind!=="asset")throw ov(n);const g=y;if($e(g))throw YR(n);if(mn(di(p,g.createdBy),"mediaItems","update"),f!==void 0&&f!==g.parentId){const S=await e.db.get(f);if(!S||S.kind!=="folder")throw iv(f);if($e(S))throw sv(f)}const b={};if(o!==void 0&&(b.name=o),s!==void 0&&(b.title=s),c!==void 0&&(b.description=c),u!==void 0&&(b.altText=u),f!==void 0&&(b.parentId=f),h!==void 0&&(b.tags=h),o!==void 0||s!==void 0||c!==void 0||h!==void 0){const S=[],A=o??g.name,I=s??g.title,k=c??g.description,R=h??g.tags;S.push(A),I&&S.push(I),k&&S.push(k),R&&R.length>0&&S.push(...R),b.searchText=S.join(" ").trim()||void 0}await e.db.patch(n,b);const x=await e.db.get(n);if(!x||x.kind!=="asset")throw fZ(n);let C;if(x.parentId){const S=await e.db.get(x.parentId);S&&S.kind==="folder"&&(C=S.path)}return await en(e,{eventType:ma("updated"),resourceType:"mediaAsset",resourceId:n,action:"updated",payload:{name:x.name,mimeType:x.mimeType,type:pa(x.mimeType),size:x.size??0,parentId:x.parentId,path:C},userId:g.createdBy}),x}});Ke({args:{mediaAssetId:a.id("mediaItems"),limit:a.optional(a.number())},returns:a.array(TF),handler:async(e,t)=>{const{mediaAssetId:n,limit:o=100}=t,s=n,c=[],u=await e.db.query("contentTypes").collect(),f=new Map(u.map(p=>[p.name,p])),h=await e.db.query("contentEntries").filter(p=>p.eq(p.field("deletedAt"),void 0)).take(1e4);for(const p of h){if(c.length>=o)break;const y=f.get(p.contentTypeName);if(!y)continue;const g=y.fields.filter(x=>x.type==="media"),b=[];for(const x of g){const C=p.data?.[x.name];if(!C)continue;(x.options?.multiple??!1)&&Array.isArray(C)?C.includes(s)&&b.push(x.name):C===s&&b.push(x.name)}b.length>0&&c.push({entryId:p._id,slug:p.slug,contentTypeName:y.name,fields:b})}return c}});async function yZ(e,t){const n=t.toString(),o=[],s=await e.db.query("contentTypes").collect(),c=new Map(s.map(f=>[f.name,f])),u=await e.db.query("contentEntries").filter(f=>f.eq(f.field("deletedAt"),void 0)).take(1e4);for(const f of u){if(o.length>=100)break;const h=c.get(f.contentTypeName);if(!h)continue;const p=h.fields.filter(g=>g.type==="media"),y=[];for(const g of p){const b=f.data?.[g.name];if(!b)continue;(g.options?.multiple??!1)&&Array.isArray(b)?b.includes(n)&&y.push(g.name):b===n&&y.push(g.name)}y.length>0&&o.push({entryId:f._id,slug:f.slug,contentTypeName:h.name,fields:y})}return o}st({args:{...dF.fields,_auth:a.optional(pn)},returns:eN,handler:async(e,t)=>{const{id:n,deletedBy:o,hardDelete:s=!1,forceDelete:c=!1,_auth:u}=t,f=await e.db.get(n);if(!f||f.kind!=="asset")throw ov(n);const h=f;if(mn(di(u,h.createdBy),"mediaItems","delete"),!s&&$e(h))throw YR(n);if(!c){const y=await yZ(e,n);if(y.length>0)throw uZ(n,y.map(g=>({type:"contentEntry",id:g.entryId,name:`${g.contentTypeName}/${g.slug}`})))}let p;if(h.parentId){const y=await e.db.get(h.parentId);y&&y.kind==="folder"&&(p=y.path)}if(s){let y=!1;try{await e.storage.delete(h.storageId),y=!0}catch(g){console.warn(`Could not delete storage file for asset ${n}:`,g instanceof Error?g.message:g)}return await e.db.delete(n),await en(e,{eventType:ma("deleted"),resourceType:"mediaAsset",resourceId:n,action:"deleted",payload:{name:h.name,mimeType:h.mimeType,type:pa(h.mimeType),size:h.size??0,parentId:h.parentId,path:p},userId:o,metadata:{hardDelete:!0,storageFileDeleted:y}}),{...h,deletedAt:Date.now(),storageFileDeleted:y}}else{const y=Date.now();return await e.db.patch(n,{deletedAt:y}),await en(e,{eventType:ma("deleted"),resourceType:"mediaAsset",resourceId:n,action:"deleted",payload:{name:h.name,mimeType:h.mimeType,type:pa(h.mimeType),size:h.size??0,parentId:h.parentId,path:p},userId:o,metadata:{hardDelete:!1}}),{...h,deletedAt:y,storageFileDeleted:void 0}}}});st({args:{...fF.fields,_auth:a.optional(pn)},returns:dy,handler:async(e,t)=>{const{id:n,restoredBy:o,_auth:s}=t,c=await e.db.get(n);if(!c||c.kind!=="asset")throw ov(n);const u=c;if(mn(di(s,u.createdBy),"mediaItems","update"),u.deletedAt===void 0)throw cZ(n);await e.db.patch(n,{deletedAt:void 0});const f=await e.db.get(n);if(!f||f.kind!=="asset")throw av("Failed to restore media asset");let h;if(f.parentId){const p=await e.db.get(f.parentId);p&&p.kind==="folder"&&(h=p.path)}return await en(e,{eventType:ma("restored"),resourceType:"mediaAsset",resourceId:n,action:"restored",payload:{name:f.name,mimeType:f.mimeType,type:pa(f.mimeType),size:f.size??0,parentId:f.parentId,path:h},userId:o}),f}});st({args:{...hF.fields,_auth:a.optional(pn)},returns:mF,handler:async(e,t)=>{const{assetIds:n,targetFolderId:o,movedBy:s,_auth:c}=t;if(mn(c,"mediaItems","update"),n.length>jS)throw hZ(jS,n.length);if(n.length===0)return{total:0,succeeded:0,failed:0,targetFolderId:o,targetFolderPath:void 0,results:[]};let u;if(o!==void 0){const p=await e.db.get(o);if(!p)throw iv(o);if($e(p))throw sv(o);u=p.path}const f=[];for(const p of n)try{const y=await e.db.get(p);if(!y||y.kind!=="asset"){f.push({id:p,success:!1,error:"Asset not found"});continue}if($e(y)){f.push({id:p,success:!1,error:"Asset has been deleted"});continue}if(y.parentId===o){f.push({id:p,success:!0,previousFolderId:y.parentId});continue}const g=y.parentId;await e.db.patch(p,{parentId:o}),await en(e,{eventType:ma("updated"),resourceType:"mediaAsset",resourceId:p,action:"updated",payload:{name:y.name,mimeType:y.mimeType,type:pa(y.mimeType),size:y.size??0,parentId:o,path:u},userId:s,metadata:{moveOperation:!0,previousFolderId:g}}),f.push({id:p,success:!0,previousFolderId:g})}catch(y){f.push({id:p,success:!1,error:y instanceof Error?y.message:"Unknown error"})}const h=f.filter(p=>p.success).length;return{total:n.length,succeeded:h,failed:n.length-h,targetFolderId:o,targetFolderPath:u,results:f}}});a.object({numItems:a.number(),cursor:a.union(a.string(),a.null())});const vZ=a.object({...Rn,type:a.literal("tags"),options:a.optional(a.object({taxonomyId:a.optional(a.string()),allowCreate:a.optional(a.boolean()),maxTags:a.optional(a.number()),minTags:a.optional(a.number())}))}),Lf=a.union(M1,D1,j1,L1,z1,P1,q1,vZ,$1,F1,U1,V1,B1);a.object({...hn(Ea.fields,["_id","fields"]),_id:a.string(),fields:a.array(Lf)});a.object({...hn(Ea.fields,["_id","fields"]),_id:a.string(),fields:a.array(Lf),entryCount:a.optional(a.number())});const tN=a.union(a.literal("code"),a.literal("database"));a.object({...hn(Ea.fields,["_id","fields"]),_id:a.string(),fields:a.array(Lf),source:tN});a.object({...hn(Ea.fields,["_id","fields"]),_id:a.string(),fields:a.array(Lf),source:tN,entryCount:a.optional(a.number())});a.object({...hn(JR.fields,["deletedId"]),deletedId:a.string()});const lv=a.object({...hn(Ut.fields,["_id","primaryEntryId"]),_id:a.string(),primaryEntryId:a.optional(a.string())});a.object({...hn(WR.fields,["_id","primaryEntryId"]),_id:a.string(),primaryEntryId:a.optional(a.string())});a.object({...hn(pf.fields,["_id","entryId"]),_id:a.string(),entryId:a.string()});a.object({hasChanges:a.boolean(),fromVersion:a.object({versionNumber:a.number(),status:wt,slug:a.string(),wasPublished:a.boolean(),createdAt:a.number()}),toVersion:a.object({versionNumber:a.number(),status:wt,slug:a.string(),wasPublished:a.boolean(),createdAt:a.number()}),changedFields:a.array(a.string()),fieldDiffs:a.array(G1),slugChanged:a.boolean(),statusChanged:a.boolean(),changeSummary:a.string()});const bZ=a.object({isResizable:a.boolean(),aspectRatio:a.optional(a.number()),hasTransparency:a.optional(a.boolean()),isVector:a.optional(a.boolean()),suggestedMaxWidth:a.optional(a.number()),durationSeconds:a.optional(a.number())}),nN=a.object({...hn(hf.fields,["parentId","storageId"]),_id:a.string(),_creationTime:a.number(),parentId:a.optional(a.string()),storageId:a.string()}),wZ=a.object({...hn(hf.fields,["parentId","storageId"]),_id:a.string(),_creationTime:a.number(),parentId:a.optional(a.string()),storageId:a.string(),url:a.union(a.string(),a.null()),optimizationHints:bZ}),rN=a.object({...hn(Z1.fields,["parentId"]),_id:a.string(),_creationTime:a.number(),parentId:a.optional(a.string())});a.union(nN,rN);a.union(wZ,rN);a.object({...hn(eN.fields,["_id","parentId","storageId"]),_id:a.string(),parentId:a.optional(a.string()),storageId:a.string()});const xZ=a.object({id:a.string(),success:a.boolean(),error:a.optional(a.string()),previousFolderId:a.optional(a.string())});a.object({total:a.number(),succeeded:a.number(),failed:a.number(),targetFolderId:a.optional(a.string()),targetFolderPath:a.optional(a.string()),results:a.array(xZ)});const SZ=a.object({_id:a.string(),_creationTime:a.number(),assetId:a.string(),storageId:a.string(),variantType:_a,width:a.optional(a.number()),height:a.optional(a.number()),format:a.string(),mimeType:a.string(),size:a.number(),quality:a.optional(a.number()),preset:a.optional(a.string()),autoGenerated:a.boolean(),status:cy,errorMessage:a.optional(a.string()),processingStartedAt:a.optional(a.number()),processingCompletedAt:a.optional(a.number()),deletedAt:a.optional(a.number()),createdBy:a.optional(a.string())}),_Z=a.object({...SZ.fields,url:a.union(a.string(),a.null())});a.object({total:a.number(),succeeded:a.number(),failed:a.number(),results:a.array(a.object({preset:a.string(),success:a.boolean(),variantId:a.optional(a.string()),error:a.optional(a.string())}))});a.object({src:a.union(a.string(),a.null()),srcset:a.string(),entries:a.array(a.object({url:a.string(),descriptor:a.string(),width:a.number(),format:a.string()})),sizes:a.optional(a.string())});a.object({asset:nN,variants:a.array(_Z),originalUrl:a.union(a.string(),a.null())});a.object({...hn(_F.fields,["_id"]),_id:a.string()});a.object({...hn(EF.fields,["_id","taxonomyId","parentId"]),_id:a.string(),taxonomyId:a.string(),parentId:a.optional(a.string())});a.object({_id:a.string(),name:a.string(),slug:a.string(),description:a.optional(a.string()),color:a.optional(a.string()),icon:a.optional(a.string()),sortOrder:a.optional(a.number()),usageCount:a.number(),depth:a.number(),children:a.array(a.any())});a.object({...hn(AF.fields,["_id"]),_id:a.optional(a.string())});a.object({...lv.fields,deletedDaysAgo:a.number(),expiresAt:a.optional(a.number()),contentTypeName:a.optional(a.string())});a.object({totalItems:a.number(),byContentType:a.array(a.object({contentTypeId:a.string(),contentTypeName:a.string(),count:a.number()})),expiringWithin7Days:a.number(),oldestItemDaysAgo:a.optional(a.number())});a.object({deletedCount:a.number(),deletedVersionsCount:a.number(),errors:a.array(a.object({id:a.string(),error:a.string()}))});a.object({isLocked:a.boolean(),lockedBy:a.optional(a.string()),lockExpiresAt:a.optional(a.number()),timeRemaining:a.optional(a.number()),isExpired:a.optional(a.boolean())});a.object({success:a.boolean(),entry:a.optional(lv),error:a.optional(a.string()),currentLockHolder:a.optional(a.string()),currentLockExpiresAt:a.optional(a.number())});a.object({...lv.fields,contentTypeName:a.optional(a.string())});const EZ=a.object({id:a.string(),success:a.boolean(),error:a.optional(a.string())});a.object({total:a.number(),succeeded:a.number(),failed:a.number(),results:a.array(EZ)});a.object({contentTypes:a.number(),contentEntries:a.number(),mediaAssets:a.number(),published:a.number()});a.object({_id:a.union(a.string(),a.null()),_creationTime:a.optional(a.number()),defaultLocale:a.string(),availableLocales:a.array(a.string()),features:a.object({versioning:a.boolean(),scheduling:a.boolean(),localization:a.boolean(),mediaManagement:a.boolean()}),updatedBy:a.optional(a.string())});a.object({type:a.union(a.literal("CONTENT_TYPE_MISSING_IN_DB"),a.literal("CONTENT_TYPE_MISSING_IN_CODE"),a.literal("FIELD_MISSING_IN_DB"),a.literal("FIELD_MISSING_IN_CODE"),a.literal("FIELD_TYPE_MISMATCH"),a.literal("FIELD_REQUIRED_MISMATCH")),severity:a.union(a.literal("error"),a.literal("warning"),a.literal("info")),contentTypeName:a.string(),fieldName:a.optional(a.string()),message:a.string()});const TZ=new Map,oN=[{name:"text",displayName:"Text",icon:"Type",validator:a.string(),defaultValue:""},{name:"richText",displayName:"Rich Text",icon:"FileText",validator:a.string(),defaultValue:""},{name:"number",displayName:"Number",icon:"Hash",validator:a.number(),defaultValue:0},{name:"boolean",displayName:"Boolean",icon:"ToggleLeft",validator:a.boolean(),defaultValue:!1},{name:"date",displayName:"Date",icon:"Calendar",validator:a.union(a.string(),a.null()),defaultValue:null},{name:"datetime",displayName:"Date & Time",icon:"Clock",validator:a.union(a.string(),a.null()),defaultValue:null},{name:"reference",displayName:"Reference",icon:"Link",validator:a.union(a.string(),a.array(a.string()),a.null()),defaultValue:null},{name:"media",displayName:"Media",icon:"Image",validator:a.union(a.string(),a.null()),defaultValue:null},{name:"json",displayName:"JSON",icon:"Braces",validator:a.any(),defaultValue:null},{name:"select",displayName:"Select",icon:"ChevronDown",validator:a.string(),defaultValue:""},{name:"multiSelect",displayName:"Multi Select",icon:"CheckSquare",validator:a.array(a.string()),defaultValue:[]},{name:"tags",displayName:"Tags",icon:"Tags",validator:a.array(a.string()),defaultValue:[]},{name:"category",displayName:"Category",icon:"Folder",validator:a.union(a.string(),a.array(a.string()),a.null()),defaultValue:null}];oN.forEach(e=>TZ.set(e.name,e));new Set(oN.map(e=>e.name));const CZ=ur({id:Mt(),path:Mt(),label:Mt(),icon:Mt(),visible:bt().default(!0),section:pc(["main","config"]).default("main"),badge:Mt().optional(),exact:bt().optional()}),W_=ur({appName:Mt().default("Convex CMS"),logo:Mt().optional(),favicon:Mt().optional()}),eE=ur({sidebarWidth:YC().min(200).max(400).default(256),sidebarCollapsible:bt().default(!1)}),tE=ur({showDashboard:bt().default(!0),showContent:bt().default(!0),showMedia:bt().default(!0),showTaxonomies:bt().default(!0),showContentTypes:bt().default(!0),showTrash:bt().default(!0),showSettings:bt().default(!0),customItems:Iy(CZ).default([])}),nE=ur({mode:pc(["light","dark","system"]).default("system"),allowModeSwitch:bt().default(!0),tokens:KC(Mt(),Mt()).optional()});ur({branding:W_.default(()=>W_.parse({})),layout:eE.default(()=>eE.parse({})),navigation:tE.default(()=>tE.parse({})),theme:nE.default(()=>nE.parse({}))});function AZ({...e}){return w.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function RZ({className:e,...t}){return w.jsx("ol",{"data-slot":"breadcrumb-list",className:De("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function NZ({className:e,...t}){return w.jsx("li",{"data-slot":"breadcrumb-item",className:De("inline-flex items-center gap-1.5",e),...t})}function IZ({asChild:e,className:t,...n}){const o=e?zA:"a";return w.jsx(o,{"data-slot":"breadcrumb-link",className:De("hover:text-foreground transition-colors",t),...n})}function OZ({className:e,...t}){return w.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:De("text-foreground font-normal",e),...t})}function kZ({children:e,className:t,...n}){return w.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:De("[&>svg]:size-3.5",t),...n,children:e??w.jsx(HP,{})})}var Ym="rovingFocusGroup.onEntryFocus",MZ={bubbles:!1,cancelable:!0},Ec="RovingFocusGroup",[kg,iN,DZ]=By(Ec),[jZ,sN]=zr(Ec,[DZ]),[LZ,zZ]=jZ(Ec),aN=_.forwardRef((e,t)=>w.jsx(kg.Provider,{scope:e.__scopeRovingFocusGroup,children:w.jsx(kg.Slot,{scope:e.__scopeRovingFocusGroup,children:w.jsx(PZ,{...e,ref:t})})}));aN.displayName=Ec;var PZ=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...g}=e,b=_.useRef(null),x=Ze(t,b),C=qy(c),[S,A]=ti({prop:u,defaultProp:f??null,onChange:h,caller:Ec}),[I,k]=_.useState(!1),R=br(p),N=iN(n),j=_.useRef(!1),[B,P]=_.useState(0);return _.useEffect(()=>{const M=b.current;if(M)return M.addEventListener(Ym,R),()=>M.removeEventListener(Ym,R)},[R]),w.jsx(LZ,{scope:n,orientation:o,dir:C,loop:s,currentTabStopId:S,onItemFocus:_.useCallback(M=>A(M),[A]),onItemShiftTab:_.useCallback(()=>k(!0),[]),onFocusableItemAdd:_.useCallback(()=>P(M=>M+1),[]),onFocusableItemRemove:_.useCallback(()=>P(M=>M-1),[]),children:w.jsx(Ne.div,{tabIndex:I||B===0?-1:0,"data-orientation":o,...g,ref:x,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{j.current=!0}),onFocus:ge(e.onFocus,M=>{const U=!j.current;if(M.target===M.currentTarget&&U&&!I){const ee=new CustomEvent(Ym,MZ);if(M.currentTarget.dispatchEvent(ee),!ee.defaultPrevented){const ae=N().filter(F=>F.focusable),re=ae.find(F=>F.active),ue=ae.find(F=>F.id===S),he=[re,ue,...ae].filter(Boolean).map(F=>F.ref.current);uN(he,y)}}j.current=!1}),onBlur:ge(e.onBlur,()=>k(!1))})})}),lN="RovingFocusGroupItem",cN=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:c,children:u,...f}=e,h=yr(),p=c||h,y=zZ(lN,n),g=y.currentTabStopId===p,b=iN(n),{onFocusableItemAdd:x,onFocusableItemRemove:C,currentTabStopId:S}=y;return _.useEffect(()=>{if(o)return x(),()=>C()},[o,x,C]),w.jsx(kg.ItemSlot,{scope:n,id:p,focusable:o,active:s,children:w.jsx(Ne.span,{tabIndex:g?0:-1,"data-orientation":y.orientation,...f,ref:t,onMouseDown:ge(e.onMouseDown,A=>{o?y.onItemFocus(p):A.preventDefault()}),onFocus:ge(e.onFocus,()=>y.onItemFocus(p)),onKeyDown:ge(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){y.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const I=BZ(A,y.orientation,y.dir);if(I!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let R=b().filter(N=>N.focusable).map(N=>N.ref.current);if(I==="last")R.reverse();else if(I==="prev"||I==="next"){I==="prev"&&R.reverse();const N=R.indexOf(A.currentTarget);R=y.loop?qZ(R,N+1):R.slice(N+1)}setTimeout(()=>uN(R))}}),children:typeof u=="function"?u({isCurrentTabStop:g,hasTabStop:S!=null}):u})})});cN.displayName=lN;var $Z={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FZ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function BZ(e,t,n){const o=FZ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return $Z[o]}function uN(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function qZ(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var UZ=aN,VZ=cN,Mg=["Enter"," "],HZ=["ArrowDown","PageUp","Home"],dN=["ArrowUp","PageDown","End"],QZ=[...HZ,...dN],ZZ={ltr:[...Mg,"ArrowRight"],rtl:[...Mg,"ArrowLeft"]},GZ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tc="Menu",[lc,YZ,KZ]=By(Tc),[rs,fN]=zr(Tc,[KZ,Na,sN]),zf=Na(),hN=sN(),[XZ,os]=rs(Tc),[JZ,Cc]=rs(Tc),pN=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:s,onOpenChange:c,modal:u=!0}=e,f=zf(t),[h,p]=_.useState(null),y=_.useRef(!1),g=br(c),b=qy(s);return _.useEffect(()=>{const x=()=>{y.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>y.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),w.jsx(Xy,{...f,children:w.jsx(XZ,{scope:t,open:n,onOpenChange:g,content:h,onContentChange:p,children:w.jsx(JZ,{scope:t,onClose:_.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:y,dir:b,modal:u,children:o})})})};pN.displayName=Tc;var WZ="MenuAnchor",cv=_.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,s=zf(n);return w.jsx(kf,{...s,...o,ref:t})});cv.displayName=WZ;var uv="MenuPortal",[eG,mN]=rs(uv,{forceMount:void 0}),gN=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:s}=e,c=os(uv,t);return w.jsx(eG,{scope:t,forceMount:n,children:w.jsx(dr,{present:n||c.open,children:w.jsx(vc,{asChild:!0,container:s,children:o})})})};gN.displayName=uv;var ar="MenuContent",[tG,dv]=rs(ar),yN=_.forwardRef((e,t)=>{const n=mN(ar,e.__scopeMenu),{forceMount:o=n.forceMount,...s}=e,c=os(ar,e.__scopeMenu),u=Cc(ar,e.__scopeMenu);return w.jsx(lc.Provider,{scope:e.__scopeMenu,children:w.jsx(dr,{present:o||c.open,children:w.jsx(lc.Slot,{scope:e.__scopeMenu,children:u.modal?w.jsx(nG,{...s,ref:t}):w.jsx(rG,{...s,ref:t})})})})}),nG=_.forwardRef((e,t)=>{const n=os(ar,e.__scopeMenu),o=_.useRef(null),s=Ze(t,o);return _.useEffect(()=>{const c=o.current;if(c)return Ef(c)},[]),w.jsx(fv,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ge(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),rG=_.forwardRef((e,t)=>{const n=os(ar,e.__scopeMenu);return w.jsx(fv,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),oG=Gi("MenuContent.ScrollLock"),fv=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:g,onInteractOutside:b,onDismiss:x,disableOutsideScroll:C,...S}=e,A=os(ar,n),I=Cc(ar,n),k=zf(n),R=hN(n),N=YZ(n),[j,B]=_.useState(null),P=_.useRef(null),M=Ze(t,P,A.onContentChange),U=_.useRef(0),ee=_.useRef(""),ae=_.useRef(0),re=_.useRef(null),ue=_.useRef("right"),ce=_.useRef(0),he=C?bc:_.Fragment,F=C?{as:oG,allowPinchZoom:!0}:void 0,X=oe=>{const be=ee.current+oe,z=N().filter(J=>!J.disabled),Y=document.activeElement,ie=z.find(J=>J.ref.current===Y)?.textValue,se=z.map(J=>J.textValue),de=gG(se,be,ie),ve=z.find(J=>J.textValue===de)?.ref.current;(function J(_e){ee.current=_e,window.clearTimeout(U.current),_e!==""&&(U.current=window.setTimeout(()=>J(""),1e3))})(be),ve&&setTimeout(()=>ve.focus())};_.useEffect(()=>()=>window.clearTimeout(U.current),[]),Sf();const Z=_.useCallback(oe=>ue.current===re.current?.side&&vG(oe,re.current?.area),[]);return w.jsx(tG,{scope:n,searchRef:ee,onItemEnter:_.useCallback(oe=>{Z(oe)&&oe.preventDefault()},[Z]),onItemLeave:_.useCallback(oe=>{Z(oe)||(P.current?.focus(),B(null))},[Z]),onTriggerLeave:_.useCallback(oe=>{Z(oe)&&oe.preventDefault()},[Z]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:_.useCallback(oe=>{re.current=oe},[]),children:w.jsx(he,{...F,children:w.jsx(yc,{asChild:!0,trapped:s,onMountAutoFocus:ge(c,oe=>{oe.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:w.jsx(gc,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:g,onInteractOutside:b,onDismiss:x,children:w.jsx(UZ,{asChild:!0,...R,dir:I.dir,orientation:"vertical",loop:o,currentTabStopId:j,onCurrentTabStopIdChange:B,onEntryFocus:ge(h,oe=>{I.isUsingKeyboardRef.current||oe.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(Jy,{role:"menu","aria-orientation":"vertical","data-state":MN(A.open),"data-radix-menu-content":"",dir:I.dir,...k,...S,ref:M,style:{outline:"none",...S.style},onKeyDown:ge(S.onKeyDown,oe=>{const z=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,Y=oe.ctrlKey||oe.altKey||oe.metaKey,ie=oe.key.length===1;z&&(oe.key==="Tab"&&oe.preventDefault(),!Y&&ie&&X(oe.key));const se=P.current;if(oe.target!==se||!QZ.includes(oe.key))return;oe.preventDefault();const ve=N().filter(J=>!J.disabled).map(J=>J.ref.current);dN.includes(oe.key)&&ve.reverse(),pG(ve)}),onBlur:ge(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(U.current),ee.current="")}),onPointerMove:ge(e.onPointerMove,cc(oe=>{const be=oe.target,z=ce.current!==oe.clientX;if(oe.currentTarget.contains(be)&&z){const Y=oe.clientX>ce.current?"right":"left";ue.current=Y,ce.current=oe.clientX}}))})})})})})})});yN.displayName=ar;var iG="MenuGroup",hv=_.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return w.jsx(Ne.div,{role:"group",...o,ref:t})});hv.displayName=iG;var sG="MenuLabel",vN=_.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return w.jsx(Ne.div,{...o,ref:t})});vN.displayName=sG;var Gd="MenuItem",rE="menu.itemSelect",Pf=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...s}=e,c=_.useRef(null),u=Cc(Gd,e.__scopeMenu),f=dv(Gd,e.__scopeMenu),h=Ze(t,c),p=_.useRef(!1),y=()=>{const g=c.current;if(!n&&g){const b=new CustomEvent(rE,{bubbles:!0,cancelable:!0});g.addEventListener(rE,x=>o?.(x),{once:!0}),oA(g,b),b.defaultPrevented?p.current=!1:u.onClose()}};return w.jsx(bN,{...s,ref:h,disabled:n,onClick:ge(e.onClick,y),onPointerDown:g=>{e.onPointerDown?.(g),p.current=!0},onPointerUp:ge(e.onPointerUp,g=>{p.current||g.currentTarget?.click()}),onKeyDown:ge(e.onKeyDown,g=>{const b=f.searchRef.current!=="";n||b&&g.key===" "||Mg.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Pf.displayName=Gd;var bN=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:s,...c}=e,u=dv(Gd,n),f=hN(n),h=_.useRef(null),p=Ze(t,h),[y,g]=_.useState(!1),[b,x]=_.useState("");return _.useEffect(()=>{const C=h.current;C&&x((C.textContent??"").trim())},[c.children]),w.jsx(lc.ItemSlot,{scope:n,disabled:o,textValue:s??b,children:w.jsx(VZ,{asChild:!0,...f,focusable:!o,children:w.jsx(Ne.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...c,ref:p,onPointerMove:ge(e.onPointerMove,cc(C=>{o?u.onItemLeave(C):(u.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ge(e.onPointerLeave,cc(C=>u.onItemLeave(C))),onFocus:ge(e.onFocus,()=>g(!0)),onBlur:ge(e.onBlur,()=>g(!1))})})})}),aG="MenuCheckboxItem",wN=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...s}=e;return w.jsx(TN,{scope:e.__scopeMenu,checked:n,children:w.jsx(Pf,{role:"menuitemcheckbox","aria-checked":Yd(n)?"mixed":n,...s,ref:t,"data-state":mv(n),onSelect:ge(s.onSelect,()=>o?.(Yd(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wN.displayName=aG;var xN="MenuRadioGroup",[lG,cG]=rs(xN,{value:void 0,onValueChange:()=>{}}),SN=_.forwardRef((e,t)=>{const{value:n,onValueChange:o,...s}=e,c=br(o);return w.jsx(lG,{scope:e.__scopeMenu,value:n,onValueChange:c,children:w.jsx(hv,{...s,ref:t})})});SN.displayName=xN;var _N="MenuRadioItem",EN=_.forwardRef((e,t)=>{const{value:n,...o}=e,s=cG(_N,e.__scopeMenu),c=n===s.value;return w.jsx(TN,{scope:e.__scopeMenu,checked:c,children:w.jsx(Pf,{role:"menuitemradio","aria-checked":c,...o,ref:t,"data-state":mv(c),onSelect:ge(o.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});EN.displayName=_N;var pv="MenuItemIndicator",[TN,uG]=rs(pv,{checked:!1}),CN=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...s}=e,c=uG(pv,n);return w.jsx(dr,{present:o||Yd(c.checked)||c.checked===!0,children:w.jsx(Ne.span,{...s,ref:t,"data-state":mv(c.checked)})})});CN.displayName=pv;var dG="MenuSeparator",AN=_.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return w.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});AN.displayName=dG;var fG="MenuArrow",RN=_.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,s=zf(n);return w.jsx(Wy,{...s,...o,ref:t})});RN.displayName=fG;var hG="MenuSub",[fX,NN]=rs(hG),$l="MenuSubTrigger",IN=_.forwardRef((e,t)=>{const n=os($l,e.__scopeMenu),o=Cc($l,e.__scopeMenu),s=NN($l,e.__scopeMenu),c=dv($l,e.__scopeMenu),u=_.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=c,p={__scopeMenu:e.__scopeMenu},y=_.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return _.useEffect(()=>y,[y]),_.useEffect(()=>{const g=f.current;return()=>{window.clearTimeout(g),h(null)}},[f,h]),w.jsx(cv,{asChild:!0,...p,children:w.jsx(bN,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":MN(n.open),...e,ref:mc(t,s.onTriggerChange),onClick:g=>{e.onClick?.(g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ge(e.onPointerMove,cc(g=>{c.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(c.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),y()},100))})),onPointerLeave:ge(e.onPointerLeave,cc(g=>{y();const b=n.content?.getBoundingClientRect();if(b){const x=n.content?.dataset.side,C=x==="right",S=C?-5:5,A=b[C?"left":"right"],I=b[C?"right":"left"];c.onPointerGraceIntentChange({area:[{x:g.clientX+S,y:g.clientY},{x:A,y:b.top},{x:I,y:b.top},{x:I,y:b.bottom},{x:A,y:b.bottom}],side:x}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(g),g.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:ge(e.onKeyDown,g=>{const b=c.searchRef.current!=="";e.disabled||b&&g.key===" "||ZZ[o.dir].includes(g.key)&&(n.onOpenChange(!0),n.content?.focus(),g.preventDefault())})})})});IN.displayName=$l;var ON="MenuSubContent",kN=_.forwardRef((e,t)=>{const n=mN(ar,e.__scopeMenu),{forceMount:o=n.forceMount,...s}=e,c=os(ar,e.__scopeMenu),u=Cc(ar,e.__scopeMenu),f=NN(ON,e.__scopeMenu),h=_.useRef(null),p=Ze(t,h);return w.jsx(lc.Provider,{scope:e.__scopeMenu,children:w.jsx(dr,{present:o||c.open,children:w.jsx(lc.Slot,{scope:e.__scopeMenu,children:w.jsx(fv,{id:f.contentId,"aria-labelledby":f.triggerId,...s,ref:p,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:ge(e.onFocusOutside,y=>{y.target!==f.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:ge(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:ge(e.onKeyDown,y=>{const g=y.currentTarget.contains(y.target),b=GZ[u.dir].includes(y.key);g&&b&&(c.onOpenChange(!1),f.trigger?.focus(),y.preventDefault())})})})})})});kN.displayName=ON;function MN(e){return e?"open":"closed"}function Yd(e){return e==="indeterminate"}function mv(e){return Yd(e)?"indeterminate":e?"checked":"unchecked"}function pG(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function mG(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function gG(e,t,n){const s=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,c=n?e.indexOf(n):-1;let u=mG(e,Math.max(c,0));s.length===1&&(u=u.filter(p=>p!==n));const h=u.find(p=>p.toLowerCase().startsWith(s.toLowerCase()));return h!==n?h:void 0}function yG(e,t){const{x:n,y:o}=e;let s=!1;for(let c=0,u=t.length-1;c<t.length;u=c++){const f=t[c],h=t[u],p=f.x,y=f.y,g=h.x,b=h.y;y>o!=b>o&&n<(g-p)*(o-y)/(b-y)+p&&(s=!s)}return s}function vG(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return yG(n,t)}function cc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var bG=pN,wG=cv,xG=gN,SG=yN,_G=hv,EG=vN,TG=Pf,CG=wN,AG=SN,RG=EN,NG=CN,IG=AN,OG=RN,kG=IN,MG=kN,$f="DropdownMenu",[DG]=zr($f,[fN]),gn=fN(),[jG,DN]=DG($f),jN=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:s,defaultOpen:c,onOpenChange:u,modal:f=!0}=e,h=gn(t),p=_.useRef(null),[y,g]=ti({prop:s,defaultProp:c??!1,onChange:u,caller:$f});return w.jsx(jG,{scope:t,triggerId:yr(),triggerRef:p,contentId:yr(),open:y,onOpenChange:g,onOpenToggle:_.useCallback(()=>g(b=>!b),[g]),modal:f,children:w.jsx(bG,{...h,open:y,onOpenChange:g,dir:o,modal:f,children:n})})};jN.displayName=$f;var LN="DropdownMenuTrigger",zN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...s}=e,c=DN(LN,n),u=gn(n);return w.jsx(wG,{asChild:!0,...u,children:w.jsx(Ne.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...s,ref:mc(t,c.triggerRef),onPointerDown:ge(e.onPointerDown,f=>{!o&&f.button===0&&f.ctrlKey===!1&&(c.onOpenToggle(),c.open||f.preventDefault())}),onKeyDown:ge(e.onKeyDown,f=>{o||(["Enter"," "].includes(f.key)&&c.onOpenToggle(),f.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});zN.displayName=LN;var LG="DropdownMenuPortal",PN=e=>{const{__scopeDropdownMenu:t,...n}=e,o=gn(t);return w.jsx(xG,{...o,...n})};PN.displayName=LG;var $N="DropdownMenuContent",FN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=DN($N,n),c=gn(n),u=_.useRef(!1);return w.jsx(SG,{id:s.contentId,"aria-labelledby":s.triggerId,...c,...o,ref:t,onCloseAutoFocus:ge(e.onCloseAutoFocus,f=>{u.current||s.triggerRef.current?.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:ge(e.onInteractOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,y=h.button===2||p;(!s.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});FN.displayName=$N;var zG="DropdownMenuGroup",PG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(_G,{...s,...o,ref:t})});PG.displayName=zG;var $G="DropdownMenuLabel",BN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(EG,{...s,...o,ref:t})});BN.displayName=$G;var FG="DropdownMenuItem",qN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(TG,{...s,...o,ref:t})});qN.displayName=FG;var BG="DropdownMenuCheckboxItem",qG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(CG,{...s,...o,ref:t})});qG.displayName=BG;var UG="DropdownMenuRadioGroup",VG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(AG,{...s,...o,ref:t})});VG.displayName=UG;var HG="DropdownMenuRadioItem",QG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(RG,{...s,...o,ref:t})});QG.displayName=HG;var ZG="DropdownMenuItemIndicator",GG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(NG,{...s,...o,ref:t})});GG.displayName=ZG;var YG="DropdownMenuSeparator",UN=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(IG,{...s,...o,ref:t})});UN.displayName=YG;var KG="DropdownMenuArrow",XG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(OG,{...s,...o,ref:t})});XG.displayName=KG;var JG="DropdownMenuSubTrigger",WG=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(kG,{...s,...o,ref:t})});WG.displayName=JG;var eY="DropdownMenuSubContent",tY=_.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,s=gn(n);return w.jsx(MG,{...s,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tY.displayName=eY;var nY=jN,rY=zN,oY=PN,iY=FN,sY=BN,aY=qN,lY=UN;function cY({...e}){return w.jsx(nY,{"data-slot":"dropdown-menu",...e})}function uY({...e}){return w.jsx(rY,{"data-slot":"dropdown-menu-trigger",...e})}function dY({className:e,sideOffset:t=4,...n}){return w.jsx(oY,{children:w.jsx(iY,{"data-slot":"dropdown-menu-content",sideOffset:t,className:De("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function oE({className:e,inset:t,variant:n="default",...o}){return w.jsx(aY,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:De("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}function fY({className:e,inset:t,...n}){return w.jsx(sY,{"data-slot":"dropdown-menu-label","data-inset":t,className:De("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function iE({className:e,...t}){return w.jsx(lY,{"data-slot":"dropdown-menu-separator",className:De("bg-border -mx-1 my-1 h-px",e),...t})}function hY(e,t=[]){let n=[];function o(c,u){const f=_.createContext(u);f.displayName=c+"Context";const h=n.length;n=[...n,u];const p=g=>{const{scope:b,children:x,...C}=g,S=b?.[e]?.[h]||f,A=_.useMemo(()=>C,Object.values(C));return w.jsx(S.Provider,{value:A,children:x})};p.displayName=c+"Provider";function y(g,b){const x=b?.[e]?.[h]||f,C=_.useContext(x);if(C)return C;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${c}\``)}return[p,y]}const s=()=>{const c=n.map(u=>_.createContext(u));return function(f){const h=f?.[e]||c;return _.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return s.scopeName=e,[o,pY(s,...t)]}function pY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(c){const u=o.reduce((f,{useScope:h,scopeName:p})=>{const g=h(c)[`__scope${p}`];return{...f,...g}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var mY=gT();function gY(){return mY.useSyncExternalStore(yY,()=>!0,()=>!1)}function yY(){return()=>{}}var gv="Avatar",[vY]=hY(gv),[bY,VN]=vY(gv),HN=_.forwardRef((e,t)=>{const{__scopeAvatar:n,...o}=e,[s,c]=_.useState("idle");return w.jsx(bY,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:c,children:w.jsx(Cf.span,{...o,ref:t})})});HN.displayName=gv;var QN="AvatarImage",ZN=_.forwardRef((e,t)=>{const{__scopeAvatar:n,src:o,onLoadingStatusChange:s=()=>{},...c}=e,u=VN(QN,n),f=wY(o,c),h=br(p=>{s(p),u.onImageLoadingStatusChange(p)});return jt(()=>{f!=="idle"&&h(f)},[f,h]),f==="loaded"?w.jsx(Cf.img,{...c,ref:t,src:o}):null});ZN.displayName=QN;var GN="AvatarFallback",YN=_.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:o,...s}=e,c=VN(GN,n),[u,f]=_.useState(o===void 0);return _.useEffect(()=>{if(o!==void 0){const h=window.setTimeout(()=>f(!0),o);return()=>window.clearTimeout(h)}},[o]),u&&c.imageLoadingStatus!=="loaded"?w.jsx(Cf.span,{...s,ref:t}):null});YN.displayName=GN;function sE(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function wY(e,{referrerPolicy:t,crossOrigin:n}){const o=gY(),s=_.useRef(null),c=o?(s.current||(s.current=new window.Image),s.current):null,[u,f]=_.useState(()=>sE(c,e));return jt(()=>{f(sE(c,e))},[c,e]),jt(()=>{const h=g=>()=>{f(g)};if(!c)return;const p=h("loaded"),y=h("error");return c.addEventListener("load",p),c.addEventListener("error",y),t&&(c.referrerPolicy=t),typeof n=="string"&&(c.crossOrigin=n),()=>{c.removeEventListener("load",p),c.removeEventListener("error",y)}},[c,n,t]),u}var xY=HN,SY=ZN,_Y=YN;function EY({className:e,...t}){return w.jsx(xY,{"data-slot":"avatar",className:De("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function TY({className:e,...t}){return w.jsx(SY,{"data-slot":"avatar-image",className:De("aspect-square size-full",e),...t})}function CY({className:e,...t}){return w.jsx(_Y,{"data-slot":"avatar-fallback",className:De("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var Ff="Popover",[KN]=zr(Ff,[Na]),Ac=Na(),[AY,fi]=KN(Ff),XN=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:s,onOpenChange:c,modal:u=!1}=e,f=Ac(t),h=_.useRef(null),[p,y]=_.useState(!1),[g,b]=ti({prop:o,defaultProp:s??!1,onChange:c,caller:Ff});return w.jsx(Xy,{...f,children:w.jsx(AY,{scope:t,contentId:yr(),triggerRef:h,open:g,onOpenChange:b,onOpenToggle:_.useCallback(()=>b(x=>!x),[b]),hasCustomAnchor:p,onCustomAnchorAdd:_.useCallback(()=>y(!0),[]),onCustomAnchorRemove:_.useCallback(()=>y(!1),[]),modal:u,children:n})})};XN.displayName=Ff;var JN="PopoverAnchor",RY=_.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,s=fi(JN,n),c=Ac(n),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=s;return _.useEffect(()=>(u(),()=>f()),[u,f]),w.jsx(kf,{...c,...o,ref:t})});RY.displayName=JN;var WN="PopoverTrigger",eI=_.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,s=fi(WN,n),c=Ac(n),u=Ze(t,s.triggerRef),f=w.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":iI(s.open),...o,ref:u,onClick:ge(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?f:w.jsx(kf,{asChild:!0,...c,children:f})});eI.displayName=WN;var yv="PopoverPortal",[NY,IY]=KN(yv,{forceMount:void 0}),tI=e=>{const{__scopePopover:t,forceMount:n,children:o,container:s}=e,c=fi(yv,t);return w.jsx(NY,{scope:t,forceMount:n,children:w.jsx(dr,{present:n||c.open,children:w.jsx(vc,{asChild:!0,container:s,children:o})})})};tI.displayName=yv;var va="PopoverContent",nI=_.forwardRef((e,t)=>{const n=IY(va,e.__scopePopover),{forceMount:o=n.forceMount,...s}=e,c=fi(va,e.__scopePopover);return w.jsx(dr,{present:o||c.open,children:c.modal?w.jsx(kY,{...s,ref:t}):w.jsx(MY,{...s,ref:t})})});nI.displayName=va;var OY=Gi("PopoverContent.RemoveScroll"),kY=_.forwardRef((e,t)=>{const n=fi(va,e.__scopePopover),o=_.useRef(null),s=Ze(t,o),c=_.useRef(!1);return _.useEffect(()=>{const u=o.current;if(u)return Ef(u)},[]),w.jsx(bc,{as:OY,allowPinchZoom:!0,children:w.jsx(rI,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,u=>{u.preventDefault(),c.current||n.triggerRef.current?.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,u=>{const f=u.detail.originalEvent,h=f.button===0&&f.ctrlKey===!0,p=f.button===2||h;c.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),MY=_.forwardRef((e,t)=>{const n=fi(va,e.__scopePopover),o=_.useRef(!1),s=_.useRef(!1);return w.jsx(rI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(o.current||n.triggerRef.current?.focus(),c.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(o.current=!0,c.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=c.target;n.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&s.current&&c.preventDefault()}})}),rI=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:y,...g}=e,b=fi(va,n),x=Ac(n);return Sf(),w.jsx(yc,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:c,children:w.jsx(gc,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:y,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:w.jsx(Jy,{"data-state":iI(b.open),role:"dialog",id:b.contentId,...x,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),oI="PopoverClose",DY=_.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,s=fi(oI,n);return w.jsx(Ne.button,{type:"button",...o,ref:t,onClick:ge(e.onClick,()=>s.onOpenChange(!1))})});DY.displayName=oI;var jY="PopoverArrow",LY=_.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,s=Ac(n);return w.jsx(Wy,{...s,...o,ref:t})});LY.displayName=jY;function iI(e){return e?"open":"closed"}var zY=XN,PY=eI,$Y=tI,FY=nI;function aE({...e}){return w.jsx(zY,{"data-slot":"popover",...e})}function lE({...e}){return w.jsx(PY,{"data-slot":"popover-trigger",...e})}function cE({className:e,align:t="center",sideOffset:n=4,...o}){return w.jsx($Y,{children:w.jsx(FY,{"data-slot":"popover-content",align:t,sideOffset:n,className:De("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})})}const BY=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],qY=[{label:"Documentation",url:"https://docs.convex.dev",icon:zP},{label:"API Reference",url:"https://docs.convex.dev/api",icon:t$},{label:"Community Discord",url:"https://discord.gg/convex",icon:Z$}],UY={"/":"Dashboard","/content":"Content","/media":"Media Library","/content-types":"Content Types","/settings":"Settings","/taxonomies":"Taxonomies","/trash":"Trash","/entries":"Entries","/entries/type":"Content Types","/entries/new":"New Entry"};function VY(e,t,n){const o=[{label:t,to:"/"}],s=decodeURIComponent(e);if(s==="/")return o;const c=s.split("/").filter(Boolean);let u="";return c.forEach((f,h)=>{u+=`/${f}`;const p=h===c.length-1;let y=n.get(u)??UY[u];y||(y=f.charAt(0).toUpperCase()+f.slice(1).replace(/-/g," ")),p?o.push({label:y}):o.push({label:y,to:u})}),o}function HY(){const e=Tt(),t=sf(),{branding:n}=Oy();let o=new Map;try{o=T8().overrides}catch{}const s=VY(e.location.pathname,n.appName,o);let c=null,u=null,f=async()=>{},h=!1;try{const S=vC();c=S.user,u=S.role,f=S.logout,h=S.isAuthenticated}catch{}const y=(u?QB(u):null)?.displayName??u??"No Role",g=c?.name??c?.email??"User",b=S=>{const A=S.split(" ");return A.length>=2?`${A[0][0]}${A[1][0]}`.toUpperCase():S.slice(0,2).toUpperCase()},x=c?.name?b(c.name):"U",C=async()=>{await f()};return w.jsxs("header",{className:"sticky top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background/95 px-6 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[w.jsx(AZ,{children:w.jsx(RZ,{children:s.map((S,A)=>w.jsxs(_.Fragment,{children:[A>0&&w.jsx(kZ,{}),w.jsx(NZ,{children:S.to?w.jsx(IZ,{asChild:!0,children:w.jsxs($i,{to:S.to,className:"flex items-center gap-1.5",children:[A===0&&w.jsx(e1,{className:"size-3.5"}),w.jsx("span",{children:S.label})]})}):w.jsx(OZ,{children:S.label})})]},A))})}),w.jsxs("div",{className:"flex items-center gap-1",children:[w.jsxs(aE,{children:[w.jsx(lE,{asChild:!0,children:w.jsxs(Gl,{variant:"ghost",size:"icon",className:"size-9",children:[w.jsx(sg,{className:"size-4"}),w.jsx("span",{className:"sr-only",children:"Notifications"})]})}),w.jsxs(cE,{align:"end",className:"w-80",children:[w.jsx("div",{className:"flex items-center justify-between pb-2",children:w.jsx("h4",{className:"font-medium",children:"Notifications"})}),w.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[w.jsx(sg,{className:"size-8 text-muted-foreground/50"}),w.jsx("p",{className:"mt-2 text-sm font-medium",children:"No notifications yet"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"You're all caught up!"})]})]})]}),w.jsxs(aE,{children:[w.jsx(lE,{asChild:!0,children:w.jsxs(Gl,{variant:"ghost",size:"icon",className:"size-9",children:[w.jsx(JT,{className:"size-4"}),w.jsx("span",{className:"sr-only",children:"Help"})]})}),w.jsxs(cE,{align:"end",className:"w-72",children:[w.jsx("div",{className:"pb-2",children:w.jsx("h4",{className:"font-medium",children:"Help & Resources"})}),w.jsxs("div",{className:"space-y-4",children:[w.jsxs("div",{children:[w.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Keyboard Shortcuts"}),w.jsx("div",{className:"space-y-1",children:BY.map((S,A)=>w.jsxs("div",{className:"flex items-center justify-between text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:S.description}),w.jsx("div",{className:"flex gap-0.5",children:S.keys.map((I,k)=>w.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",children:I},k))})]},A))})]}),w.jsxs("div",{children:[w.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Resources"}),w.jsx("div",{className:"space-y-1",children:qY.map(S=>w.jsxs("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent",children:[w.jsx(S.icon,{className:"size-4 text-muted-foreground"}),w.jsx("span",{className:"flex-1",children:S.label}),w.jsx(i$,{className:"size-3 text-muted-foreground"})]},S.label))})]})]})]})]}),w.jsxs(cY,{children:[w.jsx(uY,{asChild:!0,children:w.jsxs(Gl,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[w.jsxs(EY,{className:"size-6",children:[w.jsx(TY,{src:c?.avatarUrl,alt:g}),w.jsx(CY,{className:"text-xs",children:x})]}),w.jsx("span",{className:"text-sm font-medium",children:g}),w.jsx(ts,{className:"size-3.5 text-muted-foreground"})]})}),w.jsxs(dY,{align:"end",className:"w-56",children:[w.jsx(fY,{className:"font-normal",children:w.jsxs("div",{className:"flex flex-col space-y-1",children:[w.jsx("p",{className:"text-sm font-medium",children:g}),c?.email&&w.jsx("p",{className:"text-xs text-muted-foreground",children:c.email}),w.jsx("p",{className:"text-xs text-muted-foreground",children:y})]})}),w.jsx(iE,{}),w.jsxs(oE,{onClick:()=>t({to:"/settings"}),children:[w.jsx(i1,{className:"mr-2 size-4"}),w.jsx("span",{children:"Profile & Settings"})]}),h&&w.jsxs(w.Fragment,{children:[w.jsx(iE,{}),w.jsxs(oE,{onClick:C,className:"text-destructive focus:text-destructive",children:[w.jsx(B$,{className:"mr-2 size-4"}),w.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function QY({children:e}){const{layout:t}=Oy();return w.jsxs("div",{className:"flex min-h-screen bg-background",children:[w.jsx(JQ,{}),w.jsxs("div",{className:"flex flex-1 flex-col",style:{marginLeft:t.sidebarWidth},children:[w.jsx(HY,{}),w.jsx("main",{className:"flex-1 overflow-auto p-6",children:e})]})]})}function ZY(){return w.jsx("div",{className:"route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen",children:w.jsx(z$,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function GY(){return w.jsxs("div",{className:"route-guard route-guard--unauthenticated",children:[w.jsx("div",{className:"route-guard-icon",children:w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),w.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),w.jsx("h2",{children:"Authentication Required"}),w.jsx("p",{children:"Please log in to access the admin panel."})]})}function Km({requiredRole:e,requiredPermission:t}){return w.jsxs("div",{className:"route-guard route-guard--unauthorized",children:[w.jsx("div",{className:"route-guard-icon",children:w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"10"}),w.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]})}),w.jsx("h2",{children:"Access Denied"}),w.jsx("p",{children:"You don't have permission to access this page."}),e&&w.jsxs("p",{className:"route-guard-detail",children:["Required role: ",w.jsx("strong",{children:e})]}),t&&w.jsxs("p",{className:"route-guard-detail",children:["Required permission:"," ",w.jsxs("strong",{children:[t.action," on ",t.resource]})]})]})}function YY({error:e}){return w.jsxs("div",{className:"route-guard route-guard--error",children:[w.jsx("div",{className:"route-guard-icon",children:w.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"10"}),w.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),w.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),w.jsx("h2",{children:"Authentication Error"}),w.jsx("p",{children:e})]})}function KY({children:e,requiredPermission:t,requiredRole:n,loadingComponent:o,unauthenticatedComponent:s,unauthorizedComponent:c,onUnauthenticated:u,onUnauthorized:f}){const{authState:h,role:p,checkPermission:y,error:g}=vC();return h==="loading"?w.jsx(w.Fragment,{children:o??w.jsx(ZY,{})}):h==="error"?w.jsx(YY,{error:g??"An error occurred"}):h==="unauthenticated"?(u?.(),w.jsx(w.Fragment,{children:s??w.jsx(GY,{})})):p?n&&p!==n?(f?.(),w.jsx(w.Fragment,{children:c??w.jsx(Km,{requiredRole:n,requiredPermission:t})})):t&&!y(t)?(f?.(),w.jsx(w.Fragment,{children:c??w.jsx(Km,{requiredRole:n,requiredPermission:t})})):w.jsx(w.Fragment,{children:e}):(f?.(),w.jsx(w.Fragment,{children:c??w.jsx(Km,{requiredRole:n,requiredPermission:t})}))}const sI=()=>{throw new Error("createServerOnlyFn() functions can only be called on the server!")};function uE(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function Dg(e,t){const n=Object.create(null);if(e)for(const o of Object.keys(e))uE(o)&&(n[o]=e[o]);if(t&&typeof t=="object")for(const o of Object.keys(t))uE(o)&&(n[o]=t[o]);return n}function aI(e){return Object.create(null)}const yd=(e,t)=>{const n=t||e||{};return typeof n.method>"u"&&(n.method="GET"),Object.assign(c=>{const u={...n,...c};return yd(void 0,u)},{options:n,middleware:c=>{const u=[...n.middleware||[]];c.map(p=>{Jx in p?p.options.middleware&&u.push(...p.options.middleware):u.push(p)});const f={...n,middleware:u},h=yd(void 0,f);return h[Jx]=!0,h},inputValidator:c=>{const u={...n,inputValidator:c};return yd(void 0,u)},handler:(...c)=>{const[u,f]=c,h={...n,extractedFn:u,serverFn:f},p=[...h.middleware||[],WY(h)];return Object.assign(async y=>{const g=await dE(p,"client",{...u,...h,data:y?.data,headers:y?.headers,signal:y?.signal,fetch:y?.fetch,context:aI()}),b=AE(g.error);if(b)throw b;if(g.error)throw g.error;return g.result},{...u,__executeServer:async(y,g)=>{const b=sI(),x=b.contextAfterGlobalMiddlewares,C={...u,...y,serverFnMeta:u.serverFnMeta,context:Dg(x,y.context),signal:g,request:b.request};return await dE(p,"server",C).then(A=>({result:A.result,error:A.error,context:A.sendContext}))}})}})};async function dE(e,t,n){const o=Gg()?.functionMiddleware||[];let s=XY([...o,...e]);if(t==="server"){const u=sI();u?.executedRequestMiddlewares&&(s=s.filter(f=>!u.executedRequestMiddlewares.has(f)))}const c=async u=>{const f=s.shift();if(!f)return u;try{"inputValidator"in f.options&&f.options.inputValidator&&t==="server"&&(u.data=await JY(f.options.inputValidator,u.data));let h;if(t==="client"?"client"in f.options&&(h=f.options.client):"server"in f.options&&(h=f.options.server),h){const y=await h({...u,next:async(g={})=>{const b={...u,...g,context:Dg(u.context,g.context),sendContext:Dg(u.sendContext,g.sendContext),headers:AL(u.headers,g.headers),_callSiteFetch:u._callSiteFetch,fetch:u._callSiteFetch??g.fetch??u.fetch,result:g.result!==void 0?g.result:g instanceof Response?g:u.result,error:g.error??u.error},x=await c(b);if(x.error)throw x.error;return x}});if(Bn(y))return{...u,error:y};if(y instanceof Response)return{...u,result:y};if(!y)throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");return y}return c(u)}catch(h){return{...u,error:h}}};return c({...n,headers:n.headers||{},sendContext:n.sendContext||{},context:n.context||aI(),_callSiteFetch:n.fetch})}function XY(e,t=100){const n=new Set,o=[],s=(c,u)=>{if(u>t)throw new Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);c.forEach(f=>{f.options.middleware&&s(f.options.middleware,u+1),n.has(f)||(n.add(f),o.push(f))})};return s(e,0),o}async function JY(e,t){if(e==null)return{};if("~standard"in e){const n=await e["~standard"].validate(t);if(n.issues)throw new Error(JSON.stringify(n.issues,void 0,2));return n.value}if("parse"in e)return e.parse(t);if(typeof e=="function")return e(t);throw new Error("Invalid validator type!")}function WY(e){return{"~types":void 0,options:{inputValidator:e.inputValidator,client:async({next:t,sendContext:n,fetch:o,...s})=>{const c={...s,context:n,fetch:o},u=await e.extractedFn?.(c);return t(u)},server:async({next:t,...n})=>{const o=await e.serverFn?.(n);return t({...n,result:o})}}}}const eK=yd({method:"GET"}).handler(AT("dff4e5b7f7b29b6a323200a2df0a5335d739cf583e83c9e514598af6b5ade819")),fE=UT;O1();const hE=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),pE=()=>"admin",mE=()=>{console.log("Logout called (mock mode)")},tK=()=>null,nK=()=>null,rK=()=>{};function oK(e){switch(e){case"mock":case"demo":return{getUser:hE,getUserRole:pE,onLogout:mE};case"none":case"disabled":return{getUser:tK,getUserRole:nK,onLogout:rK};default:return{getUser:hE,getUserRole:pE,onLogout:mE}}}const fr=cL({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"Convex CMS Admin"},{name:"description",content:"Admin interface for Convex CMS - manage content, media, and publishing workflows"}],links:[{rel:"stylesheet",href:AP},{rel:"icon",href:"/favicon.ico"}]}),loader:async()=>({config:await eK()}),component:iK});function iK(){const{config:e}=fr.useLoaderData(),t=_.useMemo(()=>oK(e.authMode),[e.authMode]),n=_.useMemo(()=>b8(e.adminConfig),[e.adminConfig]);return w.jsx(aK,{children:w.jsx(Lq,{children:w.jsx(E8,{children:w.jsx(sK,{config:e,adminConfig:n,children:w.jsx(jq,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:w.jsx(KY,{children:w.jsx(QY,{children:w.jsx(wT,{})})})})})})})})}function sK({children:e,config:t,adminConfig:n}){const o=_.useMemo(()=>t.convexUrl?new vP(t.convexUrl):null,[t.convexUrl]);return o?w.jsx(wP,{client:o,children:w.jsx(A8,{api:fE.admin,children:w.jsx(_8,{baseConfig:n,api:{getSettings:fE.admin.getSettings},children:e})})}):w.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-6",children:w.jsxs("div",{className:"diff-modified max-w-lg space-y-4 rounded-lg border p-6 text-center",children:[w.jsx("h2",{className:"text-xl font-semibold text-diff-modified",children:"Convex Configuration Required"}),w.jsx("p",{className:"text-sm text-diff-modified-foreground",children:"Please provide a Convex deployment URL to connect to your backend."}),w.jsxs("div",{className:"space-y-2 text-left text-sm text-diff-modified-foreground",children:[w.jsx("p",{className:"font-medium",children:"Options:"}),w.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[w.jsxs("li",{children:["Run with URL:"," ",w.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"npx convex-cms admin --url YOUR_URL"})]}),w.jsxs("li",{children:["Set environment variable:"," ",w.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"CONVEX_URL=YOUR_URL"})]}),w.jsxs("li",{children:["Add to"," ",w.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:".env.local"}),":"," ",w.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"CONVEX_URL=YOUR_URL"})]})]})]}),w.jsxs("p",{className:"text-sm text-diff-modified-foreground",children:["Run"," ",w.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"npx convex dev"})," to start Convex and get your URL."]})]})})}function aK({children:e}){return w.jsxs("html",{lang:"en",children:[w.jsx("head",{children:w.jsx(EL,{})}),w.jsxs("body",{children:[e,w.jsx(TL,{})]})]})}const lK=()=>$r(()=>import("./trash-Cle-tcqq.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),cK=lr("/trash")({component:Lr(lK,"component")}),uK=()=>$r(()=>import("./taxonomies-CHjJKNlR.js"),__vite__mapDeps([11,1,4,12,5,2,3,13])),dK=lr("/taxonomies")({component:Lr(uK,"component")}),fK=()=>$r(()=>import("./settings-2mx3_ORG.js"),__vite__mapDeps([14,1,15,5,2,16,3,9])),hK=lr("/settings")({component:Lr(fK,"component")}),pK=()=>$r(()=>import("./media-DY5zD52L.js"),__vite__mapDeps([17,1,18,19,3,4,5,7,8,20,21,12,10])),mK=lr("/media")({component:Lr(pK,"component")}),gK=()=>$r(()=>import("./content-types-DHr9tc2V.js"),__vite__mapDeps([22,1,3,4,5,6,7,8,12])),yK=lr("/content-types")({component:Lr(gK,"component")}),vK=()=>$r(()=>import("./content-DH6k0dN6.js"),__vite__mapDeps([23,15,24,3,25,4,5,6,1,7,8])),bK=lr("/content")({component:Lr(vK,"component")}),wK=()=>$r(()=>import("./index-Cf0lbl0G.js"),__vite__mapDeps([26,1,5,2,9,19])),xK=lr("/")({component:Lr(wK,"component")}),SK=()=>$r(()=>import("./_entryId-CoZDE0l0.js"),__vite__mapDeps([27,28,16,18,19,4,12,8,21,3,25,13,24,15,29])),_K=lr("/entries/$entryId")({component:Lr(SK,"component")}),EK=()=>$r(()=>import("./_contentTypeId-BekeCblX.js"),__vite__mapDeps([30,15,29,5,8,25,3,4,20,21])),TK=lr("/entries/type/$contentTypeId")({component:Lr(EK,"component")}),CK=()=>$r(()=>import("./new._contentTypeId-Dq_NqTQV.js"),__vite__mapDeps([31,28,16,18,19,4,12,8,21,3,25,13,24,29])),AK=lr("/entries/new/$contentTypeId")({component:Lr(CK,"component")}),RK=cK.update({id:"/trash",path:"/trash",getParentRoute:()=>fr}),NK=dK.update({id:"/taxonomies",path:"/taxonomies",getParentRoute:()=>fr}),IK=hK.update({id:"/settings",path:"/settings",getParentRoute:()=>fr}),OK=mK.update({id:"/media",path:"/media",getParentRoute:()=>fr}),kK=yK.update({id:"/content-types",path:"/content-types",getParentRoute:()=>fr}),MK=bK.update({id:"/content",path:"/content",getParentRoute:()=>fr}),DK=xK.update({id:"/",path:"/",getParentRoute:()=>fr}),jK=_K.update({id:"/entries/$entryId",path:"/entries/$entryId",getParentRoute:()=>fr}),LK=TK.update({id:"/entries/type/$contentTypeId",path:"/entries/type/$contentTypeId",getParentRoute:()=>fr}),zK=AK.update({id:"/entries/new/$contentTypeId",path:"/entries/new/$contentTypeId",getParentRoute:()=>fr}),PK={IndexRoute:DK,ContentRoute:MK,ContentTypesRoute:kK,MediaRoute:OK,SettingsRoute:IK,TaxonomiesRoute:NK,TrashRoute:RK,EntriesEntryIdRoute:jK,EntriesNewContentTypeIdRoute:zK,EntriesTypeContentTypeIdRoute:LK},$K=fr._addFileChildren(PK);function FK(){return yL({routeTree:$K,scrollRestoration:!0,defaultPreload:"intent"})}async function BK(){const e=await FK();let t;return t=[],window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(HL),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:"",serializationAdapters:t}),e.state.matches.length||await NL(e),e}async function qK(){const e=await BK();return window.$_TSR?.h(),e}let Xm;function UK(){return Xm||(Xm=qK()),w.jsx(Pj,{promise:Xm,children:e=>w.jsx(wL,{router:e})})}_.startTransition(()=>{j2.hydrateRoot(document,w.jsx(_.StrictMode,{children:w.jsx(UK,{})}))});export{WP as $,vH as A,xH as B,uo as C,mH as D,t1 as E,d$ as F,Gl as G,z$ as H,ji as I,cY as J,uY as K,rr as L,dY as M,oE as N,a$ as O,r1 as P,iE as Q,KY as R,Um as S,m3 as T,O$ as U,e1 as V,b$ as W,Md as X,bH as Y,wH as Z,cX as _,xS as a,j$ as a0,h$ as a1,f3 as a2,KQ as a3,y$ as a4,YT as a5,ag as a6,o1 as a7,WT as a8,XT as a9,dr as aA,zr as aB,ge as aC,br as aD,jt as aE,z_ as aF,ti as aG,$A as aH,FA as aI,yr as aJ,UZ as aK,VZ as aL,sN as aM,T8 as aN,lH as aO,cH as aP,uH as aQ,dH as aR,mc as aS,zA as aT,GP as aa,n1 as ab,e3 as ac,IH as ad,Tt as ae,sf as af,Qg as ag,_K as ah,TK as ai,$i as aj,aE as ak,lE as al,cE as am,vC as an,ZB as ao,aX as ap,vg as aq,AK as ar,sn as as,OH as at,M$ as au,t$ as av,XP as aw,Ze as ax,qy as ay,Ne as az,y3 as b,dX as c,fE as d,Se as e,rA as f,$y as g,$H as h,L_ as i,w as j,u3 as k,ts as l,HP as m,De as n,l3 as o,Oy as p,KT as q,_ as r,Hm as s,Vm as t,ZT as u,Qm as v,Ml as w,$$ as x,lX as y,Cf as z};