convex-cms 0.0.7-alpha.0 → 0.0.8
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.
- package/README.md +22 -17
- package/admin/src/components/BreakingChangesWarningDialog.tsx +5 -5
- package/admin/src/components/BulkOperationModal.tsx +14 -14
- package/admin/src/components/ContentEntryEditor.tsx +6 -6
- package/admin/src/components/ContentTypeFormModal.tsx +1 -1
- package/admin/src/components/Header.tsx +5 -2
- package/admin/src/components/SchemaDriftWarning.tsx +126 -0
- package/admin/src/components/TaxonomyEditor.tsx +2 -2
- package/admin/src/components/TermTree.tsx +3 -3
- package/admin/src/components/UploadDropzone.tsx +7 -7
- package/admin/src/components/VersionCompare.tsx +13 -13
- package/admin/src/components/VersionHistory.tsx +2 -2
- package/admin/src/components/VersionRollbackModal.tsx +5 -5
- package/admin/src/components/cmsds/CmsButton.tsx +2 -2
- package/admin/src/components/cmsds/CmsDialog.tsx +4 -1
- package/admin/src/components/cmsds/CmsStatusBadge.tsx +5 -5
- package/admin/src/components/fields/JsonField.tsx +1 -1
- package/admin/src/components/fields/TagField.tsx +1 -1
- package/admin/src/contexts/SettingsConfigContext.tsx +10 -3
- package/admin/src/embed/index.tsx +29 -9
- package/admin/src/embed/pages/ContentTypeEntries.tsx +25 -0
- package/admin/src/embed/pages/Entry.tsx +114 -0
- package/admin/src/embed/pages/Media.tsx +3 -1
- package/admin/src/embed/pages/NewEntry.tsx +83 -0
- package/admin/src/embed/pages/index.ts +3 -0
- package/admin/src/pages/ContentPage.tsx +16 -1
- package/admin/src/pages/ContentTypeEntriesPage.tsx +466 -0
- package/admin/src/pages/ContentTypesPage.tsx +3 -3
- package/admin/src/pages/DashboardPage.tsx +3 -0
- package/admin/src/pages/SettingsPage.tsx +4 -4
- package/admin/src/pages/index.ts +1 -0
- package/admin/src/routes/__root.tsx +10 -10
- package/admin/src/styles/globals.css +31 -5
- package/admin/src/styles/tailwind-config.css +25 -0
- package/admin/src/styles/theme.css +50 -0
- package/admin-dist/nitro.json +1 -1
- package/admin-dist/public/assets/{CmsEmptyState-CXVkI3FZ.js → CmsEmptyState-6-PLaXtD.js} +1 -1
- package/admin-dist/public/assets/{CmsPageHeader-DU9fD34s.js → CmsPageHeader-SoF4Epu9.js} +1 -1
- package/admin-dist/public/assets/CmsStatusBadge-D7kYaohx.js +1 -0
- package/admin-dist/public/assets/{CmsSurface-DF7OcKg_.js → CmsSurface-BvksBm6W.js} +1 -1
- package/admin-dist/public/assets/{CmsToolbar-5S8FQrSx.js → CmsToolbar-DlZPMe2B.js} +1 -1
- package/admin-dist/public/assets/ContentEntryEditor-C6n9xLS9.js +4 -0
- package/admin-dist/public/assets/{TaxonomyFilter-DEN2Q9Lo.js → TaxonomyFilter-CFX1_g8s.js} +1 -1
- package/admin-dist/public/assets/{_contentTypeId-Ba5iowxH.js → _contentTypeId-DTv8UoTp.js} +1 -1
- package/admin-dist/public/assets/_entryId-D3lr5Dvy.js +1 -0
- package/admin-dist/public/assets/alert-BAHTL6ao.js +1 -0
- package/admin-dist/public/assets/badge-oJv4Eai8.js +1 -0
- package/admin-dist/public/assets/{circle-check-big-B7eCOM8r.js → circle-check-big-3OHxNDhO.js} +1 -1
- package/admin-dist/public/assets/{command-BIjzeKOv.js → command-DwgQs69u.js} +1 -1
- package/admin-dist/public/assets/content-CKQ4QwW2.js +1 -0
- package/admin-dist/public/assets/content-types-BrttaLpc.js +1 -0
- package/admin-dist/public/assets/globals-CoCRjt0K.css +1 -0
- package/admin-dist/public/assets/index-DOkgTSx0.js +1 -0
- package/admin-dist/public/assets/{main-BZB1uYTH.js → main-DV6oxWnU.js} +5 -5
- package/admin-dist/public/assets/media-B2i-mCbx.js +1 -0
- package/admin-dist/public/assets/new._contentTypeId-VF63rpic.js +1 -0
- package/admin-dist/public/assets/{pencil-BDQ1ZWRw.js → pencil-CX1CiTDD.js} +1 -1
- package/admin-dist/public/assets/refresh-cw-Cm-YOeFI.js +1 -0
- package/admin-dist/public/assets/{rotate-ccw-BWblSIsl.js → rotate-ccw-B45JsL5f.js} +1 -1
- package/admin-dist/public/assets/{scroll-area-BoaB6x8v.js → scroll-area-b3A1HHR7.js} +1 -1
- package/admin-dist/public/assets/{search-CYMIpd39.js → search-DKKh_DdH.js} +1 -1
- package/admin-dist/public/assets/settings-CGVDEV1r.js +1 -0
- package/admin-dist/public/assets/{switch-DN7TOCa5.js → switch-BTMY8Qnk.js} +1 -1
- package/admin-dist/public/assets/tabs-DUQwUoIb.js +1 -0
- package/admin-dist/public/assets/{tanstack-adapter-DQcKErwf.js → tanstack-adapter-f7AHmQ5L.js} +1 -1
- package/admin-dist/public/assets/taxonomies-DvMppdiD.js +1 -0
- package/admin-dist/public/assets/{trash-Dp_a2mpb.js → trash-D7e0uKd9.js} +1 -1
- package/admin-dist/public/assets/{useBreadcrumbLabel-BQ9dJI6T.js → useBreadcrumbLabel-CF2KYwsw.js} +1 -1
- package/admin-dist/public/assets/{usePermissions-WUBNg_Id.js → usePermissions-DWBImEOW.js} +1 -1
- package/admin-dist/server/_libs/lucide-react.mjs +50 -43
- package/admin-dist/server/_ssr/{CmsEmptyState-DYh_PPQE.mjs → CmsEmptyState-BM8DghTl.mjs} +1 -1
- package/admin-dist/server/_ssr/{CmsPageHeader-BcniLh49.mjs → CmsPageHeader-BHUmrIWD.mjs} +1 -1
- package/admin-dist/server/_ssr/{CmsStatusBadge-BShWDxwE.mjs → CmsStatusBadge-D0Zb0oRl.mjs} +7 -7
- package/admin-dist/server/_ssr/{CmsSurface-CHEv-Kba.mjs → CmsSurface-B2eBr-47.mjs} +1 -1
- package/admin-dist/server/_ssr/{CmsToolbar-Dqqb216_.mjs → CmsToolbar-BCrwg7OL.mjs} +1 -1
- package/admin-dist/server/_ssr/{ContentEntryEditor-DOIAyWME.mjs → ContentEntryEditor-Cjfm0uhr.mjs} +37 -37
- package/admin-dist/server/_ssr/{TaxonomyFilter-BfsPAZ-Y.mjs → TaxonomyFilter-C4pD0kfM.mjs} +3 -3
- package/admin-dist/server/_ssr/{_contentTypeId-CPjmri90.mjs → _contentTypeId-CiDiX-p7.mjs} +11 -11
- package/admin-dist/server/_ssr/{_entryId-D0yu8HuP.mjs → _entryId-9GxatOkL.mjs} +11 -11
- package/admin-dist/server/_ssr/_tanstack-start-manifest_v-CC7UrHKE.mjs +4 -0
- package/admin-dist/server/_ssr/{badge-Cp61aQNc.mjs → badge-EI998zba.mjs} +1 -1
- package/admin-dist/server/_ssr/{command-BfjE1WJf.mjs → command-BLAWQhUw.mjs} +1 -1
- package/admin-dist/server/_ssr/{content-DrODe6sA.mjs → content-BHX39L4D.mjs} +31 -22
- package/admin-dist/server/_ssr/{content-types-BPgMwxiT.mjs → content-types-DCzrBhTH.mjs} +9 -9
- package/admin-dist/server/_ssr/{index-BTHmIC9W.mjs → index-DwM_5VNP.mjs} +92 -6
- package/admin-dist/server/_ssr/index.mjs +2 -2
- package/admin-dist/server/_ssr/{media-DkvBfmD9.mjs → media-CbzgTRRQ.mjs} +9 -9
- package/admin-dist/server/_ssr/{new._contentTypeId-Co_73sDJ.mjs → new._contentTypeId-6Ph-Gtlw.mjs} +10 -10
- package/admin-dist/server/_ssr/{router-CaDgRHfQ.mjs → router-vd1nySeP.mjs} +45 -35
- package/admin-dist/server/_ssr/{scroll-area-D3v-O_jk.mjs → scroll-area--B9snFTJ.mjs} +1 -1
- package/admin-dist/server/_ssr/{settings-MaEXh2Hz.mjs → settings-DlTO2JSj.mjs} +11 -11
- package/admin-dist/server/_ssr/{switch-DmbR03dm.mjs → switch-C05NgNW0.mjs} +1 -1
- package/admin-dist/server/_ssr/{tabs-5oFlAGLz.mjs → tabs-DAk2J5xy.mjs} +8 -8
- package/admin-dist/server/_ssr/{tanstack-adapter-DNaUioIZ.mjs → tanstack-adapter-DWbaPByn.mjs} +15 -1
- package/admin-dist/server/_ssr/{taxonomies-D3xMK23a.mjs → taxonomies-B8nqce6u.mjs} +12 -12
- package/admin-dist/server/_ssr/{trash-CNw1mtF1.mjs → trash-zdlZgpTo.mjs} +7 -7
- package/admin-dist/server/_ssr/{useBreadcrumbLabel-BQGjOTcy.mjs → useBreadcrumbLabel-DpEKyG1h.mjs} +1 -1
- package/admin-dist/server/_ssr/{usePermissions-D0qtvmNi.mjs → usePermissions-olYRd9S9.mjs} +1 -1
- package/admin-dist/server/index.mjs +164 -157
- package/dist/client/admin/contentTypes.d.ts +25 -0
- package/dist/client/admin/contentTypes.d.ts.map +1 -1
- package/dist/client/admin/contentTypes.js +212 -6
- package/dist/client/admin/contentTypes.js.map +1 -1
- package/dist/client/admin/entries.d.ts.map +1 -1
- package/dist/client/admin/entries.js +27 -0
- package/dist/client/admin/entries.js.map +1 -1
- package/dist/client/admin/index.d.ts +4 -0
- package/dist/client/admin/index.d.ts.map +1 -1
- package/dist/client/admin/index.js +16 -0
- package/dist/client/admin/index.js.map +1 -1
- package/dist/client/admin/types.d.ts +4 -0
- package/dist/client/admin/types.d.ts.map +1 -1
- package/dist/client/schema/defineContentType.d.ts.map +1 -1
- package/dist/client/schema/defineContentType.js +99 -80
- package/dist/client/schema/defineContentType.js.map +1 -1
- package/dist/component/contentTypeMutations.d.ts.map +1 -1
- package/dist/component/contentTypeMutations.js +5 -4
- package/dist/component/contentTypeMutations.js.map +1 -1
- package/package.json +2 -2
- package/admin-dist/public/assets/CmsStatusBadge-nZ9TeLBL.js +0 -1
- package/admin-dist/public/assets/ContentEntryEditor-BDb44eTo.js +0 -4
- package/admin-dist/public/assets/_entryId-OY3sLz6O.js +0 -1
- package/admin-dist/public/assets/alert-BbW1Q9CR.js +0 -1
- package/admin-dist/public/assets/badge-DdM8Eua8.js +0 -1
- package/admin-dist/public/assets/content-BV3YeSSW.js +0 -1
- package/admin-dist/public/assets/content-types-Bm4b2tf8.js +0 -1
- package/admin-dist/public/assets/globals-D41WzvyZ.css +0 -1
- package/admin-dist/public/assets/index-DnJ5Twlv.js +0 -1
- package/admin-dist/public/assets/media-BIMN5jXt.js +0 -1
- package/admin-dist/public/assets/new._contentTypeId-DTWb8ZDl.js +0 -1
- package/admin-dist/public/assets/settings-DaNDUtr5.js +0 -1
- package/admin-dist/public/assets/tabs-RN__emeJ.js +0 -1
- package/admin-dist/public/assets/taxonomies-DylY9HE1.js +0 -1
- package/admin-dist/server/_ssr/_tanstack-start-manifest_v-DgCpSt_y.mjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trash-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trash-D7e0uKd9.js","assets/CmsPageHeader-SoF4Epu9.js","assets/CmsToolbar-DlZPMe2B.js","assets/search-DKKh_DdH.js","assets/CmsEmptyState-6-PLaXtD.js","assets/CmsSurface-BvksBm6W.js","assets/badge-oJv4Eai8.js","assets/alert-BAHTL6ao.js","assets/rotate-ccw-B45JsL5f.js","assets/tanstack-adapter-f7AHmQ5L.js","assets/taxonomies-DvMppdiD.js","assets/pencil-CX1CiTDD.js","assets/scroll-area-b3A1HHR7.js","assets/settings-CGVDEV1r.js","assets/usePermissions-DWBImEOW.js","assets/switch-BTMY8Qnk.js","assets/media-B2i-mCbx.js","assets/tabs-DUQwUoIb.js","assets/refresh-cw-Cm-YOeFI.js","assets/TaxonomyFilter-CFX1_g8s.js","assets/command-DwgQs69u.js","assets/content-types-BrttaLpc.js","assets/content-CKQ4QwW2.js","assets/circle-check-big-3OHxNDhO.js","assets/CmsStatusBadge-D7kYaohx.js","assets/index-DOkgTSx0.js","assets/_entryId-D3lr5Dvy.js","assets/ContentEntryEditor-C6n9xLS9.js","assets/useBreadcrumbLabel-CF2KYwsw.js","assets/_contentTypeId-DTv8UoTp.js","assets/new._contentTypeId-VF63rpic.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function QT(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(s,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function tx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fh={exports:{}},Ui={};var E0;function GT(){if(E0)return Ui;E0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,i,c){var u=null;if(c!==void 0&&(u=""+c),i.key!==void 0&&(u=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:e,type:s,key:u,ref:i!==void 0?i:null,props:c}}return Ui.Fragment=t,Ui.jsx=r,Ui.jsxs=r,Ui}var R0;function YT(){return R0||(R0=1,Fh.exports=GT()),Fh.exports}var g=YT(),Vh={exports:{}},Te={};var T0;function KT(){if(T0)return Te;T0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=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"),v=Symbol.for("react.activity"),b=Symbol.iterator;function _(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function O(z,Q,ne){this.props=z,this.context=Q,this.refs=C,this.updater=ne||E}O.prototype.isReactComponent={},O.prototype.setState=function(z,Q){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,Q,"setState")},O.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function M(){}M.prototype=O.prototype;function k(z,Q,ne){this.props=z,this.context=Q,this.refs=C,this.updater=ne||E}var D=k.prototype=new M;D.constructor=k,x(D,O.prototype),D.isPureReactComponent=!0;var U=Array.isArray;function H(){}var L={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function G(z,Q,ne){var oe=ne.ref;return{$$typeof:e,type:z,key:Q,ref:oe!==void 0?oe:null,props:ne}}function ie(z,Q){return G(z.type,Q,z.props)}function ae(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function te(z){var Q={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(ne){return Q[ne]})}var ce=/\/+/g;function le(z,Q){return typeof z=="object"&&z!==null&&z.key!=null?te(""+z.key):Q.toString(36)}function me(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(H,H):(z.status="pending",z.then(function(Q){z.status==="pending"&&(z.status="fulfilled",z.value=Q)},function(Q){z.status==="pending"&&(z.status="rejected",z.reason=Q)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function I(z,Q,ne,oe,pe){var ye=typeof z;(ye==="undefined"||ye==="boolean")&&(z=null);var X=!1;if(z===null)X=!0;else switch(ye){case"bigint":case"string":case"number":X=!0;break;case"object":switch(z.$$typeof){case e:case t:X=!0;break;case y:return X=z._init,I(X(z._payload),Q,ne,oe,pe)}}if(X)return pe=pe(z),X=oe===""?"."+le(z,0):oe,U(pe)?(ne="",X!=null&&(ne=X.replace(ce,"$&/")+"/"),I(pe,Q,ne,"",function(Re){return Re})):pe!=null&&(ae(pe)&&(pe=ie(pe,ne+(pe.key==null||z&&z.key===pe.key?"":(""+pe.key).replace(ce,"$&/")+"/")+X)),Q.push(pe)),1;X=0;var _e=oe===""?".":oe+":";if(U(z))for(var xe=0;xe<z.length;xe++)oe=z[xe],ye=_e+le(oe,xe),X+=I(oe,Q,ne,ye,pe);else if(xe=_(z),typeof xe=="function")for(z=xe.call(z),xe=0;!(oe=z.next()).done;)oe=oe.value,ye=_e+le(oe,xe++),X+=I(oe,Q,ne,ye,pe);else if(ye==="object"){if(typeof z.then=="function")return I(me(z),Q,ne,oe,pe);throw Q=String(z),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return X}function K(z,Q,ne){if(z==null)return z;var oe=[],pe=0;return I(z,oe,"","",function(ye){return Q.call(ne,ye,pe++)}),oe}function V(z){if(z._status===-1){var Q=z._result;Q=Q(),Q.then(function(ne){(z._status===0||z._status===-1)&&(z._status=1,z._result=ne)},function(ne){(z._status===0||z._status===-1)&&(z._status=2,z._result=ne)}),z._status===-1&&(z._status=0,z._result=Q)}if(z._status===1)return z._result.default;throw z._result}var re=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=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(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},ve={map:K,forEach:function(z,Q,ne){K(z,function(){Q.apply(this,arguments)},ne)},count:function(z){var Q=0;return K(z,function(){Q++}),Q},toArray:function(z){return K(z,function(Q){return Q})||[]},only:function(z){if(!ae(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Te.Activity=v,Te.Children=ve,Te.Component=O,Te.Fragment=r,Te.Profiler=i,Te.PureComponent=k,Te.StrictMode=s,Te.Suspense=h,Te.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Te.__COMPILER_RUNTIME={__proto__:null,c:function(z){return L.H.useMemoCache(z)}},Te.cache=function(z){return function(){return z.apply(null,arguments)}},Te.cacheSignal=function(){return null},Te.cloneElement=function(z,Q,ne){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var oe=x({},z.props),pe=z.key;if(Q!=null)for(ye in Q.key!==void 0&&(pe=""+Q.key),Q)!j.call(Q,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&Q.ref===void 0||(oe[ye]=Q[ye]);var ye=arguments.length-2;if(ye===1)oe.children=ne;else if(1<ye){for(var X=Array(ye),_e=0;_e<ye;_e++)X[_e]=arguments[_e+2];oe.children=X}return G(z.type,pe,oe)},Te.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},Te.createElement=function(z,Q,ne){var oe,pe={},ye=null;if(Q!=null)for(oe in Q.key!==void 0&&(ye=""+Q.key),Q)j.call(Q,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(pe[oe]=Q[oe]);var X=arguments.length-2;if(X===1)pe.children=ne;else if(1<X){for(var _e=Array(X),xe=0;xe<X;xe++)_e[xe]=arguments[xe+2];pe.children=_e}if(z&&z.defaultProps)for(oe in X=z.defaultProps,X)pe[oe]===void 0&&(pe[oe]=X[oe]);return G(z,ye,pe)},Te.createRef=function(){return{current:null}},Te.forwardRef=function(z){return{$$typeof:f,render:z}},Te.isValidElement=ae,Te.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:V}},Te.memo=function(z,Q){return{$$typeof:p,type:z,compare:Q===void 0?null:Q}},Te.startTransition=function(z){var Q=L.T,ne={};L.T=ne;try{var oe=z(),pe=L.S;pe!==null&&pe(ne,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(H,re)}catch(ye){re(ye)}finally{Q!==null&&ne.types!==null&&(Q.types=ne.types),L.T=Q}},Te.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Te.use=function(z){return L.H.use(z)},Te.useActionState=function(z,Q,ne){return L.H.useActionState(z,Q,ne)},Te.useCallback=function(z,Q){return L.H.useCallback(z,Q)},Te.useContext=function(z){return L.H.useContext(z)},Te.useDebugValue=function(){},Te.useDeferredValue=function(z,Q){return L.H.useDeferredValue(z,Q)},Te.useEffect=function(z,Q){return L.H.useEffect(z,Q)},Te.useEffectEvent=function(z){return L.H.useEffectEvent(z)},Te.useId=function(){return L.H.useId()},Te.useImperativeHandle=function(z,Q,ne){return L.H.useImperativeHandle(z,Q,ne)},Te.useInsertionEffect=function(z,Q){return L.H.useInsertionEffect(z,Q)},Te.useLayoutEffect=function(z,Q){return L.H.useLayoutEffect(z,Q)},Te.useMemo=function(z,Q){return L.H.useMemo(z,Q)},Te.useOptimistic=function(z,Q){return L.H.useOptimistic(z,Q)},Te.useReducer=function(z,Q,ne){return L.H.useReducer(z,Q,ne)},Te.useRef=function(z){return L.H.useRef(z)},Te.useState=function(z){return L.H.useState(z)},Te.useSyncExternalStore=function(z,Q,ne){return L.H.useSyncExternalStore(z,Q,ne)},Te.useTransition=function(){return L.H.useTransition()},Te.version="19.2.3",Te}var A0;function vc(){return A0||(A0=1,Vh.exports=KT()),Vh.exports}var w=vc();const qt=tx(w),Yu=QT({__proto__:null,default:qt},[w]);var Hh={exports:{}},Bi={},Zh={exports:{}},Qh={};var O0;function XT(){return O0||(O0=1,(function(e){function t(I,K){var V=I.length;I.push(K);e:for(;0<V;){var re=V-1>>>1,ve=I[re];if(0<i(ve,K))I[re]=K,I[V]=ve,V=re;else break e}}function r(I){return I.length===0?null:I[0]}function s(I){if(I.length===0)return null;var K=I[0],V=I.pop();if(V!==K){I[0]=V;e:for(var re=0,ve=I.length,z=ve>>>1;re<z;){var Q=2*(re+1)-1,ne=I[Q],oe=Q+1,pe=I[oe];if(0>i(ne,V))oe<ve&&0>i(pe,ne)?(I[re]=pe,I[oe]=V,re=oe):(I[re]=ne,I[Q]=V,re=Q);else if(oe<ve&&0>i(pe,V))I[re]=pe,I[oe]=V,re=oe;else break e}}return K}function i(I,K){var V=I.sortIndex-K.sortIndex;return V!==0?V:I.id-K.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,v=null,b=3,_=!1,E=!1,x=!1,C=!1,O=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function D(I){for(var K=r(p);K!==null;){if(K.callback===null)s(p);else if(K.startTime<=I)s(p),K.sortIndex=K.expirationTime,t(h,K);else break;K=r(p)}}function U(I){if(x=!1,D(I),!E)if(r(h)!==null)E=!0,H||(H=!0,te());else{var K=r(p);K!==null&&me(U,K.startTime-I)}}var H=!1,L=-1,j=5,G=-1;function ie(){return C?!0:!(e.unstable_now()-G<j)}function ae(){if(C=!1,H){var I=e.unstable_now();G=I;var K=!0;try{e:{E=!1,x&&(x=!1,M(L),L=-1),_=!0;var V=b;try{t:{for(D(I),v=r(h);v!==null&&!(v.expirationTime>I&&ie());){var re=v.callback;if(typeof re=="function"){v.callback=null,b=v.priorityLevel;var ve=re(v.expirationTime<=I);if(I=e.unstable_now(),typeof ve=="function"){v.callback=ve,D(I),K=!0;break t}v===r(h)&&s(h),D(I)}else s(h);v=r(h)}if(v!==null)K=!0;else{var z=r(p);z!==null&&me(U,z.startTime-I),K=!1}}break e}finally{v=null,b=V,_=!1}K=void 0}}finally{K?te():H=!1}}}var te;if(typeof k=="function")te=function(){k(ae)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,le=ce.port2;ce.port1.onmessage=ae,te=function(){le.postMessage(null)}}else te=function(){O(ae,0)};function me(I,K){L=O(function(){I(e.unstable_now())},K)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(I){switch(b){case 1:case 2:case 3:var K=3;break;default:K=b}var V=b;b=K;try{return I()}finally{b=V}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(I,K){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var V=b;b=I;try{return K()}finally{b=V}},e.unstable_scheduleCallback=function(I,K,V){var re=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?re+V:re):V=re,I){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=V+ve,I={id:y++,callback:K,priorityLevel:I,startTime:V,expirationTime:ve,sortIndex:-1},V>re?(I.sortIndex=V,t(p,I),r(h)===null&&I===r(p)&&(x?(M(L),L=-1):x=!0,me(U,V-re))):(I.sortIndex=ve,t(h,I),E||_||(E=!0,H||(H=!0,te()))),I},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(I){var K=b;return function(){var V=b;b=K;try{return I.apply(this,arguments)}finally{b=V}}}})(Qh)),Qh}var k0;function JT(){return k0||(k0=1,Zh.exports=XT()),Zh.exports}var Gh={exports:{}},Bt={};var M0;function WT(){if(M0)return Bt;M0=1;var e=vc();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 r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},i=Symbol.for("react.portal");function c(h,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:v==null?null:""+v,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 Bt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Bt.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)},Bt.flushSync=function(h){var p=u.T,y=s.p;try{if(u.T=null,s.p=2,h)return h()}finally{u.T=p,s.p=y,s.d.f()}},Bt.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(h,p))},Bt.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Bt.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,v=f(y,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,_=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?s.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:_}):y==="script"&&s.d.X(h,{crossOrigin:v,integrity:b,fetchPriority:_,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Bt.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);s.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&&s.d.M(h)},Bt.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=f(y,p.crossOrigin);s.d.L(h,y,{crossOrigin:v,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})}},Bt.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=f(p.as,p.crossOrigin);s.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 s.d.m(h)},Bt.requestFormReset=function(h){s.d.r(h)},Bt.unstable_batchedUpdates=function(h,p){return h(p)},Bt.useFormState=function(h,p,y){return u.H.useFormState(h,p,y)},Bt.useFormStatus=function(){return u.H.useHostTransitionStatus()},Bt.version="19.2.3",Bt}var N0;function nx(){if(N0)return Gh.exports;N0=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(),Gh.exports=WT(),Gh.exports}var j0;function eA(){if(j0)return Bi;j0=1;var e=JT(),t=vc(),r=nx();function s(n){var o="https://react.dev/errors/"+n;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)o+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){var o=n,a=n;if(n.alternate)for(;o.return;)o=o.return;else{n=o;do o=n,(o.flags&4098)!==0&&(a=o.return),n=o.return;while(n)}return o.tag===3?a:null}function u(n){if(n.tag===13){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function f(n){if(n.tag===31){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function h(n){if(c(n)!==n)throw Error(s(188))}function p(n){var o=n.alternate;if(!o){if(o=c(n),o===null)throw Error(s(188));return o!==n?null:n}for(var a=n,l=o;;){var d=a.return;if(d===null)break;var m=d.alternate;if(m===null){if(l=d.return,l!==null){a=l;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===a)return h(d),n;if(m===l)return h(d),o;m=m.sibling}throw Error(s(188))}if(a.return!==l.return)a=d,l=m;else{for(var S=!1,R=d.child;R;){if(R===a){S=!0,a=d,l=m;break}if(R===l){S=!0,l=d,a=m;break}R=R.sibling}if(!S){for(R=m.child;R;){if(R===a){S=!0,a=m,l=d;break}if(R===l){S=!0,l=m,a=d;break}R=R.sibling}if(!S)throw Error(s(189))}}if(a.alternate!==l)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:o}function y(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n;for(n=n.child;n!==null;){if(o=y(n),o!==null)return o;n=n.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),k=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function te(n){return n===null||typeof n!="object"?null:(n=ae&&n[ae]||n["@@iterator"],typeof n=="function"?n:null)}var ce=Symbol.for("react.client.reference");function le(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ce?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case x:return"Fragment";case O:return"Profiler";case C:return"StrictMode";case U:return"Suspense";case H:return"SuspenseList";case G:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case k:return n.displayName||"Context";case M:return(n._context.displayName||"Context")+".Consumer";case D:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case L:return o=n.displayName||null,o!==null?o:le(n.type)||"Memo";case j:o=n._payload,n=n._init;try{return le(n(o))}catch{}}return null}var me=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},re=[],ve=-1;function z(n){return{current:n}}function Q(n){0>ve||(n.current=re[ve],re[ve]=null,ve--)}function ne(n,o){ve++,re[ve]=n.current,n.current=o}var oe=z(null),pe=z(null),ye=z(null),X=z(null);function _e(n,o){switch(ne(ye,o),ne(pe,n),ne(oe,null),o.nodeType){case 9:case 11:n=(n=o.documentElement)&&(n=n.namespaceURI)?Gb(n):0;break;default:if(n=o.tagName,o=o.namespaceURI)o=Gb(o),n=Yb(o,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Q(oe),ne(oe,n)}function xe(){Q(oe),Q(pe),Q(ye)}function Re(n){n.memoizedState!==null&&ne(X,n);var o=oe.current,a=Yb(o,n.type);o!==a&&(ne(pe,n),ne(oe,a))}function Ae(n){pe.current===n&&(Q(oe),Q(pe)),X.current===n&&(Q(X),Pi._currentValue=V)}var Le,yt;function vt(n){if(Le===void 0)try{throw Error()}catch(a){var o=a.stack.trim().match(/\n( *(at )?)/);Le=o&&o[1]||"",yt=-1<a.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Le+n+yt}var Sn=!1;function Yt(n,o){if(!n||Sn)return"";Sn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(o){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(Z){var F=Z}Reflect.construct(n,[],ee)}else{try{ee.call()}catch(Z){F=Z}n.call(ee.prototype)}}else{try{throw Error()}catch(Z){F=Z}(ee=n())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(Z){if(Z&&F&&typeof Z.stack=="string")return[Z.stack,F.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),S=m[0],R=m[1];if(S&&R){var N=S.split(`
|
|
@@ -16,7 +16,7 @@ Error generating stack: `+l.message+`
|
|
|
16
16
|
`);if(p>=0){const y=i.slice(0,p).trim();i=i.slice(p+1),y.length>0&&(u=JSON.parse(y),c=!0)}}}return(async()=>{try{for(;;){const{value:f,done:h}=await s.read();f&&(i+=f);const p=i.lastIndexOf(`
|
|
17
17
|
`);if(p>=0){const y=i.slice(0,p);i=i.slice(p+1);const v=y.split(`
|
|
18
18
|
`).filter(Boolean);for(const b of v)try{t(JSON.parse(b))}catch(_){r?.(`Invalid JSON line: ${b}`,_)}}if(h)break}}catch(f){r?.("Stream processing error:",f)}})(),t(u)}async function uj({jsonStream:e,onMessage:t,onError:r}){const s=e.getReader(),{value:i,done:c}=await s.read();if(c||!i)throw new Error("Stream ended before first object");const u=JSON.parse(i);return(async()=>{try{for(;;){const{value:f,done:h}=await s.read();if(h)break;if(f)try{t(JSON.parse(f))}catch(p){r?.(`Invalid JSON: ${f}`,p)}}}catch(f){r?.("Stream processing error:",f)}})(),t(u)}function d1(e){const t="/_serverFn/"+e;return Object.assign((...i)=>{const c=Tm()?.serverFns?.fetch;return aj(t,i,c??fetch)},{url:t,serverFnMeta:{id:e},[Vp]:!0})}const fj={key:"$TSS/serverfn",test:e=>typeof e!="function"||!(Vp in e)?!1:!!e[Vp],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>d1(e)};var sr=[],Dn=[],dj=Uint8Array,dp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var da=0,hj=dp.length;da<hj;++da)sr[da]=dp[da],Dn[dp.charCodeAt(da)]=da;Dn[45]=62;Dn[95]=63;function pj(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var s=r===t?0:4-r%4;return[r,s]}function mj(e,t,r){return(t+r)*3/4-r}function cc(e){var t,r=pj(e),s=r[0],i=r[1],c=new dj(mj(e,s,i)),u=0,f=i>0?s-4:s,h;for(h=0;h<f;h+=4)t=Dn[e.charCodeAt(h)]<<18|Dn[e.charCodeAt(h+1)]<<12|Dn[e.charCodeAt(h+2)]<<6|Dn[e.charCodeAt(h+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return i===2&&(t=Dn[e.charCodeAt(h)]<<2|Dn[e.charCodeAt(h+1)]>>4,c[u++]=t&255),i===1&&(t=Dn[e.charCodeAt(h)]<<10|Dn[e.charCodeAt(h+1)]<<4|Dn[e.charCodeAt(h+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function gj(e){return sr[e>>18&63]+sr[e>>12&63]+sr[e>>6&63]+sr[e&63]}function yj(e,t,r){for(var s,i=[],c=t;c<r;c+=3)s=(e[c]<<16&16711680)+(e[c+1]<<8&65280)+(e[c+2]&255),i.push(gj(s));return i.join("")}function lc(e){for(var t,r=e.length,s=r%3,i=[],c=16383,u=0,f=r-s;u<f;u+=c)i.push(yj(e,u,u+c>f?f:u+c));return s===1?(t=e[r-1],i.push(sr[t>>2]+sr[t<<4&63]+"==")):s===2&&(t=(e[r-2]<<8)+e[r-1],i.push(sr[t>>10]+sr[t>>4&63]+sr[t<<2&63]+"=")),i.join("")}function Lr(e){if(e===void 0)return{};if(!h1(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function vj(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 h1(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),s=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&s}const p1=!0,za=BigInt("-9223372036854775808"),Am=BigInt("9223372036854775807"),Hp=BigInt("0"),bj=BigInt("8"),wj=BigInt("256");function m1(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function Sj(e){e<Hp&&(e-=za+za);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let s=0;for(const i of t.match(/.{2}/g).reverse())r.set([parseInt(i,16)],s++),e>>=bj;return lc(r)}function xj(e){const t=cc(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=Hp,s=Hp;for(const i of t)r+=BigInt(i)*wj**s,s++;return r>Am&&(r+=za+za),r}function _j(e){if(e<za||Am<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),lc(new Uint8Array(t))}function Cj(e){const t=cc(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 Ej=DataView.prototype.setBigInt64?_j:Sj,Rj=DataView.prototype.getBigInt64?Cj:xj,mw=1024;function g1(e){if(e.length>mw)throw new Error(`Field name ${e} exceeds maximum field name length ${mw}.`);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 r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function Da(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>Da(s));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const s=t[0][0];if(s==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return cc(e.$bytes).buffer}if(s==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return Rj(e.$integer)}if(s==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const i=cc(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const u=new DataView(i.buffer).getFloat64(0,p1);if(!m1(u))throw new Error(`Float ${u} should be encoded as a number`);return u}if(s==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(s==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[s,i]of Object.entries(e))g1(s),r[s]=Da(i);return r}const gw=16384;function nc(e){const t=JSON.stringify(e,(r,s)=>s===void 0?"undefined":typeof s=="bigint"?`${s.toString()}n`:s);if(t.length>gw){const r="[...truncated]";let s=gw-r.length;const i=t.codePointAt(s-1);return i!==void 0&&i>65535&&(s-=1),t.substring(0,s)+r}return t}function Zp(e,t,r,s){if(e===void 0){const u=r&&` (present at path ${r} in original object ${nc(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<za||Am<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:Ej(e)}}if(typeof e=="number")if(m1(e)){const u=new ArrayBuffer(8);return new DataView(u).setFloat64(0,e,p1),{$float:lc(new Uint8Array(u))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:lc(new Uint8Array(e))};if(Array.isArray(e))return e.map((u,f)=>Zp(u,t,r+`[${f}]`));if(e instanceof Set)throw new Error(hp(r,"Set",[...e],t));if(e instanceof Map)throw new Error(hp(r,"Map",[...e],t));if(!h1(e)){const u=e?.constructor?.name,f=u?`${u} `:"";throw new Error(hp(r,f,e,t))}const i={},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&&(g1(u),i[u]=Zp(f,t,r+`.${u}`));return i}function hp(e,t,r,s){return e?`${t}${nc(r)} is not a supported Convex type (present at path ${e} in original object ${nc(s)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${nc(r)} is not a supported Convex type.`}function Gn(e){return Zp(e,e,"")}var Tj=Object.defineProperty,Aj=(e,t,r)=>t in e?Tj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,it=(e,t,r)=>Aj(e,typeof t!="symbol"?t+"":t,r);const Oj="https://docs.convex.dev/error#undefined-validator";function uc(e,t){const r=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${r} in ${e}. This is often caused by circular imports. See ${Oj} for details.`)}class wn{constructor({isOptional:t}){it(this,"type"),it(this,"fieldPaths"),it(this,"isOptional"),it(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}}class Om extends wn{constructor({isOptional:t,tableName:r}){if(super({isOptional:t}),it(this,"tableName"),it(this,"kind","id"),typeof r!="string")throw new Error("v.id(tableName) requires a string");this.tableName=r}get json(){return{type:"id",tableName:this.tableName}}asOptional(){return new Om({isOptional:"optional",tableName:this.tableName})}}class Ou extends wn{constructor(){super(...arguments),it(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new Ou({isOptional:"optional"})}}class ku extends wn{constructor(){super(...arguments),it(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new ku({isOptional:"optional"})}}class km extends wn{constructor(){super(...arguments),it(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new km({isOptional:"optional"})}}class Mm extends wn{constructor(){super(...arguments),it(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new Mm({isOptional:"optional"})}}class Nm extends wn{constructor(){super(...arguments),it(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new Nm({isOptional:"optional"})}}class jm extends wn{constructor(){super(...arguments),it(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new jm({isOptional:"optional"})}}class zm extends wn{constructor(){super(...arguments),it(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new zm({isOptional:"optional"})}}class rs extends wn{constructor({isOptional:t,fields:r}){super({isOptional:t}),it(this,"fields"),it(this,"kind","object"),globalThis.Object.entries(r).forEach(([s,i])=>{if(i===void 0&&uc("v.object()",s),!i.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=r}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,r])=>[t,{fieldType:r.json,optional:r.isOptional==="optional"}]))}}asOptional(){return new rs({isOptional:"optional",fields:this.fields})}omit(...t){const r={...this.fields};for(const s of t)delete r[s];return new rs({isOptional:this.isOptional,fields:r})}pick(...t){const r={};for(const s of t)r[s]=this.fields[s];return new rs({isOptional:this.isOptional,fields:r})}partial(){const t={};for(const[r,s]of globalThis.Object.entries(this.fields))t[r]=s.asOptional();return new rs({isOptional:this.isOptional,fields:t})}extend(t){return new rs({isOptional:this.isOptional,fields:{...this.fields,...t}})}}class Dm extends wn{constructor({isOptional:t,value:r}){if(super({isOptional:t}),it(this,"value"),it(this,"kind","literal"),typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"&&typeof r!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=r}get json(){return{type:this.kind,value:Gn(this.value)}}asOptional(){return new Dm({isOptional:"optional",value:this.value})}}class Pm extends wn{constructor({isOptional:t,element:r}){super({isOptional:t}),it(this,"element"),it(this,"kind","array"),r===void 0&&uc("v.array()"),this.element=r}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new Pm({isOptional:"optional",element:this.element})}}class Lm extends wn{constructor({isOptional:t,key:r,value:s}){if(super({isOptional:t}),it(this,"key"),it(this,"value"),it(this,"kind","record"),r===void 0&&uc("v.record()","key"),s===void 0&&uc("v.record()","value"),r.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(s.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!r.isConvexValidator||!s.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=r,this.value=s}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new Lm({isOptional:"optional",key:this.key,value:this.value})}}class Im extends wn{constructor({isOptional:t,members:r}){super({isOptional:t}),it(this,"members"),it(this,"kind","union"),r.forEach((s,i)=>{if(s===void 0&&uc("v.union()",`member at index ${i}`),!s.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=r}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}asOptional(){return new Im({isOptional:"optional",members:this.members})}}const et={id:e=>new Om({isOptional:"required",tableName:e}),null:()=>new jm({isOptional:"required"}),number:()=>new Ou({isOptional:"required"}),float64:()=>new Ou({isOptional:"required"}),bigint:()=>new ku({isOptional:"required"}),int64:()=>new ku({isOptional:"required"}),boolean:()=>new km({isOptional:"required"}),string:()=>new Nm({isOptional:"required"}),bytes:()=>new Mm({isOptional:"required"}),literal:e=>new Dm({isOptional:"required",value:e}),array:e=>new Pm({isOptional:"required",element:e}),object:e=>new rs({isOptional:"required",fields:e}),record:(e,t)=>new Lm({isOptional:"required",key:e,value:t}),union:(...e)=>new Im({isOptional:"required",members:e}),any:()=>new zm({isOptional:"required"}),optional:e=>e.asOptional(),nullable:e=>et.union(e,et.null())};var kj=Object.defineProperty,Mj=(e,t,r)=>t in e?kj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pp=(e,t,r)=>Mj(e,typeof t!="symbol"?t+"":t,r),yw,vw;const Nj=Symbol.for("ConvexError");class Qp extends(vw=Error,yw=Nj,vw){constructor(t){super(typeof t=="string"?t:nc(t)),pp(this,"name","ConvexError"),pp(this,"data"),pp(this,yw,!0),this.data=t}}const y1=()=>Array.from({length:4},()=>0);y1();y1();const bw="1.31.6";var jj=Object.defineProperty,zj=(e,t,r)=>t in e?jj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ww=(e,t,r)=>zj(e,typeof t!="symbol"?t+"":t,r);const Dj="color:rgb(0, 145, 255)";function v1(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class b1{constructor(t){ww(this,"_onLogLineFuncs"),ww(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let r=Math.random().toString(36).substring(2,15);for(let s=0;s<10&&this._onLogLineFuncs[r]!==void 0;s++)r=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[r]=t,()=>{delete this._onLogLineFuncs[r]}}logVerbose(...t){if(this._verbose)for(const r of Object.values(this._onLogLineFuncs))r("debug",`${new Date().toISOString()}`,...t)}log(...t){for(const r of Object.values(this._onLogLineFuncs))r("info",...t)}warn(...t){for(const r of Object.values(this._onLogLineFuncs))r("warn",...t)}error(...t){for(const r of Object.values(this._onLogLineFuncs))r("error",...t)}}function w1(e){const t=new b1(e);return t.addLogLineListener((r,...s)=>{switch(r){case"debug":console.debug(...s);break;case"info":console.log(...s);break;case"warn":console.warn(...s);break;case"error":console.error(...s);break;default:console.log(...s)}}),t}function S1(e){return new b1(e)}function Mu(e,t,r,s,i){const c=v1(r);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t==="info"){const u=i.match(/^\[.*?\] /);if(u===null){e.error(`[CONVEX ${c}(${s})] Could not parse console.log`);return}const f=i.slice(1,u[0].length-2),h=i.slice(u[0].length);e.log(`%c[CONVEX ${c}(${s})] [${f}]`,Dj,h)}else e.error(`[CONVEX ${c}(${s})] ${i}`)}function Pj(e,t){const r=`[CONVEX FATAL ERROR] ${t}`;return e.error(r),new Error(r)}function wa(e,t,r){return`[CONVEX ${v1(e)}(${t})] ${r.errorMessage}
|
|
19
|
-
Called by client`}function Gp(e,t){return t.data=e.errorData,t}function ms(e){const t=e.split(":");let r,s;return t.length===1?(r=t[0],s="default"):(r=t.slice(0,t.length-1).join(":"),s=t[t.length-1]),r.endsWith(".js")&&(r=r.slice(0,-3)),`${r}:${s}`}function fs(e,t){return JSON.stringify({udfPath:ms(e),args:Gn(t)})}function Sw(e,t,r){const{initialNumItems:s,id:i}=r;return JSON.stringify({type:"paginated",udfPath:ms(e),args:Gn(t),options:Gn({initialNumItems:s,id:i})})}var Lj=Object.defineProperty,Ij=(e,t,r)=>t in e?Lj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rr=(e,t,r)=>Ij(e,typeof t!="symbol"?t+"":t,r);class $j{constructor(){rr(this,"nextQueryId"),rr(this,"querySetVersion"),rr(this,"querySet"),rr(this,"queryIdToToken"),rr(this,"identityVersion"),rr(this,"auth"),rr(this,"outstandingQueriesOlderThanRestart"),rr(this,"outstandingAuthOlderThanRestart"),rr(this,"paused"),rr(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,r,s,i){const c=ms(t),u=fs(c,r),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:r,numSubscribers:1,journal:s,componentPath:i};this.querySet.set(u,p),this.queryIdToToken.set(h,u);const y=this.querySetVersion,v=this.querySetVersion+1,b={type:"Add",queryId:h,udfPath:c,args:[Gn(r)],journal:s,componentPath:i};return this.paused?this.pendingQuerySetModifications.set(h,b):this.querySetVersion=v,{queryToken:u,modification:{type:"ModifyQuerySet",baseVersion:y,newVersion:v,modifications:[b]},unsubscribe:()=>this.removeSubscriber(u)}}}transition(t){for(const r of t.modifications)switch(r.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);const s=r.journal;if(s!==void 0){const i=this.queryIdToToken.get(r.queryId);i!==void 0&&(this.querySet.get(i).journal=s)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}}queryId(t,r){const s=ms(t),i=fs(s,r),c=this.querySet.get(i);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 r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...this.auth}}setAdminAuth(t,r){const s={tokenType:"Admin",value:t,impersonating:r};this.auth=s;const i=this.identityVersion;return this.paused||(this.identityVersion=i+1),{type:"Authenticate",baseVersion:i,...s}}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 r=this.queryIdToToken.get(t);return r?this.querySet.get(r).canonicalizedUdfPath:null}queryArgs(t){const r=this.queryIdToToken.get(t);return r?this.querySet.get(r).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 r=[];for(const c of this.querySet.values()){const u={type:"Add",queryId:c.id,udfPath:c.canonicalizedUdfPath,args:[Gn(c.args)],journal:c.journal,componentPath:c.componentPath};r.push(u),t.has(c.id)||this.outstandingQueriesOlderThanRestart.add(c.id)}this.querySetVersion=1;const s={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:r};if(!this.auth)return this.identityVersion=0,[s,void 0];this.outstandingAuthOlderThanRestart=!0;const i={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[s,i]}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,r=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,r]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const r=this.querySet.get(t);if(r.numSubscribers>1)return r.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(r.id),this.outstandingQueriesOlderThanRestart.delete(r.id);const s=this.querySetVersion,i=this.querySetVersion+1,c={type:"Remove",queryId:r.id};return this.paused?this.pendingQuerySetModifications.has(r.id)?this.pendingQuerySetModifications.delete(r.id):this.pendingQuerySetModifications.set(r.id,c):this.querySetVersion=i,{type:"ModifyQuerySet",baseVersion:s,newVersion:i,modifications:[c]}}}}var Uj=Object.defineProperty,Bj=(e,t,r)=>t in e?Uj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xl=(e,t,r)=>Bj(e,typeof t!="symbol"?t+"":t,r);class qj{constructor(t,r){this.logger=t,this.markConnectionStateDirty=r,Xl(this,"inflightRequests"),Xl(this,"requestsOlderThanRestart"),Xl(this,"inflightMutationsCount",0),Xl(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,r){const s=new Promise(i=>{const c=r?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:c,requestedAt:new Date,onResult:i}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),s}onResponse(t){const r=this.inflightRequests.get(t.requestId);if(r===void 0||r.status.status==="Completed")return null;const s=r.message.type==="Mutation"?"mutation":"action",i=r.message.udfPath;for(const h of t.logLines)Mu(this.logger,"info",s,i,h);const c=r.status;let u,f;if(t.success)u={success:!0,logLines:t.logLines,value:Da(t.result)},f=()=>c.onResult(u);else{const h=t.result,{errorData:p}=t;Mu(this.logger,"error",s,i,h),u={success:!1,errorMessage:h,errorData:p!==void 0?Da(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),r.message.type==="Action"?this.inflightActionsCount--:r.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:u}):(r.status={status:"Completed",result:u,ts:t.ts,onResolve:f},null)}removeCompleted(t){const r=new Map;for(const[s,i]of this.inflightRequests.entries()){const c=i.status;c.status==="Completed"&&c.ts.lessThanOrEqual(t)&&(c.onResolve(),r.set(s,c.result),i.message.type==="Mutation"?this.inflightMutationsCount--:i.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(s),this.requestsOlderThanRestart.delete(s))}return r.size>0&&this.markConnectionStateDirty(),r}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[r,s]of this.inflightRequests){if(s.status.status==="NotSent"){s.status.status="Requested",t.push(s.message);continue}if(s.message.type==="Mutation")t.push(s.message);else if(s.message.type==="Action"){if(this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r),this.inflightActionsCount--,s.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");s.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,r]of this.inflightRequests)if(r.status.status==="NotSent"){r.status.status="Requested",t.push(r.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 r of this.inflightRequests.values())r.status.status!=="Completed"&&r.status.requestedAt.getTime()<t&&(t=r.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const fc=Symbol.for("functionName"),x1=Symbol.for("toReferencePath");function Fj(e){return e[x1]??null}function Vj(e){return e.startsWith("function://")}function Hj(e){let t;if(typeof e=="string")Vj(e)?t={functionHandle:e}:t={name:e};else if(e[fc])t={name:e[fc]};else{const r=Fj(e);if(!r)throw new Error(`${e} is not a functionReference`);t={reference:r}}return t}function on(e){const t=Hj(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 r=e[fc];if(!r)throw new Error(`${e} is not a functionReference`);return r}function _1(e){return{[fc]:e}}function C1(e=[]){const t={get(r,s){if(typeof s=="string"){const i=[...e,s];return C1(i)}else if(s===fc){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 i=e.slice(0,-1).join("/"),c=e[e.length-1];return c==="default"?i:i+":"+c}else return s===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}const Zj=C1();var Qj=Object.defineProperty,Gj=(e,t,r)=>t in e?Qj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nu=(e,t,r)=>Gj(e,typeof t!="symbol"?t+"":t,r);class dc{constructor(t){Nu(this,"queryResults"),Nu(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...r){const s=Lr(r[0]),i=on(t),c=this.queryResults.get(fs(i,s));if(c!==void 0)return dc.queryValue(c.result)}getAllQueries(t){const r=[],s=on(t);for(const i of this.queryResults.values())i.udfPath===ms(s)&&r.push({args:i.args,value:dc.queryValue(i.result)});return r}setQuery(t,r,s){const i=Lr(r),c=on(t),u=fs(c,i);let f;s===void 0?f=void 0:f={success:!0,value:s,logLines:[]};const h={udfPath:c,args:i,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 Yj{constructor(){Nu(this,"queryResults"),Nu(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,r){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!r.has(u.mutationId));const s=this.queryResults;this.queryResults=new Map(t);const i=new dc(this.queryResults);for(const u of this.optimisticUpdates)u.update(i);const c=[];for(const[u,f]of this.queryResults){const h=s.get(u);(h===void 0||h.result!==f.result)&&c.push(u)}return c}applyOptimisticUpdate(t,r){this.optimisticUpdates.push({update:t,mutationId:r});const s=new dc(this.queryResults);return t(s),s.modifiedQueries}rawQueryResult(t){const r=this.queryResults.get(t);if(r!==void 0)return r.result}queryResult(t){const r=this.queryResults.get(t);if(r===void 0)return;const s=r.result;if(s!==void 0){if(s.success)return s.value;throw s.errorData!==void 0?Gp(s,new Qp(wa("query",r.udfPath,s))):new Error(wa("query",r.udfPath,s))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var Kj=Object.defineProperty,Xj=(e,t,r)=>t in e?Kj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mp=(e,t,r)=>Xj(e,typeof t!="symbol"?t+"":t,r);class rn{constructor(t,r){mp(this,"low"),mp(this,"high"),mp(this,"__isUnsignedLong__"),this.low=t|0,this.high=r|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new rn(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,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?xw:t>=Jj?Wj:new rn(t%rc|0,t/rc|0)}toString(){return(BigInt(this.high)*BigInt(rc)+BigInt(this.low)).toString()}equals(t){return rn.isLong(t)||(t=rn.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 rn.isLong(t)||(t=rn.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"?rn.fromNumber(t):new rn(t.low,t.high)}}const xw=new rn(0,0),_w=65536,rc=_w*_w,Jj=rc*rc,Wj=new rn(-1,-1);var ez=Object.defineProperty,tz=(e,t,r)=>t in e?ez(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jl=(e,t,r)=>tz(e,typeof t!="symbol"?t+"":t,r);class Cw{constructor(t,r){Jl(this,"version"),Jl(this,"remoteQuerySet"),Jl(this,"queryPath"),Jl(this,"logger"),this.version={querySet:0,ts:rn.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=r}transition(t){const r=t.startVersion;if(this.version.querySet!==r.querySet||this.version.ts.notEquals(r.ts)||this.version.identity!==r.identity)throw new Error(`Invalid start version: ${r.ts.toString()}:${r.querySet}:${r.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const s of t.modifications)switch(s.type){case"QueryUpdated":{const i=this.queryPath(s.queryId);if(i)for(const u of s.logLines)Mu(this.logger,"info","query",i,u);const c=Da(s.value??null);this.remoteQuerySet.set(s.queryId,{success:!0,value:c,logLines:s.logLines});break}case"QueryFailed":{const i=this.queryPath(s.queryId);if(i)for(const u of s.logLines)Mu(this.logger,"info","query",i,u);const{errorData:c}=s;this.remoteQuerySet.set(s.queryId,{success:!1,errorMessage:s.errorMessage,errorData:c!==void 0?Da(c):void 0,logLines:s.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(s.queryId);break}default:throw new Error(`Invalid modification ${s.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function gp(e){const t=cc(e);return rn.fromBytesLE(Array.from(t))}function nz(e){const t=new Uint8Array(e.toBytesLE());return lc(t)}function Ew(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:gp(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:gp(e.startVersion.ts)},endVersion:{...e.endVersion,ts:gp(e.endVersion.ts)}}}}function rz(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:nz(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var oz=Object.defineProperty,sz=(e,t,r)=>t in e?oz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_t=(e,t,r)=>sz(e,typeof t!="symbol"?t+"":t,r);const az=1e3,iz=1001,cz=1005,lz=4040;let pu;function va(){return pu===void 0&&(pu=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(pu+performance.now())}function Rw(){return`t=${Math.round((va()-pu)/100)/10}s`}const E1={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 uz(e){if(e===void 0)return"Unknown";for(const t of Object.keys(E1))if(e.startsWith(t))return t;return"Unknown"}class fz{constructor(t,r,s,i,c,u){this.markConnectionStateDirty=c,this.debug=u,_t(this,"socket"),_t(this,"connectionCount"),_t(this,"_hasEverConnected",!1),_t(this,"lastCloseReason"),_t(this,"transitionChunkBuffer",null),_t(this,"defaultInitialBackoff"),_t(this,"maxBackoff"),_t(this,"retries"),_t(this,"serverInactivityThreshold"),_t(this,"reconnectDueToServerInactivityTimeout"),_t(this,"scheduledReconnect",null),_t(this,"networkOnlineHandler",null),_t(this,"pendingNetworkRecoveryInfo",null),_t(this,"uri"),_t(this,"onOpen"),_t(this,"onResume"),_t(this,"onMessage"),_t(this,"webSocketConstructor"),_t(this,"logger"),_t(this,"onServerDisconnectError"),this.webSocketConstructor=s,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=r.onOpen,this.onResume=r.onResume,this.onMessage=r.onMessage,this.onServerDisconnectError=r.onServerDisconnectError,this.logger=i,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 r=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${r}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const r=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const s=Ew(JSON.parse(r));if(s.type!=="Transition")throw new Error(`Expected Transition, got ${s.type} after assembling chunks`);return s}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:va()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",Rw(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",Rw())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:r}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:r}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(r/1e3)}s of waiting`)}},t.onerror=r=>{this.transitionChunkBuffer=null;const s=r.message;s&&this.logger.log(`WebSocket error message: ${s}`)},t.onmessage=r=>{this.resetServerInactivityTimeout();const s=r.data.length;let i=Ew(JSON.parse(r.data));if(this._logVerbose(`received ws message with type ${i.type}`),i.type==="Ping")return;if(i.type==="TransitionChunk"){const u=this.assembleTransition(i);if(!u)return;i=u,this._logVerbose(`assembled full ws message of type ${i.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${i.type} while buffering TransitionChunks`)),i.type==="Transition"&&this.reportLargeTransition({messageLength:s,transition:i}),this.onMessage(i).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=r=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=r.reason||`closed with code ${r.code}`),r.code!==az&&r.code!==iz&&r.code!==cz&&r.code!==lz){let i=`WebSocket closed with code ${r.code}`;r.reason&&(i+=`: ${r.reason}`),this.logger.log(i),this.onServerDisconnectError&&r.reason&&this.onServerDisconnectError(i)}const s=uz(r.reason);this.scheduleReconnect(s)}}socketState(){return this.socket.state}sendMessage(t){const r={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const s=rz(t),i=JSON.stringify(s);let c=!1;try{this.socket.ws.send(i),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(r)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(r)}`),!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 r=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(r)}ms`);const s=va(),i=setTimeout(()=>{this.scheduledReconnect?.timeout===i&&(this.scheduledReconnect=null,this.connect())},r);this.scheduledReconnect={timeout:i,scheduledAt:s,backoffMs:r}}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=r=>{this._logVerbose("Ignoring message received after close")},new Promise(r=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),r()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=s=>{this._logVerbose("Ignoring message received after close")};const r=new Promise(s=>{t.onclose=()=>{s()}});return t.close(),r}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 r=va()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-r),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(r)}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:va()})):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 s=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:E1[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const i=Math.min(s,this.maxBackoff),c=i*(Math.random()-.5);return i+c}reportLargeTransition({transition:t,messageLength:r}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const s=va()-t.clientClockSkew-t.serverTs/1e6,i=`${Math.round(s)}ms`,c=`${Math.round(r/1e4)/100}MB`,u=r/(s/1e3),f=`${Math.round(u/1e4)/100}MB per second`;this._logVerbose(`received ${c} transition in ${i} at ${f}`),r>2e7?this.logger.log(`received query results totaling more that 20MB (${c}) which will take a long time to download on slower connections`):s>2e4&&this.logger.log(`received query results totaling ${c} which took more than 20s to arrive (${i})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:s,messageLength:r}})}}function dz(){return hz()}function hz(){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 Yi extends Error{}Yi.prototype.name="InvalidTokenError";function pz(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let s=r.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function mz(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 pz(t)}catch{return atob(t)}}function R1(e,t){if(typeof e!="string")throw new Yi("Invalid token specified: must be a string");t||(t={});const r=t.header===!0?0:1,s=e.split(".")[r];if(typeof s!="string")throw new Yi(`Invalid token specified: missing part #${r+1}`);let i;try{i=mz(s)}catch(c){throw new Yi(`Invalid token specified: invalid base64 for part #${r+1} (${c.message})`)}try{return JSON.parse(i)}catch(c){throw new Yi(`Invalid token specified: invalid json for part #${r+1} (${c.message})`)}}var gz=Object.defineProperty,yz=(e,t,r)=>t in e?gz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nn=(e,t,r)=>yz(e,typeof t!="symbol"?t+"":t,r);const vz=480*60*60*1e3,Tw=2;class bz{constructor(t,r,s){Nn(this,"authState",{state:"noAuth"}),Nn(this,"configVersion",0),Nn(this,"syncState"),Nn(this,"authenticate"),Nn(this,"stopSocket"),Nn(this,"tryRestartSocket"),Nn(this,"pauseSocket"),Nn(this,"resumeSocket"),Nn(this,"clearAuth"),Nn(this,"logger"),Nn(this,"refreshTokenLeewaySeconds"),Nn(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=r.authenticate,this.stopSocket=r.stopSocket,this.tryRestartSocket=r.tryRestartSocket,this.pauseSocket=r.pauseSocket,this.resumeSocket=r.resumeSocket,this.clearAuth=r.clearAuth,this.logger=s.logger,this.refreshTokenLeewaySeconds=s.refreshTokenLeewaySeconds}async setConfig(t,r){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const s=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});s.isFromOutdatedConfig||(s.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:r},hasRetried:!1}),this.authenticate(s.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:t,onAuthChange:r}}),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:r}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(r+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>=Tw){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, ${Tw-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const r=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});r.isFromOutdatedConfig||(r.value&&this.syncState.isNewAuth(r.value)?(this.authenticate(r.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:r.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 r=this.decodeToken(t);if(!r){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:s,exp:i}=r;if(!s||!i){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const c=i-s;if(c<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(vz,(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,r){const s=++this.configVersion;this._logVerbose(`fetching token with config version ${s}`);const i=await t(r);return this.configVersion!==s?(this._logVerbose(`stale config version, expected ${s}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:i}}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 r=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(r)}`),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 R1(t)}catch(r){return this._logVerbose(`Error decoding token: ${r instanceof Error?r.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const wz=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function Sz(e,t){const r={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:r})}function xz(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function _z(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const r of wz){const s=performance.getEntriesByName(r).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===e);t.push(...s)}return t.map(xz)}var Cz=Object.defineProperty,Ez=(e,t,r)=>t in e?Cz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ct=(e,t,r)=>Ez(e,typeof t!="symbol"?t+"":t,r);class Rz{constructor(t,r,s){if(Ct(this,"address"),Ct(this,"state"),Ct(this,"requestManager"),Ct(this,"webSocketManager"),Ct(this,"authenticationManager"),Ct(this,"remoteQuerySet"),Ct(this,"optimisticQueryResults"),Ct(this,"_transitionHandlerCounter",0),Ct(this,"_nextRequestId"),Ct(this,"_onTransitionFns",new Map),Ct(this,"_sessionId"),Ct(this,"firstMessageReceived",!1),Ct(this,"debug"),Ct(this,"logger"),Ct(this,"maxObservedTimestamp"),Ct(this,"connectionStateSubscribers",new Map),Ct(this,"nextConnectionStateSubscriberId",0),Ct(this,"_lastPublishedConnectionState"),Ct(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const _=this.connectionState();if(JSON.stringify(_)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=_;for(const E of this.connectionStateSubscribers.values())E(_)}})}),Ct(this,"mark",_=>{this.debug&&Sz(_,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.");s?.skipConvexDeploymentUrlCheck!==!0&&vj(t),s={...s};const i=s.authRefreshTokenLeewaySeconds??2;let c=s.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=s.reportDebugInfoToConvex??!1,this.address=t,this.logger=s.logger===!1?S1({verbose:s.verbose??!1}):s.logger!==!0&&s.logger?s.logger:w1({verbose:s.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/${bw}/sync`;this.state=new $j,this.remoteQuerySet=new Cw(_=>this.state.queryPath(_),this.logger),this.requestManager=new qj(this.logger,this.markConnectionStateDirty);const v=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new bz(this.state,{authenticate:_=>{const E=this.state.setAuth(_);return this.webSocketManager.sendMessage(E),E.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:v,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:i}),this.optimisticQueryResults=new Yj,this.addOnTransitionHandler(_=>{r(_.queries.map(E=>E.token))}),this._nextRequestId=0,this._sessionId=dz();const{unsavedChangesWarning:b}=s;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",_=>{if(this.requestManager.hasIncompleteRequests()){_.preventDefault();const E="Are you sure you want to leave? Your changes may not be saved.";return(_||window.event).returnValue=E,E}});this.webSocketManager=new fz(y,{onOpen:_=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({..._,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const E=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new Cw(O=>this.state.queryPath(O),this.logger);const[x,C]=this.state.restart(E);C&&this.webSocketManager.sendMessage(C),this.webSocketManager.sendMessage(x);for(const O of this.requestManager.restart())this.webSocketManager.sendMessage(O)},onResume:()=>{const[_,E]=this.state.resume();E&&this.webSocketManager.sendMessage(E),_&&this.webSocketManager.sendMessage(_);for(const x of this.requestManager.resume())this.webSocketManager.sendMessage(x)},onMessage:_=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),_.type){case"Transition":{this.observedTimestamp(_.endVersion.ts),this.authenticationManager.onTransition(_),this.remoteQuerySet.transition(_),this.state.transition(_);const E=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(E);break}case"MutationResponse":{_.success&&this.observedTimestamp(_.ts);const E=this.requestManager.onResponse(_);E!==null&&this.notifyOnQueryResultChanges(new Map([[E.requestId,E.result]]));break}case"ActionResponse":{this.requestManager.onResponse(_);break}case"AuthError":{this.authenticationManager.onAuthError(_);break}case"FatalError":{const E=Pj(this.logger,_.error);throw this.webSocketManager.terminate(),E}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:s.onServerDisconnectError},c,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),s.expectAuth&&v()}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 r=this.remoteQuerySet.remoteQueryResults(),s=new Map;for(const[c,u]of r){const f=this.state.queryToken(c);if(f!==null){const h={result:u,udfPath:this.state.queryPath(c),args:this.state.queryArgs(c)};s.set(f,h)}}const i=this.optimisticQueryResults.ingestQueryResultsFromServer(s,new Set(t.keys()));this.handleTransition({queries:i.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 r of this._onTransitionFns.values())r(t)}addOnTransitionHandler(t){const r=this._transitionHandlerCounter++;return this._onTransitionFns.set(r,t),()=>this._onTransitionFns.delete(r)}getCurrentAuthClaims(){const t=this.state.getAuth();let r={};if(t&&t.tokenType==="User")try{r=t?R1(t.value):{}}catch{r={}}else return;return{token:t.value,decoded:r}}setAuth(t,r){this.authenticationManager.setConfig(t,r)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,r){const s=this.state.setAdminAuth(t,r);this.webSocketManager.sendMessage(s)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,r,s){const i=Lr(r),{modification:c,queryToken:u,unsubscribe:f}=this.state.subscribe(t,i,s?.journal,s?.componentPath);return c!==null&&this.webSocketManager.sendMessage(c),{queryToken:u,unsubscribe:()=>{const h=f();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,r){const s=Lr(r),i=fs(t,s);return this.optimisticQueryResults.queryResult(i)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,r){const s=Lr(r),i=fs(t,s);return this.optimisticQueryResults.queryLogs(i)}queryJournal(t,r){const s=Lr(r),i=fs(t,s);return this.state.queryJournal(i)}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 r=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(r,t),()=>{this.connectionStateSubscribers.delete(r)}}async mutation(t,r,s){const i=await this.mutationInternal(t,r,s);if(!i.success)throw i.errorData!==void 0?Gp(i,new Qp(wa("mutation",t,i))):new Error(wa("mutation",t,i));return i.value}async mutationInternal(t,r,s,i){const{mutationPromise:c}=this.enqueueMutation(t,r,s,i);return c}enqueueMutation(t,r,s,i){const c=Lr(r);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,s!==void 0){const y=s.optimisticUpdate;if(y!==void 0){const v=E=>{y(E,c)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},_=this.optimisticQueryResults.applyOptimisticUpdate(v,u).map(E=>{const x=this.localQueryResultByToken(E);return{token:E,modification:{kind:"Updated",result:x===void 0?void 0:{success:!0,value:x,logLines:[]}}}});this.handleTransition({queries:_,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const f={type:"Mutation",requestId:u,udfPath:t,componentPath:i,args:[Gn(c)]},h=this.webSocketManager.sendMessage(f),p=this.requestManager.request(f,h);return{requestId:u,mutationPromise:p}}async action(t,r){const s=await this.actionInternal(t,r);if(!s.success)throw s.errorData!==void 0?Gp(s,new Qp(wa("action",t,s))):new Error(wa("action",t,s));return s.value}async actionInternal(t,r,s){const i=Lr(r),c=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:c,udfPath:t,componentPath:s,args:[Gn(i)]},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=_z(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 r=`${this.address}/api/debug_event`;fetch(r,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${bw}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(s=>{s.ok||this.logger.warn("Analytics request failed with response:",s.body)}).catch(s=>{this.logger.warn("Analytics response failed with error:",s)})}}function yp(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 Tz=Object.defineProperty,Az=(e,t,r)=>t in e?Tz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Aw=(e,t,r)=>Az(e,typeof t!="symbol"?t+"":t,r);class Oz{constructor(t,r){this.client=t,this.onTransition=r,Aw(this,"paginatedQuerySet",new Map),Aw(this,"lastTransitionTs"),this.lastTransitionTs=rn.fromNumber(0),this.client.addOnTransitionHandler(s=>this.onBaseTransition(s))}subscribe(t,r,s){const i=ms(t),c=Sw(i,r,s),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:i,args:r,numSubscribers:1,options:{initialNumItems:s.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:s.id}),this.addPageToPaginatedQuery(c,null,s.initialNumItems),{paginatedQueryToken:c,unsubscribe:u})}localQueryResult(t,r,s){const i=ms(t),c=Sw(i,r,s);return this.localQueryResultByToken(c)}localQueryResultByToken(t){const r=this.paginatedQuerySet.get(t);if(!r)return;const s=this.activePageQueryTokens(r);if(s.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let i=[],c=!1,u=!1;for(const h of s){const p=this.client.localQueryResultByToken(h);if(p===void 0){c=!0,u=!1;continue}const y=yp(p);i=i.concat(y.page),u=!!y.isDone}let f;return c?f=i.length===0?"LoadingFirstPage":"LoadingMore":u?f="Exhausted":f="CanLoadMore",{results:i,status:f,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const r=t.queries.map(u=>u.token),s=this.queriesContainingTokens(r);let i=[];s.length>0&&(this.processPaginatedQuerySplits(s,u=>this.client.localQueryResultByToken(u)),i=s.map(u=>({token:u,modification:{kind:"Updated",result:this.localQueryResultByToken(u)}})));const c={...t,paginatedQueries:i};this.onTransition(c)}loadMoreOfPaginatedQuery(t,r){this.mustGetPaginatedQuery(t);const s=this.queryTokenForLastPageOfPaginatedQuery(t),i=this.client.localQueryResultByToken(s);if(!i)return!1;const c=yp(i);if(c.isDone)return!1;this.addPageToPaginatedQuery(t,c.continueCursor,r);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 r=[],s=new Set(t);for(const[i,c]of this.paginatedQuerySet)for(const u of this.allQueryTokens(c))if(s.has(u)){r.push(i);break}return r}processPaginatedQuerySplits(t,r){for(const s of t){const i=this.mustGetPaginatedQuery(s),{ongoingSplits:c,pageKeyToQuery:u,pageKeys:f}=i;for(const[h,[p,y]]of c)r(u.get(p).queryToken)!==void 0&&r(u.get(y).queryToken)!==void 0&&this.completePaginatedQuerySplit(i,h,p,y);for(const h of f){if(c.has(h))continue;const p=u.get(h).queryToken,y=r(p);if(!y)continue;const v=yp(y);v.splitCursor&&(v.pageStatus==="SplitRecommended"||v.pageStatus==="SplitRequired"||v.page.length>i.options.initialNumItems*2)&&this.splitPaginatedQueryPage(i,h,v.splitCursor,v.continueCursor)}}}splitPaginatedQueryPage(t,r,s,i){const c=t.nextPageKey++,u=t.nextPageKey++,f={cursor:i,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:null,endCursor:s}});t.pageKeyToQuery.set(c,h);const p=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:s,endCursor:i}});t.pageKeyToQuery.set(u,p),t.ongoingSplits.set(r,[c,u])}addPageToPaginatedQuery(t,r,s){const i=this.mustGetPaginatedQuery(t),c=i.nextPageKey++,u={cursor:r,numItems:s,id:i.id},f={...i.args,paginationOpts:u},h=this.client.subscribe(i.canonicalizedUdfPath,f);return i.pageKeys.push(c),i.pageKeyToQuery.set(c,h),h}removePaginatedQuerySubscriber(t){const r=this.paginatedQuerySet.get(t);if(r&&(r.numSubscribers-=1,!(r.numSubscribers>0))){for(const s of r.pageKeyToQuery.values())s.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,r,s,i){const c=t.pageKeyToQuery.get(r);t.pageKeyToQuery.delete(r);const u=t.pageKeys.indexOf(r);t.pageKeys.splice(u,1,s,i),t.ongoingSplits.delete(r),c.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(r=>t.pageKeyToQuery.get(r).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(r=>r.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const r=this.mustGetPaginatedQuery(t),s=r.pageKeys[r.pageKeys.length-1];if(s===void 0)throw new Error(`No pages for paginated query ${t}`);return r.pageKeyToQuery.get(s).queryToken}mustGetPaginatedQuery(t){const r=this.paginatedQuerySet.get(t);if(!r)throw new Error("paginated query no longer exists for token "+t);return r}}function kz({getCurrentValue:e,subscribe:t}){const[r,s]=w.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let i=r.value;return(r.getCurrentValue!==e||r.subscribe!==t)&&(i=e(),s({getCurrentValue:e,subscribe:t,value:i})),w.useEffect(()=>{let c=!1;const u=()=>{c||s(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]),i}var Mz=Object.defineProperty,Nz=(e,t,r)=>t in e?Mz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dr=(e,t,r)=>Nz(e,typeof t!="symbol"?t+"":t,r);const jz=5e3;if(typeof qt>"u")throw new Error("Required dependency 'react' not found");function T1(e,t,r){function s(i){return Lz(i),t.mutation(e,i,{optimisticUpdate:r})}return s.withOptimisticUpdate=function(c){if(r!==void 0)throw new Error(`Already specified optimistic update for mutation ${on(e)}`);return T1(e,t,c)},s}class zz{constructor(t,r){if(Dr(this,"address"),Dr(this,"cachedSync"),Dr(this,"cachedPaginatedQueryClient"),Dr(this,"listeners"),Dr(this,"options"),Dr(this,"closed",!1),Dr(this,"_logger"),Dr(this,"adminAuth"),Dr(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=r?.logger===!1?S1({verbose:r?.verbose??!1}):r?.logger!==!0&&r?.logger?r.logger:w1({verbose:r?.verbose??!1}),this.options={...r,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 Rz(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new Oz(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,r){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,r??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,r){if(this.adminAuth=t,this.fakeUserIdentity=r,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,r)}watchQuery(t,...r){const[s,i]=r,c=on(t);return{onUpdate:u=>{const{queryToken:f,unsubscribe:h}=this.sync.subscribe(c,s,i),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,s)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(c,s)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(c,s)}}}prewarmQuery(t){const r=t.extendSubscriptionFor??jz,i=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(i,r)}watchPaginatedQuery(t,r,s){const i=on(t);return{onUpdate:c=>{const{paginatedQueryToken:u,unsubscribe:f}=this.paginatedQueryClient.subscribe(i,r||{},s),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(i,r,s)}}mutation(t,...r){const[s,i]=r,c=on(t);return this.sync.mutation(c,s,i)}action(t,...r){const s=on(t);return this.sync.action(s,...r)}query(t,...r){const s=this.watchQuery(t,...r),i=s.localQueryResult();return i!==void 0?Promise.resolve(i):new Promise((c,u)=>{const f=s.onUpdate(()=>{f();try{c(s.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 r=t.queries.map(i=>i.token),s=t.paginatedQueries.map(i=>i.token);this.transition([...r,...s])}transition(t){for(const r of t){const s=this.listeners.get(r);if(s)for(const i of s)i()}}}const $m=qt.createContext(void 0);function Dz(){return w.useContext($m)}const Pz=({client:e,children:t})=>qt.createElement($m.Provider,{value:e},t);function A1(e,...t){const r=t[0]==="skip",s=t[0]==="skip"?{}:Lr(t[0]),i=typeof e=="string"?_1(e):e,c=on(i),u=w.useMemo(()=>r?{}:{query:{query:i,args:s}},[JSON.stringify(Gn(s)),c,r]),h=Bz(u).query;if(h instanceof Error)throw h;return h}function Ow(e){const t=typeof e=="string"?_1(e):e,r=w.useContext($m);if(r===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 w.useMemo(()=>T1(t,r),[r,on(t)])}function Lz(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 Iz=Object.defineProperty,$z=(e,t,r)=>t in e?Iz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vp=(e,t,r)=>$z(e,typeof t!="symbol"?t+"":t,r);class Uz{constructor(t){vp(this,"createWatch"),vp(this,"queries"),vp(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const r of Object.keys(t)){const{query:s,args:i,paginationOptions:c}=t[r];if(on(s),this.queries[r]===void 0)this.addQuery(r,s,i,c?{paginationOptions:c}:{});else{const u=this.queries[r];(on(s)!==on(u.query)||JSON.stringify(Gn(i))!==JSON.stringify(Gn(u.args))||JSON.stringify(c)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(r),this.addQuery(r,s,i,c?{paginationOptions:c}:{}))}}for(const r of Object.keys(this.queries))t[r]===void 0&&this.removeQuery(r)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const r={};for(const s of Object.keys(t)){const{query:i,args:c}=t[s],u=t[s].paginationOptions;on(i);const f=this.createWatch(i,c,u?{paginationOptions:u}:{});let h;try{h=f.localQueryResult()}catch(p){if(p instanceof Error)h=p;else throw p}r[s]=h}return r}setCreateWatch(t){this.createWatch=t;for(const r of Object.keys(this.queries)){const{query:s,args:i,watch:c,paginationOptions:u}=this.queries[r],f="journal"in c?c.journal():void 0;this.removeQuery(r),this.addQuery(r,s,i,{...f?{journal:f}:[],...u?{paginationOptions:u}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,r,s,{paginationOptions:i,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(r,s,{...c?{journal:c}:[],...i?{paginationOptions:i}:{}}),f=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:r,args:s,watch:u,unsubscribe:f,...i?{paginationOptions:i}:{}}}removeQuery(t){const r=this.queries[t];if(r===void 0)throw new Error(`No query found with identifier ${t}.`);r.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function Bz(e){const t=Dz();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 r=w.useMemo(()=>(s,i,{journal:c,paginationOptions:u})=>u?t.watchPaginatedQuery(s,i,u):t.watchQuery(s,i,c?{journal:c}:{}),[t]);return qz(e,r)}function qz(e,t){const[r]=w.useState(()=>new Uz(t));r.createWatch!==t&&r.setCreateWatch(t),w.useEffect(()=>()=>r.destroy(),[r]);const s=w.useMemo(()=>({getCurrentValue:()=>r.getLocalResults(e),subscribe:i=>(r.setQueries(e),r.subscribe(i))}),[r,e]);return kz(s)}const Fz="/assets/globals-D41WzvyZ.css";const O1=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();const Vz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Hz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase());const kw=e=>{const t=Hz(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Zz={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 Qz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Gz=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:c,iconNode:u,...f},h)=>w.createElement("svg",{ref:h,...Zz,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:O1("lucide",i),...!c&&!Qz(f)&&{"aria-hidden":"true"},...f},[...u.map(([p,y])=>w.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Se=(e,t)=>{const r=w.forwardRef(({className:s,...i},c)=>w.createElement(Gz,{ref:c,iconNode:t,className:O1(`lucide-${Vz(kw(e))}`,`lucide-${e}`,s),...i}));return r.displayName=kw(e),r};const Yz=[["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"}]],Kz=Se("archive",Yz);const Xz=[["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"}]],Yp=Se("bell",Xz);const Jz=[["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"}]],Wz=Se("book",Jz);const e3=[["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"}]],t3=Se("bookmark",e3);const n3=[["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"}]],k1=Se("braces",n3);const r3=[["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"}]],Kp=Se("calendar",r3);const o3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],M1=Se("check",o3);const s3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_s=Se("chevron-down",s3);const a3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],i3=Se("chevron-right",a3);const c3=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],N1=Se("chevron-up",c3);const l3=[["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"}]],u3=Se("circle-alert",l3);const f3=[["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"}]],j1=Se("circle-question-mark",f3);const d3=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],h3=Se("clock",d3);const p3=[["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"}]],m3=Se("code-xml",p3);const g3=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],y3=Se("code",g3);const v3=[["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"}]],b3=Se("dollar-sign",v3);const w3=[["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"}]],S3=Se("external-link",w3);const x3=[["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"}]],_3=Se("eye",x3);const C3=[["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"}]],E3=Se("file-code",C3);const R3=[["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"}]],T3=Se("file-text",R3);const A3=[["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"}]],O3=Se("file-type",A3);const k3=[["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"}]],M3=Se("flag",k3);const N3=[["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"}]],j3=Se("folder-open",N3);const z3=[["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"}]],D3=Se("folder",z3);const P3=[["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"}]],L3=Se("globe",P3);const I3=[["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"}]],z1=Se("hash",I3);const $3=[["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"}]],U3=Se("heart",$3);const B3=[["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"}]],D1=Se("house",B3);const q3=[["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"}]],P1=Se("image",q3);const F3=[["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"}]],L1=Se("layers",F3);const V3=[["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"}]],H3=Se("layout-dashboard",V3);const Z3=[["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"}]],Q3=Se("link-2",Z3);const G3=[["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"}]],Y3=Se("link",G3);const K3=[["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"}]],X3=Se("list",K3);const J3=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],W3=Se("loader-circle",J3);const eD=[["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"}]],tD=Se("lock",eD);const nD=[["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"}]],rD=Se("log-out",nD);const oD=[["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"}]],sD=Se("mail",oD);const aD=[["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"}]],iD=Se("map-pin",aD);const cD=[["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"}]],lD=Se("message-square",cD);const uD=[["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"}]],fD=Se("package",uD);const dD=[["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"}]],hD=Se("phone",dD);const pD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],I1=Se("plus",pD);const mD=[["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"}]],gD=Se("settings",mD);const yD=[["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"}]],vD=Se("square-check-big",yD);const bD=[["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"}]],wD=Se("square-pen",bD);const SD=[["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"}]],xD=Se("star",SD);const _D=[["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"}]],CD=Se("tag",_D);const ED=[["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"}]],RD=Se("tags",ED);const TD=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],AD=Se("text-align-start",TD);const OD=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],$1=Se("toggle-left",OD);const kD=[["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"}]],MD=Se("trash-2",kD);const ND=[["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"}]],jD=Se("triangle-alert",ND);const zD=[["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"}]],U1=Se("user",zD);const DD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ju=Se("x",DD);function B1(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=B1(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function q1(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=B1(e))&&(s&&(s+=" "),s+=t);return s}const PD=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},LD=(e,t)=>({classGroupId:e,validator:t}),F1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),zu="-",Mw=[],ID="arbitrary..",$D=e=>{const t=BD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return UD(u);const f=u.split(zu),h=f[0]===""&&f.length>1?1:0;return V1(f,h,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const h=s[u],p=r[u];return h?p?PD(p,h):h:p||Mw}return r[u]||Mw}}},V1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],c=r.nextPart.get(i);if(c){const p=V1(e,t+1,c);if(p)return p}const u=r.validators;if(u===null)return;const f=t===0?e.join(zu):e.slice(t).join(zu),h=u.length;for(let p=0;p<h;p++){const y=u[p];if(y.validator(f))return y.classGroupId}},UD=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?ID+s:void 0})(),BD=e=>{const{theme:t,classGroups:r}=e;return qD(r,t)},qD=(e,t)=>{const r=F1();for(const s in e){const i=e[s];Um(i,r,s,t)}return r},Um=(e,t,r,s)=>{const i=e.length;for(let c=0;c<i;c++){const u=e[c];FD(u,t,r,s)}},FD=(e,t,r,s)=>{if(typeof e=="string"){VD(e,t,r);return}if(typeof e=="function"){HD(e,t,r,s);return}ZD(e,t,r,s)},VD=(e,t,r)=>{const s=e===""?t:H1(t,e);s.classGroupId=r},HD=(e,t,r,s)=>{if(QD(e)){Um(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(LD(r,e))},ZD=(e,t,r,s)=>{const i=Object.entries(e),c=i.length;for(let u=0;u<c;u++){const[f,h]=i[u];Um(h,H1(t,f),r,s)}},H1=(e,t)=>{let r=e;const s=t.split(zu),i=s.length;for(let c=0;c<i;c++){const u=s[c];let f=r.nextPart.get(u);f||(f=F1(),r.nextPart.set(u,f)),r=f}return r},QD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const i=(c,u)=>{r[c]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(c){let u=r[c];if(u!==void 0)return u;if((u=s[c])!==void 0)return i(c,u),u},set(c,u){c in r?r[c]=u:i(c,u)}}},Xp="!",Nw=":",YD=[],jw=(e,t,r,s,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:i}),KD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=i=>{const c=[];let u=0,f=0,h=0,p;const y=i.length;for(let x=0;x<y;x++){const C=i[x];if(u===0&&f===0){if(C===Nw){c.push(i.slice(h,x)),h=x+1;continue}if(C==="/"){p=x;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const v=c.length===0?i:i.slice(h);let b=v,_=!1;v.endsWith(Xp)?(b=v.slice(0,-1),_=!0):v.startsWith(Xp)&&(b=v.slice(1),_=!0);const E=p&&p>h?p-h:void 0;return jw(c,_,b,E)};if(t){const i=t+Nw,c=s;s=u=>u.startsWith(i)?c(u.slice(i.length)):jw(YD,!1,u,void 0,!0)}if(r){const i=s;s=c=>r({className:c,parseClassName:i})}return s},XD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let i=[];for(let c=0;c<r.length;c++){const u=r[c],f=u[0]==="[",h=t.has(u);f||h?(i.length>0&&(i.sort(),s.push(...i),i=[]),s.push(u)):i.push(u)}return i.length>0&&(i.sort(),s.push(...i)),s}},JD=e=>({cache:GD(e.cacheSize),parseClassName:KD(e),sortModifiers:XD(e),...$D(e)}),WD=/\s+/,e4=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:i,sortModifiers:c}=t,u=[],f=e.trim().split(WD);let h="";for(let p=f.length-1;p>=0;p-=1){const y=f[p],{isExternal:v,modifiers:b,hasImportantModifier:_,baseClassName:E,maybePostfixModifierPosition:x}=r(y);if(v){h=y+(h.length>0?" "+h:h);continue}let C=!!x,O=s(C?E.substring(0,x):E);if(!O){if(!C){h=y+(h.length>0?" "+h:h);continue}if(O=s(E),!O){h=y+(h.length>0?" "+h:h);continue}C=!1}const M=b.length===0?"":b.length===1?b[0]:c(b).join(":"),k=_?M+Xp:M,D=k+O;if(u.indexOf(D)>-1)continue;u.push(D);const U=i(O,C);for(let H=0;H<U.length;++H){const L=U[H];u.push(k+L)}h=y+(h.length>0?" "+h:h)}return h},t4=(...e)=>{let t=0,r,s,i="";for(;t<e.length;)(r=e[t++])&&(s=Z1(r))&&(i&&(i+=" "),i+=s);return i},Z1=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=Z1(e[s]))&&(r&&(r+=" "),r+=t);return r},n4=(e,...t)=>{let r,s,i,c;const u=h=>{const p=t.reduce((y,v)=>v(y),e());return r=JD(p),s=r.cache.get,i=r.cache.set,c=f,f(h)},f=h=>{const p=s(h);if(p)return p;const y=e4(h,r);return i(h,y),y};return c=u,(...h)=>c(t4(...h))},r4=[],At=e=>{const t=r=>r[e]||r4;return t.isThemeGetter=!0,t},Q1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,o4=/^\d+\/\d+$/,s4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,a4=/\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$/,i4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,c4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,l4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ha=e=>o4.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),yo=e=>!!e&&Number.isInteger(Number(e)),bp=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Pr=e=>s4.test(e),u4=()=>!0,f4=e=>a4.test(e)&&!i4.test(e),Y1=()=>!1,d4=e=>c4.test(e),h4=e=>l4.test(e),p4=e=>!fe(e)&&!de(e),m4=e=>Ua(e,J1,Y1),fe=e=>Q1.test(e),ns=e=>Ua(e,W1,f4),wp=e=>Ua(e,w4,Ne),zw=e=>Ua(e,K1,Y1),g4=e=>Ua(e,X1,h4),Wl=e=>Ua(e,e_,d4),de=e=>G1.test(e),Zi=e=>Ba(e,W1),y4=e=>Ba(e,S4),Dw=e=>Ba(e,K1),v4=e=>Ba(e,J1),b4=e=>Ba(e,X1),eu=e=>Ba(e,e_,!0),Ua=(e,t,r)=>{const s=Q1.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Ba=(e,t,r=!1)=>{const s=G1.exec(e);return s?s[1]?t(s[1]):r:!1},K1=e=>e==="position"||e==="percentage",X1=e=>e==="image"||e==="url",J1=e=>e==="length"||e==="size"||e==="bg-size",W1=e=>e==="length",w4=e=>e==="number",S4=e=>e==="family-name",e_=e=>e==="shadow",x4=()=>{const e=At("color"),t=At("font"),r=At("text"),s=At("font-weight"),i=At("tracking"),c=At("leading"),u=At("breakpoint"),f=At("container"),h=At("spacing"),p=At("radius"),y=At("shadow"),v=At("inset-shadow"),b=At("text-shadow"),_=At("drop-shadow"),E=At("blur"),x=At("perspective"),C=At("aspect"),O=At("ease"),M=At("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],U=()=>[...D(),de,fe],H=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],j=()=>[de,fe,h],G=()=>[ha,"full","auto",...j()],ie=()=>[yo,"none","subgrid",de,fe],ae=()=>["auto",{span:["full",yo,de,fe]},yo,de,fe],te=()=>[yo,"auto",de,fe],ce=()=>["auto","min","max","fr",de,fe],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...j()],K=()=>[ha,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],V=()=>[e,de,fe],re=()=>[...D(),Dw,zw,{position:[de,fe]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",v4,m4,{size:[de,fe]}],Q=()=>[bp,Zi,ns],ne=()=>["","none","full",p,de,fe],oe=()=>["",Ne,Zi,ns],pe=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Ne,bp,Dw,zw],_e=()=>["","none",E,de,fe],xe=()=>["none",Ne,de,fe],Re=()=>["none",Ne,de,fe],Ae=()=>[Ne,de,fe],Le=()=>[ha,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pr],breakpoint:[Pr],color:[u4],container:[Pr],"drop-shadow":[Pr],ease:["in","out","in-out"],font:[p4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pr],shadow:[Pr],spacing:["px",Ne],text:[Pr],"text-shadow":[Pr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ha,fe,de,C]}],container:["container"],columns:[{columns:[Ne,fe,de,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:U()}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{start:G()}],end:[{end:G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[yo,"auto",de,fe]}],basis:[{basis:[ha,"full","auto",f,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,ha,"auto","initial","none",fe]}],grow:[{grow:["",Ne,de,fe]}],shrink:[{shrink:["",Ne,de,fe]}],order:[{order:[yo,"first","last","none",de,fe]}],"grid-cols":[{"grid-cols":ie()}],"col-start-end":[{col:ae()}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":ie()}],"row-start-end":[{row:ae()}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[f,"screen",...K()]}],"min-w":[{"min-w":[f,"screen","none",...K()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Zi,ns]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,de,wp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bp,fe]}],"font-family":[{font:[y4,fe,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:[i,de,fe]}],"line-clamp":[{"line-clamp":[Ne,"none",de,wp]}],leading:[{leading:[c,...j()]}],"list-image":[{"list-image":["none",de,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",de,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",de,ns]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Ne,"auto",de,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de,fe]}],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",de,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:re()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yo,de,fe],radial:["",de,fe],conic:[yo,de,fe]},b4,g4]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...pe(),"hidden","none"]}],"divide-style":[{divide:[...pe(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,de,fe]}],"outline-w":[{outline:["",Ne,Zi,ns]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",y,eu,Wl]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",v,eu,Wl]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Ne,ns]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",b,eu,Wl]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Ne,de,fe]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[de,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:re()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",de,fe]}],filter:[{filter:["","none",de,fe]}],blur:[{blur:_e()}],brightness:[{brightness:[Ne,de,fe]}],contrast:[{contrast:[Ne,de,fe]}],"drop-shadow":[{"drop-shadow":["","none",_,eu,Wl]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Ne,de,fe]}],"hue-rotate":[{"hue-rotate":[Ne,de,fe]}],invert:[{invert:["",Ne,de,fe]}],saturate:[{saturate:[Ne,de,fe]}],sepia:[{sepia:["",Ne,de,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",de,fe]}],"backdrop-blur":[{"backdrop-blur":_e()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,de,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,de,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,de,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,de,fe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,de,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,de,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,de,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,de,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",de,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",de,fe]}],ease:[{ease:["linear","initial",O,de,fe]}],delay:[{delay:[Ne,de,fe]}],animate:[{animate:["none",M,de,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,de,fe]}],"perspective-origin":[{"perspective-origin":U()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[de,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:U()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"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",de,fe]}],"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":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",de,fe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Ne,Zi,ns,wp]}],stroke:[{stroke:["none",...V()]}],"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"]}},_4=n4(x4);function je(...e){return _4(q1(e))}et.union(et.literal("admin"),et.literal("editor"),et.literal("author"),et.literal("viewer"));const C4=et.union(et.literal("contentTypes"),et.literal("contentEntries"),et.literal("mediaItems"),et.literal("settings")),E4=et.union(et.literal("create"),et.literal("read"),et.literal("update"),et.literal("delete"),et.literal("publish"),et.literal("unpublish"),et.literal("restore"),et.literal("manage"),et.literal("move"));et.object({resource:C4,action:E4,scope:et.optional(et.union(et.literal("all"),et.literal("own")))});function oc(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 Oa(e,t="all"){return[{resource:e,action:"read",scope:t}]}function t_(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const R4={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...oc("contentTypes"),...oc("contentEntries"),...t_(),{resource:"contentEntries",action:"restore"},...oc("mediaItems"),{resource:"settings",action:"manage"},...Oa("settings")]},T4={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...Oa("contentTypes"),...oc("contentEntries"),...t_(),{resource:"contentEntries",action:"restore"},...oc("mediaItems")]},A4={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...Oa("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"}]},O4={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...Oa("contentTypes"),...Oa("contentEntries"),...Oa("mediaItems")]},Bm={admin:R4,editor:T4,author:A4,viewer:O4};function k4(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const r=e.scope??"all",s=t.scope??"all";return r==="all"?!0:s==="own"}function M4(e,t,r){const s=Bm[e]??r?.[e];return s?s.permissions.some(i=>k4(i,t)):!1}function N4(e,t){return(Bm[e]??t?.[e])?.permissions??[]}function j4(e,t){return Bm[e]??t?.[e]}function z4(e,t,r){return N4(e,r).filter(s=>s.resource===t)}function x7(e,t,r){return z4(e,t,r).length>0}const n_=w.createContext(null);function D4({children:e,getUser:t,getUserRole:r,onLogout:s,autoRedirectToLogin:i=!1,loginUrl:c="/login"}){const[u,f]=w.useState(null),[h,p]=w.useState(null),[y,v]=w.useState("loading"),[b,_]=w.useState(null),E=w.useCallback(async()=>{v("loading"),_(null);try{const k=await t();if(!k){f(null),p(null),v("unauthenticated"),i&&typeof window<"u"&&(window.location.href=c);return}const D=await r({userId:k.id});f(k),p(D),v("authenticated")}catch(k){console.error("Authentication error:",k),f(null),p(null),_(k instanceof Error?k.message:"Authentication failed"),v("error")}},[t,r,i,c]);w.useEffect(()=>{E()},[E]);const x=w.useCallback(k=>h?M4(h,k):!1,[h]),C=w.useCallback(async()=>{try{s&&await s(),f(null),p(null),v("unauthenticated"),i&&typeof window<"u"&&(window.location.href=c)}catch(k){console.error("Logout error:",k),_(k instanceof Error?k.message:"Logout failed")}},[s,i,c]),O=w.useCallback(async()=>{await E()},[E]),M={user:u,role:h,authState:y,isLoading:y==="loading",isAuthenticated:y==="authenticated",error:b,checkPermission:x,logout:C,refresh:O};return g.jsx(n_.Provider,{value:M,children:e})}function r_(){const e=w.useContext(n_);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const o_=w.createContext(null),s_="convex-cms-theme";function Pw(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Lw(){if(typeof window>"u")return"system";const e=localStorage.getItem(s_);return e==="light"||e==="dark"||e==="system"?e:"system"}function P4({children:e}){const[t,r]=w.useState(()=>Lw()),[s,i]=w.useState(()=>{const f=Lw();return f==="system"?Pw():f}),c=w.useCallback(f=>{const h=f==="system"?Pw():f;i(h);const p=document.documentElement;p.classList.remove("light","dark"),p.classList.add(h)},[]),u=w.useCallback(f=>{r(f),localStorage.setItem(s_,f),c(f)},[c]);return w.useEffect(()=>{c(t)},[t,c]),w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t==="system"&&c("system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[t,c]),g.jsx(o_.Provider,{value:{theme:t,resolvedTheme:s,setTheme:u},children:e})}function _7(){const e=w.useContext(o_);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function W(e,t,r){function s(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 v=0;v<y.length;v++){const b=y[v];b in f||(f[b]=p[b].bind(f))}}const i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function u(f){var h;const p=r?.Parent?new c:this;s(p,f),(h=p._zod).deferred??(h.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class ka extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class a_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const i_={};function Eo(e){return i_}function c_(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,i])=>t.indexOf(+s)===-1).map(([s,i])=>i)}function Jp(e,t){return typeof t=="bigint"?t.toString():t}function qm(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Fm(e){return e==null}function Vm(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function L4(e,t){const r=(e.toString().split(".")[1]||"").length,s=t.toString();let i=(s.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(s)){const h=s.match(/\d?e-(\d?)/);h?.[1]&&(i=Number.parseInt(h[1]))}const c=r>i?r:i,u=Number.parseInt(e.toFixed(c).replace(".","")),f=Number.parseInt(t.toFixed(c).replace(".",""));return u%f/10**c}const Iw=Symbol("evaluating");function Ye(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==Iw)return s===void 0&&(s=Iw,s=r()),s},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Cs(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jo(...e){const t={};for(const r of e){const s=Object.getOwnPropertyDescriptors(r);Object.assign(t,s)}return Object.defineProperties({},t)}function $w(e){return JSON.stringify(e)}function I4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const l_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Du(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const $4=qm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Pa(e){if(Du(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Du(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function u_(e){return Pa(e)?{...e}:Array.isArray(e)?[...e]:e}const U4=new Set(["string","number","symbol"]);function sf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zo(e,t,r){const s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function we(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 B4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const q4={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 F4(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c=jo(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=r.shape[f])}return Cs(this,"shape",u),u},checks:[]});return zo(e,c)}function V4(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=jo(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Cs(this,"shape",u),u},checks:[]});return zo(e,c)}function H4(e,t){if(!Pa(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.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 i=jo(e._zod.def,{get shape(){const c={...e._zod.def.shape,...t};return Cs(this,"shape",c),c}});return zo(e,i)}function Z4(e,t){if(!Pa(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=jo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Cs(this,"shape",s),s}});return zo(e,r)}function Q4(e,t){const r=jo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return Cs(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return zo(e,r)}function G4(e,t,r){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=jo(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(r)for(const p in r){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);r[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 Cs(this,"shape",h),h},checks:[]});return zo(t,u)}function Y4(e,t,r){const s=jo(t._zod.def,{get shape(){const i=t._zod.def.shape,c={...i};if(r)for(const u in r){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=new e({type:"nonoptional",innerType:i[u]}))}else for(const u in i)c[u]=new e({type:"nonoptional",innerType:i[u]});return Cs(this,"shape",c),c}});return zo(t,s)}function Sa(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xa(e,t){return t.map(r=>{var s;return(s=r).path??(s.path=[]),r.path.unshift(e),r})}function tu(e){return typeof e=="string"?e:e?.message}function Ro(e,t,r){const s={...e,path:e.path??[]};if(!e.message){const i=tu(e.inst?._zod.def?.error?.(e))??tu(t?.error?.(e))??tu(r.customError?.(e))??tu(r.localeError?.(e))??"Invalid input";s.message=i}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function Hm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hc(...e){const[t,r,s]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:s}:{...t}}const f_=(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,Jp,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},d_=W("$ZodError",f_),h_=W("$ZodError",f_,{Parent:Error});function K4(e,t=r=>r.message){const r={},s=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:r}}function X4(e,t=r=>r.message){const r={_errors:[]},s=i=>{for(const c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>s({issues:u}));else if(c.code==="invalid_key")s({issues:c.issues});else if(c.code==="invalid_element")s({issues:c.issues});else if(c.path.length===0)r._errors.push(t(c));else{let u=r,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 s(e),r}const Zm=e=>(t,r,s,i)=>{const c=s?Object.assign(s,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},c);if(u instanceof Promise)throw new ka;if(u.issues.length){const f=new(i?.Err??e)(u.issues.map(h=>Ro(h,c,Eo())));throw l_(f,i?.callee),f}return u.value},Qm=e=>async(t,r,s,i)=>{const c=s?Object.assign(s,{async:!0}):{async:!0};let u=t._zod.run({value:r,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(i?.Err??e)(u.issues.map(h=>Ro(h,c,Eo())));throw l_(f,i?.callee),f}return u.value},af=e=>(t,r,s)=>{const i=s?{...s,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new ka;return c.issues.length?{success:!1,error:new(e??d_)(c.issues.map(u=>Ro(u,i,Eo())))}:{success:!0,data:c.value}},J4=af(h_),cf=e=>async(t,r,s)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Ro(u,i,Eo())))}:{success:!0,data:c.value}},W4=cf(h_),eP=e=>(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Zm(e)(t,r,i)},tP=e=>(t,r,s)=>Zm(e)(t,r,s),nP=e=>async(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Qm(e)(t,r,i)},rP=e=>async(t,r,s)=>Qm(e)(t,r,s),oP=e=>(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return af(e)(t,r,i)},sP=e=>(t,r,s)=>af(e)(t,r,s),aP=e=>async(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return cf(e)(t,r,i)},iP=e=>async(t,r,s)=>cf(e)(t,r,s),cP=/^[cC][^\s-]{8,}$/,lP=/^[0-9a-z]+$/,uP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fP=/^[0-9a-vA-V]{20}$/,dP=/^[A-Za-z0-9]{27}$/,hP=/^[a-zA-Z0-9_-]{21}$/,pP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mP=/^([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})$/,Uw=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)$/,gP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,yP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vP(){return new RegExp(yP,"u")}const bP=/^(?:(?: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])$/,wP=/^(([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}|:))$/,SP=/^((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])$/,xP=/^(([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])$/,_P=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,p_=/^[A-Za-z0-9_-]*$/,CP=/^\+[1-9]\d{6,14}$/,m_="(?:(?:\\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])))",EP=new RegExp(`^${m_}$`);function g_(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 RP(e){return new RegExp(`^${g_(e)}$`)}function TP(e){const t=g_({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${r.join("|")})`;return new RegExp(`^${m_}T(?:${s})$`)}const AP=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},OP=/^-?\d+$/,y_=/^-?\d+(?:\.\d+)?$/,kP=/^(?:true|false)$/i,MP=/^[^A-Z]*$/,NP=/^[^a-z]*$/,an=W("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),v_={number:"number",bigint:"bigint",object:"date"},b_=W("$ZodCheckLessThan",(e,t)=>{an.init(e,t);const r=v_[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,c=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),w_=W("$ZodCheckGreaterThan",(e,t)=>{an.init(e,t);const r=v_[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,c=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jP=W("$ZodCheckMultipleOf",(e,t)=>{an.init(e,t),e._zod.onattach.push(r=>{var s;(s=r._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):L4(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),zP=W("$ZodCheckNumberFormat",(e,t)=>{an.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),s=r?"int":"number",[i,c]=q4[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=i,f.maximum=c,r&&(f.pattern=OP)}),e._zod.check=u=>{const f=u.value;if(r){if(!Number.isInteger(f)){u.issues.push({expected:s,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:s,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:s,inclusive:!0,continue:!t.abort});return}}f<i&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:i,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})}}),DP=W("$ZodCheckMaxLength",(e,t)=>{var r;an.init(e,t),(r=e._zod.def).when??(r.when=s=>{const i=s.value;return!Fm(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const i=s.value;if(i.length<=t.maximum)return;const u=Hm(i);s.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),PP=W("$ZodCheckMinLength",(e,t)=>{var r;an.init(e,t),(r=e._zod.def).when??(r.when=s=>{const i=s.value;return!Fm(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const i=s.value;if(i.length>=t.minimum)return;const u=Hm(i);s.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),LP=W("$ZodCheckLengthEquals",(e,t)=>{var r;an.init(e,t),(r=e._zod.def).when??(r.when=s=>{const i=s.value;return!Fm(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=s=>{const i=s.value,c=i.length;if(c===t.length)return;const u=Hm(i),f=c>t.length;s.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),lf=W("$ZodCheckStringFormat",(e,t)=>{var r,s;an.init(e,t),e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),IP=W("$ZodCheckRegex",(e,t)=>{lf.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),$P=W("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=MP),lf.init(e,t)}),UP=W("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=NP),lf.init(e,t)}),BP=W("$ZodCheckIncludes",(e,t)=>{an.init(e,t);const r=sf(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(i=>{const c=i._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(s)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),qP=W("$ZodCheckStartsWith",(e,t)=>{an.init(e,t);const r=new RegExp(`^${sf(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),FP=W("$ZodCheckEndsWith",(e,t)=>{an.init(e,t);const r=new RegExp(`.*${sf(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),VP=W("$ZodCheckOverwrite",(e,t)=>{an.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class HP{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 s=t.split(`
|
|
19
|
+
Called by client`}function Gp(e,t){return t.data=e.errorData,t}function ms(e){const t=e.split(":");let r,s;return t.length===1?(r=t[0],s="default"):(r=t.slice(0,t.length-1).join(":"),s=t[t.length-1]),r.endsWith(".js")&&(r=r.slice(0,-3)),`${r}:${s}`}function fs(e,t){return JSON.stringify({udfPath:ms(e),args:Gn(t)})}function Sw(e,t,r){const{initialNumItems:s,id:i}=r;return JSON.stringify({type:"paginated",udfPath:ms(e),args:Gn(t),options:Gn({initialNumItems:s,id:i})})}var Lj=Object.defineProperty,Ij=(e,t,r)=>t in e?Lj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rr=(e,t,r)=>Ij(e,typeof t!="symbol"?t+"":t,r);class $j{constructor(){rr(this,"nextQueryId"),rr(this,"querySetVersion"),rr(this,"querySet"),rr(this,"queryIdToToken"),rr(this,"identityVersion"),rr(this,"auth"),rr(this,"outstandingQueriesOlderThanRestart"),rr(this,"outstandingAuthOlderThanRestart"),rr(this,"paused"),rr(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,r,s,i){const c=ms(t),u=fs(c,r),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:r,numSubscribers:1,journal:s,componentPath:i};this.querySet.set(u,p),this.queryIdToToken.set(h,u);const y=this.querySetVersion,v=this.querySetVersion+1,b={type:"Add",queryId:h,udfPath:c,args:[Gn(r)],journal:s,componentPath:i};return this.paused?this.pendingQuerySetModifications.set(h,b):this.querySetVersion=v,{queryToken:u,modification:{type:"ModifyQuerySet",baseVersion:y,newVersion:v,modifications:[b]},unsubscribe:()=>this.removeSubscriber(u)}}}transition(t){for(const r of t.modifications)switch(r.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);const s=r.journal;if(s!==void 0){const i=this.queryIdToToken.get(r.queryId);i!==void 0&&(this.querySet.get(i).journal=s)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}}queryId(t,r){const s=ms(t),i=fs(s,r),c=this.querySet.get(i);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 r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...this.auth}}setAdminAuth(t,r){const s={tokenType:"Admin",value:t,impersonating:r};this.auth=s;const i=this.identityVersion;return this.paused||(this.identityVersion=i+1),{type:"Authenticate",baseVersion:i,...s}}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 r=this.queryIdToToken.get(t);return r?this.querySet.get(r).canonicalizedUdfPath:null}queryArgs(t){const r=this.queryIdToToken.get(t);return r?this.querySet.get(r).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 r=[];for(const c of this.querySet.values()){const u={type:"Add",queryId:c.id,udfPath:c.canonicalizedUdfPath,args:[Gn(c.args)],journal:c.journal,componentPath:c.componentPath};r.push(u),t.has(c.id)||this.outstandingQueriesOlderThanRestart.add(c.id)}this.querySetVersion=1;const s={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:r};if(!this.auth)return this.identityVersion=0,[s,void 0];this.outstandingAuthOlderThanRestart=!0;const i={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[s,i]}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,r=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[t,r]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(t){const r=this.querySet.get(t);if(r.numSubscribers>1)return r.numSubscribers-=1,null;{this.querySet.delete(t),this.queryIdToToken.delete(r.id),this.outstandingQueriesOlderThanRestart.delete(r.id);const s=this.querySetVersion,i=this.querySetVersion+1,c={type:"Remove",queryId:r.id};return this.paused?this.pendingQuerySetModifications.has(r.id)?this.pendingQuerySetModifications.delete(r.id):this.pendingQuerySetModifications.set(r.id,c):this.querySetVersion=i,{type:"ModifyQuerySet",baseVersion:s,newVersion:i,modifications:[c]}}}}var Uj=Object.defineProperty,Bj=(e,t,r)=>t in e?Uj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xl=(e,t,r)=>Bj(e,typeof t!="symbol"?t+"":t,r);class qj{constructor(t,r){this.logger=t,this.markConnectionStateDirty=r,Xl(this,"inflightRequests"),Xl(this,"requestsOlderThanRestart"),Xl(this,"inflightMutationsCount",0),Xl(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(t,r){const s=new Promise(i=>{const c=r?"Requested":"NotSent";this.inflightRequests.set(t.requestId,{message:t,status:{status:c,requestedAt:new Date,onResult:i}}),t.type==="Mutation"?this.inflightMutationsCount++:t.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),s}onResponse(t){const r=this.inflightRequests.get(t.requestId);if(r===void 0||r.status.status==="Completed")return null;const s=r.message.type==="Mutation"?"mutation":"action",i=r.message.udfPath;for(const h of t.logLines)Mu(this.logger,"info",s,i,h);const c=r.status;let u,f;if(t.success)u={success:!0,logLines:t.logLines,value:Da(t.result)},f=()=>c.onResult(u);else{const h=t.result,{errorData:p}=t;Mu(this.logger,"error",s,i,h),u={success:!1,errorMessage:h,errorData:p!==void 0?Da(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),r.message.type==="Action"?this.inflightActionsCount--:r.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:t.requestId,result:u}):(r.status={status:"Completed",result:u,ts:t.ts,onResolve:f},null)}removeCompleted(t){const r=new Map;for(const[s,i]of this.inflightRequests.entries()){const c=i.status;c.status==="Completed"&&c.ts.lessThanOrEqual(t)&&(c.onResolve(),r.set(s,c.result),i.message.type==="Mutation"?this.inflightMutationsCount--:i.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(s),this.requestsOlderThanRestart.delete(s))}return r.size>0&&this.markConnectionStateDirty(),r}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const t=[];for(const[r,s]of this.inflightRequests){if(s.status.status==="NotSent"){s.status.status="Requested",t.push(s.message);continue}if(s.message.type==="Mutation")t.push(s.message);else if(s.message.type==="Action"){if(this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r),this.inflightActionsCount--,s.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");s.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),t}resume(){const t=[];for(const[,r]of this.inflightRequests)if(r.status.status==="NotSent"){r.status.status="Requested",t.push(r.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 r of this.inflightRequests.values())r.status.status!=="Completed"&&r.status.requestedAt.getTime()<t&&(t=r.status.requestedAt.getTime());return new Date(t)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const fc=Symbol.for("functionName"),x1=Symbol.for("toReferencePath");function Fj(e){return e[x1]??null}function Vj(e){return e.startsWith("function://")}function Hj(e){let t;if(typeof e=="string")Vj(e)?t={functionHandle:e}:t={name:e};else if(e[fc])t={name:e[fc]};else{const r=Fj(e);if(!r)throw new Error(`${e} is not a functionReference`);t={reference:r}}return t}function on(e){const t=Hj(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 r=e[fc];if(!r)throw new Error(`${e} is not a functionReference`);return r}function _1(e){return{[fc]:e}}function C1(e=[]){const t={get(r,s){if(typeof s=="string"){const i=[...e,s];return C1(i)}else if(s===fc){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 i=e.slice(0,-1).join("/"),c=e[e.length-1];return c==="default"?i:i+":"+c}else return s===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}const Zj=C1();var Qj=Object.defineProperty,Gj=(e,t,r)=>t in e?Qj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nu=(e,t,r)=>Gj(e,typeof t!="symbol"?t+"":t,r);class dc{constructor(t){Nu(this,"queryResults"),Nu(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...r){const s=Lr(r[0]),i=on(t),c=this.queryResults.get(fs(i,s));if(c!==void 0)return dc.queryValue(c.result)}getAllQueries(t){const r=[],s=on(t);for(const i of this.queryResults.values())i.udfPath===ms(s)&&r.push({args:i.args,value:dc.queryValue(i.result)});return r}setQuery(t,r,s){const i=Lr(r),c=on(t),u=fs(c,i);let f;s===void 0?f=void 0:f={success:!0,value:s,logLines:[]};const h={udfPath:c,args:i,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 Yj{constructor(){Nu(this,"queryResults"),Nu(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(t,r){this.optimisticUpdates=this.optimisticUpdates.filter(u=>!r.has(u.mutationId));const s=this.queryResults;this.queryResults=new Map(t);const i=new dc(this.queryResults);for(const u of this.optimisticUpdates)u.update(i);const c=[];for(const[u,f]of this.queryResults){const h=s.get(u);(h===void 0||h.result!==f.result)&&c.push(u)}return c}applyOptimisticUpdate(t,r){this.optimisticUpdates.push({update:t,mutationId:r});const s=new dc(this.queryResults);return t(s),s.modifiedQueries}rawQueryResult(t){const r=this.queryResults.get(t);if(r!==void 0)return r.result}queryResult(t){const r=this.queryResults.get(t);if(r===void 0)return;const s=r.result;if(s!==void 0){if(s.success)return s.value;throw s.errorData!==void 0?Gp(s,new Qp(wa("query",r.udfPath,s))):new Error(wa("query",r.udfPath,s))}}hasQueryResult(t){return this.queryResults.get(t)!==void 0}queryLogs(t){return this.queryResults.get(t)?.result?.logLines}}var Kj=Object.defineProperty,Xj=(e,t,r)=>t in e?Kj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mp=(e,t,r)=>Xj(e,typeof t!="symbol"?t+"":t,r);class rn{constructor(t,r){mp(this,"low"),mp(this,"high"),mp(this,"__isUnsignedLong__"),this.low=t|0,this.high=r|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new rn(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,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?xw:t>=Jj?Wj:new rn(t%rc|0,t/rc|0)}toString(){return(BigInt(this.high)*BigInt(rc)+BigInt(this.low)).toString()}equals(t){return rn.isLong(t)||(t=rn.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 rn.isLong(t)||(t=rn.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"?rn.fromNumber(t):new rn(t.low,t.high)}}const xw=new rn(0,0),_w=65536,rc=_w*_w,Jj=rc*rc,Wj=new rn(-1,-1);var ez=Object.defineProperty,tz=(e,t,r)=>t in e?ez(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Jl=(e,t,r)=>tz(e,typeof t!="symbol"?t+"":t,r);class Cw{constructor(t,r){Jl(this,"version"),Jl(this,"remoteQuerySet"),Jl(this,"queryPath"),Jl(this,"logger"),this.version={querySet:0,ts:rn.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=t,this.logger=r}transition(t){const r=t.startVersion;if(this.version.querySet!==r.querySet||this.version.ts.notEquals(r.ts)||this.version.identity!==r.identity)throw new Error(`Invalid start version: ${r.ts.toString()}:${r.querySet}:${r.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const s of t.modifications)switch(s.type){case"QueryUpdated":{const i=this.queryPath(s.queryId);if(i)for(const u of s.logLines)Mu(this.logger,"info","query",i,u);const c=Da(s.value??null);this.remoteQuerySet.set(s.queryId,{success:!0,value:c,logLines:s.logLines});break}case"QueryFailed":{const i=this.queryPath(s.queryId);if(i)for(const u of s.logLines)Mu(this.logger,"info","query",i,u);const{errorData:c}=s;this.remoteQuerySet.set(s.queryId,{success:!1,errorMessage:s.errorMessage,errorData:c!==void 0?Da(c):void 0,logLines:s.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(s.queryId);break}default:throw new Error(`Invalid modification ${s.type}`)}this.version=t.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function gp(e){const t=cc(e);return rn.fromBytesLE(Array.from(t))}function nz(e){const t=new Uint8Array(e.toBytesLE());return lc(t)}function Ew(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:gp(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:gp(e.startVersion.ts)},endVersion:{...e.endVersion,ts:gp(e.endVersion.ts)}}}}function rz(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:nz(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var oz=Object.defineProperty,sz=(e,t,r)=>t in e?oz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_t=(e,t,r)=>sz(e,typeof t!="symbol"?t+"":t,r);const az=1e3,iz=1001,cz=1005,lz=4040;let pu;function va(){return pu===void 0&&(pu=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(pu+performance.now())}function Rw(){return`t=${Math.round((va()-pu)/100)/10}s`}const E1={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 uz(e){if(e===void 0)return"Unknown";for(const t of Object.keys(E1))if(e.startsWith(t))return t;return"Unknown"}class fz{constructor(t,r,s,i,c,u){this.markConnectionStateDirty=c,this.debug=u,_t(this,"socket"),_t(this,"connectionCount"),_t(this,"_hasEverConnected",!1),_t(this,"lastCloseReason"),_t(this,"transitionChunkBuffer",null),_t(this,"defaultInitialBackoff"),_t(this,"maxBackoff"),_t(this,"retries"),_t(this,"serverInactivityThreshold"),_t(this,"reconnectDueToServerInactivityTimeout"),_t(this,"scheduledReconnect",null),_t(this,"networkOnlineHandler",null),_t(this,"pendingNetworkRecoveryInfo",null),_t(this,"uri"),_t(this,"onOpen"),_t(this,"onResume"),_t(this,"onMessage"),_t(this,"webSocketConstructor"),_t(this,"logger"),_t(this,"onServerDisconnectError"),this.webSocketConstructor=s,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=r.onOpen,this.onResume=r.onResume,this.onMessage=r.onMessage,this.onServerDisconnectError=r.onServerDisconnectError,this.logger=i,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 r=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${r}, got ${t.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(t.chunk),this.transitionChunkBuffer.chunks.length===t.totalParts){const r=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const s=Ew(JSON.parse(r));if(s.type!=="Transition")throw new Error(`Expected Transition, got ${s.type} after assembling chunks`);return s}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:va()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",Rw(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",Rw())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:r}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:r}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(r/1e3)}s of waiting`)}},t.onerror=r=>{this.transitionChunkBuffer=null;const s=r.message;s&&this.logger.log(`WebSocket error message: ${s}`)},t.onmessage=r=>{this.resetServerInactivityTimeout();const s=r.data.length;let i=Ew(JSON.parse(r.data));if(this._logVerbose(`received ws message with type ${i.type}`),i.type==="Ping")return;if(i.type==="TransitionChunk"){const u=this.assembleTransition(i);if(!u)return;i=u,this._logVerbose(`assembled full ws message of type ${i.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${i.type} while buffering TransitionChunks`)),i.type==="Transition"&&this.reportLargeTransition({messageLength:s,transition:i}),this.onMessage(i).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},t.onclose=r=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=r.reason||`closed with code ${r.code}`),r.code!==az&&r.code!==iz&&r.code!==cz&&r.code!==lz){let i=`WebSocket closed with code ${r.code}`;r.reason&&(i+=`: ${r.reason}`),this.logger.log(i),this.onServerDisconnectError&&r.reason&&this.onServerDisconnectError(i)}const s=uz(r.reason);this.scheduleReconnect(s)}}socketState(){return this.socket.state}sendMessage(t){const r={type:t.type,...t.type==="Authenticate"&&t.tokenType==="User"?{value:`...${t.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const s=rz(t),i=JSON.stringify(s);let c=!1;try{this.socket.ws.send(i),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(r)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(r)}`),!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 r=this.nextBackoff(t);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(r)}ms`);const s=va(),i=setTimeout(()=>{this.scheduledReconnect?.timeout===i&&(this.scheduledReconnect=null,this.connect())},r);this.scheduledReconnect={timeout:i,scheduledAt:s,backoffMs:r}}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=r=>{this._logVerbose("Ignoring message received after close")},new Promise(r=>{t.onclose=()=>{this._logVerbose("Closed after connecting"),r()},t.onopen=()=>{this._logVerbose("Opened after connecting"),t.close()}})}case"ready":{this._logVerbose("ws.close called");const t=this.socket.ws;t.onmessage=s=>{this._logVerbose("Ignoring message received after close")};const r=new Promise(s=>{t.onclose=()=>{s()}});return t.close(),r}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 r=va()-this.scheduledReconnect.scheduledAt;t=Math.max(0,this.scheduledReconnect.backoffMs-r),this._logVerbose(`would have waited ${Math.round(t)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(r)}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:va()})):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 s=(t==="client"?100:t==="Unknown"?this.defaultInitialBackoff:E1[t].timeout)*Math.pow(2,this.retries);this.retries+=1;const i=Math.min(s,this.maxBackoff),c=i*(Math.random()-.5);return i+c}reportLargeTransition({transition:t,messageLength:r}){if(t.clientClockSkew===void 0||t.serverTs===void 0)return;const s=va()-t.clientClockSkew-t.serverTs/1e6,i=`${Math.round(s)}ms`,c=`${Math.round(r/1e4)/100}MB`,u=r/(s/1e3),f=`${Math.round(u/1e4)/100}MB per second`;this._logVerbose(`received ${c} transition in ${i} at ${f}`),r>2e7?this.logger.log(`received query results totaling more that 20MB (${c}) which will take a long time to download on slower connections`):s>2e4&&this.logger.log(`received query results totaling ${c} which took more than 20s to arrive (${i})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:s,messageLength:r}})}}function dz(){return hz()}function hz(){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 Yi extends Error{}Yi.prototype.name="InvalidTokenError";function pz(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let s=r.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function mz(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 pz(t)}catch{return atob(t)}}function R1(e,t){if(typeof e!="string")throw new Yi("Invalid token specified: must be a string");t||(t={});const r=t.header===!0?0:1,s=e.split(".")[r];if(typeof s!="string")throw new Yi(`Invalid token specified: missing part #${r+1}`);let i;try{i=mz(s)}catch(c){throw new Yi(`Invalid token specified: invalid base64 for part #${r+1} (${c.message})`)}try{return JSON.parse(i)}catch(c){throw new Yi(`Invalid token specified: invalid json for part #${r+1} (${c.message})`)}}var gz=Object.defineProperty,yz=(e,t,r)=>t in e?gz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nn=(e,t,r)=>yz(e,typeof t!="symbol"?t+"":t,r);const vz=480*60*60*1e3,Tw=2;class bz{constructor(t,r,s){Nn(this,"authState",{state:"noAuth"}),Nn(this,"configVersion",0),Nn(this,"syncState"),Nn(this,"authenticate"),Nn(this,"stopSocket"),Nn(this,"tryRestartSocket"),Nn(this,"pauseSocket"),Nn(this,"resumeSocket"),Nn(this,"clearAuth"),Nn(this,"logger"),Nn(this,"refreshTokenLeewaySeconds"),Nn(this,"tokenConfirmationAttempts",0),this.syncState=t,this.authenticate=r.authenticate,this.stopSocket=r.stopSocket,this.tryRestartSocket=r.tryRestartSocket,this.pauseSocket=r.pauseSocket,this.resumeSocket=r.resumeSocket,this.clearAuth=r.clearAuth,this.logger=s.logger,this.refreshTokenLeewaySeconds=s.refreshTokenLeewaySeconds}async setConfig(t,r){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const s=await this.fetchTokenAndGuardAgainstRace(t,{forceRefreshToken:!1});s.isFromOutdatedConfig||(s.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:{fetchToken:t,onAuthChange:r},hasRetried:!1}),this.authenticate(s.value)):(this.setAuthState({state:"initialRefetch",config:{fetchToken:t,onAuthChange:r}}),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:r}=t;if(!this.syncState.isCurrentOrNewerAuthVersion(r+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>=Tw){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, ${Tw-this.tokenConfirmationAttempts} attempts remaining`)),await this.stopSocket();const r=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});r.isFromOutdatedConfig||(r.value&&this.syncState.isNewAuth(r.value)?(this.authenticate(r.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:r.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 r=this.decodeToken(t);if(!r){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:s,exp:i}=r;if(!s||!i){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const c=i-s;if(c<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let u=Math.min(vz,(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,r){const s=++this.configVersion;this._logVerbose(`fetching token with config version ${s}`);const i=await t(r);return this.configVersion!==s?(this._logVerbose(`stale config version, expected ${s}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:i}}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 r=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(r)}`),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 R1(t)}catch(r){return this._logVerbose(`Error decoding token: ${r instanceof Error?r.message:"Unknown error"}`),null}}_logVerbose(t){this.logger.logVerbose(`${t} [v${this.configVersion}]`)}}const wz=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function Sz(e,t){const r={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:r})}function xz(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function _z(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const r of wz){const s=performance.getEntriesByName(r).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===e);t.push(...s)}return t.map(xz)}var Cz=Object.defineProperty,Ez=(e,t,r)=>t in e?Cz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ct=(e,t,r)=>Ez(e,typeof t!="symbol"?t+"":t,r);class Rz{constructor(t,r,s){if(Ct(this,"address"),Ct(this,"state"),Ct(this,"requestManager"),Ct(this,"webSocketManager"),Ct(this,"authenticationManager"),Ct(this,"remoteQuerySet"),Ct(this,"optimisticQueryResults"),Ct(this,"_transitionHandlerCounter",0),Ct(this,"_nextRequestId"),Ct(this,"_onTransitionFns",new Map),Ct(this,"_sessionId"),Ct(this,"firstMessageReceived",!1),Ct(this,"debug"),Ct(this,"logger"),Ct(this,"maxObservedTimestamp"),Ct(this,"connectionStateSubscribers",new Map),Ct(this,"nextConnectionStateSubscriberId",0),Ct(this,"_lastPublishedConnectionState"),Ct(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const _=this.connectionState();if(JSON.stringify(_)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=_;for(const E of this.connectionStateSubscribers.values())E(_)}})}),Ct(this,"mark",_=>{this.debug&&Sz(_,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.");s?.skipConvexDeploymentUrlCheck!==!0&&vj(t),s={...s};const i=s.authRefreshTokenLeewaySeconds??2;let c=s.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=s.reportDebugInfoToConvex??!1,this.address=t,this.logger=s.logger===!1?S1({verbose:s.verbose??!1}):s.logger!==!0&&s.logger?s.logger:w1({verbose:s.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/${bw}/sync`;this.state=new $j,this.remoteQuerySet=new Cw(_=>this.state.queryPath(_),this.logger),this.requestManager=new qj(this.logger,this.markConnectionStateDirty);const v=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new bz(this.state,{authenticate:_=>{const E=this.state.setAuth(_);return this.webSocketManager.sendMessage(E),E.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:v,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:i}),this.optimisticQueryResults=new Yj,this.addOnTransitionHandler(_=>{r(_.queries.map(E=>E.token))}),this._nextRequestId=0,this._sessionId=dz();const{unsavedChangesWarning:b}=s;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",_=>{if(this.requestManager.hasIncompleteRequests()){_.preventDefault();const E="Are you sure you want to leave? Your changes may not be saved.";return(_||window.event).returnValue=E,E}});this.webSocketManager=new fz(y,{onOpen:_=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({..._,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp});const E=new Set(this.remoteQuerySet.remoteQueryResults().keys());this.remoteQuerySet=new Cw(O=>this.state.queryPath(O),this.logger);const[x,C]=this.state.restart(E);C&&this.webSocketManager.sendMessage(C),this.webSocketManager.sendMessage(x);for(const O of this.requestManager.restart())this.webSocketManager.sendMessage(O)},onResume:()=>{const[_,E]=this.state.resume();E&&this.webSocketManager.sendMessage(E),_&&this.webSocketManager.sendMessage(_);for(const x of this.requestManager.resume())this.webSocketManager.sendMessage(x)},onMessage:_=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),_.type){case"Transition":{this.observedTimestamp(_.endVersion.ts),this.authenticationManager.onTransition(_),this.remoteQuerySet.transition(_),this.state.transition(_);const E=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(E);break}case"MutationResponse":{_.success&&this.observedTimestamp(_.ts);const E=this.requestManager.onResponse(_);E!==null&&this.notifyOnQueryResultChanges(new Map([[E.requestId,E.result]]));break}case"ActionResponse":{this.requestManager.onResponse(_);break}case"AuthError":{this.authenticationManager.onAuthError(_);break}case"FatalError":{const E=Pj(this.logger,_.error);throw this.webSocketManager.terminate(),E}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:s.onServerDisconnectError},c,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),s.expectAuth&&v()}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 r=this.remoteQuerySet.remoteQueryResults(),s=new Map;for(const[c,u]of r){const f=this.state.queryToken(c);if(f!==null){const h={result:u,udfPath:this.state.queryPath(c),args:this.state.queryArgs(c)};s.set(f,h)}}const i=this.optimisticQueryResults.ingestQueryResultsFromServer(s,new Set(t.keys()));this.handleTransition({queries:i.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 r of this._onTransitionFns.values())r(t)}addOnTransitionHandler(t){const r=this._transitionHandlerCounter++;return this._onTransitionFns.set(r,t),()=>this._onTransitionFns.delete(r)}getCurrentAuthClaims(){const t=this.state.getAuth();let r={};if(t&&t.tokenType==="User")try{r=t?R1(t.value):{}}catch{r={}}else return;return{token:t.value,decoded:r}}setAuth(t,r){this.authenticationManager.setConfig(t,r)}hasAuth(){return this.state.hasAuth()}setAdminAuth(t,r){const s=this.state.setAdminAuth(t,r);this.webSocketManager.sendMessage(s)}clearAuth(){const t=this.state.clearAuth();this.webSocketManager.sendMessage(t)}subscribe(t,r,s){const i=Lr(r),{modification:c,queryToken:u,unsubscribe:f}=this.state.subscribe(t,i,s?.journal,s?.componentPath);return c!==null&&this.webSocketManager.sendMessage(c),{queryToken:u,unsubscribe:()=>{const h=f();h&&this.webSocketManager.sendMessage(h)}}}localQueryResult(t,r){const s=Lr(r),i=fs(t,s);return this.optimisticQueryResults.queryResult(i)}localQueryResultByToken(t){return this.optimisticQueryResults.queryResult(t)}hasLocalQueryResultByToken(t){return this.optimisticQueryResults.hasQueryResult(t)}localQueryLogs(t,r){const s=Lr(r),i=fs(t,s);return this.optimisticQueryResults.queryLogs(i)}queryJournal(t,r){const s=Lr(r),i=fs(t,s);return this.state.queryJournal(i)}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 r=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(r,t),()=>{this.connectionStateSubscribers.delete(r)}}async mutation(t,r,s){const i=await this.mutationInternal(t,r,s);if(!i.success)throw i.errorData!==void 0?Gp(i,new Qp(wa("mutation",t,i))):new Error(wa("mutation",t,i));return i.value}async mutationInternal(t,r,s,i){const{mutationPromise:c}=this.enqueueMutation(t,r,s,i);return c}enqueueMutation(t,r,s,i){const c=Lr(r);this.tryReportLongDisconnect();const u=this.nextRequestId;if(this._nextRequestId++,s!==void 0){const y=s.optimisticUpdate;if(y!==void 0){const v=E=>{y(E,c)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},_=this.optimisticQueryResults.applyOptimisticUpdate(v,u).map(E=>{const x=this.localQueryResultByToken(E);return{token:E,modification:{kind:"Updated",result:x===void 0?void 0:{success:!0,value:x,logLines:[]}}}});this.handleTransition({queries:_,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const f={type:"Mutation",requestId:u,udfPath:t,componentPath:i,args:[Gn(c)]},h=this.webSocketManager.sendMessage(f),p=this.requestManager.request(f,h);return{requestId:u,mutationPromise:p}}async action(t,r){const s=await this.actionInternal(t,r);if(!s.success)throw s.errorData!==void 0?Gp(s,new Qp(wa("action",t,s))):new Error(wa("action",t,s));return s.value}async actionInternal(t,r,s){const i=Lr(r),c=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const u={type:"Action",requestId:c,udfPath:t,componentPath:s,args:[Gn(i)]},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=_z(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 r=`${this.address}/api/debug_event`;fetch(r,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${bw}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(s=>{s.ok||this.logger.warn("Analytics request failed with response:",s.body)}).catch(s=>{this.logger.warn("Analytics response failed with error:",s)})}}function yp(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 Tz=Object.defineProperty,Az=(e,t,r)=>t in e?Tz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Aw=(e,t,r)=>Az(e,typeof t!="symbol"?t+"":t,r);class Oz{constructor(t,r){this.client=t,this.onTransition=r,Aw(this,"paginatedQuerySet",new Map),Aw(this,"lastTransitionTs"),this.lastTransitionTs=rn.fromNumber(0),this.client.addOnTransitionHandler(s=>this.onBaseTransition(s))}subscribe(t,r,s){const i=ms(t),c=Sw(i,r,s),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:i,args:r,numSubscribers:1,options:{initialNumItems:s.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:s.id}),this.addPageToPaginatedQuery(c,null,s.initialNumItems),{paginatedQueryToken:c,unsubscribe:u})}localQueryResult(t,r,s){const i=ms(t),c=Sw(i,r,s);return this.localQueryResultByToken(c)}localQueryResultByToken(t){const r=this.paginatedQuerySet.get(t);if(!r)return;const s=this.activePageQueryTokens(r);if(s.length===0)return{results:[],status:"LoadingFirstPage",loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)};let i=[],c=!1,u=!1;for(const h of s){const p=this.client.localQueryResultByToken(h);if(p===void 0){c=!0,u=!1;continue}const y=yp(p);i=i.concat(y.page),u=!!y.isDone}let f;return c?f=i.length===0?"LoadingFirstPage":"LoadingMore":u?f="Exhausted":f="CanLoadMore",{results:i,status:f,loadMore:h=>this.loadMoreOfPaginatedQuery(t,h)}}onBaseTransition(t){const r=t.queries.map(u=>u.token),s=this.queriesContainingTokens(r);let i=[];s.length>0&&(this.processPaginatedQuerySplits(s,u=>this.client.localQueryResultByToken(u)),i=s.map(u=>({token:u,modification:{kind:"Updated",result:this.localQueryResultByToken(u)}})));const c={...t,paginatedQueries:i};this.onTransition(c)}loadMoreOfPaginatedQuery(t,r){this.mustGetPaginatedQuery(t);const s=this.queryTokenForLastPageOfPaginatedQuery(t),i=this.client.localQueryResultByToken(s);if(!i)return!1;const c=yp(i);if(c.isDone)return!1;this.addPageToPaginatedQuery(t,c.continueCursor,r);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 r=[],s=new Set(t);for(const[i,c]of this.paginatedQuerySet)for(const u of this.allQueryTokens(c))if(s.has(u)){r.push(i);break}return r}processPaginatedQuerySplits(t,r){for(const s of t){const i=this.mustGetPaginatedQuery(s),{ongoingSplits:c,pageKeyToQuery:u,pageKeys:f}=i;for(const[h,[p,y]]of c)r(u.get(p).queryToken)!==void 0&&r(u.get(y).queryToken)!==void 0&&this.completePaginatedQuerySplit(i,h,p,y);for(const h of f){if(c.has(h))continue;const p=u.get(h).queryToken,y=r(p);if(!y)continue;const v=yp(y);v.splitCursor&&(v.pageStatus==="SplitRecommended"||v.pageStatus==="SplitRequired"||v.page.length>i.options.initialNumItems*2)&&this.splitPaginatedQueryPage(i,h,v.splitCursor,v.continueCursor)}}}splitPaginatedQueryPage(t,r,s,i){const c=t.nextPageKey++,u=t.nextPageKey++,f={cursor:i,numItems:t.options.initialNumItems,id:t.id},h=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:null,endCursor:s}});t.pageKeyToQuery.set(c,h);const p=this.client.subscribe(t.canonicalizedUdfPath,{...t.args,paginationOpts:{...f,cursor:s,endCursor:i}});t.pageKeyToQuery.set(u,p),t.ongoingSplits.set(r,[c,u])}addPageToPaginatedQuery(t,r,s){const i=this.mustGetPaginatedQuery(t),c=i.nextPageKey++,u={cursor:r,numItems:s,id:i.id},f={...i.args,paginationOpts:u},h=this.client.subscribe(i.canonicalizedUdfPath,f);return i.pageKeys.push(c),i.pageKeyToQuery.set(c,h),h}removePaginatedQuerySubscriber(t){const r=this.paginatedQuerySet.get(t);if(r&&(r.numSubscribers-=1,!(r.numSubscribers>0))){for(const s of r.pageKeyToQuery.values())s.unsubscribe();this.paginatedQuerySet.delete(t)}}completePaginatedQuerySplit(t,r,s,i){const c=t.pageKeyToQuery.get(r);t.pageKeyToQuery.delete(r);const u=t.pageKeys.indexOf(r);t.pageKeys.splice(u,1,s,i),t.ongoingSplits.delete(r),c.unsubscribe()}activePageQueryTokens(t){return t.pageKeys.map(r=>t.pageKeyToQuery.get(r).queryToken)}allQueryTokens(t){return Array.from(t.pageKeyToQuery.values()).map(r=>r.queryToken)}queryTokenForLastPageOfPaginatedQuery(t){const r=this.mustGetPaginatedQuery(t),s=r.pageKeys[r.pageKeys.length-1];if(s===void 0)throw new Error(`No pages for paginated query ${t}`);return r.pageKeyToQuery.get(s).queryToken}mustGetPaginatedQuery(t){const r=this.paginatedQuerySet.get(t);if(!r)throw new Error("paginated query no longer exists for token "+t);return r}}function kz({getCurrentValue:e,subscribe:t}){const[r,s]=w.useState(()=>({getCurrentValue:e,subscribe:t,value:e()}));let i=r.value;return(r.getCurrentValue!==e||r.subscribe!==t)&&(i=e(),s({getCurrentValue:e,subscribe:t,value:i})),w.useEffect(()=>{let c=!1;const u=()=>{c||s(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]),i}var Mz=Object.defineProperty,Nz=(e,t,r)=>t in e?Mz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dr=(e,t,r)=>Nz(e,typeof t!="symbol"?t+"":t,r);const jz=5e3;if(typeof qt>"u")throw new Error("Required dependency 'react' not found");function T1(e,t,r){function s(i){return Lz(i),t.mutation(e,i,{optimisticUpdate:r})}return s.withOptimisticUpdate=function(c){if(r!==void 0)throw new Error(`Already specified optimistic update for mutation ${on(e)}`);return T1(e,t,c)},s}class zz{constructor(t,r){if(Dr(this,"address"),Dr(this,"cachedSync"),Dr(this,"cachedPaginatedQueryClient"),Dr(this,"listeners"),Dr(this,"options"),Dr(this,"closed",!1),Dr(this,"_logger"),Dr(this,"adminAuth"),Dr(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=r?.logger===!1?S1({verbose:r?.verbose??!1}):r?.logger!==!0&&r?.logger?r.logger:w1({verbose:r?.verbose??!1}),this.options={...r,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 Rz(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new Oz(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,r){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,r??(()=>{}))}clearAuth(){this.sync.clearAuth()}setAdminAuth(t,r){if(this.adminAuth=t,this.fakeUserIdentity=r,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(t,r)}watchQuery(t,...r){const[s,i]=r,c=on(t);return{onUpdate:u=>{const{queryToken:f,unsubscribe:h}=this.sync.subscribe(c,s,i),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,s)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(c,s)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(c,s)}}}prewarmQuery(t){const r=t.extendSubscriptionFor??jz,i=this.watchQuery(t.query,t.args||{}).onUpdate(()=>{});setTimeout(i,r)}watchPaginatedQuery(t,r,s){const i=on(t);return{onUpdate:c=>{const{paginatedQueryToken:u,unsubscribe:f}=this.paginatedQueryClient.subscribe(i,r||{},s),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(i,r,s)}}mutation(t,...r){const[s,i]=r,c=on(t);return this.sync.mutation(c,s,i)}action(t,...r){const s=on(t);return this.sync.action(s,...r)}query(t,...r){const s=this.watchQuery(t,...r),i=s.localQueryResult();return i!==void 0?Promise.resolve(i):new Promise((c,u)=>{const f=s.onUpdate(()=>{f();try{c(s.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 r=t.queries.map(i=>i.token),s=t.paginatedQueries.map(i=>i.token);this.transition([...r,...s])}transition(t){for(const r of t){const s=this.listeners.get(r);if(s)for(const i of s)i()}}}const $m=qt.createContext(void 0);function Dz(){return w.useContext($m)}const Pz=({client:e,children:t})=>qt.createElement($m.Provider,{value:e},t);function A1(e,...t){const r=t[0]==="skip",s=t[0]==="skip"?{}:Lr(t[0]),i=typeof e=="string"?_1(e):e,c=on(i),u=w.useMemo(()=>r?{}:{query:{query:i,args:s}},[JSON.stringify(Gn(s)),c,r]),h=Bz(u).query;if(h instanceof Error)throw h;return h}function Ow(e){const t=typeof e=="string"?_1(e):e,r=w.useContext($m);if(r===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 w.useMemo(()=>T1(t,r),[r,on(t)])}function Lz(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 Iz=Object.defineProperty,$z=(e,t,r)=>t in e?Iz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vp=(e,t,r)=>$z(e,typeof t!="symbol"?t+"":t,r);class Uz{constructor(t){vp(this,"createWatch"),vp(this,"queries"),vp(this,"listeners"),this.createWatch=t,this.queries={},this.listeners=new Set}setQueries(t){for(const r of Object.keys(t)){const{query:s,args:i,paginationOptions:c}=t[r];if(on(s),this.queries[r]===void 0)this.addQuery(r,s,i,c?{paginationOptions:c}:{});else{const u=this.queries[r];(on(s)!==on(u.query)||JSON.stringify(Gn(i))!==JSON.stringify(Gn(u.args))||JSON.stringify(c)!==JSON.stringify(u.paginationOptions))&&(this.removeQuery(r),this.addQuery(r,s,i,c?{paginationOptions:c}:{}))}}for(const r of Object.keys(this.queries))t[r]===void 0&&this.removeQuery(r)}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}getLocalResults(t){const r={};for(const s of Object.keys(t)){const{query:i,args:c}=t[s],u=t[s].paginationOptions;on(i);const f=this.createWatch(i,c,u?{paginationOptions:u}:{});let h;try{h=f.localQueryResult()}catch(p){if(p instanceof Error)h=p;else throw p}r[s]=h}return r}setCreateWatch(t){this.createWatch=t;for(const r of Object.keys(this.queries)){const{query:s,args:i,watch:c,paginationOptions:u}=this.queries[r],f="journal"in c?c.journal():void 0;this.removeQuery(r),this.addQuery(r,s,i,{...f?{journal:f}:[],...u?{paginationOptions:u}:{}})}}destroy(){for(const t of Object.keys(this.queries))this.removeQuery(t);this.listeners=new Set}addQuery(t,r,s,{paginationOptions:i,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(r,s,{...c?{journal:c}:[],...i?{paginationOptions:i}:{}}),f=u.onUpdate(()=>this.notifyListeners());this.queries[t]={query:r,args:s,watch:u,unsubscribe:f,...i?{paginationOptions:i}:{}}}removeQuery(t){const r=this.queries[t];if(r===void 0)throw new Error(`No query found with identifier ${t}.`);r.unsubscribe(),delete this.queries[t]}notifyListeners(){for(const t of this.listeners)t()}}function Bz(e){const t=Dz();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 r=w.useMemo(()=>(s,i,{journal:c,paginationOptions:u})=>u?t.watchPaginatedQuery(s,i,u):t.watchQuery(s,i,c?{journal:c}:{}),[t]);return qz(e,r)}function qz(e,t){const[r]=w.useState(()=>new Uz(t));r.createWatch!==t&&r.setCreateWatch(t),w.useEffect(()=>()=>r.destroy(),[r]);const s=w.useMemo(()=>({getCurrentValue:()=>r.getLocalResults(e),subscribe:i=>(r.setQueries(e),r.subscribe(i))}),[r,e]);return kz(s)}const Fz="/assets/globals-CoCRjt0K.css";const O1=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();const Vz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Hz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,s)=>s?s.toUpperCase():r.toLowerCase());const kw=e=>{const t=Hz(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Zz={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 Qz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Gz=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:c,iconNode:u,...f},h)=>w.createElement("svg",{ref:h,...Zz,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:O1("lucide",i),...!c&&!Qz(f)&&{"aria-hidden":"true"},...f},[...u.map(([p,y])=>w.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Se=(e,t)=>{const r=w.forwardRef(({className:s,...i},c)=>w.createElement(Gz,{ref:c,iconNode:t,className:O1(`lucide-${Vz(kw(e))}`,`lucide-${e}`,s),...i}));return r.displayName=kw(e),r};const Yz=[["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"}]],Kz=Se("archive",Yz);const Xz=[["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"}]],Yp=Se("bell",Xz);const Jz=[["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"}]],Wz=Se("book",Jz);const e3=[["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"}]],t3=Se("bookmark",e3);const n3=[["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"}]],k1=Se("braces",n3);const r3=[["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"}]],Kp=Se("calendar",r3);const o3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],M1=Se("check",o3);const s3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_s=Se("chevron-down",s3);const a3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],i3=Se("chevron-right",a3);const c3=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],N1=Se("chevron-up",c3);const l3=[["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"}]],u3=Se("circle-alert",l3);const f3=[["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"}]],j1=Se("circle-question-mark",f3);const d3=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],h3=Se("clock",d3);const p3=[["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"}]],m3=Se("code-xml",p3);const g3=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],y3=Se("code",g3);const v3=[["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"}]],b3=Se("dollar-sign",v3);const w3=[["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"}]],S3=Se("external-link",w3);const x3=[["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"}]],_3=Se("eye",x3);const C3=[["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"}]],E3=Se("file-code",C3);const R3=[["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"}]],T3=Se("file-text",R3);const A3=[["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"}]],O3=Se("file-type",A3);const k3=[["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"}]],M3=Se("flag",k3);const N3=[["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"}]],j3=Se("folder-open",N3);const z3=[["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"}]],D3=Se("folder",z3);const P3=[["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"}]],L3=Se("globe",P3);const I3=[["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"}]],z1=Se("hash",I3);const $3=[["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"}]],U3=Se("heart",$3);const B3=[["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"}]],D1=Se("house",B3);const q3=[["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"}]],P1=Se("image",q3);const F3=[["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"}]],L1=Se("layers",F3);const V3=[["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"}]],H3=Se("layout-dashboard",V3);const Z3=[["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"}]],Q3=Se("link-2",Z3);const G3=[["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"}]],Y3=Se("link",G3);const K3=[["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"}]],X3=Se("list",K3);const J3=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],W3=Se("loader-circle",J3);const eD=[["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"}]],tD=Se("lock",eD);const nD=[["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"}]],rD=Se("log-out",nD);const oD=[["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"}]],sD=Se("mail",oD);const aD=[["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"}]],iD=Se("map-pin",aD);const cD=[["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"}]],lD=Se("message-square",cD);const uD=[["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"}]],fD=Se("package",uD);const dD=[["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"}]],hD=Se("phone",dD);const pD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],I1=Se("plus",pD);const mD=[["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"}]],gD=Se("settings",mD);const yD=[["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"}]],vD=Se("square-check-big",yD);const bD=[["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"}]],wD=Se("square-pen",bD);const SD=[["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"}]],xD=Se("star",SD);const _D=[["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"}]],CD=Se("tag",_D);const ED=[["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"}]],RD=Se("tags",ED);const TD=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],AD=Se("text-align-start",TD);const OD=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],$1=Se("toggle-left",OD);const kD=[["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"}]],MD=Se("trash-2",kD);const ND=[["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"}]],jD=Se("triangle-alert",ND);const zD=[["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"}]],U1=Se("user",zD);const DD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ju=Se("x",DD);function B1(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=B1(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function q1(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=B1(e))&&(s&&(s+=" "),s+=t);return s}const PD=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},LD=(e,t)=>({classGroupId:e,validator:t}),F1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),zu="-",Mw=[],ID="arbitrary..",$D=e=>{const t=BD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return UD(u);const f=u.split(zu),h=f[0]===""&&f.length>1?1:0;return V1(f,h,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const h=s[u],p=r[u];return h?p?PD(p,h):h:p||Mw}return r[u]||Mw}}},V1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],c=r.nextPart.get(i);if(c){const p=V1(e,t+1,c);if(p)return p}const u=r.validators;if(u===null)return;const f=t===0?e.join(zu):e.slice(t).join(zu),h=u.length;for(let p=0;p<h;p++){const y=u[p];if(y.validator(f))return y.classGroupId}},UD=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?ID+s:void 0})(),BD=e=>{const{theme:t,classGroups:r}=e;return qD(r,t)},qD=(e,t)=>{const r=F1();for(const s in e){const i=e[s];Um(i,r,s,t)}return r},Um=(e,t,r,s)=>{const i=e.length;for(let c=0;c<i;c++){const u=e[c];FD(u,t,r,s)}},FD=(e,t,r,s)=>{if(typeof e=="string"){VD(e,t,r);return}if(typeof e=="function"){HD(e,t,r,s);return}ZD(e,t,r,s)},VD=(e,t,r)=>{const s=e===""?t:H1(t,e);s.classGroupId=r},HD=(e,t,r,s)=>{if(QD(e)){Um(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(LD(r,e))},ZD=(e,t,r,s)=>{const i=Object.entries(e),c=i.length;for(let u=0;u<c;u++){const[f,h]=i[u];Um(h,H1(t,f),r,s)}},H1=(e,t)=>{let r=e;const s=t.split(zu),i=s.length;for(let c=0;c<i;c++){const u=s[c];let f=r.nextPart.get(u);f||(f=F1(),r.nextPart.set(u,f)),r=f}return r},QD=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const i=(c,u)=>{r[c]=u,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(c){let u=r[c];if(u!==void 0)return u;if((u=s[c])!==void 0)return i(c,u),u},set(c,u){c in r?r[c]=u:i(c,u)}}},Xp="!",Nw=":",YD=[],jw=(e,t,r,s,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:i}),KD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=i=>{const c=[];let u=0,f=0,h=0,p;const y=i.length;for(let x=0;x<y;x++){const C=i[x];if(u===0&&f===0){if(C===Nw){c.push(i.slice(h,x)),h=x+1;continue}if(C==="/"){p=x;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const v=c.length===0?i:i.slice(h);let b=v,_=!1;v.endsWith(Xp)?(b=v.slice(0,-1),_=!0):v.startsWith(Xp)&&(b=v.slice(1),_=!0);const E=p&&p>h?p-h:void 0;return jw(c,_,b,E)};if(t){const i=t+Nw,c=s;s=u=>u.startsWith(i)?c(u.slice(i.length)):jw(YD,!1,u,void 0,!0)}if(r){const i=s;s=c=>r({className:c,parseClassName:i})}return s},XD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let i=[];for(let c=0;c<r.length;c++){const u=r[c],f=u[0]==="[",h=t.has(u);f||h?(i.length>0&&(i.sort(),s.push(...i),i=[]),s.push(u)):i.push(u)}return i.length>0&&(i.sort(),s.push(...i)),s}},JD=e=>({cache:GD(e.cacheSize),parseClassName:KD(e),sortModifiers:XD(e),...$D(e)}),WD=/\s+/,e4=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:i,sortModifiers:c}=t,u=[],f=e.trim().split(WD);let h="";for(let p=f.length-1;p>=0;p-=1){const y=f[p],{isExternal:v,modifiers:b,hasImportantModifier:_,baseClassName:E,maybePostfixModifierPosition:x}=r(y);if(v){h=y+(h.length>0?" "+h:h);continue}let C=!!x,O=s(C?E.substring(0,x):E);if(!O){if(!C){h=y+(h.length>0?" "+h:h);continue}if(O=s(E),!O){h=y+(h.length>0?" "+h:h);continue}C=!1}const M=b.length===0?"":b.length===1?b[0]:c(b).join(":"),k=_?M+Xp:M,D=k+O;if(u.indexOf(D)>-1)continue;u.push(D);const U=i(O,C);for(let H=0;H<U.length;++H){const L=U[H];u.push(k+L)}h=y+(h.length>0?" "+h:h)}return h},t4=(...e)=>{let t=0,r,s,i="";for(;t<e.length;)(r=e[t++])&&(s=Z1(r))&&(i&&(i+=" "),i+=s);return i},Z1=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=Z1(e[s]))&&(r&&(r+=" "),r+=t);return r},n4=(e,...t)=>{let r,s,i,c;const u=h=>{const p=t.reduce((y,v)=>v(y),e());return r=JD(p),s=r.cache.get,i=r.cache.set,c=f,f(h)},f=h=>{const p=s(h);if(p)return p;const y=e4(h,r);return i(h,y),y};return c=u,(...h)=>c(t4(...h))},r4=[],At=e=>{const t=r=>r[e]||r4;return t.isThemeGetter=!0,t},Q1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,o4=/^\d+\/\d+$/,s4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,a4=/\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$/,i4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,c4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,l4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ha=e=>o4.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),yo=e=>!!e&&Number.isInteger(Number(e)),bp=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Pr=e=>s4.test(e),u4=()=>!0,f4=e=>a4.test(e)&&!i4.test(e),Y1=()=>!1,d4=e=>c4.test(e),h4=e=>l4.test(e),p4=e=>!fe(e)&&!de(e),m4=e=>Ua(e,J1,Y1),fe=e=>Q1.test(e),ns=e=>Ua(e,W1,f4),wp=e=>Ua(e,w4,Ne),zw=e=>Ua(e,K1,Y1),g4=e=>Ua(e,X1,h4),Wl=e=>Ua(e,e_,d4),de=e=>G1.test(e),Zi=e=>Ba(e,W1),y4=e=>Ba(e,S4),Dw=e=>Ba(e,K1),v4=e=>Ba(e,J1),b4=e=>Ba(e,X1),eu=e=>Ba(e,e_,!0),Ua=(e,t,r)=>{const s=Q1.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Ba=(e,t,r=!1)=>{const s=G1.exec(e);return s?s[1]?t(s[1]):r:!1},K1=e=>e==="position"||e==="percentage",X1=e=>e==="image"||e==="url",J1=e=>e==="length"||e==="size"||e==="bg-size",W1=e=>e==="length",w4=e=>e==="number",S4=e=>e==="family-name",e_=e=>e==="shadow",x4=()=>{const e=At("color"),t=At("font"),r=At("text"),s=At("font-weight"),i=At("tracking"),c=At("leading"),u=At("breakpoint"),f=At("container"),h=At("spacing"),p=At("radius"),y=At("shadow"),v=At("inset-shadow"),b=At("text-shadow"),_=At("drop-shadow"),E=At("blur"),x=At("perspective"),C=At("aspect"),O=At("ease"),M=At("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],U=()=>[...D(),de,fe],H=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],j=()=>[de,fe,h],G=()=>[ha,"full","auto",...j()],ie=()=>[yo,"none","subgrid",de,fe],ae=()=>["auto",{span:["full",yo,de,fe]},yo,de,fe],te=()=>[yo,"auto",de,fe],ce=()=>["auto","min","max","fr",de,fe],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...j()],K=()=>[ha,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],V=()=>[e,de,fe],re=()=>[...D(),Dw,zw,{position:[de,fe]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",v4,m4,{size:[de,fe]}],Q=()=>[bp,Zi,ns],ne=()=>["","none","full",p,de,fe],oe=()=>["",Ne,Zi,ns],pe=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Ne,bp,Dw,zw],_e=()=>["","none",E,de,fe],xe=()=>["none",Ne,de,fe],Re=()=>["none",Ne,de,fe],Ae=()=>[Ne,de,fe],Le=()=>[ha,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Pr],breakpoint:[Pr],color:[u4],container:[Pr],"drop-shadow":[Pr],ease:["in","out","in-out"],font:[p4],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Pr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Pr],shadow:[Pr],spacing:["px",Ne],text:[Pr],"text-shadow":[Pr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ha,fe,de,C]}],container:["container"],columns:[{columns:[Ne,fe,de,f]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:U()}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{start:G()}],end:[{end:G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[yo,"auto",de,fe]}],basis:[{basis:[ha,"full","auto",f,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,ha,"auto","initial","none",fe]}],grow:[{grow:["",Ne,de,fe]}],shrink:[{shrink:["",Ne,de,fe]}],order:[{order:[yo,"first","last","none",de,fe]}],"grid-cols":[{"grid-cols":ie()}],"col-start-end":[{col:ae()}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":ie()}],"row-start-end":[{row:ae()}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ce()}],"auto-rows":[{"auto-rows":ce()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[f,"screen",...K()]}],"min-w":[{"min-w":[f,"screen","none",...K()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Zi,ns]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,de,wp]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bp,fe]}],"font-family":[{font:[y4,fe,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:[i,de,fe]}],"line-clamp":[{"line-clamp":[Ne,"none",de,wp]}],leading:[{leading:[c,...j()]}],"list-image":[{"list-image":["none",de,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",de,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",de,ns]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Ne,"auto",de,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de,fe]}],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",de,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:re()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yo,de,fe],radial:["",de,fe],conic:[yo,de,fe]},b4,g4]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...pe(),"hidden","none"]}],"divide-style":[{divide:[...pe(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,de,fe]}],"outline-w":[{outline:["",Ne,Zi,ns]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",y,eu,Wl]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",v,eu,Wl]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Ne,ns]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",b,eu,Wl]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Ne,de,fe]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[de,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:re()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",de,fe]}],filter:[{filter:["","none",de,fe]}],blur:[{blur:_e()}],brightness:[{brightness:[Ne,de,fe]}],contrast:[{contrast:[Ne,de,fe]}],"drop-shadow":[{"drop-shadow":["","none",_,eu,Wl]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Ne,de,fe]}],"hue-rotate":[{"hue-rotate":[Ne,de,fe]}],invert:[{invert:["",Ne,de,fe]}],saturate:[{saturate:[Ne,de,fe]}],sepia:[{sepia:["",Ne,de,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",de,fe]}],"backdrop-blur":[{"backdrop-blur":_e()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,de,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,de,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,de,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,de,fe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,de,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,de,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,de,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,de,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",de,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",de,fe]}],ease:[{ease:["linear","initial",O,de,fe]}],delay:[{delay:[Ne,de,fe]}],animate:[{animate:["none",M,de,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,de,fe]}],"perspective-origin":[{"perspective-origin":U()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[de,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:U()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Le()}],"translate-x":[{"translate-x":Le()}],"translate-y":[{"translate-y":Le()}],"translate-z":[{"translate-z":Le()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"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",de,fe]}],"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":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",de,fe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Ne,Zi,ns,wp]}],stroke:[{stroke:["none",...V()]}],"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"]}},_4=n4(x4);function je(...e){return _4(q1(e))}et.union(et.literal("admin"),et.literal("editor"),et.literal("author"),et.literal("viewer"));const C4=et.union(et.literal("contentTypes"),et.literal("contentEntries"),et.literal("mediaItems"),et.literal("settings")),E4=et.union(et.literal("create"),et.literal("read"),et.literal("update"),et.literal("delete"),et.literal("publish"),et.literal("unpublish"),et.literal("restore"),et.literal("manage"),et.literal("move"));et.object({resource:C4,action:E4,scope:et.optional(et.union(et.literal("all"),et.literal("own")))});function oc(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 Oa(e,t="all"){return[{resource:e,action:"read",scope:t}]}function t_(e="all"){return[{resource:"contentEntries",action:"publish",scope:e},{resource:"contentEntries",action:"unpublish",scope:e}]}const R4={name:"admin",displayName:"Administrator",description:"Full access to all CMS features including settings and content type management",isSystem:!0,permissions:[...oc("contentTypes"),...oc("contentEntries"),...t_(),{resource:"contentEntries",action:"restore"},...oc("mediaItems"),{resource:"settings",action:"manage"},...Oa("settings")]},T4={name:"editor",displayName:"Editor",description:"Can manage all content and media, but cannot modify settings or content types",isSystem:!0,permissions:[...Oa("contentTypes"),...oc("contentEntries"),...t_(),{resource:"contentEntries",action:"restore"},...oc("mediaItems")]},A4={name:"author",displayName:"Author",description:"Can create and manage own content and media",isSystem:!0,permissions:[...Oa("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"}]},O4={name:"viewer",displayName:"Viewer",description:"Read-only access to published content and media",isSystem:!0,permissions:[...Oa("contentTypes"),...Oa("contentEntries"),...Oa("mediaItems")]},Bm={admin:R4,editor:T4,author:A4,viewer:O4};function k4(e,t){if(e.resource!==t.resource||e.action!==t.action)return!1;const r=e.scope??"all",s=t.scope??"all";return r==="all"?!0:s==="own"}function M4(e,t,r){const s=Bm[e]??r?.[e];return s?s.permissions.some(i=>k4(i,t)):!1}function N4(e,t){return(Bm[e]??t?.[e])?.permissions??[]}function j4(e,t){return Bm[e]??t?.[e]}function z4(e,t,r){return N4(e,r).filter(s=>s.resource===t)}function x7(e,t,r){return z4(e,t,r).length>0}const n_=w.createContext(null);function D4({children:e,getUser:t,getUserRole:r,onLogout:s,autoRedirectToLogin:i=!1,loginUrl:c="/login"}){const[u,f]=w.useState(null),[h,p]=w.useState(null),[y,v]=w.useState("loading"),[b,_]=w.useState(null),E=w.useCallback(async()=>{v("loading"),_(null);try{const k=await t();if(!k){f(null),p(null),v("unauthenticated"),i&&typeof window<"u"&&(window.location.href=c);return}const D=await r({userId:k.id});f(k),p(D),v("authenticated")}catch(k){console.error("Authentication error:",k),f(null),p(null),_(k instanceof Error?k.message:"Authentication failed"),v("error")}},[t,r,i,c]);w.useEffect(()=>{E()},[E]);const x=w.useCallback(k=>h?M4(h,k):!1,[h]),C=w.useCallback(async()=>{try{s&&await s(),f(null),p(null),v("unauthenticated"),i&&typeof window<"u"&&(window.location.href=c)}catch(k){console.error("Logout error:",k),_(k instanceof Error?k.message:"Logout failed")}},[s,i,c]),O=w.useCallback(async()=>{await E()},[E]),M={user:u,role:h,authState:y,isLoading:y==="loading",isAuthenticated:y==="authenticated",error:b,checkPermission:x,logout:C,refresh:O};return g.jsx(n_.Provider,{value:M,children:e})}function r_(){const e=w.useContext(n_);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const o_=w.createContext(null),s_="convex-cms-theme";function Pw(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Lw(){if(typeof window>"u")return"system";const e=localStorage.getItem(s_);return e==="light"||e==="dark"||e==="system"?e:"system"}function P4({children:e}){const[t,r]=w.useState(()=>Lw()),[s,i]=w.useState(()=>{const f=Lw();return f==="system"?Pw():f}),c=w.useCallback(f=>{const h=f==="system"?Pw():f;i(h);const p=document.documentElement;p.classList.remove("light","dark"),p.classList.add(h)},[]),u=w.useCallback(f=>{r(f),localStorage.setItem(s_,f),c(f)},[c]);return w.useEffect(()=>{c(t)},[t,c]),w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t==="system"&&c("system")};return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[t,c]),g.jsx(o_.Provider,{value:{theme:t,resolvedTheme:s,setTheme:u},children:e})}function _7(){const e=w.useContext(o_);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function W(e,t,r){function s(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 v=0;v<y.length;v++){const b=y[v];b in f||(f[b]=p[b].bind(f))}}const i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function u(f){var h;const p=r?.Parent?new c:this;s(p,f),(h=p._zod).deferred??(h.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(u,"init",{value:s}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class ka extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class a_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const i_={};function Eo(e){return i_}function c_(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,i])=>t.indexOf(+s)===-1).map(([s,i])=>i)}function Jp(e,t){return typeof t=="bigint"?t.toString():t}function qm(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Fm(e){return e==null}function Vm(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function L4(e,t){const r=(e.toString().split(".")[1]||"").length,s=t.toString();let i=(s.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(s)){const h=s.match(/\d?e-(\d?)/);h?.[1]&&(i=Number.parseInt(h[1]))}const c=r>i?r:i,u=Number.parseInt(e.toFixed(c).replace(".","")),f=Number.parseInt(t.toFixed(c).replace(".",""));return u%f/10**c}const Iw=Symbol("evaluating");function Ye(e,t,r){let s;Object.defineProperty(e,t,{get(){if(s!==Iw)return s===void 0&&(s=Iw,s=r()),s},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Cs(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jo(...e){const t={};for(const r of e){const s=Object.getOwnPropertyDescriptors(r);Object.assign(t,s)}return Object.defineProperties({},t)}function $w(e){return JSON.stringify(e)}function I4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const l_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Du(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const $4=qm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Pa(e){if(Du(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Du(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function u_(e){return Pa(e)?{...e}:Array.isArray(e)?[...e]:e}const U4=new Set(["string","number","symbol"]);function sf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zo(e,t,r){const s=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(s._zod.parent=e),s}function we(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 B4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const q4={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 F4(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c=jo(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=r.shape[f])}return Cs(this,"shape",u),u},checks:[]});return zo(e,c)}function V4(e,t){const r=e._zod.def,s=r.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=jo(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in r.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Cs(this,"shape",u),u},checks:[]});return zo(e,c)}function H4(e,t){if(!Pa(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.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 i=jo(e._zod.def,{get shape(){const c={...e._zod.def.shape,...t};return Cs(this,"shape",c),c}});return zo(e,i)}function Z4(e,t){if(!Pa(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=jo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Cs(this,"shape",s),s}});return zo(e,r)}function Q4(e,t){const r=jo(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return Cs(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return zo(e,r)}function G4(e,t,r){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=jo(t._zod.def,{get shape(){const f=t._zod.def.shape,h={...f};if(r)for(const p in r){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);r[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 Cs(this,"shape",h),h},checks:[]});return zo(t,u)}function Y4(e,t,r){const s=jo(t._zod.def,{get shape(){const i=t._zod.def.shape,c={...i};if(r)for(const u in r){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=new e({type:"nonoptional",innerType:i[u]}))}else for(const u in i)c[u]=new e({type:"nonoptional",innerType:i[u]});return Cs(this,"shape",c),c}});return zo(t,s)}function Sa(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xa(e,t){return t.map(r=>{var s;return(s=r).path??(s.path=[]),r.path.unshift(e),r})}function tu(e){return typeof e=="string"?e:e?.message}function Ro(e,t,r){const s={...e,path:e.path??[]};if(!e.message){const i=tu(e.inst?._zod.def?.error?.(e))??tu(t?.error?.(e))??tu(r.customError?.(e))??tu(r.localeError?.(e))??"Invalid input";s.message=i}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function Hm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hc(...e){const[t,r,s]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:s}:{...t}}const f_=(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,Jp,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},d_=W("$ZodError",f_),h_=W("$ZodError",f_,{Parent:Error});function K4(e,t=r=>r.message){const r={},s=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:r}}function X4(e,t=r=>r.message){const r={_errors:[]},s=i=>{for(const c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>s({issues:u}));else if(c.code==="invalid_key")s({issues:c.issues});else if(c.code==="invalid_element")s({issues:c.issues});else if(c.path.length===0)r._errors.push(t(c));else{let u=r,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 s(e),r}const Zm=e=>(t,r,s,i)=>{const c=s?Object.assign(s,{async:!1}):{async:!1},u=t._zod.run({value:r,issues:[]},c);if(u instanceof Promise)throw new ka;if(u.issues.length){const f=new(i?.Err??e)(u.issues.map(h=>Ro(h,c,Eo())));throw l_(f,i?.callee),f}return u.value},Qm=e=>async(t,r,s,i)=>{const c=s?Object.assign(s,{async:!0}):{async:!0};let u=t._zod.run({value:r,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(i?.Err??e)(u.issues.map(h=>Ro(h,c,Eo())));throw l_(f,i?.callee),f}return u.value},af=e=>(t,r,s)=>{const i=s?{...s,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new ka;return c.issues.length?{success:!1,error:new(e??d_)(c.issues.map(u=>Ro(u,i,Eo())))}:{success:!0,data:c.value}},J4=af(h_),cf=e=>async(t,r,s)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Ro(u,i,Eo())))}:{success:!0,data:c.value}},W4=cf(h_),eP=e=>(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Zm(e)(t,r,i)},tP=e=>(t,r,s)=>Zm(e)(t,r,s),nP=e=>async(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Qm(e)(t,r,i)},rP=e=>async(t,r,s)=>Qm(e)(t,r,s),oP=e=>(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return af(e)(t,r,i)},sP=e=>(t,r,s)=>af(e)(t,r,s),aP=e=>async(t,r,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return cf(e)(t,r,i)},iP=e=>async(t,r,s)=>cf(e)(t,r,s),cP=/^[cC][^\s-]{8,}$/,lP=/^[0-9a-z]+$/,uP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fP=/^[0-9a-vA-V]{20}$/,dP=/^[A-Za-z0-9]{27}$/,hP=/^[a-zA-Z0-9_-]{21}$/,pP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mP=/^([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})$/,Uw=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)$/,gP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,yP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vP(){return new RegExp(yP,"u")}const bP=/^(?:(?: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])$/,wP=/^(([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}|:))$/,SP=/^((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])$/,xP=/^(([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])$/,_P=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,p_=/^[A-Za-z0-9_-]*$/,CP=/^\+[1-9]\d{6,14}$/,m_="(?:(?:\\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])))",EP=new RegExp(`^${m_}$`);function g_(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 RP(e){return new RegExp(`^${g_(e)}$`)}function TP(e){const t=g_({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${r.join("|")})`;return new RegExp(`^${m_}T(?:${s})$`)}const AP=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},OP=/^-?\d+$/,y_=/^-?\d+(?:\.\d+)?$/,kP=/^(?:true|false)$/i,MP=/^[^A-Z]*$/,NP=/^[^a-z]*$/,an=W("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),v_={number:"number",bigint:"bigint",object:"date"},b_=W("$ZodCheckLessThan",(e,t)=>{an.init(e,t);const r=v_[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,c=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),w_=W("$ZodCheckGreaterThan",(e,t)=>{an.init(e,t);const r=v_[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,c=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jP=W("$ZodCheckMultipleOf",(e,t)=>{an.init(e,t),e._zod.onattach.push(r=>{var s;(s=r._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):L4(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),zP=W("$ZodCheckNumberFormat",(e,t)=>{an.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),s=r?"int":"number",[i,c]=q4[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=i,f.maximum=c,r&&(f.pattern=OP)}),e._zod.check=u=>{const f=u.value;if(r){if(!Number.isInteger(f)){u.issues.push({expected:s,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:s,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:s,inclusive:!0,continue:!t.abort});return}}f<i&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:i,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})}}),DP=W("$ZodCheckMaxLength",(e,t)=>{var r;an.init(e,t),(r=e._zod.def).when??(r.when=s=>{const i=s.value;return!Fm(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const i=s.value;if(i.length<=t.maximum)return;const u=Hm(i);s.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),PP=W("$ZodCheckMinLength",(e,t)=>{var r;an.init(e,t),(r=e._zod.def).when??(r.when=s=>{const i=s.value;return!Fm(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const i=s.value;if(i.length>=t.minimum)return;const u=Hm(i);s.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),LP=W("$ZodCheckLengthEquals",(e,t)=>{var r;an.init(e,t),(r=e._zod.def).when??(r.when=s=>{const i=s.value;return!Fm(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=s=>{const i=s.value,c=i.length;if(c===t.length)return;const u=Hm(i),f=c>t.length;s.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),lf=W("$ZodCheckStringFormat",(e,t)=>{var r,s;an.init(e,t),e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),IP=W("$ZodCheckRegex",(e,t)=>{lf.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),$P=W("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=MP),lf.init(e,t)}),UP=W("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=NP),lf.init(e,t)}),BP=W("$ZodCheckIncludes",(e,t)=>{an.init(e,t);const r=sf(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=s,e._zod.onattach.push(i=>{const c=i._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(s)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),qP=W("$ZodCheckStartsWith",(e,t)=>{an.init(e,t);const r=new RegExp(`^${sf(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),FP=W("$ZodCheckEndsWith",(e,t)=>{an.init(e,t);const r=new RegExp(`.*${sf(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),VP=W("$ZodCheckOverwrite",(e,t)=>{an.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class HP{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 s=t.split(`
|
|
20
20
|
`).filter(u=>u),i=Math.min(...s.map(u=>u.length-u.trimStart().length)),c=s.map(u=>u.slice(i)).map(u=>" ".repeat(this.indent*2)+u);for(const u of c)this.content.push(u)}compile(){const t=Function,r=this?.args,i=[...(this?.content??[""]).map(c=>` ${c}`)];return new t(...r,i.join(`
|
|
21
21
|
`))}}const ZP={major:4,minor:3,patch:6},ht=W("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ZP;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const i of s)for(const c of i._zod.onattach)c(e);if(s.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(u,f,h)=>{let p=Sa(u),y;for(const v of f){if(v._zod.def.when){if(!v._zod.def.when(u))continue}else if(p)continue;const b=u.issues.length,_=v._zod.check(u);if(_ instanceof Promise&&h?.async===!1)throw new ka;if(y||_ instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await _,u.issues.length!==b&&(p||(p=Sa(u,b)))});else{if(u.issues.length===b)continue;p||(p=Sa(u,b))}}return y?y.then(()=>u):u},c=(u,f,h)=>{if(Sa(u))return u.aborted=!0,u;const p=i(f,s,h);if(p instanceof Promise){if(h.async===!1)throw new ka;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 ka;return h.then(p=>i(p,s,f))}return i(h,s,f)}}Ye(e,"~standard",()=>({validate:i=>{try{const c=J4(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return W4(e,i).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Gm=W("$ZodString",(e,t)=>{ht.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??AP(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ct=W("$ZodStringFormat",(e,t)=>{lf.init(e,t),Gm.init(e,t)}),QP=W("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mP),ct.init(e,t)}),GP=W("$ZodUUID",(e,t)=>{if(t.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(s===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Uw(s))}else t.pattern??(t.pattern=Uw());ct.init(e,t)}),YP=W("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gP),ct.init(e,t)}),KP=W("$ZodURL",(e,t)=>{ct.init(e,t),e._zod.check=r=>{try{const s=r.value.trim(),i=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),XP=W("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=vP()),ct.init(e,t)}),JP=W("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=hP),ct.init(e,t)}),WP=W("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=cP),ct.init(e,t)}),eL=W("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lP),ct.init(e,t)}),tL=W("$ZodULID",(e,t)=>{t.pattern??(t.pattern=uP),ct.init(e,t)}),nL=W("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fP),ct.init(e,t)}),rL=W("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=dP),ct.init(e,t)}),oL=W("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=TP(t)),ct.init(e,t)}),sL=W("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=EP),ct.init(e,t)}),aL=W("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RP(t)),ct.init(e,t)}),iL=W("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pP),ct.init(e,t)}),cL=W("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=bP),ct.init(e,t),e._zod.bag.format="ipv4"}),lL=W("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wP),ct.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),uL=W("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=SP),ct.init(e,t)}),fL=W("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=xP),ct.init(e,t),e._zod.check=r=>{const s=r.value.split("/");try{if(s.length!==2)throw new Error;const[i,c]=s;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://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function S_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const dL=W("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_P),ct.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{S_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function hL(e){if(!p_.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return S_(r)}const pL=W("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=p_),ct.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{hL(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),mL=W("$ZodE164",(e,t)=>{t.pattern??(t.pattern=CP),ct.init(e,t)});function gL(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[s]=r;if(!s)return!1;const i=JSON.parse(atob(s));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const yL=W("$ZodJWT",(e,t)=>{ct.init(e,t),e._zod.check=r=>{gL(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),x_=W("$ZodNumber",(e,t)=>{ht.init(e,t),e._zod.pattern=e._zod.bag.pattern??y_,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const c=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...c?{received:c}:{}}),r}}),vL=W("$ZodNumberFormat",(e,t)=>{zP.init(e,t),x_.init(e,t)}),bL=W("$ZodBoolean",(e,t)=>{ht.init(e,t),e._zod.pattern=kP,e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=!!r.value}catch{}const i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),wL=W("$ZodUnknown",(e,t)=>{ht.init(e,t),e._zod.parse=r=>r}),SL=W("$ZodNever",(e,t)=>{ht.init(e,t),e._zod.parse=(r,s)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Bw(e,t,r){e.issues.length&&t.issues.push(...xa(r,e.issues)),t.value[r]=e.value}const xL=W("$ZodArray",(e,t)=>{ht.init(e,t),e._zod.parse=(r,s)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const c=[];for(let u=0;u<i.length;u++){const f=i[u],h=t.element._zod.run({value:f,issues:[]},s);h instanceof Promise?c.push(h.then(p=>Bw(p,r,u))):Bw(h,r,u)}return c.length?Promise.all(c).then(()=>r):r}});function Pu(e,t,r,s,i){if(e.issues.length){if(i&&!(r in s))return;t.issues.push(...xa(r,e.issues))}e.value===void 0?r in s&&(t.value[r]=void 0):t.value[r]=e.value}function __(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const r=B4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function C_(e,t,r,s,i,c){const u=[],f=i.keySet,h=i.catchall._zod,p=h.def.type,y=h.optout==="optional";for(const v in t){if(f.has(v))continue;if(p==="never"){u.push(v);continue}const b=h.run({value:t[v],issues:[]},s);b instanceof Promise?e.push(b.then(_=>Pu(_,r,v,t,y))):Pu(b,r,v,t,y)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}const _L=W("$ZodObject",(e,t)=>{if(ht.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 s=qm(()=>__(t));Ye(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 v of y.values)h[p].add(v)}}return h});const i=Du,c=t.catchall;let u;e._zod.parse=(f,h)=>{u??(u=s.value);const p=f.value;if(!i(p))return f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f;f.value={};const y=[],v=u.shape;for(const b of u.keys){const _=v[b],E=_._zod.optout==="optional",x=_._zod.run({value:p[b],issues:[]},h);x instanceof Promise?y.push(x.then(C=>Pu(C,f,b,p,E))):Pu(x,f,b,p,E)}return c?C_(y,p,f,h,s.value,e):y.length?Promise.all(y).then(()=>f):f}}),CL=W("$ZodObjectJIT",(e,t)=>{_L.init(e,t);const r=e._zod.parse,s=qm(()=>__(t)),i=b=>{const _=new HP(["shape","payload","ctx"]),E=s.value,x=k=>{const D=$w(k);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};_.write("const input = payload.value;");const C=Object.create(null);let O=0;for(const k of E.keys)C[k]=`key_${O++}`;_.write("const newResult = {};");for(const k of E.keys){const D=C[k],U=$w(k),L=b[k]?._zod?.optout==="optional";_.write(`const ${D} = ${x(k)};`),L?_.write(`
|
|
22
22
|
if (${D}.issues.length) {
|
|
@@ -54,7 +54,7 @@ Error generating stack: `+l.message+`
|
|
|
54
54
|
|
|
55
55
|
`)}_.write("payload.value = newResult;"),_.write("return payload;");const M=_.compile();return(k,D)=>M(b,k,D)};let c;const u=Du,f=!i_.jitless,p=f&&$4.value,y=t.catchall;let v;e._zod.parse=(b,_)=>{v??(v=s.value);const E=b.value;return u(E)?f&&p&&_?.async===!1&&_.jitless!==!0?(c||(c=i(t.shape)),b=c(b,_),y?C_([],E,b,_,v,e):b):r(b,_):(b.issues.push({expected:"object",code:"invalid_type",input:E,inst:e}),b)}});function qw(e,t,r,s){for(const c of e)if(c.issues.length===0)return t.value=c.value,t;const i=e.filter(c=>!Sa(c));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(c=>c.issues.map(u=>Ro(u,s,Eo())))}),t)}const EL=W("$ZodUnion",(e,t)=>{ht.init(e,t),Ye(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Ye(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Ye(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),Ye(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(c=>c._zod.pattern);return new RegExp(`^(${i.map(c=>Vm(c.source)).join("|")})$`)}});const r=t.options.length===1,s=t.options[0]._zod.run;e._zod.parse=(i,c)=>{if(r)return s(i,c);let u=!1;const f=[];for(const h of t.options){const p=h._zod.run({value:i.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=>qw(h,i,e,c)):qw(f,i,e,c)}}),RL=W("$ZodIntersection",(e,t)=>{ht.init(e,t),e._zod.parse=(r,s)=>{const i=r.value,c=t.left._zod.run({value:i,issues:[]},s),u=t.right._zod.run({value:i,issues:[]},s);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([h,p])=>Fw(r,h,p)):Fw(r,c,u)}});function Wp(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(Pa(e)&&Pa(t)){const r=Object.keys(t),s=Object.keys(e).filter(c=>r.indexOf(c)!==-1),i={...e,...t};for(const c of s){const u=Wp(e[c],t[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};i[c]=u.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let s=0;s<e.length;s++){const i=e[s],c=t[s],u=Wp(i,c);if(!u.valid)return{valid:!1,mergeErrorPath:[s,...u.mergeErrorPath]};r.push(u.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Fw(e,t,r){const s=new Map;let i;for(const f of t.issues)if(f.code==="unrecognized_keys"){i??(i=f);for(const h of f.keys)s.has(h)||s.set(h,{}),s.get(h).l=!0}else e.issues.push(f);for(const f of r.issues)if(f.code==="unrecognized_keys")for(const h of f.keys)s.has(h)||s.set(h,{}),s.get(h).r=!0;else e.issues.push(f);const c=[...s].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(c.length&&i&&e.issues.push({...i,keys:c}),Sa(e))return e;const u=Wp(t.value,r.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const TL=W("$ZodRecord",(e,t)=>{ht.init(e,t),e._zod.parse=(r,s)=>{const i=r.value;if(!Pa(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const c=[],u=t.keyType._zod.values;if(u){r.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:i[p],issues:[]},s);y instanceof Promise?c.push(y.then(v=>{v.issues.length&&r.issues.push(...xa(p,v.issues)),r.value[p]=v.value})):(y.issues.length&&r.issues.push(...xa(p,y.issues)),r.value[p]=y.value)}let h;for(const p in i)f.has(p)||(h=h??[],h.push(p));h&&h.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:h})}else{r.value={};for(const f of Reflect.ownKeys(i)){if(f==="__proto__")continue;let h=t.keyType._zod.run({value:f,issues:[]},s);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&y_.test(f)&&h.issues.length){const v=t.keyType._zod.run({value:Number(f),issues:[]},s);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(h=v)}if(h.issues.length){t.mode==="loose"?r.value[f]=i[f]:r.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(v=>Ro(v,s,Eo())),input:f,path:[f],inst:e});continue}const y=t.valueType._zod.run({value:i[f],issues:[]},s);y instanceof Promise?c.push(y.then(v=>{v.issues.length&&r.issues.push(...xa(f,v.issues)),r.value[h.value]=v.value})):(y.issues.length&&r.issues.push(...xa(f,y.issues)),r.value[h.value]=y.value)}}return c.length?Promise.all(c).then(()=>r):r}}),AL=W("$ZodEnum",(e,t)=>{ht.init(e,t);const r=c_(t.entries),s=new Set(r);e._zod.values=s,e._zod.pattern=new RegExp(`^(${r.filter(i=>U4.has(typeof i)).map(i=>typeof i=="string"?sf(i):i.toString()).join("|")})$`),e._zod.parse=(i,c)=>{const u=i.value;return s.has(u)||i.issues.push({code:"invalid_value",values:r,input:u,inst:e}),i}}),OL=W("$ZodTransform",(e,t)=>{ht.init(e,t),e._zod.parse=(r,s)=>{if(s.direction==="backward")throw new a_(e.constructor.name);const i=t.transform(r.value,r);if(s.async)return(i instanceof Promise?i:Promise.resolve(i)).then(u=>(r.value=u,r));if(i instanceof Promise)throw new ka;return r.value=i,r}});function Vw(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const E_=W("$ZodOptional",(e,t)=>{ht.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ye(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Vm(r.source)})?$`):void 0}),e._zod.parse=(r,s)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(c=>Vw(c,r.value)):Vw(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,s)}}),kL=W("$ZodExactOptional",(e,t)=>{E_.init(e,t),Ye(e._zod,"values",()=>t.innerType._zod.values),Ye(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,s)=>t.innerType._zod.run(r,s)}),ML=W("$ZodNullable",(e,t)=>{ht.init(e,t),Ye(e._zod,"optin",()=>t.innerType._zod.optin),Ye(e._zod,"optout",()=>t.innerType._zod.optout),Ye(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Vm(r.source)}|null)$`):void 0}),Ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,s)=>r.value===null?r:t.innerType._zod.run(r,s)}),NL=W("$ZodDefault",(e,t)=>{ht.init(e,t),e._zod.optin="optional",Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,s)=>{if(s.direction==="backward")return t.innerType._zod.run(r,s);if(r.value===void 0)return r.value=t.defaultValue,r;const i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(c=>Hw(c,t)):Hw(i,t)}});function Hw(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const jL=W("$ZodPrefault",(e,t)=>{ht.init(e,t),e._zod.optin="optional",Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,s)=>(s.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,s))}),zL=W("$ZodNonOptional",(e,t)=>{ht.init(e,t),Ye(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(s=>s!==void 0)):void 0}),e._zod.parse=(r,s)=>{const i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(c=>Zw(c,e)):Zw(i,e)}});function Zw(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 DL=W("$ZodCatch",(e,t)=>{ht.init(e,t),Ye(e._zod,"optin",()=>t.innerType._zod.optin),Ye(e._zod,"optout",()=>t.innerType._zod.optout),Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,s)=>{if(s.direction==="backward")return t.innerType._zod.run(r,s);const i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(c=>(r.value=c.value,c.issues.length&&(r.value=t.catchValue({...r,error:{issues:c.issues.map(u=>Ro(u,s,Eo()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(c=>Ro(c,s,Eo()))},input:r.value}),r.issues=[]),r)}}),PL=W("$ZodPipe",(e,t)=>{ht.init(e,t),Ye(e._zod,"values",()=>t.in._zod.values),Ye(e._zod,"optin",()=>t.in._zod.optin),Ye(e._zod,"optout",()=>t.out._zod.optout),Ye(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,s)=>{if(s.direction==="backward"){const c=t.out._zod.run(r,s);return c instanceof Promise?c.then(u=>nu(u,t.in,s)):nu(c,t.in,s)}const i=t.in._zod.run(r,s);return i instanceof Promise?i.then(c=>nu(c,t.out,s)):nu(i,t.out,s)}});function nu(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const LL=W("$ZodReadonly",(e,t)=>{ht.init(e,t),Ye(e._zod,"propValues",()=>t.innerType._zod.propValues),Ye(e._zod,"values",()=>t.innerType._zod.values),Ye(e._zod,"optin",()=>t.innerType?._zod?.optin),Ye(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,s)=>{if(s.direction==="backward")return t.innerType._zod.run(r,s);const i=t.innerType._zod.run(r,s);return i instanceof Promise?i.then(Qw):Qw(i)}});function Qw(e){return e.value=Object.freeze(e.value),e}const IL=W("$ZodCustom",(e,t)=>{an.init(e,t),ht.init(e,t),e._zod.parse=(r,s)=>r,e._zod.check=r=>{const s=r.value,i=t.fn(s);if(i instanceof Promise)return i.then(c=>Gw(c,r,s,e));Gw(i,r,s,e)}});function Gw(e,t,r,s){if(!e){const i={code:"custom",input:r,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(i.params=s._zod.def.params),t.issues.push(hc(i))}}var Yw;class $L{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const s=r[0];return this._map.set(t,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const s={...this.get(r)??{}};delete s.id;const i={...s,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function UL(){return new $L}(Yw=globalThis).__zod_globalRegistry??(Yw.__zod_globalRegistry=UL());const Ki=globalThis.__zod_globalRegistry;function BL(e,t){return new e({type:"string",...we(t)})}function qL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...we(t)})}function Kw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...we(t)})}function FL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...we(t)})}function VL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...we(t)})}function HL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...we(t)})}function ZL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...we(t)})}function QL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...we(t)})}function GL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...we(t)})}function YL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...we(t)})}function KL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...we(t)})}function XL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...we(t)})}function JL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...we(t)})}function WL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...we(t)})}function e5(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...we(t)})}function t5(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...we(t)})}function n5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...we(t)})}function r5(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...we(t)})}function o5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...we(t)})}function s5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...we(t)})}function a5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...we(t)})}function i5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...we(t)})}function c5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...we(t)})}function l5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...we(t)})}function u5(e,t){return new e({type:"string",format:"date",check:"string_format",...we(t)})}function f5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...we(t)})}function d5(e,t){return new e({type:"string",format:"duration",check:"string_format",...we(t)})}function h5(e,t){return new e({type:"number",checks:[],...we(t)})}function p5(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...we(t)})}function m5(e,t){return new e({type:"boolean",...we(t)})}function g5(e){return new e({type:"unknown"})}function y5(e,t){return new e({type:"never",...we(t)})}function Xw(e,t){return new b_({check:"less_than",...we(t),value:e,inclusive:!1})}function Sp(e,t){return new b_({check:"less_than",...we(t),value:e,inclusive:!0})}function Jw(e,t){return new w_({check:"greater_than",...we(t),value:e,inclusive:!1})}function xp(e,t){return new w_({check:"greater_than",...we(t),value:e,inclusive:!0})}function Ww(e,t){return new jP({check:"multiple_of",...we(t),value:e})}function R_(e,t){return new DP({check:"max_length",...we(t),maximum:e})}function Lu(e,t){return new PP({check:"min_length",...we(t),minimum:e})}function T_(e,t){return new LP({check:"length_equals",...we(t),length:e})}function v5(e,t){return new IP({check:"string_format",format:"regex",...we(t),pattern:e})}function b5(e){return new $P({check:"string_format",format:"lowercase",...we(e)})}function w5(e){return new UP({check:"string_format",format:"uppercase",...we(e)})}function S5(e,t){return new BP({check:"string_format",format:"includes",...we(t),includes:e})}function x5(e,t){return new qP({check:"string_format",format:"starts_with",...we(t),prefix:e})}function _5(e,t){return new FP({check:"string_format",format:"ends_with",...we(t),suffix:e})}function qa(e){return new VP({check:"overwrite",tx:e})}function C5(e){return qa(t=>t.normalize(e))}function E5(){return qa(e=>e.trim())}function R5(){return qa(e=>e.toLowerCase())}function T5(){return qa(e=>e.toUpperCase())}function A5(){return qa(e=>I4(e))}function O5(e,t,r){return new e({type:"array",element:t,...we(r)})}function k5(e,t,r){return new e({type:"custom",check:"custom",fn:t,...we(r)})}function M5(e){const t=N5(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push(hc(s,r.value,t._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(hc(i))}},e(r.value,r)));return t}function N5(e,t){const r=new an({check:"custom",...we(t)});return r._zod.check=e,r}function A_(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??Ki,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 Et(e,t,r={path:[],schemaPath:[]}){var s;const i=e._zod.def,c=t.seen.get(e);if(c)return c.count++,r.schemaPath.includes(e)&&(c.cycle=r.path),c.schema;const u={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const y={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,y);else{const b=u.schema,_=t.processors[i.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);_(e,t,b,y)}const v=e._zod.parent;v&&(u.ref||(u.ref=v),Et(v,t,y),t.seen.get(v).isParent=!0)}const h=t.metadataRegistry.get(e);return h&&Object.assign(u.schema,h),t.io==="input"&&Zt(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((s=u.schema).default??(s.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function O_(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const h=s.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.`);s.set(f,u[0])}}const i=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=e.external.registry.get(u[0])?.id,b=e.external.uri??(E=>E);if(v)return{ref:b(v)};const _=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=_,{defId:_,ref:`${b("__shared")}#/${f}/${_}`}}if(u[1]===r)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}=i(u);f.def={...f.schema},p&&(f.defId=p);const y=f.schema;for(const v in y)delete y[v];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>
|
|
56
56
|
|
|
57
|
-
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 k_(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=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){s(y);const b=e.seen.get(y),_=b.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(_)):Object.assign(h,_),Object.assign(h,p),u._zod.parent===y)for(const x in h)x==="$ref"||x==="allOf"||x in p||delete h[x];if(_.$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]}const v=u._zod.parent;if(v&&v!==y){s(v);const b=e.seen.get(v);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const _ in h)_==="$ref"||_==="allOf"||_ in b.def&&JSON.stringify(h[_])===JSON.stringify(b.def[_])&&delete h[_]}e.override({zodSchema:u,jsonSchema:h,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())s(u[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$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");i.$id=e.external.uri(u)}Object.assign(i,r.def??r.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"?i.$defs=c:i.definitions=c);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Iu(t,"input",e.processors),output:Iu(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Zt(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return Zt(s.element,r);if(s.type==="set")return Zt(s.valueType,r);if(s.type==="lazy")return Zt(s.getter(),r);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return Zt(s.innerType,r);if(s.type==="intersection")return Zt(s.left,r)||Zt(s.right,r);if(s.type==="record"||s.type==="map")return Zt(s.keyType,r)||Zt(s.valueType,r);if(s.type==="pipe")return Zt(s.in,r)||Zt(s.out,r);if(s.type==="object"){for(const i in s.shape)if(Zt(s.shape[i],r))return!0;return!1}if(s.type==="union"){for(const i of s.options)if(Zt(i,r))return!0;return!1}if(s.type==="tuple"){for(const i of s.items)if(Zt(i,r))return!0;return!!(s.rest&&Zt(s.rest,r))}return!1}const j5=(e,t={})=>r=>{const s=A_({...r,processors:t});return Et(e,s),O_(s,e),k_(s,e)},Iu=(e,t,r={})=>s=>{const{libraryOptions:i,target:c}=s??{},u=A_({...i??{},target:c,io:t,processors:r});return Et(e,u),O_(u,e),k_(u,e)},z5={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},D5=(e,t,r,s)=>{const i=r;i.type="string";const{minimum:c,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof c=="number"&&(i.minLength=c),typeof u=="number"&&(i.maxLength=u),f&&(i.format=z5[f]??f,i.format===""&&delete i.format,f==="time"&&delete i.format),p&&(i.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?i.pattern=y[0].source:y.length>1&&(i.allOf=[...y.map(v=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},P5=(e,t,r,s)=>{const i=r,{minimum:c,maximum:u,format:f,multipleOf:h,exclusiveMaximum:p,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?i.type="integer":i.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=y,i.exclusiveMinimum=!0):i.exclusiveMinimum=y),typeof c=="number"&&(i.minimum=c,typeof y=="number"&&t.target!=="draft-04"&&(y>=c?delete i.minimum:delete i.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p),typeof u=="number"&&(i.maximum=u,typeof p=="number"&&t.target!=="draft-04"&&(p<=u?delete i.maximum:delete i.exclusiveMaximum)),typeof h=="number"&&(i.multipleOf=h)},L5=(e,t,r,s)=>{r.type="boolean"},I5=(e,t,r,s)=>{r.not={}},$5=(e,t,r,s)=>{},U5=(e,t,r,s)=>{const i=e._zod.def,c=c_(i.entries);c.every(u=>typeof u=="number")&&(r.type="number"),c.every(u=>typeof u=="string")&&(r.type="string"),r.enum=c},B5=(e,t,r,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},q5=(e,t,r,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},F5=(e,t,r,s)=>{const i=r,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(i.minItems=u),typeof f=="number"&&(i.maxItems=f),i.type="array",i.items=Et(c.element,t,{...s,path:[...s.path,"items"]})},V5=(e,t,r,s)=>{const i=r,c=e._zod.def;i.type="object",i.properties={};const u=c.shape;for(const p in u)i.properties[p]=Et(u[p],t,{...s,path:[...s.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&&(i.required=Array.from(h)),c.catchall?._zod.def.type==="never"?i.additionalProperties=!1:c.catchall?c.catchall&&(i.additionalProperties=Et(c.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},H5=(e,t,r,s)=>{const i=e._zod.def,c=i.inclusive===!1,u=i.options.map((f,h)=>Et(f,t,{...s,path:[...s.path,c?"oneOf":"anyOf",h]}));c?r.oneOf=u:r.anyOf=u},Z5=(e,t,r,s)=>{const i=e._zod.def,c=Et(i.left,t,{...s,path:[...s.path,"allOf",0]}),u=Et(i.right,t,{...s,path:[...s.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];r.allOf=h},Q5=(e,t,r,s)=>{const i=r,c=e._zod.def;i.type="object";const u=c.keyType,h=u._zod.bag?.patterns;if(c.mode==="loose"&&h&&h.size>0){const y=Et(c.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});i.patternProperties={};for(const v of h)i.patternProperties[v.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Et(c.keyType,t,{...s,path:[...s.path,"propertyNames"]})),i.additionalProperties=Et(c.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const p=u._zod.values;if(p){const y=[...p].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(i.required=y)}},G5=(e,t,r,s)=>{const i=e._zod.def,c=Et(i.innerType,t,s),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=i.innerType,r.nullable=!0):r.anyOf=[c,{type:"null"}]},Y5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType},K5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},X5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},J5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType;let u;try{u=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=u},W5=(e,t,r,s)=>{const i=e._zod.def,c=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Et(c,t,s);const u=t.seen.get(e);u.ref=c},e6=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType,r.readOnly=!0},M_=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType},t6=W("ZodISODateTime",(e,t)=>{oL.init(e,t),ut.init(e,t)});function n6(e){return l5(t6,e)}const r6=W("ZodISODate",(e,t)=>{sL.init(e,t),ut.init(e,t)});function o6(e){return u5(r6,e)}const s6=W("ZodISOTime",(e,t)=>{aL.init(e,t),ut.init(e,t)});function a6(e){return f5(s6,e)}const i6=W("ZodISODuration",(e,t)=>{iL.init(e,t),ut.init(e,t)});function c6(e){return d5(i6,e)}const l6=(e,t)=>{d_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>X4(e,r)},flatten:{value:r=>K4(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Jp,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Jp,2)}},isEmpty:{get(){return e.issues.length===0}}})},$n=W("ZodError",l6,{Parent:Error}),u6=Zm($n),f6=Qm($n),d6=af($n),h6=cf($n),p6=eP($n),m6=tP($n),g6=nP($n),y6=rP($n),v6=oP($n),b6=sP($n),w6=aP($n),S6=iP($n),pt=W("ZodType",(e,t)=>(ht.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Iu(e,"input"),output:Iu(e,"output")}}),e.toJSONSchema=j5(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(jo(t,{checks:[...t.checks??[],...r.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(r,s)=>zo(e,r,s),e.brand=()=>e,e.register=((r,s)=>(r.add(e,s),e)),e.parse=(r,s)=>u6(e,r,s,{callee:e.parse}),e.safeParse=(r,s)=>d6(e,r,s),e.parseAsync=async(r,s)=>f6(e,r,s,{callee:e.parseAsync}),e.safeParseAsync=async(r,s)=>h6(e,r,s),e.spa=e.safeParseAsync,e.encode=(r,s)=>p6(e,r,s),e.decode=(r,s)=>m6(e,r,s),e.encodeAsync=async(r,s)=>g6(e,r,s),e.decodeAsync=async(r,s)=>y6(e,r,s),e.safeEncode=(r,s)=>v6(e,r,s),e.safeDecode=(r,s)=>b6(e,r,s),e.safeEncodeAsync=async(r,s)=>w6(e,r,s),e.safeDecodeAsync=async(r,s)=>S6(e,r,s),e.refine=(r,s)=>e.check(gI(r,s)),e.superRefine=r=>e.check(yI(r)),e.overwrite=r=>e.check(qa(r)),e.optional=()=>rS(e),e.exactOptional=()=>rI(e),e.nullable=()=>oS(e),e.nullish=()=>rS(oS(e)),e.nonoptional=r=>lI(e,r),e.array=()=>z_(e),e.or=r=>Y6([e,r]),e.and=r=>X6(e,r),e.transform=r=>sS(e,tI(r)),e.default=r=>aI(e,r),e.prefault=r=>cI(e,r),e.catch=r=>fI(e,r),e.pipe=r=>sS(e,r),e.readonly=()=>pI(e),e.describe=r=>{const s=e.clone();return Ki.add(s,{description:r}),s},Object.defineProperty(e,"description",{get(){return Ki.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ki.get(e);const s=e.clone();return Ki.add(s,r[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),N_=W("_ZodString",(e,t)=>{Gm.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(s,i,c)=>D5(e,s,i);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...s)=>e.check(v5(...s)),e.includes=(...s)=>e.check(S5(...s)),e.startsWith=(...s)=>e.check(x5(...s)),e.endsWith=(...s)=>e.check(_5(...s)),e.min=(...s)=>e.check(Lu(...s)),e.max=(...s)=>e.check(R_(...s)),e.length=(...s)=>e.check(T_(...s)),e.nonempty=(...s)=>e.check(Lu(1,...s)),e.lowercase=s=>e.check(b5(s)),e.uppercase=s=>e.check(w5(s)),e.trim=()=>e.check(E5()),e.normalize=(...s)=>e.check(C5(...s)),e.toLowerCase=()=>e.check(R5()),e.toUpperCase=()=>e.check(T5()),e.slugify=()=>e.check(A5())}),x6=W("ZodString",(e,t)=>{Gm.init(e,t),N_.init(e,t),e.email=r=>e.check(qL(_6,r)),e.url=r=>e.check(QL(C6,r)),e.jwt=r=>e.check(c5($6,r)),e.emoji=r=>e.check(GL(E6,r)),e.guid=r=>e.check(Kw(eS,r)),e.uuid=r=>e.check(FL(ru,r)),e.uuidv4=r=>e.check(VL(ru,r)),e.uuidv6=r=>e.check(HL(ru,r)),e.uuidv7=r=>e.check(ZL(ru,r)),e.nanoid=r=>e.check(YL(R6,r)),e.guid=r=>e.check(Kw(eS,r)),e.cuid=r=>e.check(KL(T6,r)),e.cuid2=r=>e.check(XL(A6,r)),e.ulid=r=>e.check(JL(O6,r)),e.base64=r=>e.check(s5(P6,r)),e.base64url=r=>e.check(a5(L6,r)),e.xid=r=>e.check(WL(k6,r)),e.ksuid=r=>e.check(e5(M6,r)),e.ipv4=r=>e.check(t5(N6,r)),e.ipv6=r=>e.check(n5(j6,r)),e.cidrv4=r=>e.check(r5(z6,r)),e.cidrv6=r=>e.check(o5(D6,r)),e.e164=r=>e.check(i5(I6,r)),e.datetime=r=>e.check(n6(r)),e.date=r=>e.check(o6(r)),e.time=r=>e.check(a6(r)),e.duration=r=>e.check(c6(r))});function ar(e){return BL(x6,e)}const ut=W("ZodStringFormat",(e,t)=>{ct.init(e,t),N_.init(e,t)}),_6=W("ZodEmail",(e,t)=>{YP.init(e,t),ut.init(e,t)}),eS=W("ZodGUID",(e,t)=>{QP.init(e,t),ut.init(e,t)}),ru=W("ZodUUID",(e,t)=>{GP.init(e,t),ut.init(e,t)}),C6=W("ZodURL",(e,t)=>{KP.init(e,t),ut.init(e,t)}),E6=W("ZodEmoji",(e,t)=>{XP.init(e,t),ut.init(e,t)}),R6=W("ZodNanoID",(e,t)=>{JP.init(e,t),ut.init(e,t)}),T6=W("ZodCUID",(e,t)=>{WP.init(e,t),ut.init(e,t)}),A6=W("ZodCUID2",(e,t)=>{eL.init(e,t),ut.init(e,t)}),O6=W("ZodULID",(e,t)=>{tL.init(e,t),ut.init(e,t)}),k6=W("ZodXID",(e,t)=>{nL.init(e,t),ut.init(e,t)}),M6=W("ZodKSUID",(e,t)=>{rL.init(e,t),ut.init(e,t)}),N6=W("ZodIPv4",(e,t)=>{cL.init(e,t),ut.init(e,t)}),j6=W("ZodIPv6",(e,t)=>{lL.init(e,t),ut.init(e,t)}),z6=W("ZodCIDRv4",(e,t)=>{uL.init(e,t),ut.init(e,t)}),D6=W("ZodCIDRv6",(e,t)=>{fL.init(e,t),ut.init(e,t)}),P6=W("ZodBase64",(e,t)=>{dL.init(e,t),ut.init(e,t)}),L6=W("ZodBase64URL",(e,t)=>{pL.init(e,t),ut.init(e,t)}),I6=W("ZodE164",(e,t)=>{mL.init(e,t),ut.init(e,t)}),$6=W("ZodJWT",(e,t)=>{yL.init(e,t),ut.init(e,t)}),j_=W("ZodNumber",(e,t)=>{x_.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(s,i,c)=>P5(e,s,i),e.gt=(s,i)=>e.check(Jw(s,i)),e.gte=(s,i)=>e.check(xp(s,i)),e.min=(s,i)=>e.check(xp(s,i)),e.lt=(s,i)=>e.check(Xw(s,i)),e.lte=(s,i)=>e.check(Sp(s,i)),e.max=(s,i)=>e.check(Sp(s,i)),e.int=s=>e.check(tS(s)),e.safe=s=>e.check(tS(s)),e.positive=s=>e.check(Jw(0,s)),e.nonnegative=s=>e.check(xp(0,s)),e.negative=s=>e.check(Xw(0,s)),e.nonpositive=s=>e.check(Sp(0,s)),e.multipleOf=(s,i)=>e.check(Ww(s,i)),e.step=(s,i)=>e.check(Ww(s,i)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U6(e){return h5(j_,e)}const B6=W("ZodNumberFormat",(e,t)=>{vL.init(e,t),j_.init(e,t)});function tS(e){return p5(B6,e)}const q6=W("ZodBoolean",(e,t)=>{bL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>L5(e,r,s)});function Zn(e){return m5(q6,e)}const F6=W("ZodUnknown",(e,t)=>{wL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>$5()});function nS(){return g5(F6)}const V6=W("ZodNever",(e,t)=>{SL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>I5(e,r,s)});function H6(e){return y5(V6,e)}const Z6=W("ZodArray",(e,t)=>{xL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>F5(e,r,s,i),e.element=t.element,e.min=(r,s)=>e.check(Lu(r,s)),e.nonempty=r=>e.check(Lu(1,r)),e.max=(r,s)=>e.check(R_(r,s)),e.length=(r,s)=>e.check(T_(r,s)),e.unwrap=()=>e.element});function z_(e,t){return O5(Z6,e,t)}const Q6=W("ZodObject",(e,t)=>{CL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>V5(e,r,s,i),Ye(e,"shape",()=>t.shape),e.keyof=()=>Ym(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:nS()}),e.loose=()=>e.clone({...e._zod.def,catchall:nS()}),e.strict=()=>e.clone({...e._zod.def,catchall:H6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>H4(e,r),e.safeExtend=r=>Z4(e,r),e.merge=r=>Q4(e,r),e.pick=r=>F4(e,r),e.omit=r=>V4(e,r),e.partial=(...r)=>G4(D_,e,r[0]),e.required=(...r)=>Y4(P_,e,r[0])});function Fa(e,t){const r={type:"object",shape:e??{},...we(t)};return new Q6(r)}const G6=W("ZodUnion",(e,t)=>{EL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>H5(e,r,s,i),e.options=t.options});function Y6(e,t){return new G6({type:"union",options:e,...we(t)})}const K6=W("ZodIntersection",(e,t)=>{RL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>Z5(e,r,s,i)});function X6(e,t){return new K6({type:"intersection",left:e,right:t})}const J6=W("ZodRecord",(e,t)=>{TL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>Q5(e,r,s,i),e.keyType=t.keyType,e.valueType=t.valueType});function W6(e,t,r){return new J6({type:"record",keyType:e,valueType:t,...we(r)})}const em=W("ZodEnum",(e,t)=>{AL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(s,i,c)=>U5(e,s,i),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(s,i)=>{const c={};for(const u of s)if(r.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new em({...t,checks:[],...we(i),entries:c})},e.exclude=(s,i)=>{const c={...t.entries};for(const u of s)if(r.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new em({...t,checks:[],...we(i),entries:c})}});function Ym(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new em({type:"enum",entries:r,...we(t)})}const eI=W("ZodTransform",(e,t)=>{OL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>q5(e,r),e._zod.parse=(r,s)=>{if(s.direction==="backward")throw new a_(e.constructor.name);r.addIssue=c=>{if(typeof c=="string")r.issues.push(hc(c,r.value,t));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=r.value),u.inst??(u.inst=e),r.issues.push(hc(u))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(c=>(r.value=c,r)):(r.value=i,r)}});function tI(e){return new eI({type:"transform",transform:e})}const D_=W("ZodOptional",(e,t)=>{E_.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>M_(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function rS(e){return new D_({type:"optional",innerType:e})}const nI=W("ZodExactOptional",(e,t)=>{kL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>M_(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function rI(e){return new nI({type:"optional",innerType:e})}const oI=W("ZodNullable",(e,t)=>{ML.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>G5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function oS(e){return new oI({type:"nullable",innerType:e})}const sI=W("ZodDefault",(e,t)=>{NL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>K5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function aI(e,t){return new sI({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():u_(t)}})}const iI=W("ZodPrefault",(e,t)=>{jL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>X5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function cI(e,t){return new iI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():u_(t)}})}const P_=W("ZodNonOptional",(e,t)=>{zL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>Y5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function lI(e,t){return new P_({type:"nonoptional",innerType:e,...we(t)})}const uI=W("ZodCatch",(e,t)=>{DL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>J5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fI(e,t){return new uI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const dI=W("ZodPipe",(e,t)=>{PL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>W5(e,r,s,i),e.in=t.in,e.out=t.out});function sS(e,t){return new dI({type:"pipe",in:e,out:t})}const hI=W("ZodReadonly",(e,t)=>{LL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>e6(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function pI(e){return new hI({type:"readonly",innerType:e})}const mI=W("ZodCustom",(e,t)=>{IL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>B5(e,r)});function gI(e,t={}){return k5(mI,e,t)}function yI(e){return M5(e)}const vI=Fa({id:ar(),path:ar(),label:ar(),icon:ar(),visible:Zn().default(!0),section:Ym(["main","config"]).default("main"),badge:ar().optional(),exact:Zn().optional()}),aS=Fa({appName:ar().default("Convex CMS"),logo:ar().optional(),favicon:ar().optional()}),iS=Fa({sidebarWidth:U6().min(200).max(400).default(256),sidebarCollapsible:Zn().default(!1)}),cS=Fa({showDashboard:Zn().default(!0),showContent:Zn().default(!0),showMedia:Zn().default(!0),showTaxonomies:Zn().default(!0),showContentTypes:Zn().default(!0),showTrash:Zn().default(!0),showSettings:Zn().default(!0),customItems:z_(vI).default([])}),lS=Fa({mode:Ym(["light","dark","system"]).default("system"),allowModeSwitch:Zn().default(!0),tokens:W6(ar(),ar()).optional()}),bI=Fa({branding:aS.default(()=>aS.parse({})),layout:iS.default(()=>iS.parse({})),navigation:cS.default(()=>cS.parse({})),theme:lS.default(()=>lS.parse({}))}),wI=[{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 SI(e){return bI.parse(e??{})}function xI(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},s=[...wI.filter(i=>t[i.id]!==!1),...e.navigation.customItems.filter(i=>i.visible!==!1)];return{main:s.filter(i=>i.section==="main"),config:s.filter(i=>i.section==="config")}}const L_=w.createContext(null);function _I({config:e,children:t}){const r=xI(e),s={...e,navItems:r};return g.jsx(L_.Provider,{value:s,children:t})}function Km(){const e=w.useContext(L_);if(!e)throw new Error("useAdminConfig must be used within AdminConfigProvider");return e}function I_(e,t){const r={get(s,i){if(typeof i=="string"){const c=[...t,i];return I_(e,c)}else if(i===x1){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({},r)}const CI=()=>I_("components",[]),$u=Zj;CI();const $_=w.createContext(null);function EI({baseConfig:e,children:t}){const r=A1($u.admin.getSettings),s=w.useMemo(()=>r?{...e,navigation:{...e.navigation,showMedia:e.navigation.showMedia&&r.features.mediaManagement}}:e,[e,r]),i=w.useMemo(()=>({baseConfig:e,settings:r}),[e,r]);return g.jsx($_.Provider,{value:i,children:g.jsx(_I,{config:s,children:t})})}function C7(){const e=w.useContext($_);if(!e)throw new Error("useSettingsConfig must be used within SettingsConfigProvider");return e}const U_=w.createContext(null);function RI({children:e}){const[t,r]=w.useState(new Map),s=w.useCallback((u,f)=>{r(h=>{const p=new Map(h);return p.set(u,f),p})},[]),i=w.useCallback(u=>{r(f=>{const h=new Map(f);return h.delete(u),h})},[]),c=w.useMemo(()=>({overrides:t,setOverride:s,clearOverride:i}),[t,s,i]);return g.jsx(U_.Provider,{value:c,children:e})}function TI(){const e=w.useContext(U_);if(!e)throw new Error("useBreadcrumbContext must be used within a BreadcrumbProvider");return e}const AI={LayoutDashboard:H3,FileText:T3,Image:P1,Layers:L1,Tags:RD,FileCode:E3,Settings:gD,Trash2:MD,HelpCircle:j1,Home:D1,User:U1,Bell:Yp,Lock:tD,Globe:L3,Calendar:Kp,Clock:h3,Link:Y3,Hash:z1,ToggleLeft:$1,ChevronDown:_s,CheckSquare:vD,Braces:k1,Folder:D3,MapPin:iD,DollarSign:b3,Mail:sD,Phone:hD,Package:fD,Star:xD,Heart:U3,Flag:M3,Bookmark:t3,Archive:Kz,Edit:wD,Eye:_3,AlertCircle:u3};function uS({name:e,className:t="size-5"}){const r=AI[e];return r?g.jsx(r,{className:t}):null}function he(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}function OI(e,t){const r=w.createContext(t),s=c=>{const{children:u,...f}=c,h=w.useMemo(()=>f,Object.values(f));return g.jsx(r.Provider,{value:h,children:u})};s.displayName=e+"Provider";function i(c){const u=w.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[s,i]}function hr(e,t=[]){let r=[];function s(c,u){const f=w.createContext(u),h=r.length;r=[...r,u];const p=v=>{const{scope:b,children:_,...E}=v,x=b?.[e]?.[h]||f,C=w.useMemo(()=>E,Object.values(E));return g.jsx(x.Provider,{value:C,children:_})};p.displayName=c+"Provider";function y(v,b){const _=b?.[e]?.[h]||f,E=w.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${c}\``)}return[p,y]}const i=()=>{const c=r.map(u=>w.createContext(u));return function(f){const h=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return i.scopeName=e,[s,kI(i,...t)]}function kI(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(c){const u=s.reduce((f,{useScope:h,scopeName:p})=>{const v=h(c)[`__scope${p}`];return{...f,...v}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Rt=globalThis?.document?w.useLayoutEffect:()=>{},MI=Yu[" useInsertionEffect ".trim().toString()]||Rt;function To({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[i,c,u]=NI({defaultProp:t,onChange:r}),f=e!==void 0,h=f?e:i;{const y=w.useRef(e!==void 0);w.useEffect(()=>{const v=y.current;v!==f&&console.warn(`${s} is changing from ${v?"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,s])}const p=w.useCallback(y=>{if(f){const v=jI(y)?y(e):y;v!==e&&u.current?.(v)}else c(y)},[f,e,c,u]);return[h,p]}function NI({defaultProp:e,onChange:t}){const[r,s]=w.useState(e),i=w.useRef(r),c=w.useRef(t);return MI(()=>{c.current=t},[t]),w.useEffect(()=>{i.current!==r&&(c.current?.(r),i.current=r)},[r,i]),[r,s,c]}function jI(e){return typeof e=="function"}function fS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wc(...e){return t=>{let r=!1;const s=e.map(i=>{const c=fS(i,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let i=0;i<s.length;i++){const c=s[i];typeof c=="function"?c():fS(e[i],null)}}}}function Ve(...e){return w.useCallback(wc(...e),e)}function gs(e){const t=zI(e),r=w.forwardRef((s,i)=>{const{children:c,...u}=s,f=w.Children.toArray(c),h=f.find(PI);if(h){const p=h.props.children,y=f.map(v=>v===h?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:v);return g.jsx(t,{...u,ref:i,children:w.isValidElement(p)?w.cloneElement(p,void 0,y):null})}return g.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function zI(e){const t=w.forwardRef((r,s)=>{const{children:i,...c}=r;if(w.isValidElement(i)){const u=II(i),f=LI(c,i.props);return i.type!==w.Fragment&&(f.ref=s?wc(s,u):u),w.cloneElement(i,f)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DI=Symbol("radix.slottable");function PI(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DI}function LI(e,t){const r={...t};for(const s in t){const i=e[s],c=t[s];/^on[A-Z]/.test(s)?i&&c?r[s]=(...f)=>{const h=c(...f);return i(...f),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...c}:s==="className"&&(r[s]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function II(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var $I=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=$I.reduce((e,t)=>{const r=gs(`Primitive.${t}`),s=w.forwardRef((i,c)=>{const{asChild:u,...f}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...f,ref:c})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function B_(e,t){e&&$a.flushSync(()=>e.dispatchEvent(t))}function UI(e,t){return w.useReducer((r,s)=>t[r][s]??r,e)}var Un=e=>{const{present:t,children:r}=e,s=BI(t),i=typeof r=="function"?r({present:s.isPresent}):w.Children.only(r),c=Ve(s.ref,qI(i));return typeof r=="function"||s.isPresent?w.cloneElement(i,{ref:c}):null};Un.displayName="Presence";function BI(e){const[t,r]=w.useState(),s=w.useRef(null),i=w.useRef(e),c=w.useRef("none"),u=e?"mounted":"unmounted",[f,h]=UI(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=ou(s.current);c.current=f==="mounted"?p:"none"},[f]),Rt(()=>{const p=s.current,y=i.current;if(y!==e){const b=c.current,_=ou(p);e?h("MOUNT"):_==="none"||p?.display==="none"?h("UNMOUNT"):h(y&&b!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Rt(()=>{if(t){let p;const y=t.ownerDocument.defaultView??window,v=_=>{const x=ou(s.current).includes(CSS.escape(_.animationName));if(_.target===t&&x&&(h("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},b=_=>{_.target===t&&(c.current=ou(s.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{y.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(p=>{s.current=p?getComputedStyle(p):null,r(p)},[])}}function ou(e){return e?.animationName||"none"}function qI(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var FI=Yu[" useId ".trim().toString()]||(()=>{}),VI=0;function Qn(e){const[t,r]=w.useState(FI());return Rt(()=>{r(s=>s??String(VI++))},[e]),e||(t?`radix-${t}`:"")}var uf="Collapsible",[HI]=hr(uf),[ZI,Xm]=HI(uf),q_=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:s,defaultOpen:i,disabled:c,onOpenChange:u,...f}=e,[h,p]=To({prop:s,defaultProp:i??!1,onChange:u,caller:uf});return g.jsx(ZI,{scope:r,disabled:c,contentId:Qn(),open:h,onOpenToggle:w.useCallback(()=>p(y=>!y),[p]),children:g.jsx(ke.div,{"data-state":Wm(h),"data-disabled":c?"":void 0,...f,ref:t})})});q_.displayName=uf;var F_="CollapsibleTrigger",V_=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,...s}=e,i=Xm(F_,r);return g.jsx(ke.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Wm(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:t,onClick:he(e.onClick,i.onOpenToggle)})});V_.displayName=F_;var Jm="CollapsibleContent",H_=w.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=Xm(Jm,e.__scopeCollapsible);return g.jsx(Un,{present:r||i.open,children:({present:c})=>g.jsx(QI,{...s,ref:t,present:c})})});H_.displayName=Jm;var QI=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:s,children:i,...c}=e,u=Xm(Jm,r),[f,h]=w.useState(s),p=w.useRef(null),y=Ve(t,p),v=w.useRef(0),b=v.current,_=w.useRef(0),E=_.current,x=u.open||f,C=w.useRef(x),O=w.useRef(void 0);return w.useEffect(()=>{const M=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(M)},[]),Rt(()=>{const M=p.current;if(M){O.current=O.current||{transitionDuration:M.style.transitionDuration,animationName:M.style.animationName},M.style.transitionDuration="0s",M.style.animationName="none";const k=M.getBoundingClientRect();v.current=k.height,_.current=k.width,C.current||(M.style.transitionDuration=O.current.transitionDuration,M.style.animationName=O.current.animationName),h(s)}},[u.open,s]),g.jsx(ke.div,{"data-state":Wm(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!x,...c,ref:y,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...e.style},children:x&&i})});function Wm(e){return e?"open":"closed"}var GI=q_;const YI=GI,KI=V_,XI=H_;function Yn(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...r)=>t.current?.(...r),[])}function JI(e,t=globalThis?.document){const r=Yn(e);w.useEffect(()=>{const s=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var WI="DismissableLayer",tm="dismissableLayer.update",e$="dismissableLayer.pointerDownOutside",t$="dismissableLayer.focusOutside",dS,Z_=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sc=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...h}=e,p=w.useContext(Z_),[y,v]=w.useState(null),b=y?.ownerDocument??globalThis?.document,[,_]=w.useState({}),E=Ve(t,L=>v(L)),x=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),O=x.indexOf(C),M=y?x.indexOf(y):-1,k=p.layersWithOutsidePointerEventsDisabled.size>0,D=M>=O,U=o$(L=>{const j=L.target,G=[...p.branches].some(ie=>ie.contains(j));!D||G||(i?.(L),u?.(L),L.defaultPrevented||f?.())},b),H=s$(L=>{const j=L.target;[...p.branches].some(ie=>ie.contains(j))||(c?.(L),u?.(L),L.defaultPrevented||f?.())},b);return JI(L=>{M===p.layers.size-1&&(s?.(L),!L.defaultPrevented&&f&&(L.preventDefault(),f()))},b),w.useEffect(()=>{if(y)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(dS=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),hS(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=dS)}},[y,b,r,p]),w.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),hS())},[y,p]),w.useEffect(()=>{const L=()=>_({});return document.addEventListener(tm,L),()=>document.removeEventListener(tm,L)},[]),g.jsx(ke.div,{...h,ref:E,style:{pointerEvents:k?D?"auto":"none":void 0,...e.style},onFocusCapture:he(e.onFocusCapture,H.onFocusCapture),onBlurCapture:he(e.onBlurCapture,H.onBlurCapture),onPointerDownCapture:he(e.onPointerDownCapture,U.onPointerDownCapture)})});Sc.displayName=WI;var n$="DismissableLayerBranch",r$=w.forwardRef((e,t)=>{const r=w.useContext(Z_),s=w.useRef(null),i=Ve(t,s);return w.useEffect(()=>{const c=s.current;if(c)return r.branches.add(c),()=>{r.branches.delete(c)}},[r.branches]),g.jsx(ke.div,{...e,ref:i})});r$.displayName=n$;function o$(e,t=globalThis?.document){const r=Yn(e),s=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const c=f=>{if(f.target&&!s.current){let h=function(){Q_(e$,r,p,{discrete:!0})};const p={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function s$(e,t=globalThis?.document){const r=Yn(e),s=w.useRef(!1);return w.useEffect(()=>{const i=c=>{c.target&&!s.current&&Q_(t$,r,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function hS(){const e=new CustomEvent(tm);document.dispatchEvent(e)}function Q_(e,t,r,{discrete:s}){const i=r.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),s?B_(i,c):i.dispatchEvent(c)}var _p="focusScope.autoFocusOnMount",Cp="focusScope.autoFocusOnUnmount",pS={bubbles:!1,cancelable:!0},a$="FocusScope",xc=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...u}=e,[f,h]=w.useState(null),p=Yn(i),y=Yn(c),v=w.useRef(null),b=Ve(t,x=>h(x)),_=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(s){let x=function(k){if(_.paused||!f)return;const D=k.target;f.contains(D)?v.current=D:vo(v.current,{select:!0})},C=function(k){if(_.paused||!f)return;const D=k.relatedTarget;D!==null&&(f.contains(D)||vo(v.current,{select:!0}))},O=function(k){if(document.activeElement===document.body)for(const U of k)U.removedNodes.length>0&&vo(f)};document.addEventListener("focusin",x),document.addEventListener("focusout",C);const M=new MutationObserver(O);return f&&M.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",C),M.disconnect()}}},[s,f,_.paused]),w.useEffect(()=>{if(f){gS.add(_);const x=document.activeElement;if(!f.contains(x)){const O=new CustomEvent(_p,pS);f.addEventListener(_p,p),f.dispatchEvent(O),O.defaultPrevented||(i$(d$(G_(f)),{select:!0}),document.activeElement===x&&vo(f))}return()=>{f.removeEventListener(_p,p),setTimeout(()=>{const O=new CustomEvent(Cp,pS);f.addEventListener(Cp,y),f.dispatchEvent(O),O.defaultPrevented||vo(x??document.body,{select:!0}),f.removeEventListener(Cp,y),gS.remove(_)},0)}}},[f,p,y,_]);const E=w.useCallback(x=>{if(!r&&!s||_.paused)return;const C=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,O=document.activeElement;if(C&&O){const M=x.currentTarget,[k,D]=c$(M);k&&D?!x.shiftKey&&O===D?(x.preventDefault(),r&&vo(k,{select:!0})):x.shiftKey&&O===k&&(x.preventDefault(),r&&vo(D,{select:!0})):O===M&&x.preventDefault()}},[r,s,_.paused]);return g.jsx(ke.div,{tabIndex:-1,...u,ref:b,onKeyDown:E})});xc.displayName=a$;function i$(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(vo(s,{select:t}),document.activeElement!==r)return}function c$(e){const t=G_(e),r=mS(t,e),s=mS(t.reverse(),e);return[r,s]}function G_(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function mS(e,t){for(const r of e)if(!l$(r,{upTo:t}))return r}function l$(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 u$(e){return e instanceof HTMLInputElement&&"select"in e}function vo(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&u$(e)&&t&&e.select()}}var gS=f$();function f$(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=yS(e,t),e.unshift(t)},remove(t){e=yS(e,t),e[0]?.resume()}}}function yS(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function d$(e){return e.filter(t=>t.tagName!=="A")}var h$="Portal",_c=w.forwardRef((e,t)=>{const{container:r,...s}=e,[i,c]=w.useState(!1);Rt(()=>c(!0),[]);const u=r||i&&globalThis?.document?.body;return u?gN.createPortal(g.jsx(ke.div,{...s,ref:t}),u):null});_c.displayName=h$;var Ep=0;function ff(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vS()),document.body.insertAdjacentElement("beforeend",e[1]??vS()),Ep++,()=>{Ep===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ep--}},[])}function vS(){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 ir=function(){return ir=Object.assign||function(t){for(var r,s=1,i=arguments.length;s<i;s++){r=arguments[s];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},ir.apply(this,arguments)};function Y_(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r}function p$(e,t,r){if(r||arguments.length===2)for(var s=0,i=t.length,c;s<i;s++)(c||!(s in t))&&(c||(c=Array.prototype.slice.call(t,0,s)),c[s]=t[s]);return e.concat(c||Array.prototype.slice.call(t))}var mu="right-scroll-bar-position",gu="width-before-scroll-bar",m$="with-scroll-bars-hidden",g$="--removed-body-scroll-bar-size";function Rp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function y$(e,t){var r=w.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var i=r.value;i!==s&&(r.value=s,r.callback(s,i))}}}})[0];return r.callback=t,r.facade}var v$=typeof window<"u"?w.useLayoutEffect:w.useEffect,bS=new WeakMap;function b$(e,t){var r=y$(null,function(s){return e.forEach(function(i){return Rp(i,s)})});return v$(function(){var s=bS.get(r);if(s){var i=new Set(s),c=new Set(e),u=r.current;i.forEach(function(f){c.has(f)||Rp(f,null)}),c.forEach(function(f){i.has(f)||Rp(f,u)})}bS.set(r,e)},[e]),r}function w$(e){return e}function S$(e,t){t===void 0&&(t=w$);var r=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(c){var u=t(c,s);return r.push(u),function(){r=r.filter(function(f){return f!==u})}},assignSyncMedium:function(c){for(s=!0;r.length;){var u=r;r=[],u.forEach(c)}r={push:function(f){return c(f)},filter:function(){return r}}},assignMedium:function(c){s=!0;var u=[];if(r.length){var f=r;r=[],f.forEach(c),u=r}var h=function(){var y=u;u=[],y.forEach(c)},p=function(){return Promise.resolve().then(h)};p(),r={push:function(y){u.push(y),p()},filter:function(y){return u=u.filter(y),r}}}};return i}function x$(e){e===void 0&&(e={});var t=S$(null);return t.options=ir({async:!0,ssr:!1},e),t}var K_=function(e){var t=e.sideCar,r=Y_(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return w.createElement(s,ir({},r))};K_.isSideCarExport=!0;function _$(e,t){return e.useMedium(t),K_}var X_=x$(),Tp=function(){},df=w.forwardRef(function(e,t){var r=w.useRef(null),s=w.useState({onScrollCapture:Tp,onWheelCapture:Tp,onTouchMoveCapture:Tp}),i=s[0],c=s[1],u=e.forwardProps,f=e.children,h=e.className,p=e.removeScrollBar,y=e.enabled,v=e.shards,b=e.sideCar,_=e.noRelative,E=e.noIsolation,x=e.inert,C=e.allowPinchZoom,O=e.as,M=O===void 0?"div":O,k=e.gapMode,D=Y_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),U=b,H=b$([r,t]),L=ir(ir({},D),i);return w.createElement(w.Fragment,null,y&&w.createElement(U,{sideCar:X_,removeScrollBar:p,shards:v,noRelative:_,noIsolation:E,inert:x,setCallbacks:c,allowPinchZoom:!!C,lockRef:r,gapMode:k}),u?w.cloneElement(w.Children.only(f),ir(ir({},L),{ref:H})):w.createElement(M,ir({},L,{className:h,ref:H}),f))});df.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};df.classNames={fullWidth:gu,zeroRight:mu};var C$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function E$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=C$();return t&&e.setAttribute("nonce",t),e}function R$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function T$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var A$=function(){var e=0,t=null;return{add:function(r){e==0&&(t=E$())&&(R$(t,r),T$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},O$=function(){var e=A$();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},J_=function(){var e=O$(),t=function(r){var s=r.styles,i=r.dynamic;return e(s,i),null};return t},k$={left:0,top:0,right:0,gap:0},Ap=function(e){return parseInt(e||"",10)||0},M$=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ap(r),Ap(s),Ap(i)]},N$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return k$;var t=M$(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},j$=J_(),Ma="data-scroll-locked",z$=function(e,t,r,s){var i=e.left,c=e.top,u=e.right,f=e.gap;return r===void 0&&(r="margin"),`
|
|
57
|
+
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 k_(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=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){s(y);const b=e.seen.get(y),_=b.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(_)):Object.assign(h,_),Object.assign(h,p),u._zod.parent===y)for(const x in h)x==="$ref"||x==="allOf"||x in p||delete h[x];if(_.$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]}const v=u._zod.parent;if(v&&v!==y){s(v);const b=e.seen.get(v);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const _ in h)_==="$ref"||_==="allOf"||_ in b.def&&JSON.stringify(h[_])===JSON.stringify(b.def[_])&&delete h[_]}e.override({zodSchema:u,jsonSchema:h,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())s(u[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$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");i.$id=e.external.uri(u)}Object.assign(i,r.def??r.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"?i.$defs=c:i.definitions=c);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Iu(t,"input",e.processors),output:Iu(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Zt(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return Zt(s.element,r);if(s.type==="set")return Zt(s.valueType,r);if(s.type==="lazy")return Zt(s.getter(),r);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return Zt(s.innerType,r);if(s.type==="intersection")return Zt(s.left,r)||Zt(s.right,r);if(s.type==="record"||s.type==="map")return Zt(s.keyType,r)||Zt(s.valueType,r);if(s.type==="pipe")return Zt(s.in,r)||Zt(s.out,r);if(s.type==="object"){for(const i in s.shape)if(Zt(s.shape[i],r))return!0;return!1}if(s.type==="union"){for(const i of s.options)if(Zt(i,r))return!0;return!1}if(s.type==="tuple"){for(const i of s.items)if(Zt(i,r))return!0;return!!(s.rest&&Zt(s.rest,r))}return!1}const j5=(e,t={})=>r=>{const s=A_({...r,processors:t});return Et(e,s),O_(s,e),k_(s,e)},Iu=(e,t,r={})=>s=>{const{libraryOptions:i,target:c}=s??{},u=A_({...i??{},target:c,io:t,processors:r});return Et(e,u),O_(u,e),k_(u,e)},z5={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},D5=(e,t,r,s)=>{const i=r;i.type="string";const{minimum:c,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof c=="number"&&(i.minLength=c),typeof u=="number"&&(i.maxLength=u),f&&(i.format=z5[f]??f,i.format===""&&delete i.format,f==="time"&&delete i.format),p&&(i.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?i.pattern=y[0].source:y.length>1&&(i.allOf=[...y.map(v=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},P5=(e,t,r,s)=>{const i=r,{minimum:c,maximum:u,format:f,multipleOf:h,exclusiveMaximum:p,exclusiveMinimum:y}=e._zod.bag;typeof f=="string"&&f.includes("int")?i.type="integer":i.type="number",typeof y=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=y,i.exclusiveMinimum=!0):i.exclusiveMinimum=y),typeof c=="number"&&(i.minimum=c,typeof y=="number"&&t.target!=="draft-04"&&(y>=c?delete i.minimum:delete i.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p),typeof u=="number"&&(i.maximum=u,typeof p=="number"&&t.target!=="draft-04"&&(p<=u?delete i.maximum:delete i.exclusiveMaximum)),typeof h=="number"&&(i.multipleOf=h)},L5=(e,t,r,s)=>{r.type="boolean"},I5=(e,t,r,s)=>{r.not={}},$5=(e,t,r,s)=>{},U5=(e,t,r,s)=>{const i=e._zod.def,c=c_(i.entries);c.every(u=>typeof u=="number")&&(r.type="number"),c.every(u=>typeof u=="string")&&(r.type="string"),r.enum=c},B5=(e,t,r,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},q5=(e,t,r,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},F5=(e,t,r,s)=>{const i=r,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(i.minItems=u),typeof f=="number"&&(i.maxItems=f),i.type="array",i.items=Et(c.element,t,{...s,path:[...s.path,"items"]})},V5=(e,t,r,s)=>{const i=r,c=e._zod.def;i.type="object",i.properties={};const u=c.shape;for(const p in u)i.properties[p]=Et(u[p],t,{...s,path:[...s.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&&(i.required=Array.from(h)),c.catchall?._zod.def.type==="never"?i.additionalProperties=!1:c.catchall?c.catchall&&(i.additionalProperties=Et(c.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},H5=(e,t,r,s)=>{const i=e._zod.def,c=i.inclusive===!1,u=i.options.map((f,h)=>Et(f,t,{...s,path:[...s.path,c?"oneOf":"anyOf",h]}));c?r.oneOf=u:r.anyOf=u},Z5=(e,t,r,s)=>{const i=e._zod.def,c=Et(i.left,t,{...s,path:[...s.path,"allOf",0]}),u=Et(i.right,t,{...s,path:[...s.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];r.allOf=h},Q5=(e,t,r,s)=>{const i=r,c=e._zod.def;i.type="object";const u=c.keyType,h=u._zod.bag?.patterns;if(c.mode==="loose"&&h&&h.size>0){const y=Et(c.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});i.patternProperties={};for(const v of h)i.patternProperties[v.source]=y}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=Et(c.keyType,t,{...s,path:[...s.path,"propertyNames"]})),i.additionalProperties=Et(c.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const p=u._zod.values;if(p){const y=[...p].filter(v=>typeof v=="string"||typeof v=="number");y.length>0&&(i.required=y)}},G5=(e,t,r,s)=>{const i=e._zod.def,c=Et(i.innerType,t,s),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=i.innerType,r.nullable=!0):r.anyOf=[c,{type:"null"}]},Y5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType},K5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},X5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},J5=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType;let u;try{u=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=u},W5=(e,t,r,s)=>{const i=e._zod.def,c=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Et(c,t,s);const u=t.seen.get(e);u.ref=c},e6=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType,r.readOnly=!0},M_=(e,t,r,s)=>{const i=e._zod.def;Et(i.innerType,t,s);const c=t.seen.get(e);c.ref=i.innerType},t6=W("ZodISODateTime",(e,t)=>{oL.init(e,t),ut.init(e,t)});function n6(e){return l5(t6,e)}const r6=W("ZodISODate",(e,t)=>{sL.init(e,t),ut.init(e,t)});function o6(e){return u5(r6,e)}const s6=W("ZodISOTime",(e,t)=>{aL.init(e,t),ut.init(e,t)});function a6(e){return f5(s6,e)}const i6=W("ZodISODuration",(e,t)=>{iL.init(e,t),ut.init(e,t)});function c6(e){return d5(i6,e)}const l6=(e,t)=>{d_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>X4(e,r)},flatten:{value:r=>K4(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Jp,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Jp,2)}},isEmpty:{get(){return e.issues.length===0}}})},$n=W("ZodError",l6,{Parent:Error}),u6=Zm($n),f6=Qm($n),d6=af($n),h6=cf($n),p6=eP($n),m6=tP($n),g6=nP($n),y6=rP($n),v6=oP($n),b6=sP($n),w6=aP($n),S6=iP($n),pt=W("ZodType",(e,t)=>(ht.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Iu(e,"input"),output:Iu(e,"output")}}),e.toJSONSchema=j5(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(jo(t,{checks:[...t.checks??[],...r.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(r,s)=>zo(e,r,s),e.brand=()=>e,e.register=((r,s)=>(r.add(e,s),e)),e.parse=(r,s)=>u6(e,r,s,{callee:e.parse}),e.safeParse=(r,s)=>d6(e,r,s),e.parseAsync=async(r,s)=>f6(e,r,s,{callee:e.parseAsync}),e.safeParseAsync=async(r,s)=>h6(e,r,s),e.spa=e.safeParseAsync,e.encode=(r,s)=>p6(e,r,s),e.decode=(r,s)=>m6(e,r,s),e.encodeAsync=async(r,s)=>g6(e,r,s),e.decodeAsync=async(r,s)=>y6(e,r,s),e.safeEncode=(r,s)=>v6(e,r,s),e.safeDecode=(r,s)=>b6(e,r,s),e.safeEncodeAsync=async(r,s)=>w6(e,r,s),e.safeDecodeAsync=async(r,s)=>S6(e,r,s),e.refine=(r,s)=>e.check(gI(r,s)),e.superRefine=r=>e.check(yI(r)),e.overwrite=r=>e.check(qa(r)),e.optional=()=>rS(e),e.exactOptional=()=>rI(e),e.nullable=()=>oS(e),e.nullish=()=>rS(oS(e)),e.nonoptional=r=>lI(e,r),e.array=()=>z_(e),e.or=r=>Y6([e,r]),e.and=r=>X6(e,r),e.transform=r=>sS(e,tI(r)),e.default=r=>aI(e,r),e.prefault=r=>cI(e,r),e.catch=r=>fI(e,r),e.pipe=r=>sS(e,r),e.readonly=()=>pI(e),e.describe=r=>{const s=e.clone();return Ki.add(s,{description:r}),s},Object.defineProperty(e,"description",{get(){return Ki.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ki.get(e);const s=e.clone();return Ki.add(s,r[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),N_=W("_ZodString",(e,t)=>{Gm.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(s,i,c)=>D5(e,s,i);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...s)=>e.check(v5(...s)),e.includes=(...s)=>e.check(S5(...s)),e.startsWith=(...s)=>e.check(x5(...s)),e.endsWith=(...s)=>e.check(_5(...s)),e.min=(...s)=>e.check(Lu(...s)),e.max=(...s)=>e.check(R_(...s)),e.length=(...s)=>e.check(T_(...s)),e.nonempty=(...s)=>e.check(Lu(1,...s)),e.lowercase=s=>e.check(b5(s)),e.uppercase=s=>e.check(w5(s)),e.trim=()=>e.check(E5()),e.normalize=(...s)=>e.check(C5(...s)),e.toLowerCase=()=>e.check(R5()),e.toUpperCase=()=>e.check(T5()),e.slugify=()=>e.check(A5())}),x6=W("ZodString",(e,t)=>{Gm.init(e,t),N_.init(e,t),e.email=r=>e.check(qL(_6,r)),e.url=r=>e.check(QL(C6,r)),e.jwt=r=>e.check(c5($6,r)),e.emoji=r=>e.check(GL(E6,r)),e.guid=r=>e.check(Kw(eS,r)),e.uuid=r=>e.check(FL(ru,r)),e.uuidv4=r=>e.check(VL(ru,r)),e.uuidv6=r=>e.check(HL(ru,r)),e.uuidv7=r=>e.check(ZL(ru,r)),e.nanoid=r=>e.check(YL(R6,r)),e.guid=r=>e.check(Kw(eS,r)),e.cuid=r=>e.check(KL(T6,r)),e.cuid2=r=>e.check(XL(A6,r)),e.ulid=r=>e.check(JL(O6,r)),e.base64=r=>e.check(s5(P6,r)),e.base64url=r=>e.check(a5(L6,r)),e.xid=r=>e.check(WL(k6,r)),e.ksuid=r=>e.check(e5(M6,r)),e.ipv4=r=>e.check(t5(N6,r)),e.ipv6=r=>e.check(n5(j6,r)),e.cidrv4=r=>e.check(r5(z6,r)),e.cidrv6=r=>e.check(o5(D6,r)),e.e164=r=>e.check(i5(I6,r)),e.datetime=r=>e.check(n6(r)),e.date=r=>e.check(o6(r)),e.time=r=>e.check(a6(r)),e.duration=r=>e.check(c6(r))});function ar(e){return BL(x6,e)}const ut=W("ZodStringFormat",(e,t)=>{ct.init(e,t),N_.init(e,t)}),_6=W("ZodEmail",(e,t)=>{YP.init(e,t),ut.init(e,t)}),eS=W("ZodGUID",(e,t)=>{QP.init(e,t),ut.init(e,t)}),ru=W("ZodUUID",(e,t)=>{GP.init(e,t),ut.init(e,t)}),C6=W("ZodURL",(e,t)=>{KP.init(e,t),ut.init(e,t)}),E6=W("ZodEmoji",(e,t)=>{XP.init(e,t),ut.init(e,t)}),R6=W("ZodNanoID",(e,t)=>{JP.init(e,t),ut.init(e,t)}),T6=W("ZodCUID",(e,t)=>{WP.init(e,t),ut.init(e,t)}),A6=W("ZodCUID2",(e,t)=>{eL.init(e,t),ut.init(e,t)}),O6=W("ZodULID",(e,t)=>{tL.init(e,t),ut.init(e,t)}),k6=W("ZodXID",(e,t)=>{nL.init(e,t),ut.init(e,t)}),M6=W("ZodKSUID",(e,t)=>{rL.init(e,t),ut.init(e,t)}),N6=W("ZodIPv4",(e,t)=>{cL.init(e,t),ut.init(e,t)}),j6=W("ZodIPv6",(e,t)=>{lL.init(e,t),ut.init(e,t)}),z6=W("ZodCIDRv4",(e,t)=>{uL.init(e,t),ut.init(e,t)}),D6=W("ZodCIDRv6",(e,t)=>{fL.init(e,t),ut.init(e,t)}),P6=W("ZodBase64",(e,t)=>{dL.init(e,t),ut.init(e,t)}),L6=W("ZodBase64URL",(e,t)=>{pL.init(e,t),ut.init(e,t)}),I6=W("ZodE164",(e,t)=>{mL.init(e,t),ut.init(e,t)}),$6=W("ZodJWT",(e,t)=>{yL.init(e,t),ut.init(e,t)}),j_=W("ZodNumber",(e,t)=>{x_.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(s,i,c)=>P5(e,s,i),e.gt=(s,i)=>e.check(Jw(s,i)),e.gte=(s,i)=>e.check(xp(s,i)),e.min=(s,i)=>e.check(xp(s,i)),e.lt=(s,i)=>e.check(Xw(s,i)),e.lte=(s,i)=>e.check(Sp(s,i)),e.max=(s,i)=>e.check(Sp(s,i)),e.int=s=>e.check(tS(s)),e.safe=s=>e.check(tS(s)),e.positive=s=>e.check(Jw(0,s)),e.nonnegative=s=>e.check(xp(0,s)),e.negative=s=>e.check(Xw(0,s)),e.nonpositive=s=>e.check(Sp(0,s)),e.multipleOf=(s,i)=>e.check(Ww(s,i)),e.step=(s,i)=>e.check(Ww(s,i)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U6(e){return h5(j_,e)}const B6=W("ZodNumberFormat",(e,t)=>{vL.init(e,t),j_.init(e,t)});function tS(e){return p5(B6,e)}const q6=W("ZodBoolean",(e,t)=>{bL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>L5(e,r,s)});function Zn(e){return m5(q6,e)}const F6=W("ZodUnknown",(e,t)=>{wL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>$5()});function nS(){return g5(F6)}const V6=W("ZodNever",(e,t)=>{SL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>I5(e,r,s)});function H6(e){return y5(V6,e)}const Z6=W("ZodArray",(e,t)=>{xL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>F5(e,r,s,i),e.element=t.element,e.min=(r,s)=>e.check(Lu(r,s)),e.nonempty=r=>e.check(Lu(1,r)),e.max=(r,s)=>e.check(R_(r,s)),e.length=(r,s)=>e.check(T_(r,s)),e.unwrap=()=>e.element});function z_(e,t){return O5(Z6,e,t)}const Q6=W("ZodObject",(e,t)=>{CL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>V5(e,r,s,i),Ye(e,"shape",()=>t.shape),e.keyof=()=>Ym(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:nS()}),e.loose=()=>e.clone({...e._zod.def,catchall:nS()}),e.strict=()=>e.clone({...e._zod.def,catchall:H6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>H4(e,r),e.safeExtend=r=>Z4(e,r),e.merge=r=>Q4(e,r),e.pick=r=>F4(e,r),e.omit=r=>V4(e,r),e.partial=(...r)=>G4(D_,e,r[0]),e.required=(...r)=>Y4(P_,e,r[0])});function Fa(e,t){const r={type:"object",shape:e??{},...we(t)};return new Q6(r)}const G6=W("ZodUnion",(e,t)=>{EL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>H5(e,r,s,i),e.options=t.options});function Y6(e,t){return new G6({type:"union",options:e,...we(t)})}const K6=W("ZodIntersection",(e,t)=>{RL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>Z5(e,r,s,i)});function X6(e,t){return new K6({type:"intersection",left:e,right:t})}const J6=W("ZodRecord",(e,t)=>{TL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>Q5(e,r,s,i),e.keyType=t.keyType,e.valueType=t.valueType});function W6(e,t,r){return new J6({type:"record",keyType:e,valueType:t,...we(r)})}const em=W("ZodEnum",(e,t)=>{AL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(s,i,c)=>U5(e,s,i),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(s,i)=>{const c={};for(const u of s)if(r.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new em({...t,checks:[],...we(i),entries:c})},e.exclude=(s,i)=>{const c={...t.entries};for(const u of s)if(r.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new em({...t,checks:[],...we(i),entries:c})}});function Ym(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new em({type:"enum",entries:r,...we(t)})}const eI=W("ZodTransform",(e,t)=>{OL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>q5(e,r),e._zod.parse=(r,s)=>{if(s.direction==="backward")throw new a_(e.constructor.name);r.addIssue=c=>{if(typeof c=="string")r.issues.push(hc(c,r.value,t));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=r.value),u.inst??(u.inst=e),r.issues.push(hc(u))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(c=>(r.value=c,r)):(r.value=i,r)}});function tI(e){return new eI({type:"transform",transform:e})}const D_=W("ZodOptional",(e,t)=>{E_.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>M_(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function rS(e){return new D_({type:"optional",innerType:e})}const nI=W("ZodExactOptional",(e,t)=>{kL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>M_(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function rI(e){return new nI({type:"optional",innerType:e})}const oI=W("ZodNullable",(e,t)=>{ML.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>G5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function oS(e){return new oI({type:"nullable",innerType:e})}const sI=W("ZodDefault",(e,t)=>{NL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>K5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function aI(e,t){return new sI({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():u_(t)}})}const iI=W("ZodPrefault",(e,t)=>{jL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>X5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function cI(e,t){return new iI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():u_(t)}})}const P_=W("ZodNonOptional",(e,t)=>{zL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>Y5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function lI(e,t){return new P_({type:"nonoptional",innerType:e,...we(t)})}const uI=W("ZodCatch",(e,t)=>{DL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>J5(e,r,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fI(e,t){return new uI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const dI=W("ZodPipe",(e,t)=>{PL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>W5(e,r,s,i),e.in=t.in,e.out=t.out});function sS(e,t){return new dI({type:"pipe",in:e,out:t})}const hI=W("ZodReadonly",(e,t)=>{LL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>e6(e,r,s,i),e.unwrap=()=>e._zod.def.innerType});function pI(e){return new hI({type:"readonly",innerType:e})}const mI=W("ZodCustom",(e,t)=>{IL.init(e,t),pt.init(e,t),e._zod.processJSONSchema=(r,s,i)=>B5(e,r)});function gI(e,t={}){return k5(mI,e,t)}function yI(e){return M5(e)}const vI=Fa({id:ar(),path:ar(),label:ar(),icon:ar(),visible:Zn().default(!0),section:Ym(["main","config"]).default("main"),badge:ar().optional(),exact:Zn().optional()}),aS=Fa({appName:ar().default("Convex CMS"),logo:ar().optional(),favicon:ar().optional()}),iS=Fa({sidebarWidth:U6().min(200).max(400).default(256),sidebarCollapsible:Zn().default(!1)}),cS=Fa({showDashboard:Zn().default(!0),showContent:Zn().default(!0),showMedia:Zn().default(!0),showTaxonomies:Zn().default(!0),showContentTypes:Zn().default(!0),showTrash:Zn().default(!0),showSettings:Zn().default(!0),customItems:z_(vI).default([])}),lS=Fa({mode:Ym(["light","dark","system"]).default("system"),allowModeSwitch:Zn().default(!0),tokens:W6(ar(),ar()).optional()}),bI=Fa({branding:aS.default(()=>aS.parse({})),layout:iS.default(()=>iS.parse({})),navigation:cS.default(()=>cS.parse({})),theme:lS.default(()=>lS.parse({}))}),wI=[{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 SI(e){return bI.parse(e??{})}function xI(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},s=[...wI.filter(i=>t[i.id]!==!1),...e.navigation.customItems.filter(i=>i.visible!==!1)];return{main:s.filter(i=>i.section==="main"),config:s.filter(i=>i.section==="config")}}const L_=w.createContext(null);function _I({config:e,children:t}){const r=xI(e),s={...e,navItems:r};return g.jsx(L_.Provider,{value:s,children:t})}function Km(){const e=w.useContext(L_);if(!e)throw new Error("useAdminConfig must be used within AdminConfigProvider");return e}function I_(e,t){const r={get(s,i){if(typeof i=="string"){const c=[...t,i];return I_(e,c)}else if(i===x1){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({},r)}const CI=()=>I_("components",[]),$u=Zj;CI();const $_=w.createContext(null);function EI({baseConfig:e,children:t,api:r}){const s=r??$u.admin,i=A1(s.getSettings),c=w.useMemo(()=>i?{...e,navigation:{...e.navigation,showMedia:e.navigation.showMedia&&i.features.mediaManagement}}:e,[e,i]),u=w.useMemo(()=>({baseConfig:e,settings:i}),[e,i]);return g.jsx($_.Provider,{value:u,children:g.jsx(_I,{config:c,children:t})})}function C7(){const e=w.useContext($_);if(!e)throw new Error("useSettingsConfig must be used within SettingsConfigProvider");return e}const U_=w.createContext(null);function RI({children:e}){const[t,r]=w.useState(new Map),s=w.useCallback((u,f)=>{r(h=>{const p=new Map(h);return p.set(u,f),p})},[]),i=w.useCallback(u=>{r(f=>{const h=new Map(f);return h.delete(u),h})},[]),c=w.useMemo(()=>({overrides:t,setOverride:s,clearOverride:i}),[t,s,i]);return g.jsx(U_.Provider,{value:c,children:e})}function TI(){const e=w.useContext(U_);if(!e)throw new Error("useBreadcrumbContext must be used within a BreadcrumbProvider");return e}const AI={LayoutDashboard:H3,FileText:T3,Image:P1,Layers:L1,Tags:RD,FileCode:E3,Settings:gD,Trash2:MD,HelpCircle:j1,Home:D1,User:U1,Bell:Yp,Lock:tD,Globe:L3,Calendar:Kp,Clock:h3,Link:Y3,Hash:z1,ToggleLeft:$1,ChevronDown:_s,CheckSquare:vD,Braces:k1,Folder:D3,MapPin:iD,DollarSign:b3,Mail:sD,Phone:hD,Package:fD,Star:xD,Heart:U3,Flag:M3,Bookmark:t3,Archive:Kz,Edit:wD,Eye:_3,AlertCircle:u3};function uS({name:e,className:t="size-5"}){const r=AI[e];return r?g.jsx(r,{className:t}):null}function he(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e?.(i),r===!1||!i.defaultPrevented)return t?.(i)}}function OI(e,t){const r=w.createContext(t),s=c=>{const{children:u,...f}=c,h=w.useMemo(()=>f,Object.values(f));return g.jsx(r.Provider,{value:h,children:u})};s.displayName=e+"Provider";function i(c){const u=w.useContext(r);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[s,i]}function hr(e,t=[]){let r=[];function s(c,u){const f=w.createContext(u),h=r.length;r=[...r,u];const p=v=>{const{scope:b,children:_,...E}=v,x=b?.[e]?.[h]||f,C=w.useMemo(()=>E,Object.values(E));return g.jsx(x.Provider,{value:C,children:_})};p.displayName=c+"Provider";function y(v,b){const _=b?.[e]?.[h]||f,E=w.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${c}\``)}return[p,y]}const i=()=>{const c=r.map(u=>w.createContext(u));return function(f){const h=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return i.scopeName=e,[s,kI(i,...t)]}function kI(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(c){const u=s.reduce((f,{useScope:h,scopeName:p})=>{const v=h(c)[`__scope${p}`];return{...f,...v}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Rt=globalThis?.document?w.useLayoutEffect:()=>{},MI=Yu[" useInsertionEffect ".trim().toString()]||Rt;function To({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[i,c,u]=NI({defaultProp:t,onChange:r}),f=e!==void 0,h=f?e:i;{const y=w.useRef(e!==void 0);w.useEffect(()=>{const v=y.current;v!==f&&console.warn(`${s} is changing from ${v?"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,s])}const p=w.useCallback(y=>{if(f){const v=jI(y)?y(e):y;v!==e&&u.current?.(v)}else c(y)},[f,e,c,u]);return[h,p]}function NI({defaultProp:e,onChange:t}){const[r,s]=w.useState(e),i=w.useRef(r),c=w.useRef(t);return MI(()=>{c.current=t},[t]),w.useEffect(()=>{i.current!==r&&(c.current?.(r),i.current=r)},[r,i]),[r,s,c]}function jI(e){return typeof e=="function"}function fS(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wc(...e){return t=>{let r=!1;const s=e.map(i=>{const c=fS(i,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let i=0;i<s.length;i++){const c=s[i];typeof c=="function"?c():fS(e[i],null)}}}}function Ve(...e){return w.useCallback(wc(...e),e)}function gs(e){const t=zI(e),r=w.forwardRef((s,i)=>{const{children:c,...u}=s,f=w.Children.toArray(c),h=f.find(PI);if(h){const p=h.props.children,y=f.map(v=>v===h?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:v);return g.jsx(t,{...u,ref:i,children:w.isValidElement(p)?w.cloneElement(p,void 0,y):null})}return g.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}function zI(e){const t=w.forwardRef((r,s)=>{const{children:i,...c}=r;if(w.isValidElement(i)){const u=II(i),f=LI(c,i.props);return i.type!==w.Fragment&&(f.ref=s?wc(s,u):u),w.cloneElement(i,f)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DI=Symbol("radix.slottable");function PI(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===DI}function LI(e,t){const r={...t};for(const s in t){const i=e[s],c=t[s];/^on[A-Z]/.test(s)?i&&c?r[s]=(...f)=>{const h=c(...f);return i(...f),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...c}:s==="className"&&(r[s]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function II(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var $I=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=$I.reduce((e,t)=>{const r=gs(`Primitive.${t}`),s=w.forwardRef((i,c)=>{const{asChild:u,...f}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...f,ref:c})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function B_(e,t){e&&$a.flushSync(()=>e.dispatchEvent(t))}function UI(e,t){return w.useReducer((r,s)=>t[r][s]??r,e)}var Un=e=>{const{present:t,children:r}=e,s=BI(t),i=typeof r=="function"?r({present:s.isPresent}):w.Children.only(r),c=Ve(s.ref,qI(i));return typeof r=="function"||s.isPresent?w.cloneElement(i,{ref:c}):null};Un.displayName="Presence";function BI(e){const[t,r]=w.useState(),s=w.useRef(null),i=w.useRef(e),c=w.useRef("none"),u=e?"mounted":"unmounted",[f,h]=UI(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=ou(s.current);c.current=f==="mounted"?p:"none"},[f]),Rt(()=>{const p=s.current,y=i.current;if(y!==e){const b=c.current,_=ou(p);e?h("MOUNT"):_==="none"||p?.display==="none"?h("UNMOUNT"):h(y&&b!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Rt(()=>{if(t){let p;const y=t.ownerDocument.defaultView??window,v=_=>{const x=ou(s.current).includes(CSS.escape(_.animationName));if(_.target===t&&x&&(h("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},b=_=>{_.target===t&&(c.current=ou(s.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{y.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(p=>{s.current=p?getComputedStyle(p):null,r(p)},[])}}function ou(e){return e?.animationName||"none"}function qI(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var FI=Yu[" useId ".trim().toString()]||(()=>{}),VI=0;function Qn(e){const[t,r]=w.useState(FI());return Rt(()=>{r(s=>s??String(VI++))},[e]),e||(t?`radix-${t}`:"")}var uf="Collapsible",[HI]=hr(uf),[ZI,Xm]=HI(uf),q_=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:s,defaultOpen:i,disabled:c,onOpenChange:u,...f}=e,[h,p]=To({prop:s,defaultProp:i??!1,onChange:u,caller:uf});return g.jsx(ZI,{scope:r,disabled:c,contentId:Qn(),open:h,onOpenToggle:w.useCallback(()=>p(y=>!y),[p]),children:g.jsx(ke.div,{"data-state":Wm(h),"data-disabled":c?"":void 0,...f,ref:t})})});q_.displayName=uf;var F_="CollapsibleTrigger",V_=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,...s}=e,i=Xm(F_,r);return g.jsx(ke.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Wm(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:t,onClick:he(e.onClick,i.onOpenToggle)})});V_.displayName=F_;var Jm="CollapsibleContent",H_=w.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=Xm(Jm,e.__scopeCollapsible);return g.jsx(Un,{present:r||i.open,children:({present:c})=>g.jsx(QI,{...s,ref:t,present:c})})});H_.displayName=Jm;var QI=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:s,children:i,...c}=e,u=Xm(Jm,r),[f,h]=w.useState(s),p=w.useRef(null),y=Ve(t,p),v=w.useRef(0),b=v.current,_=w.useRef(0),E=_.current,x=u.open||f,C=w.useRef(x),O=w.useRef(void 0);return w.useEffect(()=>{const M=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(M)},[]),Rt(()=>{const M=p.current;if(M){O.current=O.current||{transitionDuration:M.style.transitionDuration,animationName:M.style.animationName},M.style.transitionDuration="0s",M.style.animationName="none";const k=M.getBoundingClientRect();v.current=k.height,_.current=k.width,C.current||(M.style.transitionDuration=O.current.transitionDuration,M.style.animationName=O.current.animationName),h(s)}},[u.open,s]),g.jsx(ke.div,{"data-state":Wm(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!x,...c,ref:y,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...e.style},children:x&&i})});function Wm(e){return e?"open":"closed"}var GI=q_;const YI=GI,KI=V_,XI=H_;function Yn(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...r)=>t.current?.(...r),[])}function JI(e,t=globalThis?.document){const r=Yn(e);w.useEffect(()=>{const s=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var WI="DismissableLayer",tm="dismissableLayer.update",e$="dismissableLayer.pointerDownOutside",t$="dismissableLayer.focusOutside",dS,Z_=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sc=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...h}=e,p=w.useContext(Z_),[y,v]=w.useState(null),b=y?.ownerDocument??globalThis?.document,[,_]=w.useState({}),E=Ve(t,L=>v(L)),x=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),O=x.indexOf(C),M=y?x.indexOf(y):-1,k=p.layersWithOutsidePointerEventsDisabled.size>0,D=M>=O,U=o$(L=>{const j=L.target,G=[...p.branches].some(ie=>ie.contains(j));!D||G||(i?.(L),u?.(L),L.defaultPrevented||f?.())},b),H=s$(L=>{const j=L.target;[...p.branches].some(ie=>ie.contains(j))||(c?.(L),u?.(L),L.defaultPrevented||f?.())},b);return JI(L=>{M===p.layers.size-1&&(s?.(L),!L.defaultPrevented&&f&&(L.preventDefault(),f()))},b),w.useEffect(()=>{if(y)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(dS=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),hS(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=dS)}},[y,b,r,p]),w.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),hS())},[y,p]),w.useEffect(()=>{const L=()=>_({});return document.addEventListener(tm,L),()=>document.removeEventListener(tm,L)},[]),g.jsx(ke.div,{...h,ref:E,style:{pointerEvents:k?D?"auto":"none":void 0,...e.style},onFocusCapture:he(e.onFocusCapture,H.onFocusCapture),onBlurCapture:he(e.onBlurCapture,H.onBlurCapture),onPointerDownCapture:he(e.onPointerDownCapture,U.onPointerDownCapture)})});Sc.displayName=WI;var n$="DismissableLayerBranch",r$=w.forwardRef((e,t)=>{const r=w.useContext(Z_),s=w.useRef(null),i=Ve(t,s);return w.useEffect(()=>{const c=s.current;if(c)return r.branches.add(c),()=>{r.branches.delete(c)}},[r.branches]),g.jsx(ke.div,{...e,ref:i})});r$.displayName=n$;function o$(e,t=globalThis?.document){const r=Yn(e),s=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const c=f=>{if(f.target&&!s.current){let h=function(){Q_(e$,r,p,{discrete:!0})};const p={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);s.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function s$(e,t=globalThis?.document){const r=Yn(e),s=w.useRef(!1);return w.useEffect(()=>{const i=c=>{c.target&&!s.current&&Q_(t$,r,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function hS(){const e=new CustomEvent(tm);document.dispatchEvent(e)}function Q_(e,t,r,{discrete:s}){const i=r.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),s?B_(i,c):i.dispatchEvent(c)}var _p="focusScope.autoFocusOnMount",Cp="focusScope.autoFocusOnUnmount",pS={bubbles:!1,cancelable:!0},a$="FocusScope",xc=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...u}=e,[f,h]=w.useState(null),p=Yn(i),y=Yn(c),v=w.useRef(null),b=Ve(t,x=>h(x)),_=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(s){let x=function(k){if(_.paused||!f)return;const D=k.target;f.contains(D)?v.current=D:vo(v.current,{select:!0})},C=function(k){if(_.paused||!f)return;const D=k.relatedTarget;D!==null&&(f.contains(D)||vo(v.current,{select:!0}))},O=function(k){if(document.activeElement===document.body)for(const U of k)U.removedNodes.length>0&&vo(f)};document.addEventListener("focusin",x),document.addEventListener("focusout",C);const M=new MutationObserver(O);return f&&M.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",C),M.disconnect()}}},[s,f,_.paused]),w.useEffect(()=>{if(f){gS.add(_);const x=document.activeElement;if(!f.contains(x)){const O=new CustomEvent(_p,pS);f.addEventListener(_p,p),f.dispatchEvent(O),O.defaultPrevented||(i$(d$(G_(f)),{select:!0}),document.activeElement===x&&vo(f))}return()=>{f.removeEventListener(_p,p),setTimeout(()=>{const O=new CustomEvent(Cp,pS);f.addEventListener(Cp,y),f.dispatchEvent(O),O.defaultPrevented||vo(x??document.body,{select:!0}),f.removeEventListener(Cp,y),gS.remove(_)},0)}}},[f,p,y,_]);const E=w.useCallback(x=>{if(!r&&!s||_.paused)return;const C=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,O=document.activeElement;if(C&&O){const M=x.currentTarget,[k,D]=c$(M);k&&D?!x.shiftKey&&O===D?(x.preventDefault(),r&&vo(k,{select:!0})):x.shiftKey&&O===k&&(x.preventDefault(),r&&vo(D,{select:!0})):O===M&&x.preventDefault()}},[r,s,_.paused]);return g.jsx(ke.div,{tabIndex:-1,...u,ref:b,onKeyDown:E})});xc.displayName=a$;function i$(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(vo(s,{select:t}),document.activeElement!==r)return}function c$(e){const t=G_(e),r=mS(t,e),s=mS(t.reverse(),e);return[r,s]}function G_(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function mS(e,t){for(const r of e)if(!l$(r,{upTo:t}))return r}function l$(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 u$(e){return e instanceof HTMLInputElement&&"select"in e}function vo(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&u$(e)&&t&&e.select()}}var gS=f$();function f$(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=yS(e,t),e.unshift(t)},remove(t){e=yS(e,t),e[0]?.resume()}}}function yS(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function d$(e){return e.filter(t=>t.tagName!=="A")}var h$="Portal",_c=w.forwardRef((e,t)=>{const{container:r,...s}=e,[i,c]=w.useState(!1);Rt(()=>c(!0),[]);const u=r||i&&globalThis?.document?.body;return u?gN.createPortal(g.jsx(ke.div,{...s,ref:t}),u):null});_c.displayName=h$;var Ep=0;function ff(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vS()),document.body.insertAdjacentElement("beforeend",e[1]??vS()),Ep++,()=>{Ep===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ep--}},[])}function vS(){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 ir=function(){return ir=Object.assign||function(t){for(var r,s=1,i=arguments.length;s<i;s++){r=arguments[s];for(var c in r)Object.prototype.hasOwnProperty.call(r,c)&&(t[c]=r[c])}return t},ir.apply(this,arguments)};function Y_(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r}function p$(e,t,r){if(r||arguments.length===2)for(var s=0,i=t.length,c;s<i;s++)(c||!(s in t))&&(c||(c=Array.prototype.slice.call(t,0,s)),c[s]=t[s]);return e.concat(c||Array.prototype.slice.call(t))}var mu="right-scroll-bar-position",gu="width-before-scroll-bar",m$="with-scroll-bars-hidden",g$="--removed-body-scroll-bar-size";function Rp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function y$(e,t){var r=w.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var i=r.value;i!==s&&(r.value=s,r.callback(s,i))}}}})[0];return r.callback=t,r.facade}var v$=typeof window<"u"?w.useLayoutEffect:w.useEffect,bS=new WeakMap;function b$(e,t){var r=y$(null,function(s){return e.forEach(function(i){return Rp(i,s)})});return v$(function(){var s=bS.get(r);if(s){var i=new Set(s),c=new Set(e),u=r.current;i.forEach(function(f){c.has(f)||Rp(f,null)}),c.forEach(function(f){i.has(f)||Rp(f,u)})}bS.set(r,e)},[e]),r}function w$(e){return e}function S$(e,t){t===void 0&&(t=w$);var r=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(c){var u=t(c,s);return r.push(u),function(){r=r.filter(function(f){return f!==u})}},assignSyncMedium:function(c){for(s=!0;r.length;){var u=r;r=[],u.forEach(c)}r={push:function(f){return c(f)},filter:function(){return r}}},assignMedium:function(c){s=!0;var u=[];if(r.length){var f=r;r=[],f.forEach(c),u=r}var h=function(){var y=u;u=[],y.forEach(c)},p=function(){return Promise.resolve().then(h)};p(),r={push:function(y){u.push(y),p()},filter:function(y){return u=u.filter(y),r}}}};return i}function x$(e){e===void 0&&(e={});var t=S$(null);return t.options=ir({async:!0,ssr:!1},e),t}var K_=function(e){var t=e.sideCar,r=Y_(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return w.createElement(s,ir({},r))};K_.isSideCarExport=!0;function _$(e,t){return e.useMedium(t),K_}var X_=x$(),Tp=function(){},df=w.forwardRef(function(e,t){var r=w.useRef(null),s=w.useState({onScrollCapture:Tp,onWheelCapture:Tp,onTouchMoveCapture:Tp}),i=s[0],c=s[1],u=e.forwardProps,f=e.children,h=e.className,p=e.removeScrollBar,y=e.enabled,v=e.shards,b=e.sideCar,_=e.noRelative,E=e.noIsolation,x=e.inert,C=e.allowPinchZoom,O=e.as,M=O===void 0?"div":O,k=e.gapMode,D=Y_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),U=b,H=b$([r,t]),L=ir(ir({},D),i);return w.createElement(w.Fragment,null,y&&w.createElement(U,{sideCar:X_,removeScrollBar:p,shards:v,noRelative:_,noIsolation:E,inert:x,setCallbacks:c,allowPinchZoom:!!C,lockRef:r,gapMode:k}),u?w.cloneElement(w.Children.only(f),ir(ir({},L),{ref:H})):w.createElement(M,ir({},L,{className:h,ref:H}),f))});df.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};df.classNames={fullWidth:gu,zeroRight:mu};var C$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function E$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=C$();return t&&e.setAttribute("nonce",t),e}function R$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function T$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var A$=function(){var e=0,t=null;return{add:function(r){e==0&&(t=E$())&&(R$(t,r),T$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},O$=function(){var e=A$();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},J_=function(){var e=O$(),t=function(r){var s=r.styles,i=r.dynamic;return e(s,i),null};return t},k$={left:0,top:0,right:0,gap:0},Ap=function(e){return parseInt(e||"",10)||0},M$=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ap(r),Ap(s),Ap(i)]},N$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return k$;var t=M$(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},j$=J_(),Ma="data-scroll-locked",z$=function(e,t,r,s){var i=e.left,c=e.top,u=e.right,f=e.gap;return r===void 0&&(r="margin"),`
|
|
58
58
|
.`.concat(m$,` {
|
|
59
59
|
overflow: hidden `).concat(s,`;
|
|
60
60
|
padding-right: `).concat(f,"px ").concat(s,`;
|
|
@@ -98,5 +98,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
98
98
|
|
|
99
99
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
100
100
|
|
|
101
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},i8="DialogDescriptionWarning",c8=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yC(i8).contentName}}.`;return w.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},l8=oC,u8=iC,f8=cC,d8=lC,h8=fC,p8=hC,m8=mC;function g8({...e}){return g.jsx(l8,{"data-slot":"dialog",...e})}function y8({...e}){return g.jsx(u8,{"data-slot":"dialog-portal",...e})}function v8({className:e,...t}){return g.jsx(f8,{"data-slot":"dialog-overlay",className:je("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 b8({className:e,children:t,showCloseButton:r=!0,...s}){return g.jsxs(y8,{"data-slot":"dialog-portal",children:[g.jsx(v8,{}),g.jsxs(d8,{"data-slot":"dialog-content",className:je("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),...s,children:[t,r&&g.jsxs(m8,{"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:[g.jsx(ju,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function w8({className:e,...t}){return g.jsx("div",{"data-slot":"dialog-header",className:je("flex flex-col gap-2 text-center sm:text-left",e),...t})}function S8({className:e,...t}){return g.jsx("div",{"data-slot":"dialog-footer",className:je("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function x8({className:e,...t}){return g.jsx(h8,{"data-slot":"dialog-title",className:je("text-lg leading-none font-semibold",e),...t})}function _8({className:e,...t}){return g.jsx(p8,{"data-slot":"dialog-description",className:je("text-muted-foreground text-sm",e),...t})}var C8=Symbol.for("react.lazy"),Bu=Yu[" use ".trim().toString()];function E8(e){return typeof e=="object"&&e!==null&&"then"in e}function vC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===C8&&"_payload"in e&&E8(e._payload)}function bC(e){const t=R8(e),r=w.forwardRef((s,i)=>{let{children:c,...u}=s;vC(c)&&typeof Bu=="function"&&(c=Bu(c._payload));const f=w.Children.toArray(c),h=f.find(A8);if(h){const p=h.props.children,y=f.map(v=>v===h?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:v);return g.jsx(t,{...u,ref:i,children:w.isValidElement(p)?w.cloneElement(p,void 0,y):null})}return g.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}var wC=bC("Slot");function R8(e){const t=w.forwardRef((r,s)=>{let{children:i,...c}=r;if(vC(i)&&typeof Bu=="function"&&(i=Bu(i._payload)),w.isValidElement(i)){const u=k8(i),f=O8(c,i.props);return i.type!==w.Fragment&&(f.ref=s?wc(s,u):u),w.cloneElement(i,f)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var T8=Symbol("radix.slottable");function A8(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===T8}function O8(e,t){const r={...t};for(const s in t){const i=e[s],c=t[s];/^on[A-Z]/.test(s)?i&&c?r[s]=(...f)=>{const h=c(...f);return i(...f),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...c}:s==="className"&&(r[s]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function k8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const CS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ES=q1,M8=(e,t)=>r=>{var s;if(t?.variants==null)return ES(e,r?.class,r?.className);const{variants:i,defaultVariants:c}=t,u=Object.keys(i).map(p=>{const y=r?.[p],v=c?.[p];if(y===null)return null;const b=CS(y)||CS(v);return i[p][b]}),f=r&&Object.entries(r).reduce((p,y)=>{let[v,b]=y;return b===void 0||(p[v]=b),p},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((p,y)=>{let{class:v,className:b,..._}=y;return Object.entries(_).every(E=>{let[x,C]=E;return Array.isArray(C)?C.includes({...c,...f}[x]):{...c,...f}[x]===C})?[...p,v,b]:p},[]);return ES(e,u,h,r?.class,r?.className)},N8=M8("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 sc({className:e,variant:t="default",size:r="default",asChild:s=!1,...i}){const c=s?wC:"button";return g.jsx(c,{"data-slot":"button","data-variant":t,"data-size":r,className:je(N8({variant:t,size:r,className:e})),...i})}const RS={fast:"duration-100 ease-out"},j8={primary:"default",secondary:"secondary",danger:"destructive",ghost:"ghost",outline:"outline",link:"link",success:"default",warning:"default"},z8={success:"bg-emerald-600 text-white hover:bg-emerald-700 focus-visible:ring-emerald-500",warning:"bg-amber-500 text-white hover:bg-amber-600 focus-visible:ring-amber-500"},D8=()=>g.jsxs("svg",{className:"size-4 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.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 $r({variant:e="primary",loading:t,disabled:r,children:s,className:i,asChild:c,...u}){const f=j8[e],h=z8[e];return c?g.jsx(sc,{variant:f,disabled:r||t,className:je(RS.fast,h,i),asChild:!0,...u,children:s}):g.jsxs(sc,{variant:f,disabled:r||t,className:je(RS.fast,h,i),...u,children:[t&&g.jsx(D8,{}),s]})}const P8={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"};function rg({open:e,onOpenChange:t,title:r,description:s,children:i,footer:c,size:u="md",className:f}){return g.jsx(g8,{open:e,onOpenChange:t,children:g.jsxs(b8,{className:je("flex max-h-[85vh] flex-col overflow-hidden",P8[u],f),children:[g.jsxs(w8,{className:"shrink-0",children:[g.jsx(x8,{children:r}),s&&g.jsx(_8,{children:s})]}),g.jsx("div",{className:"min-h-0 flex-1 py-4 scrollbar-none",children:i}),c&&g.jsx(S8,{className:"shrink-0 border-t pt-4",children:c})]})})}function R7({open:e,onOpenChange:t,title:r,description:s,confirmLabel:i="Confirm",cancelLabel:c="Cancel",onConfirm:u,onCancel:f,variant:h="default",loading:p,isLoading:y,error:v}){const b=p??y??!1,_=()=>{f?.(),t(!1)},E=()=>{u()},x=()=>h==="danger"?"danger":h==="warning"?"warning":"primary";return g.jsx(rg,{open:e,onOpenChange:t,title:r,size:"sm",footer:g.jsxs(g.Fragment,{children:[g.jsx($r,{variant:"outline",onClick:_,disabled:b,children:c}),g.jsx($r,{variant:x(),onClick:E,loading:b,children:i})]}),children:g.jsxs("div",{className:"space-y-3",children:[g.jsx("p",{className:"text-sm text-muted-foreground",children:s}),v&&g.jsx("p",{className:"text-sm text-destructive",children:v})]})})}function os({className:e,type:t,...r}){return g.jsx("input",{type:t,"data-slot":"input",className:je("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),...r})}var L8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mf=L8.reduce((e,t)=>{const r=bC(`Primitive.${t}`),s=w.forwardRef((i,c)=>{const{asChild:u,...f}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...f,ref:c})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),I8="Label",SC=w.forwardRef((e,t)=>g.jsx(mf.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));SC.displayName=I8;var $8=SC;function jn({className:e,...t}){return g.jsx($8,{"data-slot":"label",className:je("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 U8({className:e,...t}){return g.jsx("textarea",{"data-slot":"textarea",className:je("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 xC(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function _C(e){const[t,r]=w.useState(void 0);return Rt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const c=i[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;r({width:u,height:f})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var gf="Checkbox",[B8]=hr(gf),[q8,og]=B8(gf);function F8(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:i,disabled:c,form:u,name:f,onCheckedChange:h,required:p,value:y="on",internal_do_not_use_render:v}=e,[b,_]=To({prop:r,defaultProp:i??!1,onChange:h,caller:gf}),[E,x]=w.useState(null),[C,O]=w.useState(null),M=w.useRef(!1),k=E?!!u||!!E.closest("form"):!0,D={checked:b,disabled:c,setChecked:_,control:E,setControl:x,name:f,form:u,value:y,hasConsumerStoppedPropagationRef:M,required:p,defaultChecked:Co(i)?!1:i,isFormControl:k,bubbleInput:C,setBubbleInput:O};return g.jsx(q8,{scope:t,...D,children:V8(v)?v(D):s})}var CC="CheckboxTrigger",EC=w.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},i)=>{const{control:c,value:u,disabled:f,checked:h,required:p,setControl:y,setChecked:v,hasConsumerStoppedPropagationRef:b,isFormControl:_,bubbleInput:E}=og(CC,e),x=Ve(i,y),C=w.useRef(h);return w.useEffect(()=>{const O=c?.form;if(O){const M=()=>v(C.current);return O.addEventListener("reset",M),()=>O.removeEventListener("reset",M)}},[c,v]),g.jsx(ke.button,{type:"button",role:"checkbox","aria-checked":Co(h)?"mixed":h,"aria-required":p,"data-state":MC(h),"data-disabled":f?"":void 0,disabled:f,value:u,...s,ref:x,onKeyDown:he(t,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:he(r,O=>{v(M=>Co(M)?!0:!M),E&&_&&(b.current=O.isPropagationStopped(),b.current||O.stopPropagation())})})});EC.displayName=CC;var RC=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:i,defaultChecked:c,required:u,disabled:f,value:h,onCheckedChange:p,form:y,...v}=e;return g.jsx(F8,{__scopeCheckbox:r,checked:i,defaultChecked:c,disabled:f,required:u,onCheckedChange:p,name:s,form:y,value:h,internal_do_not_use_render:({isFormControl:b})=>g.jsxs(g.Fragment,{children:[g.jsx(EC,{...v,ref:t,__scopeCheckbox:r}),b&&g.jsx(kC,{__scopeCheckbox:r})]})})});RC.displayName=gf;var TC="CheckboxIndicator",AC=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...i}=e,c=og(TC,r);return g.jsx(Un,{present:s||Co(c.checked)||c.checked===!0,children:g.jsx(ke.span,{"data-state":MC(c.checked),"data-disabled":c.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});AC.displayName=TC;var OC="CheckboxBubbleInput",kC=w.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:c,defaultChecked:u,required:f,disabled:h,name:p,value:y,form:v,bubbleInput:b,setBubbleInput:_}=og(OC,e),E=Ve(r,_),x=xC(c),C=_C(s);w.useEffect(()=>{const M=b;if(!M)return;const k=window.HTMLInputElement.prototype,U=Object.getOwnPropertyDescriptor(k,"checked").set,H=!i.current;if(x!==c&&U){const L=new Event("click",{bubbles:H});M.indeterminate=Co(c),U.call(M,Co(c)?!1:c),M.dispatchEvent(L)}},[b,x,c,i]);const O=w.useRef(Co(c)?!1:c);return g.jsx(ke.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??O.current,required:f,disabled:h,name:p,value:y,form:v,...t,tabIndex:-1,ref:E,style:{...t.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});kC.displayName=OC;function V8(e){return typeof e=="function"}function Co(e){return e==="indeterminate"}function MC(e){return Co(e)?"indeterminate":e?"checked":"unchecked"}function TS({className:e,...t}){return g.jsx(RC,{"data-slot":"checkbox",className:je("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:g.jsx(AC,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:g.jsx(M1,{className:"size-3.5"})})})}function AS(e,[t,r]){return Math.min(r,Math.max(t,e))}function sg(e){const t=e+"CollectionProvider",[r,s]=hr(t),[i,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=x=>{const{scope:C,children:O}=x,M=qt.useRef(null),k=qt.useRef(new Map).current;return g.jsx(i,{scope:C,itemMap:k,collectionRef:M,children:O})};u.displayName=t;const f=e+"CollectionSlot",h=gs(f),p=qt.forwardRef((x,C)=>{const{scope:O,children:M}=x,k=c(f,O),D=Ve(C,k.collectionRef);return g.jsx(h,{ref:D,children:M})});p.displayName=f;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=gs(y),_=qt.forwardRef((x,C)=>{const{scope:O,children:M,...k}=x,D=qt.useRef(null),U=Ve(C,D),H=c(y,O);return qt.useEffect(()=>(H.itemMap.set(D,{ref:D,...k}),()=>{H.itemMap.delete(D)})),g.jsx(b,{[v]:"",ref:U,children:M})});_.displayName=y;function E(x){const C=c(e+"CollectionConsumer",x);return qt.useCallback(()=>{const M=C.collectionRef.current;if(!M)return[];const k=Array.from(M.querySelectorAll(`[${v}]`));return Array.from(C.itemMap.values()).sort((H,L)=>k.indexOf(H.ref.current)-k.indexOf(L.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:u,Slot:p,ItemSlot:_},E,s]}var H8=w.createContext(void 0);function ag(e){const t=w.useContext(H8);return e||t||"ltr"}const Z8=["top","right","bottom","left"],Ao=Math.min,yn=Math.max,qu=Math.round,lu=Math.floor,lr=e=>({x:e,y:e}),Q8={left:"right",right:"left",bottom:"top",top:"bottom"},G8={start:"end",end:"start"};function rm(e,t,r){return yn(e,Ao(t,r))}function qr(e,t){return typeof e=="function"?e(t):e}function Fr(e){return e.split("-")[0]}function Va(e){return e.split("-")[1]}function ig(e){return e==="x"?"y":"x"}function cg(e){return e==="y"?"height":"width"}const Y8=new Set(["top","bottom"]);function cr(e){return Y8.has(Fr(e))?"y":"x"}function lg(e){return ig(cr(e))}function K8(e,t,r){r===void 0&&(r=!1);const s=Va(e),i=lg(e),c=cg(i);let u=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Fu(u)),[u,Fu(u)]}function X8(e){const t=Fu(e);return[om(e),t,om(t)]}function om(e){return e.replace(/start|end/g,t=>G8[t])}const OS=["left","right"],kS=["right","left"],J8=["top","bottom"],W8=["bottom","top"];function eU(e,t,r){switch(e){case"top":case"bottom":return r?t?kS:OS:t?OS:kS;case"left":case"right":return t?J8:W8;default:return[]}}function tU(e,t,r,s){const i=Va(e);let c=eU(Fr(e),r==="start",s);return i&&(c=c.map(u=>u+"-"+i),t&&(c=c.concat(c.map(om)))),c}function Fu(e){return e.replace(/left|right|bottom|top/g,t=>Q8[t])}function nU(e){return{top:0,right:0,bottom:0,left:0,...e}}function NC(e){return typeof e!="number"?nU(e):{top:e,right:e,bottom:e,left:e}}function Vu(e){const{x:t,y:r,width:s,height:i}=e;return{width:s,height:i,top:r,left:t,right:t+s,bottom:r+i,x:t,y:r}}function MS(e,t,r){let{reference:s,floating:i}=e;const c=cr(t),u=lg(t),f=cg(u),h=Fr(t),p=c==="y",y=s.x+s.width/2-i.width/2,v=s.y+s.height/2-i.height/2,b=s[f]/2-i[f]/2;let _;switch(h){case"top":_={x:y,y:s.y-i.height};break;case"bottom":_={x:y,y:s.y+s.height};break;case"right":_={x:s.x+s.width,y:v};break;case"left":_={x:s.x-i.width,y:v};break;default:_={x:s.x,y:s.y}}switch(Va(t)){case"start":_[u]-=b*(r&&p?-1:1);break;case"end":_[u]+=b*(r&&p?-1:1);break}return _}const rU=async(e,t,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,f=c.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:y,y:v}=MS(p,s,h),b=s,_={},E=0;for(let x=0;x<f.length;x++){const{name:C,fn:O}=f[x],{x:M,y:k,data:D,reset:U}=await O({x:y,y:v,initialPlacement:s,placement:b,strategy:i,middlewareData:_,rects:p,platform:u,elements:{reference:e,floating:t}});y=M??y,v=k??v,_={..._,[C]:{..._[C],...D}},U&&E<=50&&(E++,typeof U=="object"&&(U.placement&&(b=U.placement),U.rects&&(p=U.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):U.rects),{x:y,y:v}=MS(p,b,h)),x=-1)}return{x:y,y:v,placement:b,strategy:i,middlewareData:_}};async function pc(e,t){var r;t===void 0&&(t={});const{x:s,y:i,platform:c,rects:u,elements:f,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:_=0}=qr(t,e),E=NC(_),C=f[b?v==="floating"?"reference":"floating":v],O=Vu(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(C)))==null||r?C:C.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:p,rootBoundary:y,strategy:h})),M=v==="floating"?{x:s,y:i,width:u.floating.width,height:u.floating.height}:u.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),D=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},U=Vu(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:M,offsetParent:k,strategy:h}):M);return{top:(O.top-U.top+E.top)/D.y,bottom:(U.bottom-O.bottom+E.bottom)/D.y,left:(O.left-U.left+E.left)/D.x,right:(U.right-O.right+E.right)/D.x}}const oU=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:i,rects:c,platform:u,elements:f,middlewareData:h}=t,{element:p,padding:y=0}=qr(e,t)||{};if(p==null)return{};const v=NC(y),b={x:r,y:s},_=lg(i),E=cg(_),x=await u.getDimensions(p),C=_==="y",O=C?"top":"left",M=C?"bottom":"right",k=C?"clientHeight":"clientWidth",D=c.reference[E]+c.reference[_]-b[_]-c.floating[E],U=b[_]-c.reference[_],H=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let L=H?H[k]:0;(!L||!await(u.isElement==null?void 0:u.isElement(H)))&&(L=f.floating[k]||c.floating[E]);const j=D/2-U/2,G=L/2-x[E]/2-1,ie=Ao(v[O],G),ae=Ao(v[M],G),te=ie,ce=L-x[E]-ae,le=L/2-x[E]/2+j,me=rm(te,le,ce),I=!h.arrow&&Va(i)!=null&&le!==me&&c.reference[E]/2-(le<te?ie:ae)-x[E]/2<0,K=I?le<te?le-te:le-ce:0;return{[_]:b[_]+K,data:{[_]:me,centerOffset:le-me-K,...I&&{alignmentOffset:K}},reset:I}}}),sU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:i,middlewareData:c,rects:u,initialPlacement:f,platform:h,elements:p}=t,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:b,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:x=!0,...C}=qr(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const O=Fr(i),M=cr(f),k=Fr(f)===f,D=await(h.isRTL==null?void 0:h.isRTL(p.floating)),U=b||(k||!x?[Fu(f)]:X8(f)),H=E!=="none";!b&&H&&U.push(...tU(f,x,E,D));const L=[f,...U],j=await pc(t,C),G=[];let ie=((s=c.flip)==null?void 0:s.overflows)||[];if(y&&G.push(j[O]),v){const le=K8(i,u,D);G.push(j[le[0]],j[le[1]])}if(ie=[...ie,{placement:i,overflows:G}],!G.every(le=>le<=0)){var ae,te;const le=(((ae=c.flip)==null?void 0:ae.index)||0)+1,me=L[le];if(me&&(!(v==="alignment"?M!==cr(me):!1)||ie.every(V=>cr(V.placement)===M?V.overflows[0]>0:!0)))return{data:{index:le,overflows:ie},reset:{placement:me}};let I=(te=ie.filter(K=>K.overflows[0]<=0).sort((K,V)=>K.overflows[1]-V.overflows[1])[0])==null?void 0:te.placement;if(!I)switch(_){case"bestFit":{var ce;const K=(ce=ie.filter(V=>{if(H){const re=cr(V.placement);return re===M||re==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(re=>re>0).reduce((re,ve)=>re+ve,0)]).sort((V,re)=>V[1]-re[1])[0])==null?void 0:ce[0];K&&(I=K);break}case"initialPlacement":I=f;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function NS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jS(e){return Z8.some(t=>e[t]>=0)}const aU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:s="referenceHidden",...i}=qr(e,t);switch(s){case"referenceHidden":{const c=await pc(t,{...i,elementContext:"reference"}),u=NS(c,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:jS(u)}}}case"escaped":{const c=await pc(t,{...i,altBoundary:!0}),u=NS(c,r.floating);return{data:{escapedOffsets:u,escaped:jS(u)}}}default:return{}}}}},jC=new Set(["left","top"]);async function iU(e,t){const{placement:r,platform:s,elements:i}=e,c=await(s.isRTL==null?void 0:s.isRTL(i.floating)),u=Fr(r),f=Va(r),h=cr(r)==="y",p=jC.has(u)?-1:1,y=c&&h?-1:1,v=qr(t,e);let{mainAxis:b,crossAxis:_,alignmentAxis:E}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof E=="number"&&(_=f==="end"?E*-1:E),h?{x:_*y,y:b*p}:{x:b*p,y:_*y}}const cU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:i,y:c,placement:u,middlewareData:f}=t,h=await iU(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(s=f.arrow)!=null&&s.alignmentOffset?{}:{x:i+h.x,y:c+h.y,data:{...h,placement:u}}}}},lU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:i}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:f={fn:C=>{let{x:O,y:M}=C;return{x:O,y:M}}},...h}=qr(e,t),p={x:r,y:s},y=await pc(t,h),v=cr(Fr(i)),b=ig(v);let _=p[b],E=p[v];if(c){const C=b==="y"?"top":"left",O=b==="y"?"bottom":"right",M=_+y[C],k=_-y[O];_=rm(M,_,k)}if(u){const C=v==="y"?"top":"left",O=v==="y"?"bottom":"right",M=E+y[C],k=E-y[O];E=rm(M,E,k)}const x=f.fn({...t,[b]:_,[v]:E});return{...x,data:{x:x.x-r,y:x.y-s,enabled:{[b]:c,[v]:u}}}}}},uU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:i,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:h=!0,crossAxis:p=!0}=qr(e,t),y={x:r,y:s},v=cr(i),b=ig(v);let _=y[b],E=y[v];const x=qr(f,t),C=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(h){const k=b==="y"?"height":"width",D=c.reference[b]-c.floating[k]+C.mainAxis,U=c.reference[b]+c.reference[k]-C.mainAxis;_<D?_=D:_>U&&(_=U)}if(p){var O,M;const k=b==="y"?"width":"height",D=jC.has(Fr(i)),U=c.reference[v]-c.floating[k]+(D&&((O=u.offset)==null?void 0:O[v])||0)+(D?0:C.crossAxis),H=c.reference[v]+c.reference[k]+(D?0:((M=u.offset)==null?void 0:M[v])||0)-(D?C.crossAxis:0);E<U?E=U:E>H&&(E=H)}return{[b]:_,[v]:E}}}},fU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:i,rects:c,platform:u,elements:f}=t,{apply:h=()=>{},...p}=qr(e,t),y=await pc(t,p),v=Fr(i),b=Va(i),_=cr(i)==="y",{width:E,height:x}=c.floating;let C,O;v==="top"||v==="bottom"?(C=v,O=b===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(O=v,C=b==="end"?"top":"bottom");const M=x-y.top-y.bottom,k=E-y.left-y.right,D=Ao(x-y[C],M),U=Ao(E-y[O],k),H=!t.middlewareData.shift;let L=D,j=U;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(j=k),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=M),H&&!b){const ie=yn(y.left,0),ae=yn(y.right,0),te=yn(y.top,0),ce=yn(y.bottom,0);_?j=E-2*(ie!==0||ae!==0?ie+ae:yn(y.left,y.right)):L=x-2*(te!==0||ce!==0?te+ce:yn(y.top,y.bottom))}await h({...t,availableWidth:j,availableHeight:L});const G=await u.getDimensions(f.floating);return E!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function yf(){return typeof window<"u"}function Ha(e){return zC(e)?(e.nodeName||"").toLowerCase():"#document"}function bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pr(e){var t;return(t=(zC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zC(e){return yf()?e instanceof Node||e instanceof bn(e).Node:!1}function Kn(e){return yf()?e instanceof Element||e instanceof bn(e).Element:!1}function fr(e){return yf()?e instanceof HTMLElement||e instanceof bn(e).HTMLElement:!1}function zS(e){return!yf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bn(e).ShadowRoot}const dU=new Set(["inline","contents"]);function Ec(e){const{overflow:t,overflowX:r,overflowY:s,display:i}=Xn(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&!dU.has(i)}const hU=new Set(["table","td","th"]);function pU(e){return hU.has(Ha(e))}const mU=[":popover-open",":modal"];function vf(e){return mU.some(t=>{try{return e.matches(t)}catch{return!1}})}const gU=["transform","translate","scale","rotate","perspective"],yU=["transform","translate","scale","rotate","perspective","filter"],vU=["paint","layout","strict","content"];function ug(e){const t=fg(),r=Kn(e)?Xn(e):e;return gU.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||yU.some(s=>(r.willChange||"").includes(s))||vU.some(s=>(r.contain||"").includes(s))}function bU(e){let t=Oo(e);for(;fr(t)&&!La(t);){if(ug(t))return t;if(vf(t))return null;t=Oo(t)}return null}function fg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wU=new Set(["html","body","#document"]);function La(e){return wU.has(Ha(e))}function Xn(e){return bn(e).getComputedStyle(e)}function bf(e){return Kn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oo(e){if(Ha(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zS(e)&&e.host||pr(e);return zS(t)?t.host:t}function DC(e){const t=Oo(e);return La(t)?e.ownerDocument?e.ownerDocument.body:e.body:fr(t)&&Ec(t)?t:DC(t)}function mc(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=DC(e),c=i===((s=e.ownerDocument)==null?void 0:s.body),u=bn(i);if(c){const f=sm(u);return t.concat(u,u.visualViewport||[],Ec(i)?i:[],f&&r?mc(f):[])}return t.concat(i,mc(i,[],r))}function sm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PC(e){const t=Xn(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=fr(e),c=i?e.offsetWidth:r,u=i?e.offsetHeight:s,f=qu(r)!==c||qu(s)!==u;return f&&(r=c,s=u),{width:r,height:s,$:f}}function dg(e){return Kn(e)?e:e.contextElement}function Na(e){const t=dg(e);if(!fr(t))return lr(1);const r=t.getBoundingClientRect(),{width:s,height:i,$:c}=PC(t);let u=(c?qu(r.width):r.width)/s,f=(c?qu(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const SU=lr(0);function LC(e){const t=bn(e);return!fg()||!t.visualViewport?SU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xU(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==bn(e)?!1:t}function vs(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),c=dg(e);let u=lr(1);t&&(s?Kn(s)&&(u=Na(s)):u=Na(e));const f=xU(c,r,s)?LC(c):lr(0);let h=(i.left+f.x)/u.x,p=(i.top+f.y)/u.y,y=i.width/u.x,v=i.height/u.y;if(c){const b=bn(c),_=s&&Kn(s)?bn(s):s;let E=b,x=sm(E);for(;x&&s&&_!==E;){const C=Na(x),O=x.getBoundingClientRect(),M=Xn(x),k=O.left+(x.clientLeft+parseFloat(M.paddingLeft))*C.x,D=O.top+(x.clientTop+parseFloat(M.paddingTop))*C.y;h*=C.x,p*=C.y,y*=C.x,v*=C.y,h+=k,p+=D,E=bn(x),x=sm(E)}}return Vu({width:y,height:v,x:h,y:p})}function wf(e,t){const r=bf(e).scrollLeft;return t?t.left+r:vs(pr(e)).left+r}function IC(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-wf(e,r),i=r.top+t.scrollTop;return{x:s,y:i}}function _U(e){let{elements:t,rect:r,offsetParent:s,strategy:i}=e;const c=i==="fixed",u=pr(s),f=t?vf(t.floating):!1;if(s===u||f&&c)return r;let h={scrollLeft:0,scrollTop:0},p=lr(1);const y=lr(0),v=fr(s);if((v||!v&&!c)&&((Ha(s)!=="body"||Ec(u))&&(h=bf(s)),fr(s))){const _=vs(s);p=Na(s),y.x=_.x+s.clientLeft,y.y=_.y+s.clientTop}const b=u&&!v&&!c?IC(u,h):lr(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-h.scrollLeft*p.x+y.x+b.x,y:r.y*p.y-h.scrollTop*p.y+y.y+b.y}}function CU(e){return Array.from(e.getClientRects())}function EU(e){const t=pr(e),r=bf(e),s=e.ownerDocument.body,i=yn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),c=yn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+wf(e);const f=-r.scrollTop;return Xn(s).direction==="rtl"&&(u+=yn(t.clientWidth,s.clientWidth)-i),{width:i,height:c,x:u,y:f}}const DS=25;function RU(e,t){const r=bn(e),s=pr(e),i=r.visualViewport;let c=s.clientWidth,u=s.clientHeight,f=0,h=0;if(i){c=i.width,u=i.height;const y=fg();(!y||y&&t==="fixed")&&(f=i.offsetLeft,h=i.offsetTop)}const p=wf(s);if(p<=0){const y=s.ownerDocument,v=y.body,b=getComputedStyle(v),_=y.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,E=Math.abs(s.clientWidth-v.clientWidth-_);E<=DS&&(c-=E)}else p<=DS&&(c+=p);return{width:c,height:u,x:f,y:h}}const TU=new Set(["absolute","fixed"]);function AU(e,t){const r=vs(e,!0,t==="fixed"),s=r.top+e.clientTop,i=r.left+e.clientLeft,c=fr(e)?Na(e):lr(1),u=e.clientWidth*c.x,f=e.clientHeight*c.y,h=i*c.x,p=s*c.y;return{width:u,height:f,x:h,y:p}}function PS(e,t,r){let s;if(t==="viewport")s=RU(e,r);else if(t==="document")s=EU(pr(e));else if(Kn(t))s=AU(t,r);else{const i=LC(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Vu(s)}function $C(e,t){const r=Oo(e);return r===t||!Kn(r)||La(r)?!1:Xn(r).position==="fixed"||$C(r,t)}function OU(e,t){const r=t.get(e);if(r)return r;let s=mc(e,[],!1).filter(f=>Kn(f)&&Ha(f)!=="body"),i=null;const c=Xn(e).position==="fixed";let u=c?Oo(e):e;for(;Kn(u)&&!La(u);){const f=Xn(u),h=ug(u);!h&&f.position==="fixed"&&(i=null),(c?!h&&!i:!h&&f.position==="static"&&!!i&&TU.has(i.position)||Ec(u)&&!h&&$C(e,u))?s=s.filter(y=>y!==u):i=f,u=Oo(u)}return t.set(e,s),s}function kU(e){let{element:t,boundary:r,rootBoundary:s,strategy:i}=e;const u=[...r==="clippingAncestors"?vf(t)?[]:OU(t,this._c):[].concat(r),s],f=u[0],h=u.reduce((p,y)=>{const v=PS(t,y,i);return p.top=yn(v.top,p.top),p.right=Ao(v.right,p.right),p.bottom=Ao(v.bottom,p.bottom),p.left=yn(v.left,p.left),p},PS(t,f,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function MU(e){const{width:t,height:r}=PC(e);return{width:t,height:r}}function NU(e,t,r){const s=fr(t),i=pr(t),c=r==="fixed",u=vs(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const h=lr(0);function p(){h.x=wf(i)}if(s||!s&&!c)if((Ha(t)!=="body"||Ec(i))&&(f=bf(t)),s){const _=vs(t,!0,c,t);h.x=_.x+t.clientLeft,h.y=_.y+t.clientTop}else i&&p();c&&!s&&i&&p();const y=i&&!s&&!c?IC(i,f):lr(0),v=u.left+f.scrollLeft-h.x-y.x,b=u.top+f.scrollTop-h.y-y.y;return{x:v,y:b,width:u.width,height:u.height}}function kp(e){return Xn(e).position==="static"}function LS(e,t){if(!fr(e)||Xn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pr(e)===r&&(r=r.ownerDocument.body),r}function UC(e,t){const r=bn(e);if(vf(e))return r;if(!fr(e)){let i=Oo(e);for(;i&&!La(i);){if(Kn(i)&&!kp(i))return i;i=Oo(i)}return r}let s=LS(e,t);for(;s&&pU(s)&&kp(s);)s=LS(s,t);return s&&La(s)&&kp(s)&&!ug(s)?r:s||bU(e)||r}const jU=async function(e){const t=this.getOffsetParent||UC,r=this.getDimensions,s=await r(e.floating);return{reference:NU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function zU(e){return Xn(e).direction==="rtl"}const DU={convertOffsetParentRelativeRectToViewportRelativeRect:_U,getDocumentElement:pr,getClippingRect:kU,getOffsetParent:UC,getElementRects:jU,getClientRects:CU,getDimensions:MU,getScale:Na,isElement:Kn,isRTL:zU};function BC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PU(e,t){let r=null,s;const i=pr(e);function c(){var f;clearTimeout(s),(f=r)==null||f.disconnect(),r=null}function u(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),c();const p=e.getBoundingClientRect(),{left:y,top:v,width:b,height:_}=p;if(f||t(),!b||!_)return;const E=lu(v),x=lu(i.clientWidth-(y+b)),C=lu(i.clientHeight-(v+_)),O=lu(y),k={rootMargin:-E+"px "+-x+"px "+-C+"px "+-O+"px",threshold:yn(0,Ao(1,h))||1};let D=!0;function U(H){const L=H[0].intersectionRatio;if(L!==h){if(!D)return u();L?u(!1,L):s=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!BC(p,e.getBoundingClientRect())&&u(),D=!1}try{r=new IntersectionObserver(U,{...k,root:i.ownerDocument})}catch{r=new IntersectionObserver(U,k)}r.observe(e)}return u(!0),c}function LU(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=dg(e),y=i||c?[...p?mc(p):[],...mc(t)]:[];y.forEach(O=>{i&&O.addEventListener("scroll",r,{passive:!0}),c&&O.addEventListener("resize",r)});const v=p&&f?PU(p,r):null;let b=-1,_=null;u&&(_=new ResizeObserver(O=>{let[M]=O;M&&M.target===p&&_&&(_.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var k;(k=_)==null||k.observe(t)})),r()}),p&&!h&&_.observe(p),_.observe(t));let E,x=h?vs(e):null;h&&C();function C(){const O=vs(e);x&&!BC(x,O)&&r(),x=O,E=requestAnimationFrame(C)}return r(),()=>{var O;y.forEach(M=>{i&&M.removeEventListener("scroll",r),c&&M.removeEventListener("resize",r)}),v?.(),(O=_)==null||O.disconnect(),_=null,h&&cancelAnimationFrame(E)}}const IU=cU,$U=lU,UU=sU,BU=fU,qU=aU,IS=oU,FU=uU,VU=(e,t,r)=>{const s=new Map,i={platform:DU,...r},c={...i.platform,_c:s};return rU(e,t,{...i,platform:c})};var HU=typeof document<"u",ZU=function(){},yu=HU?w.useLayoutEffect:ZU;function Hu(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 r,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!Hu(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=r;s--!==0;){const c=i[s];if(!(c==="_owner"&&e.$$typeof)&&!Hu(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function qC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $S(e,t){const r=qC(e);return Math.round(t*r)/r}function Mp(e){const t=w.useRef(e);return yu(()=>{t.current=e}),t}function QU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:i,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:h,open:p}=e,[y,v]=w.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,_]=w.useState(s);Hu(b,s)||_(s);const[E,x]=w.useState(null),[C,O]=w.useState(null),M=w.useCallback(V=>{V!==H.current&&(H.current=V,x(V))},[]),k=w.useCallback(V=>{V!==L.current&&(L.current=V,O(V))},[]),D=c||E,U=u||C,H=w.useRef(null),L=w.useRef(null),j=w.useRef(y),G=h!=null,ie=Mp(h),ae=Mp(i),te=Mp(p),ce=w.useCallback(()=>{if(!H.current||!L.current)return;const V={placement:t,strategy:r,middleware:b};ae.current&&(V.platform=ae.current),VU(H.current,L.current,V).then(re=>{const ve={...re,isPositioned:te.current!==!1};le.current&&!Hu(j.current,ve)&&(j.current=ve,$a.flushSync(()=>{v(ve)}))})},[b,t,r,ae,te]);yu(()=>{p===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,v(V=>({...V,isPositioned:!1})))},[p]);const le=w.useRef(!1);yu(()=>(le.current=!0,()=>{le.current=!1}),[]),yu(()=>{if(D&&(H.current=D),U&&(L.current=U),D&&U){if(ie.current)return ie.current(D,U,ce);ce()}},[D,U,ce,ie,G]);const me=w.useMemo(()=>({reference:H,floating:L,setReference:M,setFloating:k}),[M,k]),I=w.useMemo(()=>({reference:D,floating:U}),[D,U]),K=w.useMemo(()=>{const V={position:r,left:0,top:0};if(!I.floating)return V;const re=$S(I.floating,y.x),ve=$S(I.floating,y.y);return f?{...V,transform:"translate("+re+"px, "+ve+"px)",...qC(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:re,top:ve}},[r,f,I.floating,y.x,y.y]);return w.useMemo(()=>({...y,update:ce,refs:me,elements:I,floatingStyles:K}),[y,ce,me,I,K])}const GU=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:i}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?IS({element:s.current,padding:i}).fn(r):{}:s?IS({element:s,padding:i}).fn(r):{}}}},YU=(e,t)=>({...IU(e),options:[e,t]}),KU=(e,t)=>({...$U(e),options:[e,t]}),XU=(e,t)=>({...FU(e),options:[e,t]}),JU=(e,t)=>({...UU(e),options:[e,t]}),WU=(e,t)=>({...BU(e),options:[e,t]}),eB=(e,t)=>({...qU(e),options:[e,t]}),tB=(e,t)=>({...GU(e),options:[e,t]});var nB="Arrow",FC=w.forwardRef((e,t)=>{const{children:r,width:s=10,height:i=5,...c}=e;return g.jsx(ke.svg,{...c,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});FC.displayName=nB;var rB=FC,hg="Popper",[VC,Za]=hr(hg),[oB,HC]=VC(hg),ZC=e=>{const{__scopePopper:t,children:r}=e,[s,i]=w.useState(null);return g.jsx(oB,{scope:t,anchor:s,onAnchorChange:i,children:r})};ZC.displayName=hg;var QC="PopperAnchor",GC=w.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...i}=e,c=HC(QC,r),u=w.useRef(null),f=Ve(t,u),h=w.useRef(null);return w.useEffect(()=>{const p=h.current;h.current=s?.current||u.current,p!==h.current&&c.onAnchorChange(h.current)}),s?null:g.jsx(ke.div,{...i,ref:f})});GC.displayName=QC;var pg="PopperContent",[sB,aB]=VC(pg),YC=w.forwardRef((e,t)=>{const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:c="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:_="optimized",onPlaced:E,...x}=e,C=HC(pg,r),[O,M]=w.useState(null),k=Ve(t,X=>M(X)),[D,U]=w.useState(null),H=_C(D),L=H?.width??0,j=H?.height??0,G=s+(c!=="center"?"-"+c:""),ie=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ae=Array.isArray(p)?p:[p],te=ae.length>0,ce={padding:ie,boundary:ae.filter(cB),altBoundary:te},{refs:le,floatingStyles:me,placement:I,isPositioned:K,middlewareData:V}=QU({strategy:"fixed",placement:G,whileElementsMounted:(...X)=>LU(...X,{animationFrame:_==="always"}),elements:{reference:C.anchor},middleware:[YU({mainAxis:i+j,alignmentAxis:u}),h&&KU({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?XU():void 0,...ce}),h&&JU({...ce}),WU({...ce,apply:({elements:X,rects:_e,availableWidth:xe,availableHeight:Re})=>{const{width:Ae,height:Le}=_e.reference,yt=X.floating.style;yt.setProperty("--radix-popper-available-width",`${xe}px`),yt.setProperty("--radix-popper-available-height",`${Re}px`),yt.setProperty("--radix-popper-anchor-width",`${Ae}px`),yt.setProperty("--radix-popper-anchor-height",`${Le}px`)}}),D&&tB({element:D,padding:f}),lB({arrowWidth:L,arrowHeight:j}),b&&eB({strategy:"referenceHidden",...ce})]}),[re,ve]=JC(I),z=Yn(E);Rt(()=>{K&&z?.()},[K,z]);const Q=V.arrow?.x,ne=V.arrow?.y,oe=V.arrow?.centerOffset!==0,[pe,ye]=w.useState();return Rt(()=>{O&&ye(window.getComputedStyle(O).zIndex)},[O]),g.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...me,transform:K?me.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:pe,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(sB,{scope:r,placedSide:re,onArrowChange:U,arrowX:Q,arrowY:ne,shouldHideArrow:oe,children:g.jsx(ke.div,{"data-side":re,"data-align":ve,...x,ref:k,style:{...x.style,animation:K?void 0:"none"}})})})});YC.displayName=pg;var KC="PopperArrow",iB={top:"bottom",right:"left",bottom:"top",left:"right"},XC=w.forwardRef(function(t,r){const{__scopePopper:s,...i}=t,c=aB(KC,s),u=iB[c.placedSide];return g.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:g.jsx(rB,{...i,ref:r,style:{...i.style,display:"block"}})})});XC.displayName=KC;function cB(e){return e!==null}var lB=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:s,middlewareData:i}=t,u=i.arrow?.centerOffset!==0,f=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[p,y]=JC(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(i.arrow?.x??0)+f/2,_=(i.arrow?.y??0)+h/2;let E="",x="";return p==="bottom"?(E=u?v:`${b}px`,x=`${-h}px`):p==="top"?(E=u?v:`${b}px`,x=`${s.floating.height+h}px`):p==="right"?(E=`${-h}px`,x=u?v:`${_}px`):p==="left"&&(E=`${s.floating.width+h}px`,x=u?v:`${_}px`),{data:{x:E,y:x}}}});function JC(e){const[t,r="center"]=e.split("-");return[t,r]}var mg=ZC,Sf=GC,gg=YC,yg=XC,WC=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"}),uB="VisuallyHidden",fB=w.forwardRef((e,t)=>g.jsx(ke.span,{...e,ref:t,style:{...WC,...e.style}}));fB.displayName=uB;var dB=[" ","Enter","ArrowUp","ArrowDown"],hB=[" ","Enter"],bs="Select",[xf,_f,pB]=sg(bs),[Qa]=hr(bs,[pB,Za]),Cf=Za(),[mB,Do]=Qa(bs),[gB,yB]=Qa(bs),eE=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:i,onOpenChange:c,value:u,defaultValue:f,onValueChange:h,dir:p,name:y,autoComplete:v,disabled:b,required:_,form:E}=e,x=Cf(t),[C,O]=w.useState(null),[M,k]=w.useState(null),[D,U]=w.useState(!1),H=ag(p),[L,j]=To({prop:s,defaultProp:i??!1,onChange:c,caller:bs}),[G,ie]=To({prop:u,defaultProp:f,onChange:h,caller:bs}),ae=w.useRef(null),te=C?E||!!C.closest("form"):!0,[ce,le]=w.useState(new Set),me=Array.from(ce).map(I=>I.props.value).join(";");return g.jsx(mg,{...x,children:g.jsxs(mB,{required:_,scope:t,trigger:C,onTriggerChange:O,valueNode:M,onValueNodeChange:k,valueNodeHasChildren:D,onValueNodeHasChildrenChange:U,contentId:Qn(),value:G,onValueChange:ie,open:L,onOpenChange:j,dir:H,triggerPointerDownPosRef:ae,disabled:b,children:[g.jsx(xf.Provider,{scope:t,children:g.jsx(gB,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(I=>{le(K=>new Set(K).add(I))},[]),onNativeOptionRemove:w.useCallback(I=>{le(K=>{const V=new Set(K);return V.delete(I),V})},[]),children:r})}),te?g.jsxs(xE,{"aria-hidden":!0,required:_,tabIndex:-1,name:y,autoComplete:v,value:G,onChange:I=>ie(I.target.value),disabled:b,form:E,children:[G===void 0?g.jsx("option",{value:""}):null,Array.from(ce)]},me):null]})})};eE.displayName=bs;var tE="SelectTrigger",nE=w.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...i}=e,c=Cf(r),u=Do(tE,r),f=u.disabled||s,h=Ve(t,u.onTriggerChange),p=_f(r),y=w.useRef("touch"),[v,b,_]=CE(x=>{const C=p().filter(k=>!k.disabled),O=C.find(k=>k.value===u.value),M=EE(C,x,O);M!==void 0&&u.onValueChange(M.value)}),E=x=>{f||(u.onOpenChange(!0),_()),x&&(u.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return g.jsx(Sf,{asChild:!0,...c,children:g.jsx(ke.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":_E(u.value)?"":void 0,...i,ref:h,onClick:he(i.onClick,x=>{x.currentTarget.focus(),y.current!=="mouse"&&E(x)}),onPointerDown:he(i.onPointerDown,x=>{y.current=x.pointerType;const C=x.target;C.hasPointerCapture(x.pointerId)&&C.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(E(x),x.preventDefault())}),onKeyDown:he(i.onKeyDown,x=>{const C=v.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&b(x.key),!(C&&x.key===" ")&&dB.includes(x.key)&&(E(),x.preventDefault())})})})});nE.displayName=tE;var rE="SelectValue",oE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,children:c,placeholder:u="",...f}=e,h=Do(rE,r),{onValueNodeHasChildrenChange:p}=h,y=c!==void 0,v=Ve(t,h.onValueNodeChange);return Rt(()=>{p(y)},[p,y]),g.jsx(ke.span,{...f,ref:v,style:{pointerEvents:"none"},children:_E(h.value)?g.jsx(g.Fragment,{children:u}):c})});oE.displayName=rE;var vB="SelectIcon",sE=w.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...i}=e;return g.jsx(ke.span,{"aria-hidden":!0,...i,ref:t,children:s||"▼"})});sE.displayName=vB;var bB="SelectPortal",aE=e=>g.jsx(_c,{asChild:!0,...e});aE.displayName=bB;var ws="SelectContent",iE=w.forwardRef((e,t)=>{const r=Do(ws,e.__scopeSelect),[s,i]=w.useState();if(Rt(()=>{i(new DocumentFragment)},[]),!r.open){const c=s;return c?$a.createPortal(g.jsx(cE,{scope:e.__scopeSelect,children:g.jsx(xf.Slot,{scope:e.__scopeSelect,children:g.jsx("div",{children:e.children})})}),c):null}return g.jsx(lE,{...e,ref:t})});iE.displayName=ws;var Hn=10,[cE,Po]=Qa(ws),wB="SelectContentImpl",SB=gs("SelectContent.RemoveScroll"),lE=w.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:u,side:f,sideOffset:h,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:_,sticky:E,hideWhenDetached:x,avoidCollisions:C,...O}=e,M=Do(ws,r),[k,D]=w.useState(null),[U,H]=w.useState(null),L=Ve(t,X=>D(X)),[j,G]=w.useState(null),[ie,ae]=w.useState(null),te=_f(r),[ce,le]=w.useState(!1),me=w.useRef(!1);w.useEffect(()=>{if(k)return hf(k)},[k]),ff();const I=w.useCallback(X=>{const[_e,...xe]=te().map(Le=>Le.ref.current),[Re]=xe.slice(-1),Ae=document.activeElement;for(const Le of X)if(Le===Ae||(Le?.scrollIntoView({block:"nearest"}),Le===_e&&U&&(U.scrollTop=0),Le===Re&&U&&(U.scrollTop=U.scrollHeight),Le?.focus(),document.activeElement!==Ae))return},[te,U]),K=w.useCallback(()=>I([j,k]),[I,j,k]);w.useEffect(()=>{ce&&K()},[ce,K]);const{onOpenChange:V,triggerPointerDownPosRef:re}=M;w.useEffect(()=>{if(k){let X={x:0,y:0};const _e=Re=>{X={x:Math.abs(Math.round(Re.pageX)-(re.current?.x??0)),y:Math.abs(Math.round(Re.pageY)-(re.current?.y??0))}},xe=Re=>{X.x<=10&&X.y<=10?Re.preventDefault():k.contains(Re.target)||V(!1),document.removeEventListener("pointermove",_e),re.current=null};return re.current!==null&&(document.addEventListener("pointermove",_e),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",xe,{capture:!0})}}},[k,V,re]),w.useEffect(()=>{const X=()=>V(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[V]);const[ve,z]=CE(X=>{const _e=te().filter(Ae=>!Ae.disabled),xe=_e.find(Ae=>Ae.ref.current===document.activeElement),Re=EE(_e,X,xe);Re&&setTimeout(()=>Re.ref.current.focus())}),Q=w.useCallback((X,_e,xe)=>{const Re=!me.current&&!xe;(M.value!==void 0&&M.value===_e||Re)&&(G(X),Re&&(me.current=!0))},[M.value]),ne=w.useCallback(()=>k?.focus(),[k]),oe=w.useCallback((X,_e,xe)=>{const Re=!me.current&&!xe;(M.value!==void 0&&M.value===_e||Re)&&ae(X)},[M.value]),pe=s==="popper"?am:uE,ye=pe===am?{side:f,sideOffset:h,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:_,sticky:E,hideWhenDetached:x,avoidCollisions:C}:{};return g.jsx(cE,{scope:r,content:k,viewport:U,onViewportChange:H,itemRefCallback:Q,selectedItem:j,onItemLeave:ne,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:ie,position:s,isPositioned:ce,searchRef:ve,children:g.jsx(Cc,{as:SB,allowPinchZoom:!0,children:g.jsx(xc,{asChild:!0,trapped:M.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:he(i,X=>{M.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:g.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:g.jsx(pe,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:X=>X.preventDefault(),...O,...ye,onPlaced:()=>le(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...O.style},onKeyDown:he(O.onKeyDown,X=>{const _e=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!_e&&X.key.length===1&&z(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let Re=te().filter(Ae=>!Ae.disabled).map(Ae=>Ae.ref.current);if(["ArrowUp","End"].includes(X.key)&&(Re=Re.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const Ae=X.target,Le=Re.indexOf(Ae);Re=Re.slice(Le+1)}setTimeout(()=>I(Re)),X.preventDefault()}})})})})})})});lE.displayName=wB;var xB="SelectItemAlignedPosition",uE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...i}=e,c=Do(ws,r),u=Po(ws,r),[f,h]=w.useState(null),[p,y]=w.useState(null),v=Ve(t,L=>y(L)),b=_f(r),_=w.useRef(!1),E=w.useRef(!0),{viewport:x,selectedItem:C,selectedItemText:O,focusSelectedItem:M}=u,k=w.useCallback(()=>{if(c.trigger&&c.valueNode&&f&&p&&x&&C&&O){const L=c.trigger.getBoundingClientRect(),j=p.getBoundingClientRect(),G=c.valueNode.getBoundingClientRect(),ie=O.getBoundingClientRect();if(c.dir!=="rtl"){const Ae=ie.left-j.left,Le=G.left-Ae,yt=L.left-Le,vt=L.width+yt,Sn=Math.max(vt,j.width),Yt=window.innerWidth-Hn,nt=AS(Le,[Hn,Math.max(Hn,Yt-Sn)]);f.style.minWidth=vt+"px",f.style.left=nt+"px"}else{const Ae=j.right-ie.right,Le=window.innerWidth-G.right-Ae,yt=window.innerWidth-L.right-Le,vt=L.width+yt,Sn=Math.max(vt,j.width),Yt=window.innerWidth-Hn,nt=AS(Le,[Hn,Math.max(Hn,Yt-Sn)]);f.style.minWidth=vt+"px",f.style.right=nt+"px"}const ae=b(),te=window.innerHeight-Hn*2,ce=x.scrollHeight,le=window.getComputedStyle(p),me=parseInt(le.borderTopWidth,10),I=parseInt(le.paddingTop,10),K=parseInt(le.borderBottomWidth,10),V=parseInt(le.paddingBottom,10),re=me+I+ce+V+K,ve=Math.min(C.offsetHeight*5,re),z=window.getComputedStyle(x),Q=parseInt(z.paddingTop,10),ne=parseInt(z.paddingBottom,10),oe=L.top+L.height/2-Hn,pe=te-oe,ye=C.offsetHeight/2,X=C.offsetTop+ye,_e=me+I+X,xe=re-_e;if(_e<=oe){const Ae=ae.length>0&&C===ae[ae.length-1].ref.current;f.style.bottom="0px";const Le=p.clientHeight-x.offsetTop-x.offsetHeight,yt=Math.max(pe,ye+(Ae?ne:0)+Le+K),vt=_e+yt;f.style.height=vt+"px"}else{const Ae=ae.length>0&&C===ae[0].ref.current;f.style.top="0px";const yt=Math.max(oe,me+x.offsetTop+(Ae?Q:0)+ye)+xe;f.style.height=yt+"px",x.scrollTop=_e-oe+x.offsetTop}f.style.margin=`${Hn}px 0`,f.style.minHeight=ve+"px",f.style.maxHeight=te+"px",s?.(),requestAnimationFrame(()=>_.current=!0)}},[b,c.trigger,c.valueNode,f,p,x,C,O,c.dir,s]);Rt(()=>k(),[k]);const[D,U]=w.useState();Rt(()=>{p&&U(window.getComputedStyle(p).zIndex)},[p]);const H=w.useCallback(L=>{L&&E.current===!0&&(k(),M?.(),E.current=!1)},[k,M]);return g.jsx(CB,{scope:r,contentWrapper:f,shouldExpandOnScrollRef:_,onScrollButtonChange:H,children:g.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:D},children:g.jsx(ke.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});uE.displayName=xB;var _B="SelectPopperPosition",am=w.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:i=Hn,...c}=e,u=Cf(r);return g.jsx(gg,{...u,...c,ref:t,align:s,collisionPadding:i,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)"}})});am.displayName=_B;var[CB,vg]=Qa(ws,{}),im="SelectViewport",fE=w.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...i}=e,c=Po(im,r),u=vg(im,r),f=Ve(t,c.onViewportChange),h=w.useRef(0);return g.jsxs(g.Fragment,{children:[g.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:s}),g.jsx(xf.Slot,{scope:r,children:g.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:he(i.onScroll,p=>{const y=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const _=Math.abs(h.current-y.scrollTop);if(_>0){const E=window.innerHeight-Hn*2,x=parseFloat(v.style.minHeight),C=parseFloat(v.style.height),O=Math.max(x,C);if(O<E){const M=O+_,k=Math.min(E,M),D=M-k;v.style.height=k+"px",v.style.bottom==="0px"&&(y.scrollTop=D>0?D:0,v.style.justifyContent="flex-end")}}}h.current=y.scrollTop})})})]})});fE.displayName=im;var dE="SelectGroup",[EB,RB]=Qa(dE),TB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=Qn();return g.jsx(EB,{scope:r,id:i,children:g.jsx(ke.div,{role:"group","aria-labelledby":i,...s,ref:t})})});TB.displayName=dE;var hE="SelectLabel",AB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=RB(hE,r);return g.jsx(ke.div,{id:i.id,...s,ref:t})});AB.displayName=hE;var Zu="SelectItem",[OB,pE]=Qa(Zu),mE=w.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:i=!1,textValue:c,...u}=e,f=Do(Zu,r),h=Po(Zu,r),p=f.value===s,[y,v]=w.useState(c??""),[b,_]=w.useState(!1),E=Ve(t,M=>h.itemRefCallback?.(M,s,i)),x=Qn(),C=w.useRef("touch"),O=()=>{i||(f.onValueChange(s),f.onOpenChange(!1))};if(s==="")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 g.jsx(OB,{scope:r,value:s,disabled:i,textId:x,isSelected:p,onItemTextChange:w.useCallback(M=>{v(k=>k||(M?.textContent??"").trim())},[]),children:g.jsx(xf.ItemSlot,{scope:r,value:s,disabled:i,textValue:y,children:g.jsx(ke.div,{role:"option","aria-labelledby":x,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:E,onFocus:he(u.onFocus,()=>_(!0)),onBlur:he(u.onBlur,()=>_(!1)),onClick:he(u.onClick,()=>{C.current!=="mouse"&&O()}),onPointerUp:he(u.onPointerUp,()=>{C.current==="mouse"&&O()}),onPointerDown:he(u.onPointerDown,M=>{C.current=M.pointerType}),onPointerMove:he(u.onPointerMove,M=>{C.current=M.pointerType,i?h.onItemLeave?.():C.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:he(u.onPointerLeave,M=>{M.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:he(u.onKeyDown,M=>{h.searchRef?.current!==""&&M.key===" "||(hB.includes(M.key)&&O(),M.key===" "&&M.preventDefault())})})})})});mE.displayName=Zu;var Xi="SelectItemText",gE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,...c}=e,u=Do(Xi,r),f=Po(Xi,r),h=pE(Xi,r),p=yB(Xi,r),[y,v]=w.useState(null),b=Ve(t,O=>v(O),h.onItemTextChange,O=>f.itemTextRefCallback?.(O,h.value,h.disabled)),_=y?.textContent,E=w.useMemo(()=>g.jsx("option",{value:h.value,disabled:h.disabled,children:_},h.value),[h.disabled,h.value,_]),{onNativeOptionAdd:x,onNativeOptionRemove:C}=p;return Rt(()=>(x(E),()=>C(E)),[x,C,E]),g.jsxs(g.Fragment,{children:[g.jsx(ke.span,{id:h.textId,...c,ref:b}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?$a.createPortal(c.children,u.valueNode):null]})});gE.displayName=Xi;var yE="SelectItemIndicator",vE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return pE(yE,r).isSelected?g.jsx(ke.span,{"aria-hidden":!0,...s,ref:t}):null});vE.displayName=yE;var cm="SelectScrollUpButton",bE=w.forwardRef((e,t)=>{const r=Po(cm,e.__scopeSelect),s=vg(cm,e.__scopeSelect),[i,c]=w.useState(!1),u=Ve(t,s.onScrollButtonChange);return Rt(()=>{if(r.viewport&&r.isPositioned){let f=function(){const p=h.scrollTop>0;c(p)};const h=r.viewport;return f(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[r.viewport,r.isPositioned]),i?g.jsx(SE,{...e,ref:u,onAutoScroll:()=>{const{viewport:f,selectedItem:h}=r;f&&h&&(f.scrollTop=f.scrollTop-h.offsetHeight)}}):null});bE.displayName=cm;var lm="SelectScrollDownButton",wE=w.forwardRef((e,t)=>{const r=Po(lm,e.__scopeSelect),s=vg(lm,e.__scopeSelect),[i,c]=w.useState(!1),u=Ve(t,s.onScrollButtonChange);return Rt(()=>{if(r.viewport&&r.isPositioned){let f=function(){const p=h.scrollHeight-h.clientHeight,y=Math.ceil(h.scrollTop)<p;c(y)};const h=r.viewport;return f(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[r.viewport,r.isPositioned]),i?g.jsx(SE,{...e,ref:u,onAutoScroll:()=>{const{viewport:f,selectedItem:h}=r;f&&h&&(f.scrollTop=f.scrollTop+h.offsetHeight)}}):null});wE.displayName=lm;var SE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...i}=e,c=Po("SelectScrollButton",r),u=w.useRef(null),f=_f(r),h=w.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return w.useEffect(()=>()=>h(),[h]),Rt(()=>{f().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[f]),g.jsx(ke.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:he(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:he(i.onPointerMove,()=>{c.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:he(i.onPointerLeave,()=>{h()})})}),kB="SelectSeparator",MB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return g.jsx(ke.div,{"aria-hidden":!0,...s,ref:t})});MB.displayName=kB;var um="SelectArrow",NB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=Cf(r),c=Do(um,r),u=Po(um,r);return c.open&&u.position==="popper"?g.jsx(yg,{...i,...s,ref:t}):null});NB.displayName=um;var jB="SelectBubbleInput",xE=w.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const i=w.useRef(null),c=Ve(s,i),u=xC(t);return w.useEffect(()=>{const f=i.current;if(!f)return;const h=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&y){const v=new Event("change",{bubbles:!0});y.call(f,t),f.dispatchEvent(v)}},[u,t]),g.jsx(ke.select,{...r,style:{...WC,...r.style},ref:c,defaultValue:t})});xE.displayName=jB;function _E(e){return e===""||e===void 0}function CE(e){const t=Yn(e),r=w.useRef(""),s=w.useRef(0),i=w.useCallback(u=>{const f=r.current+u;t(f),(function h(p){r.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>h(""),1e3))})(f)},[t]),c=w.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,i,c]}function EE(e,t,r){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,c=r?e.indexOf(r):-1;let u=zB(e,Math.max(c,0));i.length===1&&(u=u.filter(p=>p!==r));const h=u.find(p=>p.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function zB(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var DB=eE,PB=nE,LB=oE,IB=sE,$B=aE,UB=iE,BB=fE,qB=mE,FB=gE,VB=vE,HB=bE,ZB=wE;function Np({...e}){return g.jsx(DB,{"data-slot":"select",...e})}function jp({...e}){return g.jsx(LB,{"data-slot":"select-value",...e})}function zp({className:e,size:t="default",children:r,...s}){return g.jsxs(PB,{"data-slot":"select-trigger","data-size":t,className:je("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),...s,children:[r,g.jsx(IB,{asChild:!0,children:g.jsx(_s,{className:"size-4 opacity-50"})})]})}function Dp({className:e,children:t,position:r="item-aligned",align:s="center",...i}){return g.jsx($B,{children:g.jsxs(UB,{"data-slot":"select-content",className:je("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",r==="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:r,align:s,...i,children:[g.jsx(QB,{}),g.jsx(BB,{className:je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),g.jsx(GB,{})]})})}function Qi({className:e,children:t,...r}){return g.jsxs(qB,{"data-slot":"select-item",className:je("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),...r,children:[g.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:g.jsx(VB,{children:g.jsx(M1,{className:"size-4"})})}),g.jsx(FB,{children:t})]})}function QB({className:e,...t}){return g.jsx(HB,{"data-slot":"select-scroll-up-button",className:je("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(N1,{className:"size-4"})})}function GB({className:e,...t}){return g.jsx(ZB,{"data-slot":"select-scroll-down-button",className:je("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(_s,{className:"size-4"})})}function YB({isOpen:e,onClose:t,breakingChanges:r,onForceUpdate:s,onCancel:i,isLoading:c}){const u=()=>{i(),t()};return g.jsx(rg,{open:e,onOpenChange:f=>!f&&!c&&u(),title:"Breaking Changes Detected",size:"lg",footer:g.jsxs(g.Fragment,{children:[g.jsx($r,{variant:"outline",onClick:u,disabled:c,children:"Cancel"}),g.jsx($r,{variant:"danger",onClick:s,loading:c,children:"Force Update"})]}),children:g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-amber-200 bg-amber-50 p-3",children:[g.jsx(jD,{className:"mt-0.5 size-5 shrink-0 text-amber-600"}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("p",{className:"text-sm font-medium text-amber-800",children:"These changes may affect existing content"}),g.jsx("p",{className:"text-sm text-amber-700",children:"The following changes could cause data loss or validation errors for existing entries. Review carefully before proceeding."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"text-sm font-medium text-foreground",children:[r.length," breaking change",r.length!==1?"s":""," detected:"]}),g.jsx("ul",{className:"space-y-2",children:r.map((f,h)=>g.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[g.jsx("span",{className:"mt-0.5 size-1.5 shrink-0 rounded-full bg-amber-500"}),g.jsx("span",{className:"text-muted-foreground",children:f})]},h))})]}),g.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 Pp={text:{label:"Text",icon:g.jsx(AD,{className:"size-4"}),description:"Single line text input"},richText:{label:"Rich Text",icon:g.jsx(O3,{className:"size-4"}),description:"Multi-line formatted text"},number:{label:"Number",icon:g.jsx(z1,{className:"size-4"}),description:"Numeric value"},boolean:{label:"Boolean",icon:g.jsx($1,{className:"size-4"}),description:"True/false toggle"},date:{label:"Date",icon:g.jsx(Kp,{className:"size-4"}),description:"Date picker"},datetime:{label:"Date & Time",icon:g.jsx(Kp,{className:"size-4"}),description:"Date and time picker"},reference:{label:"Reference",icon:g.jsx(Q3,{className:"size-4"}),description:"Link to another content entry"},media:{label:"Media",icon:g.jsx(P1,{className:"size-4"}),description:"Image, video, or file"},json:{label:"JSON",icon:g.jsx(k1,{className:"size-4"}),description:"Custom JSON data"},select:{label:"Select",icon:g.jsx(_s,{className:"size-4"}),description:"Dropdown selection"},multiSelect:{label:"Multi-Select",icon:g.jsx(X3,{className:"size-4"}),description:"Multiple selections"},tags:{label:"Tags",icon:g.jsx(CD,{className:"size-4"}),description:"Free-form tag list"},category:{label:"Category",icon:g.jsx(j3,{className:"size-4"}),description:"Taxonomy category selection"}};function US(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^[0-9]/,"_$&").slice(0,64)}function BS(e){return/^[a-z][a-z0-9_]{0,63}$/.test(e)}function KB({isOpen:e,onClose:t,onCreated:r,onUpdated:s,contentType:i}){const c=!!i,u=i?.source==="code",f=u,[h,p]=w.useState(""),[y,v]=w.useState(""),[b,_]=w.useState(!1),[E,x]=w.useState(""),[C,O]=w.useState(!1),[M,k]=w.useState([{name:"title",label:"Title",type:"text",required:!0}]),[D,U]=w.useState("title"),[H,L]=w.useState("title"),[j,G]=w.useState(!1),[ie,ae]=w.useState(null),[te,ce]=w.useState(null),[le,me]=w.useState(!1),[I,K]=w.useState([]),[V,re]=w.useState(!1),[ve,z]=w.useState(!1),Q=Ow($u.admin.createContentType),ne=Ow($u.admin.updateContentType);w.useEffect(()=>{i&&e&&(p(i.displayName),v(i.name),_(!0),x(i.description||""),O(i.singleton||!1),k(i.fields),U(i.titleField||""),L(i.slugField||""))},[i,e]);const oe=w.useCallback(()=>{p(""),v(""),_(!1),x(""),O(!1),k([{name:"title",label:"Title",type:"text",required:!0}]),U("title"),L("title"),G(!1),ae(null),ce(null),me(!1),K([]),re(!1),z(!1)},[]),pe=w.useCallback(se=>{p(se),b||v(US(se))},[b]),ye=w.useCallback(se=>{_(!0),v(se.toLowerCase().replace(/[^a-z0-9_]/g,""))},[]),X=w.useCallback(()=>{const se=`field_${M.length+1}`;k(Ee=>[...Ee,{name:se,label:`Field ${Ee.length+1}`,type:"text",required:!1}]),ce(M.length),me(!0)},[M.length]),_e=w.useCallback(se=>{const Ee=M[se];if(k(Ue=>Ue.filter((ze,Mt)=>Mt!==se)),D===Ee.name){const Ue=M.find((ze,Mt)=>Mt!==se&&ze.type==="text");U(Ue?.name||"")}if(H===Ee.name){const Ue=M.find((ze,Mt)=>Mt!==se&&ze.type==="text");L(Ue?.name||"")}te===se?(ce(null),me(!1)):te!==null&&te>se&&ce(te-1)},[M,te,D,H]),xe=w.useCallback((se,Ee)=>{k(Ue=>Ue.map((ze,Mt)=>Mt===se?{...ze,...Ee}:ze))},[]),Re=w.useCallback((se,Ee)=>{k(Ue=>{const ze=[...Ue],[Mt]=ze.splice(se,1);return ze.splice(Ee,0,Mt),ze}),ce(Ee)},[]),Ae=w.useMemo(()=>{const se=[];h.trim()||se.push("Display name is required"),y.trim()?BS(y)||se.push("System Name must start with a letter and contain only lowercase letters, numbers, and underscores"):se.push("System Name is required"),M.length===0&&se.push("At least one field is required");const Ee=M.map(ze=>ze.name),Ue=Ee.filter((ze,Mt)=>Ee.indexOf(ze)!==Mt);Ue.length>0&&se.push(`Duplicate field names: ${[...new Set(Ue)].join(", ")}`);for(const ze of M)ze.name.trim()?/^[a-z][a-z0-9_]{0,63}$/.test(ze.name)||se.push(`Field "${ze.name}" has an invalid name format`):se.push(`Field "${ze.label}" has an empty name`),ze.label.trim()||se.push(`Field with name "${ze.name}" has an empty label`),(ze.type==="select"||ze.type==="multiSelect")&&(!ze.options?.options||ze.options.options.length===0)&&se.push(`${ze.type} field "${ze.label}" requires at least one option`);return se},[h,y,M]),Le=w.useMemo(()=>M.filter(se=>se.type==="text"),[M]),yt=se=>se.split(`
|
|
102
|
-
`).filter(Ue=>Ue.trim().startsWith("-")).map(Ue=>Ue.trim().substring(2)),vt=w.useCallback(async(se,Ee=!1)=>{if(se.preventDefault(),Ae.length>0){ae(Ae.join(". "));return}G(!0),ae(null);try{if(c&&i){const Ue=await ne({id:i._id,displayName:h.trim(),description:E.trim()||void 0,fields:M,singleton:C,titleField:D||void 0,slugField:H||void 0,force:Ee});s?.(Ue),oe(),t()}else{const Ue=await Q({name:y,displayName:h.trim(),description:E.trim()||void 0,fields:M,singleton:C,titleField:D||void 0,slugField:H||void 0});r?.(Ue),oe(),t()}}catch(Ue){const ze=Ue instanceof Error?Ue.message:c?"Failed to update content type":"Failed to create content type";if(c&&!Ee&&ze.includes("breaking change")){const Mt=yt(ze);K(Mt),re(!0)}else ae(ze)}finally{G(!1)}},[Ae,c,i,Q,ne,y,h,E,M,C,D,H,r,s,oe,t]),Sn=w.useCallback(async()=>{z(!0);try{if(i){const se=await ne({id:i._id,displayName:h.trim(),description:E.trim()||void 0,fields:M,singleton:C,titleField:D||void 0,slugField:H||void 0,force:!0});s?.(se),oe(),re(!1),t()}}catch(se){const Ee=se instanceof Error?se.message:"Failed to update content type";ae(Ee),re(!1)}finally{z(!1)}},[i,ne,h,E,M,C,D,H,s,oe,t]),Yt=w.useCallback(()=>{j||(oe(),t())},[j,oe,t]);if(!e)return null;const nt=te!==null?M[te]:null;return g.jsxs(g.Fragment,{children:[g.jsx(rg,{open:e,onOpenChange:se=>!se&&Yt(),title:u?"View Content Type":c?"Edit Content Type":"Create Content Type",size:"2xl",footer:f?g.jsx($r,{variant:"outline",onClick:Yt,children:"Close"}):g.jsxs(g.Fragment,{children:[g.jsx($r,{variant:"outline",onClick:Yt,disabled:j,children:"Cancel"}),g.jsx($r,{variant:"primary",onClick:vt,disabled:Ae.length>0,loading:j,"data-testid":c?"update-content-type-submit":"create-content-type-submit",children:c?"Save Changes":"Create Content Type"})]}),children:g.jsxs("form",{onSubmit:vt,className:"space-y-6",children:[u&&g.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-violet-200 bg-violet-50 p-3",children:[g.jsx(m3,{className:"mt-0.5 size-5 shrink-0 text-violet-600"}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("p",{className:"text-sm font-medium text-violet-900",children:"Managed by Code"}),g.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."})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Basic Information"}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"displayName",children:["Display Name ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"displayName",value:h,onChange:se=>pe(se.target.value),placeholder:"e.g., Blog Post",disabled:j||f,autoFocus:!f,"data-testid":"display-name-input"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"machineName",children:["System Name ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"machineName",value:y,onChange:se=>ye(se.target.value),placeholder:"e.g., blog_post",disabled:j||c||f,className:je(!BS(y)&&y&&"border-destructive"),"data-testid":"machine-name-input"}),g.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."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"description",children:"Description"}),g.jsx(U8,{id:"description",value:E,onChange:se=>x(se.target.value),placeholder:"Optional description of this content type",disabled:j||f,rows:2})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(TS,{id:"singleton",checked:C,onCheckedChange:se=>O(se),disabled:j||f}),g.jsx(jn,{htmlFor:"singleton",className:"cursor-pointer",children:"Singleton (only one entry allowed)"})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Fields"}),!f&&g.jsxs($r,{type:"button",variant:"secondary",size:"sm",onClick:X,disabled:j,"data-testid":"add-field-button",children:[g.jsx(I1,{className:"size-3.5"}),"Add Field"]})]}),g.jsx("div",{className:"space-y-2",children:M.map((se,Ee)=>g.jsxs("div",{className:je("flex items-center gap-2 rounded-lg border p-2 transition-colors",!f&&"cursor-pointer hover:bg-muted/50",te===Ee&&"border-primary bg-primary/5"),onClick:()=>{f||(ce(Ee),me(!0))},"data-testid":`field-item-${Ee}`,children:[!f&&g.jsxs("div",{className:"flex flex-col gap-0.5",children:[Ee>0&&g.jsx("button",{type:"button",onClick:Ue=>{Ue.stopPropagation(),Re(Ee,Ee-1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:g.jsx(N1,{className:"size-3"})}),Ee<M.length-1&&g.jsx("button",{type:"button",onClick:Ue=>{Ue.stopPropagation(),Re(Ee,Ee+1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:g.jsx(_s,{className:"size-3"})})]}),g.jsx("div",{className:"flex size-8 items-center justify-center rounded bg-muted text-muted-foreground",children:Pp[se.type].icon}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"truncate text-sm font-medium",children:se.label}),g.jsxs("p",{className:"text-xs text-muted-foreground",children:[Pp[se.type].label,se.required&&" *"]})]}),!f&&g.jsx("button",{type:"button",onClick:Ue=>{Ue.stopPropagation(),_e(Ee)},disabled:j||M.length===1,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-50",children:g.jsx(ju,{className:"size-4"})})]},Ee))}),!f&&le&&nt&&te!==null&&g.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4","data-testid":"field-editor",children:[g.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[g.jsxs("h5",{className:"font-medium",children:["Edit Field: ",nt.label]}),g.jsx("button",{type:"button",onClick:()=>{me(!1),ce(null)},className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:g.jsx(ju,{className:"size-4"})})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"fieldLabel",children:["Label ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"fieldLabel",value:nt.label,onChange:se=>xe(te,{label:se.target.value,name:b?nt.name:US(se.target.value)||nt.name}),disabled:j,"data-testid":"field-label-input"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"fieldName",children:["Name ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"fieldName",value:nt.name,onChange:se=>xe(te,{name:se.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),disabled:j,"data-testid":"field-name-input"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"fieldType",children:["Type ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsxs(Np,{value:nt.type,onValueChange:se=>xe(te,{type:se,options:void 0}),disabled:j,children:[g.jsx(zp,{"data-testid":"field-type-select",children:g.jsx(jp,{})}),g.jsx(Dp,{children:Object.entries(Pp).map(([se,Ee])=>g.jsx(Qi,{value:se,children:g.jsxs("div",{className:"flex items-center gap-2",children:[Ee.icon,g.jsx("span",{children:Ee.label}),g.jsxs("span",{className:"text-muted-foreground",children:["- ",Ee.description]})]})},se))})]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(TS,{id:"fieldRequired",checked:nt.required,onCheckedChange:se=>xe(te,{required:se}),disabled:j}),g.jsx(jn,{htmlFor:"fieldRequired",className:"cursor-pointer",children:"Required"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"fieldDescription",children:"Help Text"}),g.jsx(os,{id:"fieldDescription",value:nt.description||"",onChange:se=>xe(te,{description:se.target.value||void 0}),placeholder:"Help text shown below the field",disabled:j})]}),(nt.type==="select"||nt.type==="multiSelect")&&g.jsx(XB,{options:nt.options?.options||[],onChange:se=>xe(te,{options:{...nt.options,options:se}}),disabled:j})]})]})]}),Le.length>0&&g.jsxs("div",{className:"space-y-4",children:[g.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Display Settings"}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"titleField",children:"Title Field"}),g.jsxs(Np,{value:D||"none",onValueChange:se=>U(se==="none"?"":se),disabled:j,children:[g.jsx(zp,{children:g.jsx(jp,{placeholder:"None"})}),g.jsxs(Dp,{children:[g.jsx(Qi,{value:"none",children:"None"}),Le.map(se=>g.jsx(Qi,{value:se.name,children:se.label},se.name))]})]}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to display as the entry title in lists"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"slugField",children:"Slug Field"}),g.jsxs(Np,{value:H||"none",onValueChange:se=>L(se==="none"?"":se),disabled:j,children:[g.jsx(zp,{children:g.jsx(jp,{placeholder:"None (auto-generate)"})}),g.jsxs(Dp,{children:[g.jsx(Qi,{value:"none",children:"None (auto-generate)"}),Le.map(se=>g.jsx(Qi,{value:se.name,children:se.label},se.name))]})]}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to use for generating URL-friendly slugs"})]})]}),ie&&g.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800",role:"alert","data-testid":"submit-error",children:ie})]})}),g.jsx(YB,{isOpen:V,onClose:()=>re(!1),breakingChanges:I,onForceUpdate:Sn,onCancel:()=>{re(!1),K([])},isLoading:ve})]})}function XB({options:e,onChange:t,disabled:r}){const s=()=>{t([...e,{value:`option_${e.length+1}`,label:""}])},i=u=>{t(e.filter((f,h)=>h!==u))},c=(u,f)=>{t(e.map((h,p)=>p===u?{...h,...f}:h))};return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{children:["Options ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx("div",{className:"space-y-2",children:e.map((u,f)=>g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(os,{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:r,className:"flex-1"}),g.jsx(os,{value:u.value,onChange:h=>c(f,{value:h.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),placeholder:"value",disabled:r,className:"w-32"}),g.jsx("button",{type:"button",onClick:()=>i(f),disabled:r,className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:g.jsx(ju,{className:"size-4"})})]},f))}),g.jsxs($r,{type:"button",variant:"secondary",size:"sm",onClick:s,disabled:r,children:[g.jsx(I1,{className:"size-3.5"}),"Add Option"]})]})}function JB(){const t=lt().location.pathname,r=Km(),{navItems:s,branding:i,layout:c}=r,[u,f]=w.useState(!1),h=A1($u.admin.listContentTypes,{isActive:!0}),p=h?.page??[],y=(x,C)=>C?t===x:t.startsWith(x),v=t==="/content"||t.startsWith("/entries/type/")||t.startsWith("/entries/new/")||t.startsWith("/entries/"),b=x=>x.id==="content"?_(x):g.jsxs(cs,{to:x.path,className:je("flex items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",y(x.path,x.exact)?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground"),children:[g.jsx(uS,{name:x.icon,className:"size-5"}),g.jsx("span",{className:"flex-1",children:x.label}),x.badge&&g.jsx("span",{className:"rounded-full bg-sidebar-primary px-2 py-0.5 text-xs text-sidebar-primary-foreground",children:x.badge})]},x.id),_=x=>g.jsxs(YI,{defaultOpen:v,children:[g.jsxs(KI,{className:je("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",v?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground","group"),children:[g.jsx(uS,{name:x.icon,className:"size-5"}),g.jsx("span",{className:"flex-1 text-left",children:x.label}),g.jsx(_s,{className:"size-4 transition-transform duration-200 group-data-[state=open]:rotate-180"})]}),g.jsx(XI,{children:g.jsxs("div",{className:"ml-5 mt-1 space-y-1 border-l border-sidebar-border pl-3",children:[g.jsx(cs,{to:"/content",className:je("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"}),p.map(C=>g.jsx(cs,{to:"/entries/type/$contentTypeId",params:{contentTypeId:C._id},className:je("flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",t===`/entries/type/${C._id}`?"bg-sidebar-accent/60 text-sidebar-accent-foreground":"text-sidebar-foreground/80 hover:bg-sidebar-accent/30 hover:text-sidebar-accent-foreground"),children:C.displayName},C._id)),p.length===0&&h!==void 0&&g.jsx("button",{type:"button",onClick:()=>f(!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"})]})})]},x.id),E=c.sidebarWidth;return g.jsxs(g.Fragment,{children:[g.jsxs("aside",{className:"fixed inset-y-0 left-0 z-50 flex flex-col border-r border-sidebar-border bg-sidebar",style:{width:E},children:[g.jsx("div",{className:"flex h-14 items-center gap-2 border-b border-sidebar-border px-4",children:g.jsxs(cs,{to:"/",className:"flex items-center gap-2 font-semibold text-sidebar-foreground",children:[i.logo?g.jsx("img",{src:i.logo,alt:i.appName,className:"size-8"}):g.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:g.jsx(L1,{className:"size-4"})}),g.jsx("span",{className:"text-base",children:i.appName})]})}),g.jsxs("nav",{className:"flex-1 space-y-6 overflow-y-auto p-4",children:[s.main.length>0&&g.jsxs("div",{className:"space-y-1",children:[g.jsx("span",{className:"px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60",children:"Main"}),g.jsx("div",{className:"space-y-1 pt-2",children:s.main.map(b)})]}),s.config.length>0&&g.jsxs("div",{className:"space-y-1",children:[g.jsx("span",{className:"px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60",children:"Configuration"}),g.jsx("div",{className:"space-y-1 pt-2",children:s.config.map(b)})]})]}),g.jsx("div",{className:"border-t border-sidebar-border p-4",children:g.jsxs("div",{className:"flex items-center justify-between text-xs text-sidebar-foreground/60",children:[g.jsx("span",{children:"Version"}),g.jsx("span",{className:"font-mono",children:"0.1.0"})]})})]}),g.jsx(KB,{isOpen:u,onClose:()=>f(!1)})]})}function WB({...e}){return g.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function e9({className:e,...t}){return g.jsx("ol",{"data-slot":"breadcrumb-list",className:je("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function t9({className:e,...t}){return g.jsx("li",{"data-slot":"breadcrumb-item",className:je("inline-flex items-center gap-1.5",e),...t})}function n9({asChild:e,className:t,...r}){const s=e?wC:"a";return g.jsx(s,{"data-slot":"breadcrumb-link",className:je("hover:text-foreground transition-colors",t),...r})}function r9({className:e,...t}){return g.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:je("text-foreground font-normal",e),...t})}function o9({children:e,className:t,...r}){return g.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:je("[&>svg]:size-3.5",t),...r,children:e??g.jsx(i3,{})})}var Lp="rovingFocusGroup.onEntryFocus",s9={bubbles:!1,cancelable:!0},Rc="RovingFocusGroup",[fm,RE,a9]=sg(Rc),[i9,TE]=hr(Rc,[a9]),[c9,l9]=i9(Rc),AE=w.forwardRef((e,t)=>g.jsx(fm.Provider,{scope:e.__scopeRovingFocusGroup,children:g.jsx(fm.Slot,{scope:e.__scopeRovingFocusGroup,children:g.jsx(u9,{...e,ref:t})})}));AE.displayName=Rc;var u9=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:i=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...v}=e,b=w.useRef(null),_=Ve(t,b),E=ag(c),[x,C]=To({prop:u,defaultProp:f??null,onChange:h,caller:Rc}),[O,M]=w.useState(!1),k=Yn(p),D=RE(r),U=w.useRef(!1),[H,L]=w.useState(0);return w.useEffect(()=>{const j=b.current;if(j)return j.addEventListener(Lp,k),()=>j.removeEventListener(Lp,k)},[k]),g.jsx(c9,{scope:r,orientation:s,dir:E,loop:i,currentTabStopId:x,onItemFocus:w.useCallback(j=>C(j),[C]),onItemShiftTab:w.useCallback(()=>M(!0),[]),onFocusableItemAdd:w.useCallback(()=>L(j=>j+1),[]),onFocusableItemRemove:w.useCallback(()=>L(j=>j-1),[]),children:g.jsx(ke.div,{tabIndex:O||H===0?-1:0,"data-orientation":s,...v,ref:_,style:{outline:"none",...e.style},onMouseDown:he(e.onMouseDown,()=>{U.current=!0}),onFocus:he(e.onFocus,j=>{const G=!U.current;if(j.target===j.currentTarget&&G&&!O){const ie=new CustomEvent(Lp,s9);if(j.currentTarget.dispatchEvent(ie),!ie.defaultPrevented){const ae=D().filter(I=>I.focusable),te=ae.find(I=>I.active),ce=ae.find(I=>I.id===x),me=[te,ce,...ae].filter(Boolean).map(I=>I.ref.current);ME(me,y)}}U.current=!1}),onBlur:he(e.onBlur,()=>M(!1))})})}),OE="RovingFocusGroupItem",kE=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:i=!1,tabStopId:c,children:u,...f}=e,h=Qn(),p=c||h,y=l9(OE,r),v=y.currentTabStopId===p,b=RE(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:x}=y;return w.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),g.jsx(fm.ItemSlot,{scope:r,id:p,focusable:s,active:i,children:g.jsx(ke.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...f,ref:t,onMouseDown:he(e.onMouseDown,C=>{s?y.onItemFocus(p):C.preventDefault()}),onFocus:he(e.onFocus,()=>y.onItemFocus(p)),onKeyDown:he(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){y.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const O=h9(C,y.orientation,y.dir);if(O!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let k=b().filter(D=>D.focusable).map(D=>D.ref.current);if(O==="last")k.reverse();else if(O==="prev"||O==="next"){O==="prev"&&k.reverse();const D=k.indexOf(C.currentTarget);k=y.loop?p9(k,D+1):k.slice(D+1)}setTimeout(()=>ME(k))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:x!=null}):u})})});kE.displayName=OE;var f9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function d9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function h9(e,t,r){const s=d9(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return f9[s]}function ME(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function p9(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var m9=AE,g9=kE,dm=["Enter"," "],y9=["ArrowDown","PageUp","Home"],NE=["ArrowUp","PageDown","End"],v9=[...y9,...NE],b9={ltr:[...dm,"ArrowRight"],rtl:[...dm,"ArrowLeft"]},w9={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tc="Menu",[gc,S9,x9]=sg(Tc),[Es,jE]=hr(Tc,[x9,Za,TE]),Ef=Za(),zE=TE(),[_9,Rs]=Es(Tc),[C9,Ac]=Es(Tc),DE=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:i,onOpenChange:c,modal:u=!0}=e,f=Ef(t),[h,p]=w.useState(null),y=w.useRef(!1),v=Yn(c),b=ag(i);return w.useEffect(()=>{const _=()=>{y.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>y.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),g.jsx(mg,{...f,children:g.jsx(_9,{scope:t,open:r,onOpenChange:v,content:h,onContentChange:p,children:g.jsx(C9,{scope:t,onClose:w.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:s})})})};DE.displayName=Tc;var E9="MenuAnchor",bg=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=Ef(r);return g.jsx(Sf,{...i,...s,ref:t})});bg.displayName=E9;var wg="MenuPortal",[R9,PE]=Es(wg,{forceMount:void 0}),LE=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:i}=e,c=Rs(wg,t);return g.jsx(R9,{scope:t,forceMount:r,children:g.jsx(Un,{present:r||c.open,children:g.jsx(_c,{asChild:!0,container:i,children:s})})})};LE.displayName=wg;var Ln="MenuContent",[T9,Sg]=Es(Ln),IE=w.forwardRef((e,t)=>{const r=PE(Ln,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,c=Rs(Ln,e.__scopeMenu),u=Ac(Ln,e.__scopeMenu);return g.jsx(gc.Provider,{scope:e.__scopeMenu,children:g.jsx(Un,{present:s||c.open,children:g.jsx(gc.Slot,{scope:e.__scopeMenu,children:u.modal?g.jsx(A9,{...i,ref:t}):g.jsx(O9,{...i,ref:t})})})})}),A9=w.forwardRef((e,t)=>{const r=Rs(Ln,e.__scopeMenu),s=w.useRef(null),i=Ve(t,s);return w.useEffect(()=>{const c=s.current;if(c)return hf(c)},[]),g.jsx(xg,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:he(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),O9=w.forwardRef((e,t)=>{const r=Rs(Ln,e.__scopeMenu);return g.jsx(xg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),k9=gs("MenuContent.ScrollLock"),xg=w.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:_,disableOutsideScroll:E,...x}=e,C=Rs(Ln,r),O=Ac(Ln,r),M=Ef(r),k=zE(r),D=S9(r),[U,H]=w.useState(null),L=w.useRef(null),j=Ve(t,L,C.onContentChange),G=w.useRef(0),ie=w.useRef(""),ae=w.useRef(0),te=w.useRef(null),ce=w.useRef("right"),le=w.useRef(0),me=E?Cc:w.Fragment,I=E?{as:k9,allowPinchZoom:!0}:void 0,K=re=>{const ve=ie.current+re,z=D().filter(X=>!X.disabled),Q=document.activeElement,ne=z.find(X=>X.ref.current===Q)?.textValue,oe=z.map(X=>X.textValue),pe=q9(oe,ve,ne),ye=z.find(X=>X.textValue===pe)?.ref.current;(function X(_e){ie.current=_e,window.clearTimeout(G.current),_e!==""&&(G.current=window.setTimeout(()=>X(""),1e3))})(ve),ye&&setTimeout(()=>ye.focus())};w.useEffect(()=>()=>window.clearTimeout(G.current),[]),ff();const V=w.useCallback(re=>ce.current===te.current?.side&&V9(re,te.current?.area),[]);return g.jsx(T9,{scope:r,searchRef:ie,onItemEnter:w.useCallback(re=>{V(re)&&re.preventDefault()},[V]),onItemLeave:w.useCallback(re=>{V(re)||(L.current?.focus(),H(null))},[V]),onTriggerLeave:w.useCallback(re=>{V(re)&&re.preventDefault()},[V]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:w.useCallback(re=>{te.current=re},[]),children:g.jsx(me,{...I,children:g.jsx(xc,{asChild:!0,trapped:i,onMountAutoFocus:he(c,re=>{re.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:g.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:_,children:g.jsx(m9,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:s,currentTabStopId:U,onCurrentTabStopIdChange:H,onEntryFocus:he(h,re=>{O.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(gg,{role:"menu","aria-orientation":"vertical","data-state":eR(C.open),"data-radix-menu-content":"",dir:O.dir,...M,...x,ref:j,style:{outline:"none",...x.style},onKeyDown:he(x.onKeyDown,re=>{const z=re.target.closest("[data-radix-menu-content]")===re.currentTarget,Q=re.ctrlKey||re.altKey||re.metaKey,ne=re.key.length===1;z&&(re.key==="Tab"&&re.preventDefault(),!Q&&ne&&K(re.key));const oe=L.current;if(re.target!==oe||!v9.includes(re.key))return;re.preventDefault();const ye=D().filter(X=>!X.disabled).map(X=>X.ref.current);NE.includes(re.key)&&ye.reverse(),U9(ye)}),onBlur:he(e.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(G.current),ie.current="")}),onPointerMove:he(e.onPointerMove,yc(re=>{const ve=re.target,z=le.current!==re.clientX;if(re.currentTarget.contains(ve)&&z){const Q=re.clientX>le.current?"right":"left";ce.current=Q,le.current=re.clientX}}))})})})})})})});IE.displayName=Ln;var M9="MenuGroup",_g=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return g.jsx(ke.div,{role:"group",...s,ref:t})});_g.displayName=M9;var N9="MenuLabel",$E=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return g.jsx(ke.div,{...s,ref:t})});$E.displayName=N9;var Qu="MenuItem",qS="menu.itemSelect",Rf=w.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...i}=e,c=w.useRef(null),u=Ac(Qu,e.__scopeMenu),f=Sg(Qu,e.__scopeMenu),h=Ve(t,c),p=w.useRef(!1),y=()=>{const v=c.current;if(!r&&v){const b=new CustomEvent(qS,{bubbles:!0,cancelable:!0});v.addEventListener(qS,_=>s?.(_),{once:!0}),B_(v,b),b.defaultPrevented?p.current=!1:u.onClose()}};return g.jsx(UE,{...i,ref:h,disabled:r,onClick:he(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),p.current=!0},onPointerUp:he(e.onPointerUp,v=>{p.current||v.currentTarget?.click()}),onKeyDown:he(e.onKeyDown,v=>{const b=f.searchRef.current!=="";r||b&&v.key===" "||dm.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Rf.displayName=Qu;var UE=w.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:i,...c}=e,u=Sg(Qu,r),f=zE(r),h=w.useRef(null),p=Ve(t,h),[y,v]=w.useState(!1),[b,_]=w.useState("");return w.useEffect(()=>{const E=h.current;E&&_((E.textContent??"").trim())},[c.children]),g.jsx(gc.ItemSlot,{scope:r,disabled:s,textValue:i??b,children:g.jsx(g9,{asChild:!0,...f,focusable:!s,children:g.jsx(ke.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...c,ref:p,onPointerMove:he(e.onPointerMove,yc(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:he(e.onPointerLeave,yc(E=>u.onItemLeave(E))),onFocus:he(e.onFocus,()=>v(!0)),onBlur:he(e.onBlur,()=>v(!1))})})})}),j9="MenuCheckboxItem",BE=w.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...i}=e;return g.jsx(ZE,{scope:e.__scopeMenu,checked:r,children:g.jsx(Rf,{role:"menuitemcheckbox","aria-checked":Gu(r)?"mixed":r,...i,ref:t,"data-state":Eg(r),onSelect:he(i.onSelect,()=>s?.(Gu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});BE.displayName=j9;var qE="MenuRadioGroup",[z9,D9]=Es(qE,{value:void 0,onValueChange:()=>{}}),FE=w.forwardRef((e,t)=>{const{value:r,onValueChange:s,...i}=e,c=Yn(s);return g.jsx(z9,{scope:e.__scopeMenu,value:r,onValueChange:c,children:g.jsx(_g,{...i,ref:t})})});FE.displayName=qE;var VE="MenuRadioItem",HE=w.forwardRef((e,t)=>{const{value:r,...s}=e,i=D9(VE,e.__scopeMenu),c=r===i.value;return g.jsx(ZE,{scope:e.__scopeMenu,checked:c,children:g.jsx(Rf,{role:"menuitemradio","aria-checked":c,...s,ref:t,"data-state":Eg(c),onSelect:he(s.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});HE.displayName=VE;var Cg="MenuItemIndicator",[ZE,P9]=Es(Cg,{checked:!1}),QE=w.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...i}=e,c=P9(Cg,r);return g.jsx(Un,{present:s||Gu(c.checked)||c.checked===!0,children:g.jsx(ke.span,{...i,ref:t,"data-state":Eg(c.checked)})})});QE.displayName=Cg;var L9="MenuSeparator",GE=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return g.jsx(ke.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});GE.displayName=L9;var I9="MenuArrow",YE=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=Ef(r);return g.jsx(yg,{...i,...s,ref:t})});YE.displayName=I9;var $9="MenuSub",[T7,KE]=Es($9),Ji="MenuSubTrigger",XE=w.forwardRef((e,t)=>{const r=Rs(Ji,e.__scopeMenu),s=Ac(Ji,e.__scopeMenu),i=KE(Ji,e.__scopeMenu),c=Sg(Ji,e.__scopeMenu),u=w.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=c,p={__scopeMenu:e.__scopeMenu},y=w.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return w.useEffect(()=>y,[y]),w.useEffect(()=>{const v=f.current;return()=>{window.clearTimeout(v),h(null)}},[f,h]),g.jsx(bg,{asChild:!0,...p,children:g.jsx(UE,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":eR(r.open),...e,ref:wc(t,i.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:he(e.onPointerMove,yc(v=>{c.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(c.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:he(e.onPointerLeave,yc(v=>{y();const b=r.content?.getBoundingClientRect();if(b){const _=r.content?.dataset.side,E=_==="right",x=E?-5:5,C=b[E?"left":"right"],O=b[E?"right":"left"];c.onPointerGraceIntentChange({area:[{x:v.clientX+x,y:v.clientY},{x:C,y:b.top},{x:O,y:b.top},{x:O,y:b.bottom},{x:C,y:b.bottom}],side:_}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(v),v.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:he(e.onKeyDown,v=>{const b=c.searchRef.current!=="";e.disabled||b&&v.key===" "||b9[s.dir].includes(v.key)&&(r.onOpenChange(!0),r.content?.focus(),v.preventDefault())})})})});XE.displayName=Ji;var JE="MenuSubContent",WE=w.forwardRef((e,t)=>{const r=PE(Ln,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,c=Rs(Ln,e.__scopeMenu),u=Ac(Ln,e.__scopeMenu),f=KE(JE,e.__scopeMenu),h=w.useRef(null),p=Ve(t,h);return g.jsx(gc.Provider,{scope:e.__scopeMenu,children:g.jsx(Un,{present:s||c.open,children:g.jsx(gc.Slot,{scope:e.__scopeMenu,children:g.jsx(xg,{id:f.contentId,"aria-labelledby":f.triggerId,...i,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:he(e.onFocusOutside,y=>{y.target!==f.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:he(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:he(e.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),b=w9[u.dir].includes(y.key);v&&b&&(c.onOpenChange(!1),f.trigger?.focus(),y.preventDefault())})})})})})});WE.displayName=JE;function eR(e){return e?"open":"closed"}function Gu(e){return e==="indeterminate"}function Eg(e){return Gu(e)?"indeterminate":e?"checked":"unchecked"}function U9(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function B9(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function q9(e,t,r){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,c=r?e.indexOf(r):-1;let u=B9(e,Math.max(c,0));i.length===1&&(u=u.filter(p=>p!==r));const h=u.find(p=>p.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function F9(e,t){const{x:r,y:s}=e;let i=!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,v=h.x,b=h.y;y>s!=b>s&&r<(v-p)*(s-y)/(b-y)+p&&(i=!i)}return i}function V9(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return F9(r,t)}function yc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var H9=DE,Z9=bg,Q9=LE,G9=IE,Y9=_g,K9=$E,X9=Rf,J9=BE,W9=FE,eq=HE,tq=QE,nq=GE,rq=YE,oq=XE,sq=WE,Tf="DropdownMenu",[aq]=hr(Tf,[jE]),Gt=jE(),[iq,tR]=aq(Tf),nR=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:i,defaultOpen:c,onOpenChange:u,modal:f=!0}=e,h=Gt(t),p=w.useRef(null),[y,v]=To({prop:i,defaultProp:c??!1,onChange:u,caller:Tf});return g.jsx(iq,{scope:t,triggerId:Qn(),triggerRef:p,contentId:Qn(),open:y,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(b=>!b),[v]),modal:f,children:g.jsx(H9,{...h,open:y,onOpenChange:v,dir:s,modal:f,children:r})})};nR.displayName=Tf;var rR="DropdownMenuTrigger",oR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...i}=e,c=tR(rR,r),u=Gt(r);return g.jsx(Z9,{asChild:!0,...u,children:g.jsx(ke.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":s?"":void 0,disabled:s,...i,ref:wc(t,c.triggerRef),onPointerDown:he(e.onPointerDown,f=>{!s&&f.button===0&&f.ctrlKey===!1&&(c.onOpenToggle(),c.open||f.preventDefault())}),onKeyDown:he(e.onKeyDown,f=>{s||(["Enter"," "].includes(f.key)&&c.onOpenToggle(),f.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});oR.displayName=rR;var cq="DropdownMenuPortal",sR=e=>{const{__scopeDropdownMenu:t,...r}=e,s=Gt(t);return g.jsx(Q9,{...s,...r})};sR.displayName=cq;var aR="DropdownMenuContent",iR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=tR(aR,r),c=Gt(r),u=w.useRef(!1);return g.jsx(G9,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...s,ref:t,onCloseAutoFocus:he(e.onCloseAutoFocus,f=>{u.current||i.triggerRef.current?.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:he(e.onInteractOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,y=h.button===2||p;(!i.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)"}})});iR.displayName=aR;var lq="DropdownMenuGroup",uq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(Y9,{...i,...s,ref:t})});uq.displayName=lq;var fq="DropdownMenuLabel",cR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(K9,{...i,...s,ref:t})});cR.displayName=fq;var dq="DropdownMenuItem",lR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(X9,{...i,...s,ref:t})});lR.displayName=dq;var hq="DropdownMenuCheckboxItem",pq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(J9,{...i,...s,ref:t})});pq.displayName=hq;var mq="DropdownMenuRadioGroup",gq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(W9,{...i,...s,ref:t})});gq.displayName=mq;var yq="DropdownMenuRadioItem",vq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(eq,{...i,...s,ref:t})});vq.displayName=yq;var bq="DropdownMenuItemIndicator",wq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(tq,{...i,...s,ref:t})});wq.displayName=bq;var Sq="DropdownMenuSeparator",uR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(nq,{...i,...s,ref:t})});uR.displayName=Sq;var xq="DropdownMenuArrow",_q=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(rq,{...i,...s,ref:t})});_q.displayName=xq;var Cq="DropdownMenuSubTrigger",Eq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(oq,{...i,...s,ref:t})});Eq.displayName=Cq;var Rq="DropdownMenuSubContent",Tq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(sq,{...i,...s,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)"}})});Tq.displayName=Rq;var Aq=nR,Oq=oR,kq=sR,Mq=iR,Nq=cR,jq=lR,zq=uR;function Dq({...e}){return g.jsx(Aq,{"data-slot":"dropdown-menu",...e})}function Pq({...e}){return g.jsx(Oq,{"data-slot":"dropdown-menu-trigger",...e})}function Lq({className:e,sideOffset:t=4,...r}){return g.jsx(kq,{children:g.jsx(Mq,{"data-slot":"dropdown-menu-content",sideOffset:t,className:je("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),...r})})}function FS({className:e,inset:t,variant:r="default",...s}){return g.jsx(jq,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:je("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),...s})}function Iq({className:e,inset:t,...r}){return g.jsx(Nq,{"data-slot":"dropdown-menu-label","data-inset":t,className:je("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function VS({className:e,...t}){return g.jsx(zq,{"data-slot":"dropdown-menu-separator",className:je("bg-border -mx-1 my-1 h-px",e),...t})}function $q(e,t=[]){let r=[];function s(c,u){const f=w.createContext(u);f.displayName=c+"Context";const h=r.length;r=[...r,u];const p=v=>{const{scope:b,children:_,...E}=v,x=b?.[e]?.[h]||f,C=w.useMemo(()=>E,Object.values(E));return g.jsx(x.Provider,{value:C,children:_})};p.displayName=c+"Provider";function y(v,b){const _=b?.[e]?.[h]||f,E=w.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${c}\``)}return[p,y]}const i=()=>{const c=r.map(u=>w.createContext(u));return function(f){const h=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return i.scopeName=e,[s,Uq(i,...t)]}function Uq(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(c){const u=s.reduce((f,{useScope:h,scopeName:p})=>{const v=h(c)[`__scope${p}`];return{...f,...v}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Bq=t1();function qq(){return Bq.useSyncExternalStore(Fq,()=>!0,()=>!1)}function Fq(){return()=>{}}var Rg="Avatar",[Vq]=$q(Rg),[Hq,fR]=Vq(Rg),dR=w.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[i,c]=w.useState("idle");return g.jsx(Hq,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:c,children:g.jsx(mf.span,{...s,ref:t})})});dR.displayName=Rg;var hR="AvatarImage",pR=w.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:i=()=>{},...c}=e,u=fR(hR,r),f=Zq(s,c),h=Yn(p=>{i(p),u.onImageLoadingStatusChange(p)});return Rt(()=>{f!=="idle"&&h(f)},[f,h]),f==="loaded"?g.jsx(mf.img,{...c,ref:t,src:s}):null});pR.displayName=hR;var mR="AvatarFallback",gR=w.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...i}=e,c=fR(mR,r),[u,f]=w.useState(s===void 0);return w.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>f(!0),s);return()=>window.clearTimeout(h)}},[s]),u&&c.imageLoadingStatus!=="loaded"?g.jsx(mf.span,{...i,ref:t}):null});gR.displayName=mR;function HS(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Zq(e,{referrerPolicy:t,crossOrigin:r}){const s=qq(),i=w.useRef(null),c=s?(i.current||(i.current=new window.Image),i.current):null,[u,f]=w.useState(()=>HS(c,e));return Rt(()=>{f(HS(c,e))},[c,e]),Rt(()=>{const h=v=>()=>{f(v)};if(!c)return;const p=h("loaded"),y=h("error");return c.addEventListener("load",p),c.addEventListener("error",y),t&&(c.referrerPolicy=t),typeof r=="string"&&(c.crossOrigin=r),()=>{c.removeEventListener("load",p),c.removeEventListener("error",y)}},[c,r,t]),u}var Qq=dR,Gq=pR,Yq=gR;function Kq({className:e,...t}){return g.jsx(Qq,{"data-slot":"avatar",className:je("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function Xq({className:e,...t}){return g.jsx(Gq,{"data-slot":"avatar-image",className:je("aspect-square size-full",e),...t})}function Jq({className:e,...t}){return g.jsx(Yq,{"data-slot":"avatar-fallback",className:je("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var Af="Popover",[yR]=hr(Af,[Za]),Oc=Za(),[Wq,Lo]=yR(Af),vR=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:i,onOpenChange:c,modal:u=!1}=e,f=Oc(t),h=w.useRef(null),[p,y]=w.useState(!1),[v,b]=To({prop:s,defaultProp:i??!1,onChange:c,caller:Af});return g.jsx(mg,{...f,children:g.jsx(Wq,{scope:t,contentId:Qn(),triggerRef:h,open:v,onOpenChange:b,onOpenToggle:w.useCallback(()=>b(_=>!_),[b]),hasCustomAnchor:p,onCustomAnchorAdd:w.useCallback(()=>y(!0),[]),onCustomAnchorRemove:w.useCallback(()=>y(!1),[]),modal:u,children:r})})};vR.displayName=Af;var bR="PopoverAnchor",eF=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Lo(bR,r),c=Oc(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=i;return w.useEffect(()=>(u(),()=>f()),[u,f]),g.jsx(Sf,{...c,...s,ref:t})});eF.displayName=bR;var wR="PopoverTrigger",SR=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Lo(wR,r),c=Oc(r),u=Ve(t,i.triggerRef),f=g.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":RR(i.open),...s,ref:u,onClick:he(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:g.jsx(Sf,{asChild:!0,...c,children:f})});SR.displayName=wR;var Tg="PopoverPortal",[tF,nF]=yR(Tg,{forceMount:void 0}),xR=e=>{const{__scopePopover:t,forceMount:r,children:s,container:i}=e,c=Lo(Tg,t);return g.jsx(tF,{scope:t,forceMount:r,children:g.jsx(Un,{present:r||c.open,children:g.jsx(_c,{asChild:!0,container:i,children:s})})})};xR.displayName=Tg;var Ia="PopoverContent",_R=w.forwardRef((e,t)=>{const r=nF(Ia,e.__scopePopover),{forceMount:s=r.forceMount,...i}=e,c=Lo(Ia,e.__scopePopover);return g.jsx(Un,{present:s||c.open,children:c.modal?g.jsx(oF,{...i,ref:t}):g.jsx(sF,{...i,ref:t})})});_R.displayName=Ia;var rF=gs("PopoverContent.RemoveScroll"),oF=w.forwardRef((e,t)=>{const r=Lo(Ia,e.__scopePopover),s=w.useRef(null),i=Ve(t,s),c=w.useRef(!1);return w.useEffect(()=>{const u=s.current;if(u)return hf(u)},[]),g.jsx(Cc,{as:rF,allowPinchZoom:!0,children:g.jsx(CR,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:he(e.onCloseAutoFocus,u=>{u.preventDefault(),c.current||r.triggerRef.current?.focus()}),onPointerDownOutside:he(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:he(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),sF=w.forwardRef((e,t)=>{const r=Lo(Ia,e.__scopePopover),s=w.useRef(!1),i=w.useRef(!1);return g.jsx(CR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(s.current||r.triggerRef.current?.focus(),c.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(s.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=c.target;r.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})}),CR=w.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:y,...v}=e,b=Lo(Ia,r),_=Oc(r);return ff(),g.jsx(xc,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:c,children:g.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:y,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:g.jsx(gg,{"data-state":RR(b.open),role:"dialog",id:b.contentId,..._,...v,ref:t,style:{...v.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)"}})})})}),ER="PopoverClose",aF=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Lo(ER,r);return g.jsx(ke.button,{type:"button",...s,ref:t,onClick:he(e.onClick,()=>i.onOpenChange(!1))})});aF.displayName=ER;var iF="PopoverArrow",cF=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Oc(r);return g.jsx(yg,{...i,...s,ref:t})});cF.displayName=iF;function RR(e){return e?"open":"closed"}var lF=vR,uF=SR,fF=xR,dF=_R;function ZS({...e}){return g.jsx(lF,{"data-slot":"popover",...e})}function QS({...e}){return g.jsx(uF,{"data-slot":"popover-trigger",...e})}function GS({className:e,align:t="center",sideOffset:r=4,...s}){return g.jsx(fF,{children:g.jsx(dF,{"data-slot":"popover-content",align:t,sideOffset:r,className:je("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),...s})})}const hF=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],pF=[{label:"Documentation",url:"https://docs.convex.dev",icon:Wz},{label:"API Reference",url:"https://docs.convex.dev/api",icon:y3},{label:"Community Discord",url:"https://discord.gg/convex",icon:lD}],mF={"/":"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 gF(e,t,r){const s=[{label:t,to:"/"}];if(e==="/")return s;const i=e.split("/").filter(Boolean);let c="";return i.forEach((u,f)=>{c+=`/${u}`;const h=f===i.length-1;let p=r.get(c)??mF[c];p||(p=u.charAt(0).toUpperCase()+u.slice(1).replace(/-/g," ")),h?s.push({label:p}):s.push({label:p,to:c})}),s}function yF(){const e=lt(),t=of(),{branding:r}=Km();let s=new Map;try{s=TI().overrides}catch{}const i=gF(e.location.pathname,r.appName,s);let c=null,u=null,f=async()=>{},h=!1;try{const x=r_();c=x.user,u=x.role,f=x.logout,h=x.isAuthenticated}catch{}const y=(u?j4(u):null)?.displayName??u??"No Role",v=c?.name??c?.email??"User",b=x=>{const C=x.split(" ");return C.length>=2?`${C[0][0]}${C[1][0]}`.toUpperCase():x.slice(0,2).toUpperCase()},_=c?.name?b(c.name):"U",E=async()=>{await f()};return g.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:[g.jsx(WB,{children:g.jsx(e9,{children:i.map((x,C)=>g.jsxs(w.Fragment,{children:[C>0&&g.jsx(o9,{}),g.jsx(t9,{children:x.to?g.jsx(n9,{asChild:!0,children:g.jsxs(cs,{to:x.to,className:"flex items-center gap-1.5",children:[C===0&&g.jsx(D1,{className:"size-3.5"}),g.jsx("span",{children:x.label})]})}):g.jsx(r9,{children:x.label})})]},C))})}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsxs(ZS,{children:[g.jsx(QS,{asChild:!0,children:g.jsxs(sc,{variant:"ghost",size:"icon",className:"size-9",children:[g.jsx(Yp,{className:"size-4"}),g.jsx("span",{className:"sr-only",children:"Notifications"})]})}),g.jsxs(GS,{align:"end",className:"w-80",children:[g.jsx("div",{className:"flex items-center justify-between pb-2",children:g.jsx("h4",{className:"font-medium",children:"Notifications"})}),g.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[g.jsx(Yp,{className:"size-8 text-muted-foreground/50"}),g.jsx("p",{className:"mt-2 text-sm font-medium",children:"No notifications yet"}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"You're all caught up!"})]})]})]}),g.jsxs(ZS,{children:[g.jsx(QS,{asChild:!0,children:g.jsxs(sc,{variant:"ghost",size:"icon",className:"size-9",children:[g.jsx(j1,{className:"size-4"}),g.jsx("span",{className:"sr-only",children:"Help"})]})}),g.jsxs(GS,{align:"end",className:"w-72",children:[g.jsx("div",{className:"pb-2",children:g.jsx("h4",{className:"font-medium",children:"Help & Resources"})}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Keyboard Shortcuts"}),g.jsx("div",{className:"space-y-1",children:hF.map((x,C)=>g.jsxs("div",{className:"flex items-center justify-between text-sm",children:[g.jsx("span",{className:"text-muted-foreground",children:x.description}),g.jsx("div",{className:"flex gap-0.5",children:x.keys.map((O,M)=>g.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",children:O},M))})]},C))})]}),g.jsxs("div",{children:[g.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Resources"}),g.jsx("div",{className:"space-y-1",children:pF.map(x=>g.jsxs("a",{href:x.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:[g.jsx(x.icon,{className:"size-4 text-muted-foreground"}),g.jsx("span",{className:"flex-1",children:x.label}),g.jsx(S3,{className:"size-3 text-muted-foreground"})]},x.label))})]})]})]})]}),g.jsxs(Dq,{children:[g.jsx(Pq,{asChild:!0,children:g.jsxs(sc,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[g.jsxs(Kq,{className:"size-6",children:[g.jsx(Xq,{src:c?.avatarUrl,alt:v}),g.jsx(Jq,{className:"text-xs",children:_})]}),g.jsx("span",{className:"text-sm font-medium",children:v}),g.jsx(_s,{className:"size-3.5 text-muted-foreground"})]})}),g.jsxs(Lq,{align:"end",className:"w-56",children:[g.jsx(Iq,{className:"font-normal",children:g.jsxs("div",{className:"flex flex-col space-y-1",children:[g.jsx("p",{className:"text-sm font-medium",children:v}),c?.email&&g.jsx("p",{className:"text-xs text-muted-foreground",children:c.email}),g.jsx("p",{className:"text-xs text-muted-foreground",children:y})]})}),g.jsx(VS,{}),g.jsxs(FS,{onClick:()=>t({to:"/settings"}),children:[g.jsx(U1,{className:"mr-2 size-4"}),g.jsx("span",{children:"Profile & Settings"})]}),h&&g.jsxs(g.Fragment,{children:[g.jsx(VS,{}),g.jsxs(FS,{onClick:E,className:"text-destructive focus:text-destructive",children:[g.jsx(rD,{className:"mr-2 size-4"}),g.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function vF({children:e}){const{layout:t}=Km();return g.jsxs("div",{className:"flex min-h-screen bg-background",children:[g.jsx(JB,{}),g.jsxs("div",{className:"flex flex-1 flex-col",style:{marginLeft:t.sidebarWidth},children:[g.jsx(yF,{}),g.jsx("main",{className:"flex-1 overflow-auto p-6",children:e})]})]})}function bF(){return g.jsx("div",{className:"route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen",children:g.jsx(W3,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function wF(){return g.jsxs("div",{className:"route-guard route-guard--unauthenticated",children:[g.jsx("div",{className:"route-guard-icon",children:g.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:[g.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),g.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),g.jsx("h2",{children:"Authentication Required"}),g.jsx("p",{children:"Please log in to access the admin panel."})]})}function Ip({requiredRole:e,requiredPermission:t}){return g.jsxs("div",{className:"route-guard route-guard--unauthorized",children:[g.jsx("div",{className:"route-guard-icon",children:g.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:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]})}),g.jsx("h2",{children:"Access Denied"}),g.jsx("p",{children:"You don't have permission to access this page."}),e&&g.jsxs("p",{className:"route-guard-detail",children:["Required role: ",g.jsx("strong",{children:e})]}),t&&g.jsxs("p",{className:"route-guard-detail",children:["Required permission:"," ",g.jsxs("strong",{children:[t.action," on ",t.resource]})]})]})}function SF({error:e}){return g.jsxs("div",{className:"route-guard route-guard--error",children:[g.jsx("div",{className:"route-guard-icon",children:g.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:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),g.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),g.jsx("h2",{children:"Authentication Error"}),g.jsx("p",{children:e})]})}function xF({children:e,requiredPermission:t,requiredRole:r,loadingComponent:s,unauthenticatedComponent:i,unauthorizedComponent:c,onUnauthenticated:u,onUnauthorized:f}){const{authState:h,role:p,checkPermission:y,error:v}=r_();return h==="loading"?g.jsx(g.Fragment,{children:s??g.jsx(bF,{})}):h==="error"?g.jsx(SF,{error:v??"An error occurred"}):h==="unauthenticated"?(u?.(),g.jsx(g.Fragment,{children:i??g.jsx(wF,{})})):p?r&&p!==r?(f?.(),g.jsx(g.Fragment,{children:c??g.jsx(Ip,{requiredRole:r,requiredPermission:t})})):t&&!y(t)?(f?.(),g.jsx(g.Fragment,{children:c??g.jsx(Ip,{requiredRole:r,requiredPermission:t})})):g.jsx(g.Fragment,{children:e}):(f?.(),g.jsx(g.Fragment,{children:c??g.jsx(Ip,{requiredRole:r,requiredPermission:t})}))}const TR=()=>{throw new Error("createServerOnlyFn() functions can only be called on the server!")};function YS(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function hm(e,t){const r=Object.create(null);if(e)for(const s of Object.keys(e))YS(s)&&(r[s]=e[s]);if(t&&typeof t=="object")for(const s of Object.keys(t))YS(s)&&(r[s]=t[s]);return r}function AR(e){return Object.create(null)}const vu=(e,t)=>{const r=t||e||{};return typeof r.method>"u"&&(r.method="GET"),Object.assign(c=>{const u={...r,...c};return vu(void 0,u)},{options:r,middleware:c=>{const u=[...r.middleware||[]];c.map(p=>{cw in p?p.options.middleware&&u.push(...p.options.middleware):u.push(p)});const f={...r,middleware:u},h=vu(void 0,f);return h[cw]=!0,h},inputValidator:c=>{const u={...r,inputValidator:c};return vu(void 0,u)},handler:(...c)=>{const[u,f]=c,h={...r,extractedFn:u,serverFn:f},p=[...h.middleware||[],EF(h)];return Object.assign(async y=>{const v=await KS(p,"client",{...u,...h,data:y?.data,headers:y?.headers,signal:y?.signal,fetch:y?.fetch,context:AR()}),b=dx(v.error);if(b)throw b;if(v.error)throw v.error;return v.result},{...u,__executeServer:async(y,v)=>{const b=TR(),_=b.contextAfterGlobalMiddlewares,E={...u,...y,serverFnMeta:u.serverFnMeta,context:hm(_,y.context),signal:v,request:b.request};return await KS(p,"server",E).then(C=>({result:C.result,error:C.error,context:C.sendContext}))}})}})};async function KS(e,t,r){const s=Tm()?.functionMiddleware||[];let i=_F([...s,...e]);if(t==="server"){const u=TR();u?.executedRequestMiddlewares&&(i=i.filter(f=>!u.executedRequestMiddlewares.has(f)))}const c=async u=>{const f=i.shift();if(!f)return u;try{"inputValidator"in f.options&&f.options.inputValidator&&t==="server"&&(u.data=await CF(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(v={})=>{const b={...u,...v,context:hm(u.context,v.context),sendContext:hm(u.sendContext,v.sendContext),headers:QN(u.headers,v.headers),_callSiteFetch:u._callSiteFetch,fetch:u._callSiteFetch??v.fetch??u.fetch,result:v.result!==void 0?v.result:v instanceof Response?v:u.result,error:v.error??u.error},_=await c(b);if(_.error)throw _.error;return _}});if(vn(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({...r,headers:r.headers||{},sendContext:r.sendContext||{},context:r.context||AR(),_callSiteFetch:r.fetch})}function _F(e,t=100){const r=new Set,s=[],i=(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&&i(f.options.middleware,u+1),r.has(f)||(r.add(f),s.push(f))})};return i(e,0),s}async function CF(e,t){if(e==null)return{};if("~standard"in e){const r=await e["~standard"].validate(t);if(r.issues)throw new Error(JSON.stringify(r.issues,void 0,2));return r.value}if("parse"in e)return e.parse(t);if(typeof e=="function")return e(t);throw new Error("Invalid validator type!")}function EF(e){return{"~types":void 0,options:{inputValidator:e.inputValidator,client:async({next:t,sendContext:r,fetch:s,...i})=>{const c={...i,context:r,fetch:s},u=await e.extractedFn?.(c);return t(u)},server:async({next:t,...r})=>{const s=await e.serverFn?.(r);return t({...r,result:s})}}}}const RF=vu({method:"GET"}).handler(d1("dff4e5b7f7b29b6a323200a2df0a5335d739cf583e83c9e514598af6b5ade819")),XS=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),JS=()=>"admin",WS=()=>{console.log("Logout called (mock mode)")},TF=()=>null,AF=()=>null,OF=()=>{};function kF(e){switch(e){case"mock":case"demo":return{getUser:XS,getUserRole:JS,onLogout:WS};case"none":case"disabled":return{getUser:TF,getUserRole:AF,onLogout:OF};default:return{getUser:XS,getUserRole:JS,onLogout:WS}}}const Bn=ON({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:Fz},{rel:"icon",href:"/favicon.ico"}]}),loader:async()=>({config:await RF()}),component:MF});function MF(){const{config:e}=Bn.useLoaderData(),t=w.useMemo(()=>kF(e.authMode),[e.authMode]),r=w.useMemo(()=>SI(e.adminConfig),[e.adminConfig]);return g.jsx(jF,{children:g.jsx(P4,{children:g.jsx(RI,{children:g.jsx(NF,{config:e,adminConfig:r,children:g.jsx(D4,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:g.jsx(xF,{children:g.jsx(vF,{children:g.jsx(s1,{})})})})})})})})}function NF({children:e,config:t,adminConfig:r}){const s=w.useMemo(()=>t.convexUrl?new zz(t.convexUrl):null,[t.convexUrl]);return s?g.jsx(Pz,{client:s,children:g.jsx(EI,{baseConfig:r,children:e})}):g.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-6",children:g.jsxs("div",{className:"max-w-lg space-y-4 rounded-lg border border-amber-200 bg-amber-50 p-6 text-center",children:[g.jsx("h2",{className:"text-xl font-semibold text-amber-900",children:"Convex Configuration Required"}),g.jsx("p",{className:"text-sm text-amber-800",children:"Please provide a Convex deployment URL to connect to your backend."}),g.jsxs("div",{className:"space-y-2 text-left text-sm text-amber-700",children:[g.jsx("p",{className:"font-medium",children:"Options:"}),g.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[g.jsxs("li",{children:["Run with URL:"," ",g.jsx("code",{className:"rounded bg-amber-100 px-1",children:"npx convex-cms admin --url YOUR_URL"})]}),g.jsxs("li",{children:["Set environment variable:"," ",g.jsx("code",{className:"rounded bg-amber-100 px-1",children:"CONVEX_URL=YOUR_URL"})]}),g.jsxs("li",{children:["Add to"," ",g.jsx("code",{className:"rounded bg-amber-100 px-1",children:".env.local"}),":"," ",g.jsx("code",{className:"rounded bg-amber-100 px-1",children:"CONVEX_URL=YOUR_URL"})]})]})]}),g.jsxs("p",{className:"text-sm text-amber-700",children:["Run"," ",g.jsx("code",{className:"rounded bg-amber-100 px-1",children:"npx convex dev"})," to start Convex and get your URL."]})]})})}function jF({children:e}){return g.jsxs("html",{lang:"en",children:[g.jsx("head",{children:g.jsx(VN,{})}),g.jsxs("body",{children:[e,g.jsx(HN,{})]})]})}const zF="modulepreload",DF=function(e){return"/"+e},ex={},mr=function(t,r,s){let i=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");i=h(r.map(p=>{if(p=DF(p),p in ex)return;ex[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":zF,y||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((_,E)=>{b.addEventListener("load",_),b.addEventListener("error",()=>E(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 i.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},PF=()=>mr(()=>import("./trash-Dp_a2mpb.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),LF=In("/trash")({component:dr(PF,"component")}),IF=()=>mr(()=>import("./taxonomies-DylY9HE1.js"),__vite__mapDeps([10,4,11,1,5,6,12,9])),$F=In("/taxonomies")({component:dr(IF,"component")}),UF=()=>mr(()=>import("./settings-DaNDUtr5.js"),__vite__mapDeps([13,14,1,5,15,6,7,9])),BF=In("/settings")({component:dr(UF,"component")}),qF=()=>mr(()=>import("./media-BIMN5jXt.js"),__vite__mapDeps([16,17,1,2,3,4,18,19,6,11,8,9])),FF=In("/media")({component:dr(qF,"component")}),VF=()=>mr(()=>import("./content-types-Bm4b2tf8.js"),__vite__mapDeps([20,1,2,3,4,6,11,9])),HF=In("/content-types")({component:dr(VF,"component")}),ZF=()=>mr(()=>import("./content-BV3YeSSW.js"),__vite__mapDeps([21,14,22,6,1,2,3,4,23,9])),QF=In("/content")({component:dr(ZF,"component")}),GF=()=>mr(()=>import("./index-DnJ5Twlv.js"),__vite__mapDeps([24,1,9])),YF=In("/")({component:dr(GF,"component")}),KF=()=>mr(()=>import("./_entryId-OY3sLz6O.js"),__vite__mapDeps([25,26,15,17,4,11,3,19,6,23,12,22,14,27])),XF=In("/entries/$entryId")({component:dr(KF,"component")}),JF=()=>mr(()=>import("./_contentTypeId-Ba5iowxH.js"),__vite__mapDeps([28,14,27,1,2,3,23,6,4,18,19])),WF=In("/entries/type/$contentTypeId")({component:dr(JF,"component")}),e7=()=>mr(()=>import("./new._contentTypeId-DTWb8ZDl.js"),__vite__mapDeps([29,26,15,17,4,11,3,19,6,23,12,22,27])),t7=In("/entries/new/$contentTypeId")({component:dr(e7,"component")}),n7=LF.update({id:"/trash",path:"/trash",getParentRoute:()=>Bn}),r7=$F.update({id:"/taxonomies",path:"/taxonomies",getParentRoute:()=>Bn}),o7=BF.update({id:"/settings",path:"/settings",getParentRoute:()=>Bn}),s7=FF.update({id:"/media",path:"/media",getParentRoute:()=>Bn}),a7=HF.update({id:"/content-types",path:"/content-types",getParentRoute:()=>Bn}),i7=QF.update({id:"/content",path:"/content",getParentRoute:()=>Bn}),c7=YF.update({id:"/",path:"/",getParentRoute:()=>Bn}),l7=XF.update({id:"/entries/$entryId",path:"/entries/$entryId",getParentRoute:()=>Bn}),u7=WF.update({id:"/entries/type/$contentTypeId",path:"/entries/type/$contentTypeId",getParentRoute:()=>Bn}),f7=t7.update({id:"/entries/new/$contentTypeId",path:"/entries/new/$contentTypeId",getParentRoute:()=>Bn}),d7={IndexRoute:c7,ContentRoute:i7,ContentTypesRoute:a7,MediaRoute:s7,SettingsRoute:o7,TaxonomiesRoute:r7,TrashRoute:n7,EntriesEntryIdRoute:l7,EntriesNewContentTypeIdRoute:f7,EntriesTypeContentTypeIdRoute:u7},h7=Bn._addFileChildren(d7);function p7(){return LN({routeTree:h7,scrollRestoration:!0,defaultPreload:"intent"})}async function m7(){const e=await p7();let t;return t=[],window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(fj),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:"",serializationAdapters:t}),e.state.matches.length||await YN(e),e}async function g7(){const e=await m7();return window.$_TSR?.h(),e}let $p;function y7(){return $p||($p=g7()),g.jsx(oN,{promise:$p,children:e=>g.jsx(UN,{router:e})})}w.startTransition(()=>{nA.hydrateRoot(document,g.jsx(w.StrictMode,{children:g.jsx(y7,{})}))});export{X3 as $,b8 as A,x8 as B,$r as C,g8 as D,P1 as E,T3 as F,sc as G,W3 as H,os as I,Dq as J,Pq as K,jn as L,Lq as M,FS as N,_3 as O,I1 as P,VS as Q,xF as R,Np as S,MD as T,Q3 as U,D1 as V,D3 as W,ju as X,w8 as Y,S8 as Z,C7 as _,Ow as a,O3 as a0,m3 as a1,AD as a2,KB as a3,j3 as a4,k1 as a5,Kp as a6,$1 as a7,z1 as a8,L1 as a9,hr as aA,he as aB,Yn as aC,Rt as aD,AS as aE,To as aF,xC as aG,_C as aH,Qn as aI,m9 as aJ,g9 as aK,TE as aL,TI as aM,l8 as aN,u8 as aO,f8 as aP,d8 as aQ,wc as aR,wC as aS,gD as aa,lt as ab,of as ac,Em as ad,XF as ae,WF as af,cs as ag,N1 as ah,ZS as ai,QS as aj,GS as ak,r_ as al,z4 as am,x7 as an,M4 as ao,t7 as ap,qt as aq,N8 as ar,Y3 as as,y3 as at,u3 as au,h3 as av,Ve as aw,ag as ax,ke as ay,Un as az,zp as b,jp as c,Dp as d,Qi as e,jD as f,TS as g,je as h,R7 as i,g as j,$u as k,Se as l,rg as m,U8 as n,RD as o,_s as p,i3 as q,w as r,CD as s,Km as t,A1 as u,tD as v,M1 as w,_7 as x,M8 as y,mf as z};
|
|
101
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},i8="DialogDescriptionWarning",c8=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yC(i8).contentName}}.`;return w.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},l8=oC,u8=iC,f8=cC,d8=lC,h8=fC,p8=hC,m8=mC;function g8({...e}){return g.jsx(l8,{"data-slot":"dialog",...e})}function y8({...e}){return g.jsx(u8,{"data-slot":"dialog-portal",...e})}function v8({className:e,...t}){return g.jsx(f8,{"data-slot":"dialog-overlay",className:je("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 b8({className:e,children:t,showCloseButton:r=!0,...s}){return g.jsxs(y8,{"data-slot":"dialog-portal",children:[g.jsx(v8,{}),g.jsxs(d8,{"data-slot":"dialog-content",className:je("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),...s,children:[t,r&&g.jsxs(m8,{"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:[g.jsx(ju,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function w8({className:e,...t}){return g.jsx("div",{"data-slot":"dialog-header",className:je("flex flex-col gap-2 text-center sm:text-left",e),...t})}function S8({className:e,...t}){return g.jsx("div",{"data-slot":"dialog-footer",className:je("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function x8({className:e,...t}){return g.jsx(h8,{"data-slot":"dialog-title",className:je("text-lg leading-none font-semibold",e),...t})}function _8({className:e,...t}){return g.jsx(p8,{"data-slot":"dialog-description",className:je("text-muted-foreground text-sm",e),...t})}var C8=Symbol.for("react.lazy"),Bu=Yu[" use ".trim().toString()];function E8(e){return typeof e=="object"&&e!==null&&"then"in e}function vC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===C8&&"_payload"in e&&E8(e._payload)}function bC(e){const t=R8(e),r=w.forwardRef((s,i)=>{let{children:c,...u}=s;vC(c)&&typeof Bu=="function"&&(c=Bu(c._payload));const f=w.Children.toArray(c),h=f.find(A8);if(h){const p=h.props.children,y=f.map(v=>v===h?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:v);return g.jsx(t,{...u,ref:i,children:w.isValidElement(p)?w.cloneElement(p,void 0,y):null})}return g.jsx(t,{...u,ref:i,children:c})});return r.displayName=`${e}.Slot`,r}var wC=bC("Slot");function R8(e){const t=w.forwardRef((r,s)=>{let{children:i,...c}=r;if(vC(i)&&typeof Bu=="function"&&(i=Bu(i._payload)),w.isValidElement(i)){const u=k8(i),f=O8(c,i.props);return i.type!==w.Fragment&&(f.ref=s?wc(s,u):u),w.cloneElement(i,f)}return w.Children.count(i)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var T8=Symbol("radix.slottable");function A8(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===T8}function O8(e,t){const r={...t};for(const s in t){const i=e[s],c=t[s];/^on[A-Z]/.test(s)?i&&c?r[s]=(...f)=>{const h=c(...f);return i(...f),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...c}:s==="className"&&(r[s]=[i,c].filter(Boolean).join(" "))}return{...e,...r}}function k8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const CS=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ES=q1,M8=(e,t)=>r=>{var s;if(t?.variants==null)return ES(e,r?.class,r?.className);const{variants:i,defaultVariants:c}=t,u=Object.keys(i).map(p=>{const y=r?.[p],v=c?.[p];if(y===null)return null;const b=CS(y)||CS(v);return i[p][b]}),f=r&&Object.entries(r).reduce((p,y)=>{let[v,b]=y;return b===void 0||(p[v]=b),p},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((p,y)=>{let{class:v,className:b,..._}=y;return Object.entries(_).every(E=>{let[x,C]=E;return Array.isArray(C)?C.includes({...c,...f}[x]):{...c,...f}[x]===C})?[...p,v,b]:p},[]);return ES(e,u,h,r?.class,r?.className)},N8=M8("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 sc({className:e,variant:t="default",size:r="default",asChild:s=!1,...i}){const c=s?wC:"button";return g.jsx(c,{"data-slot":"button","data-variant":t,"data-size":r,className:je(N8({variant:t,size:r,className:e})),...i})}const RS={fast:"duration-100 ease-out"},j8={primary:"default",secondary:"secondary",danger:"destructive",ghost:"ghost",outline:"outline",link:"link",success:"default",warning:"default"},z8={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"},D8=()=>g.jsxs("svg",{className:"size-4 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[g.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),g.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 $r({variant:e="primary",loading:t,disabled:r,children:s,className:i,asChild:c,...u}){const f=j8[e],h=z8[e];return c?g.jsx(sc,{variant:f,disabled:r||t,className:je(RS.fast,h,i),asChild:!0,...u,children:s}):g.jsxs(sc,{variant:f,disabled:r||t,className:je(RS.fast,h,i),...u,children:[t&&g.jsx(D8,{}),s]})}const P8={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl"};function rg({open:e,onOpenChange:t,title:r,description:s,children:i,footer:c,size:u="md",className:f}){return g.jsx(g8,{open:e,onOpenChange:t,children:g.jsxs(b8,{className:je("flex max-h-[85vh] flex-col overflow-hidden",P8[u],f),children:[g.jsxs(w8,{className:"shrink-0",children:[g.jsx(x8,{children:r}),s&&g.jsx(_8,{children:s})]}),g.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-4 [&::-webkit-scrollbar]:hidden",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:i}),c&&g.jsx(S8,{className:"shrink-0 border-t pt-4",children:c})]})})}function R7({open:e,onOpenChange:t,title:r,description:s,confirmLabel:i="Confirm",cancelLabel:c="Cancel",onConfirm:u,onCancel:f,variant:h="default",loading:p,isLoading:y,error:v}){const b=p??y??!1,_=()=>{f?.(),t(!1)},E=()=>{u()},x=()=>h==="danger"?"danger":h==="warning"?"warning":"primary";return g.jsx(rg,{open:e,onOpenChange:t,title:r,size:"sm",footer:g.jsxs(g.Fragment,{children:[g.jsx($r,{variant:"outline",onClick:_,disabled:b,children:c}),g.jsx($r,{variant:x(),onClick:E,loading:b,children:i})]}),children:g.jsxs("div",{className:"space-y-3",children:[g.jsx("p",{className:"text-sm text-muted-foreground",children:s}),v&&g.jsx("p",{className:"text-sm text-destructive",children:v})]})})}function os({className:e,type:t,...r}){return g.jsx("input",{type:t,"data-slot":"input",className:je("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),...r})}var L8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mf=L8.reduce((e,t)=>{const r=bC(`Primitive.${t}`),s=w.forwardRef((i,c)=>{const{asChild:u,...f}=i,h=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...f,ref:c})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),I8="Label",SC=w.forwardRef((e,t)=>g.jsx(mf.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));SC.displayName=I8;var $8=SC;function jn({className:e,...t}){return g.jsx($8,{"data-slot":"label",className:je("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 U8({className:e,...t}){return g.jsx("textarea",{"data-slot":"textarea",className:je("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 xC(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function _C(e){const[t,r]=w.useState(void 0);return Rt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const c=i[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;r({width:u,height:f})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var gf="Checkbox",[B8]=hr(gf),[q8,og]=B8(gf);function F8(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:i,disabled:c,form:u,name:f,onCheckedChange:h,required:p,value:y="on",internal_do_not_use_render:v}=e,[b,_]=To({prop:r,defaultProp:i??!1,onChange:h,caller:gf}),[E,x]=w.useState(null),[C,O]=w.useState(null),M=w.useRef(!1),k=E?!!u||!!E.closest("form"):!0,D={checked:b,disabled:c,setChecked:_,control:E,setControl:x,name:f,form:u,value:y,hasConsumerStoppedPropagationRef:M,required:p,defaultChecked:Co(i)?!1:i,isFormControl:k,bubbleInput:C,setBubbleInput:O};return g.jsx(q8,{scope:t,...D,children:V8(v)?v(D):s})}var CC="CheckboxTrigger",EC=w.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},i)=>{const{control:c,value:u,disabled:f,checked:h,required:p,setControl:y,setChecked:v,hasConsumerStoppedPropagationRef:b,isFormControl:_,bubbleInput:E}=og(CC,e),x=Ve(i,y),C=w.useRef(h);return w.useEffect(()=>{const O=c?.form;if(O){const M=()=>v(C.current);return O.addEventListener("reset",M),()=>O.removeEventListener("reset",M)}},[c,v]),g.jsx(ke.button,{type:"button",role:"checkbox","aria-checked":Co(h)?"mixed":h,"aria-required":p,"data-state":MC(h),"data-disabled":f?"":void 0,disabled:f,value:u,...s,ref:x,onKeyDown:he(t,O=>{O.key==="Enter"&&O.preventDefault()}),onClick:he(r,O=>{v(M=>Co(M)?!0:!M),E&&_&&(b.current=O.isPropagationStopped(),b.current||O.stopPropagation())})})});EC.displayName=CC;var RC=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:i,defaultChecked:c,required:u,disabled:f,value:h,onCheckedChange:p,form:y,...v}=e;return g.jsx(F8,{__scopeCheckbox:r,checked:i,defaultChecked:c,disabled:f,required:u,onCheckedChange:p,name:s,form:y,value:h,internal_do_not_use_render:({isFormControl:b})=>g.jsxs(g.Fragment,{children:[g.jsx(EC,{...v,ref:t,__scopeCheckbox:r}),b&&g.jsx(kC,{__scopeCheckbox:r})]})})});RC.displayName=gf;var TC="CheckboxIndicator",AC=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...i}=e,c=og(TC,r);return g.jsx(Un,{present:s||Co(c.checked)||c.checked===!0,children:g.jsx(ke.span,{"data-state":MC(c.checked),"data-disabled":c.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});AC.displayName=TC;var OC="CheckboxBubbleInput",kC=w.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:c,defaultChecked:u,required:f,disabled:h,name:p,value:y,form:v,bubbleInput:b,setBubbleInput:_}=og(OC,e),E=Ve(r,_),x=xC(c),C=_C(s);w.useEffect(()=>{const M=b;if(!M)return;const k=window.HTMLInputElement.prototype,U=Object.getOwnPropertyDescriptor(k,"checked").set,H=!i.current;if(x!==c&&U){const L=new Event("click",{bubbles:H});M.indeterminate=Co(c),U.call(M,Co(c)?!1:c),M.dispatchEvent(L)}},[b,x,c,i]);const O=w.useRef(Co(c)?!1:c);return g.jsx(ke.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??O.current,required:f,disabled:h,name:p,value:y,form:v,...t,tabIndex:-1,ref:E,style:{...t.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});kC.displayName=OC;function V8(e){return typeof e=="function"}function Co(e){return e==="indeterminate"}function MC(e){return Co(e)?"indeterminate":e?"checked":"unchecked"}function TS({className:e,...t}){return g.jsx(RC,{"data-slot":"checkbox",className:je("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:g.jsx(AC,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:g.jsx(M1,{className:"size-3.5"})})})}function AS(e,[t,r]){return Math.min(r,Math.max(t,e))}function sg(e){const t=e+"CollectionProvider",[r,s]=hr(t),[i,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=x=>{const{scope:C,children:O}=x,M=qt.useRef(null),k=qt.useRef(new Map).current;return g.jsx(i,{scope:C,itemMap:k,collectionRef:M,children:O})};u.displayName=t;const f=e+"CollectionSlot",h=gs(f),p=qt.forwardRef((x,C)=>{const{scope:O,children:M}=x,k=c(f,O),D=Ve(C,k.collectionRef);return g.jsx(h,{ref:D,children:M})});p.displayName=f;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=gs(y),_=qt.forwardRef((x,C)=>{const{scope:O,children:M,...k}=x,D=qt.useRef(null),U=Ve(C,D),H=c(y,O);return qt.useEffect(()=>(H.itemMap.set(D,{ref:D,...k}),()=>{H.itemMap.delete(D)})),g.jsx(b,{[v]:"",ref:U,children:M})});_.displayName=y;function E(x){const C=c(e+"CollectionConsumer",x);return qt.useCallback(()=>{const M=C.collectionRef.current;if(!M)return[];const k=Array.from(M.querySelectorAll(`[${v}]`));return Array.from(C.itemMap.values()).sort((H,L)=>k.indexOf(H.ref.current)-k.indexOf(L.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:u,Slot:p,ItemSlot:_},E,s]}var H8=w.createContext(void 0);function ag(e){const t=w.useContext(H8);return e||t||"ltr"}const Z8=["top","right","bottom","left"],Ao=Math.min,yn=Math.max,qu=Math.round,lu=Math.floor,lr=e=>({x:e,y:e}),Q8={left:"right",right:"left",bottom:"top",top:"bottom"},G8={start:"end",end:"start"};function rm(e,t,r){return yn(e,Ao(t,r))}function qr(e,t){return typeof e=="function"?e(t):e}function Fr(e){return e.split("-")[0]}function Va(e){return e.split("-")[1]}function ig(e){return e==="x"?"y":"x"}function cg(e){return e==="y"?"height":"width"}const Y8=new Set(["top","bottom"]);function cr(e){return Y8.has(Fr(e))?"y":"x"}function lg(e){return ig(cr(e))}function K8(e,t,r){r===void 0&&(r=!1);const s=Va(e),i=lg(e),c=cg(i);let u=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=Fu(u)),[u,Fu(u)]}function X8(e){const t=Fu(e);return[om(e),t,om(t)]}function om(e){return e.replace(/start|end/g,t=>G8[t])}const OS=["left","right"],kS=["right","left"],J8=["top","bottom"],W8=["bottom","top"];function eU(e,t,r){switch(e){case"top":case"bottom":return r?t?kS:OS:t?OS:kS;case"left":case"right":return t?J8:W8;default:return[]}}function tU(e,t,r,s){const i=Va(e);let c=eU(Fr(e),r==="start",s);return i&&(c=c.map(u=>u+"-"+i),t&&(c=c.concat(c.map(om)))),c}function Fu(e){return e.replace(/left|right|bottom|top/g,t=>Q8[t])}function nU(e){return{top:0,right:0,bottom:0,left:0,...e}}function NC(e){return typeof e!="number"?nU(e):{top:e,right:e,bottom:e,left:e}}function Vu(e){const{x:t,y:r,width:s,height:i}=e;return{width:s,height:i,top:r,left:t,right:t+s,bottom:r+i,x:t,y:r}}function MS(e,t,r){let{reference:s,floating:i}=e;const c=cr(t),u=lg(t),f=cg(u),h=Fr(t),p=c==="y",y=s.x+s.width/2-i.width/2,v=s.y+s.height/2-i.height/2,b=s[f]/2-i[f]/2;let _;switch(h){case"top":_={x:y,y:s.y-i.height};break;case"bottom":_={x:y,y:s.y+s.height};break;case"right":_={x:s.x+s.width,y:v};break;case"left":_={x:s.x-i.width,y:v};break;default:_={x:s.x,y:s.y}}switch(Va(t)){case"start":_[u]-=b*(r&&p?-1:1);break;case"end":_[u]+=b*(r&&p?-1:1);break}return _}const rU=async(e,t,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:c=[],platform:u}=r,f=c.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:y,y:v}=MS(p,s,h),b=s,_={},E=0;for(let x=0;x<f.length;x++){const{name:C,fn:O}=f[x],{x:M,y:k,data:D,reset:U}=await O({x:y,y:v,initialPlacement:s,placement:b,strategy:i,middlewareData:_,rects:p,platform:u,elements:{reference:e,floating:t}});y=M??y,v=k??v,_={..._,[C]:{..._[C],...D}},U&&E<=50&&(E++,typeof U=="object"&&(U.placement&&(b=U.placement),U.rects&&(p=U.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):U.rects),{x:y,y:v}=MS(p,b,h)),x=-1)}return{x:y,y:v,placement:b,strategy:i,middlewareData:_}};async function pc(e,t){var r;t===void 0&&(t={});const{x:s,y:i,platform:c,rects:u,elements:f,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:_=0}=qr(t,e),E=NC(_),C=f[b?v==="floating"?"reference":"floating":v],O=Vu(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(C)))==null||r?C:C.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:p,rootBoundary:y,strategy:h})),M=v==="floating"?{x:s,y:i,width:u.floating.width,height:u.floating.height}:u.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),D=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},U=Vu(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:M,offsetParent:k,strategy:h}):M);return{top:(O.top-U.top+E.top)/D.y,bottom:(U.bottom-O.bottom+E.bottom)/D.y,left:(O.left-U.left+E.left)/D.x,right:(U.right-O.right+E.right)/D.x}}const oU=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:i,rects:c,platform:u,elements:f,middlewareData:h}=t,{element:p,padding:y=0}=qr(e,t)||{};if(p==null)return{};const v=NC(y),b={x:r,y:s},_=lg(i),E=cg(_),x=await u.getDimensions(p),C=_==="y",O=C?"top":"left",M=C?"bottom":"right",k=C?"clientHeight":"clientWidth",D=c.reference[E]+c.reference[_]-b[_]-c.floating[E],U=b[_]-c.reference[_],H=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let L=H?H[k]:0;(!L||!await(u.isElement==null?void 0:u.isElement(H)))&&(L=f.floating[k]||c.floating[E]);const j=D/2-U/2,G=L/2-x[E]/2-1,ie=Ao(v[O],G),ae=Ao(v[M],G),te=ie,ce=L-x[E]-ae,le=L/2-x[E]/2+j,me=rm(te,le,ce),I=!h.arrow&&Va(i)!=null&&le!==me&&c.reference[E]/2-(le<te?ie:ae)-x[E]/2<0,K=I?le<te?le-te:le-ce:0;return{[_]:b[_]+K,data:{[_]:me,centerOffset:le-me-K,...I&&{alignmentOffset:K}},reset:I}}}),sU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:i,middlewareData:c,rects:u,initialPlacement:f,platform:h,elements:p}=t,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:b,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:x=!0,...C}=qr(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const O=Fr(i),M=cr(f),k=Fr(f)===f,D=await(h.isRTL==null?void 0:h.isRTL(p.floating)),U=b||(k||!x?[Fu(f)]:X8(f)),H=E!=="none";!b&&H&&U.push(...tU(f,x,E,D));const L=[f,...U],j=await pc(t,C),G=[];let ie=((s=c.flip)==null?void 0:s.overflows)||[];if(y&&G.push(j[O]),v){const le=K8(i,u,D);G.push(j[le[0]],j[le[1]])}if(ie=[...ie,{placement:i,overflows:G}],!G.every(le=>le<=0)){var ae,te;const le=(((ae=c.flip)==null?void 0:ae.index)||0)+1,me=L[le];if(me&&(!(v==="alignment"?M!==cr(me):!1)||ie.every(V=>cr(V.placement)===M?V.overflows[0]>0:!0)))return{data:{index:le,overflows:ie},reset:{placement:me}};let I=(te=ie.filter(K=>K.overflows[0]<=0).sort((K,V)=>K.overflows[1]-V.overflows[1])[0])==null?void 0:te.placement;if(!I)switch(_){case"bestFit":{var ce;const K=(ce=ie.filter(V=>{if(H){const re=cr(V.placement);return re===M||re==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(re=>re>0).reduce((re,ve)=>re+ve,0)]).sort((V,re)=>V[1]-re[1])[0])==null?void 0:ce[0];K&&(I=K);break}case"initialPlacement":I=f;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function NS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jS(e){return Z8.some(t=>e[t]>=0)}const aU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:s="referenceHidden",...i}=qr(e,t);switch(s){case"referenceHidden":{const c=await pc(t,{...i,elementContext:"reference"}),u=NS(c,r.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:jS(u)}}}case"escaped":{const c=await pc(t,{...i,altBoundary:!0}),u=NS(c,r.floating);return{data:{escapedOffsets:u,escaped:jS(u)}}}default:return{}}}}},jC=new Set(["left","top"]);async function iU(e,t){const{placement:r,platform:s,elements:i}=e,c=await(s.isRTL==null?void 0:s.isRTL(i.floating)),u=Fr(r),f=Va(r),h=cr(r)==="y",p=jC.has(u)?-1:1,y=c&&h?-1:1,v=qr(t,e);let{mainAxis:b,crossAxis:_,alignmentAxis:E}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return f&&typeof E=="number"&&(_=f==="end"?E*-1:E),h?{x:_*y,y:b*p}:{x:b*p,y:_*y}}const cU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:i,y:c,placement:u,middlewareData:f}=t,h=await iU(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(s=f.arrow)!=null&&s.alignmentOffset?{}:{x:i+h.x,y:c+h.y,data:{...h,placement:u}}}}},lU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:i}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:f={fn:C=>{let{x:O,y:M}=C;return{x:O,y:M}}},...h}=qr(e,t),p={x:r,y:s},y=await pc(t,h),v=cr(Fr(i)),b=ig(v);let _=p[b],E=p[v];if(c){const C=b==="y"?"top":"left",O=b==="y"?"bottom":"right",M=_+y[C],k=_-y[O];_=rm(M,_,k)}if(u){const C=v==="y"?"top":"left",O=v==="y"?"bottom":"right",M=E+y[C],k=E-y[O];E=rm(M,E,k)}const x=f.fn({...t,[b]:_,[v]:E});return{...x,data:{x:x.x-r,y:x.y-s,enabled:{[b]:c,[v]:u}}}}}},uU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:i,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:h=!0,crossAxis:p=!0}=qr(e,t),y={x:r,y:s},v=cr(i),b=ig(v);let _=y[b],E=y[v];const x=qr(f,t),C=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(h){const k=b==="y"?"height":"width",D=c.reference[b]-c.floating[k]+C.mainAxis,U=c.reference[b]+c.reference[k]-C.mainAxis;_<D?_=D:_>U&&(_=U)}if(p){var O,M;const k=b==="y"?"width":"height",D=jC.has(Fr(i)),U=c.reference[v]-c.floating[k]+(D&&((O=u.offset)==null?void 0:O[v])||0)+(D?0:C.crossAxis),H=c.reference[v]+c.reference[k]+(D?0:((M=u.offset)==null?void 0:M[v])||0)-(D?C.crossAxis:0);E<U?E=U:E>H&&(E=H)}return{[b]:_,[v]:E}}}},fU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:i,rects:c,platform:u,elements:f}=t,{apply:h=()=>{},...p}=qr(e,t),y=await pc(t,p),v=Fr(i),b=Va(i),_=cr(i)==="y",{width:E,height:x}=c.floating;let C,O;v==="top"||v==="bottom"?(C=v,O=b===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(O=v,C=b==="end"?"top":"bottom");const M=x-y.top-y.bottom,k=E-y.left-y.right,D=Ao(x-y[C],M),U=Ao(E-y[O],k),H=!t.middlewareData.shift;let L=D,j=U;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(j=k),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=M),H&&!b){const ie=yn(y.left,0),ae=yn(y.right,0),te=yn(y.top,0),ce=yn(y.bottom,0);_?j=E-2*(ie!==0||ae!==0?ie+ae:yn(y.left,y.right)):L=x-2*(te!==0||ce!==0?te+ce:yn(y.top,y.bottom))}await h({...t,availableWidth:j,availableHeight:L});const G=await u.getDimensions(f.floating);return E!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function yf(){return typeof window<"u"}function Ha(e){return zC(e)?(e.nodeName||"").toLowerCase():"#document"}function bn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pr(e){var t;return(t=(zC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zC(e){return yf()?e instanceof Node||e instanceof bn(e).Node:!1}function Kn(e){return yf()?e instanceof Element||e instanceof bn(e).Element:!1}function fr(e){return yf()?e instanceof HTMLElement||e instanceof bn(e).HTMLElement:!1}function zS(e){return!yf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bn(e).ShadowRoot}const dU=new Set(["inline","contents"]);function Ec(e){const{overflow:t,overflowX:r,overflowY:s,display:i}=Xn(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&!dU.has(i)}const hU=new Set(["table","td","th"]);function pU(e){return hU.has(Ha(e))}const mU=[":popover-open",":modal"];function vf(e){return mU.some(t=>{try{return e.matches(t)}catch{return!1}})}const gU=["transform","translate","scale","rotate","perspective"],yU=["transform","translate","scale","rotate","perspective","filter"],vU=["paint","layout","strict","content"];function ug(e){const t=fg(),r=Kn(e)?Xn(e):e;return gU.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||yU.some(s=>(r.willChange||"").includes(s))||vU.some(s=>(r.contain||"").includes(s))}function bU(e){let t=Oo(e);for(;fr(t)&&!La(t);){if(ug(t))return t;if(vf(t))return null;t=Oo(t)}return null}function fg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wU=new Set(["html","body","#document"]);function La(e){return wU.has(Ha(e))}function Xn(e){return bn(e).getComputedStyle(e)}function bf(e){return Kn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oo(e){if(Ha(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zS(e)&&e.host||pr(e);return zS(t)?t.host:t}function DC(e){const t=Oo(e);return La(t)?e.ownerDocument?e.ownerDocument.body:e.body:fr(t)&&Ec(t)?t:DC(t)}function mc(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=DC(e),c=i===((s=e.ownerDocument)==null?void 0:s.body),u=bn(i);if(c){const f=sm(u);return t.concat(u,u.visualViewport||[],Ec(i)?i:[],f&&r?mc(f):[])}return t.concat(i,mc(i,[],r))}function sm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PC(e){const t=Xn(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=fr(e),c=i?e.offsetWidth:r,u=i?e.offsetHeight:s,f=qu(r)!==c||qu(s)!==u;return f&&(r=c,s=u),{width:r,height:s,$:f}}function dg(e){return Kn(e)?e:e.contextElement}function Na(e){const t=dg(e);if(!fr(t))return lr(1);const r=t.getBoundingClientRect(),{width:s,height:i,$:c}=PC(t);let u=(c?qu(r.width):r.width)/s,f=(c?qu(r.height):r.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const SU=lr(0);function LC(e){const t=bn(e);return!fg()||!t.visualViewport?SU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xU(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==bn(e)?!1:t}function vs(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),c=dg(e);let u=lr(1);t&&(s?Kn(s)&&(u=Na(s)):u=Na(e));const f=xU(c,r,s)?LC(c):lr(0);let h=(i.left+f.x)/u.x,p=(i.top+f.y)/u.y,y=i.width/u.x,v=i.height/u.y;if(c){const b=bn(c),_=s&&Kn(s)?bn(s):s;let E=b,x=sm(E);for(;x&&s&&_!==E;){const C=Na(x),O=x.getBoundingClientRect(),M=Xn(x),k=O.left+(x.clientLeft+parseFloat(M.paddingLeft))*C.x,D=O.top+(x.clientTop+parseFloat(M.paddingTop))*C.y;h*=C.x,p*=C.y,y*=C.x,v*=C.y,h+=k,p+=D,E=bn(x),x=sm(E)}}return Vu({width:y,height:v,x:h,y:p})}function wf(e,t){const r=bf(e).scrollLeft;return t?t.left+r:vs(pr(e)).left+r}function IC(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-wf(e,r),i=r.top+t.scrollTop;return{x:s,y:i}}function _U(e){let{elements:t,rect:r,offsetParent:s,strategy:i}=e;const c=i==="fixed",u=pr(s),f=t?vf(t.floating):!1;if(s===u||f&&c)return r;let h={scrollLeft:0,scrollTop:0},p=lr(1);const y=lr(0),v=fr(s);if((v||!v&&!c)&&((Ha(s)!=="body"||Ec(u))&&(h=bf(s)),fr(s))){const _=vs(s);p=Na(s),y.x=_.x+s.clientLeft,y.y=_.y+s.clientTop}const b=u&&!v&&!c?IC(u,h):lr(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-h.scrollLeft*p.x+y.x+b.x,y:r.y*p.y-h.scrollTop*p.y+y.y+b.y}}function CU(e){return Array.from(e.getClientRects())}function EU(e){const t=pr(e),r=bf(e),s=e.ownerDocument.body,i=yn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),c=yn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-r.scrollLeft+wf(e);const f=-r.scrollTop;return Xn(s).direction==="rtl"&&(u+=yn(t.clientWidth,s.clientWidth)-i),{width:i,height:c,x:u,y:f}}const DS=25;function RU(e,t){const r=bn(e),s=pr(e),i=r.visualViewport;let c=s.clientWidth,u=s.clientHeight,f=0,h=0;if(i){c=i.width,u=i.height;const y=fg();(!y||y&&t==="fixed")&&(f=i.offsetLeft,h=i.offsetTop)}const p=wf(s);if(p<=0){const y=s.ownerDocument,v=y.body,b=getComputedStyle(v),_=y.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,E=Math.abs(s.clientWidth-v.clientWidth-_);E<=DS&&(c-=E)}else p<=DS&&(c+=p);return{width:c,height:u,x:f,y:h}}const TU=new Set(["absolute","fixed"]);function AU(e,t){const r=vs(e,!0,t==="fixed"),s=r.top+e.clientTop,i=r.left+e.clientLeft,c=fr(e)?Na(e):lr(1),u=e.clientWidth*c.x,f=e.clientHeight*c.y,h=i*c.x,p=s*c.y;return{width:u,height:f,x:h,y:p}}function PS(e,t,r){let s;if(t==="viewport")s=RU(e,r);else if(t==="document")s=EU(pr(e));else if(Kn(t))s=AU(t,r);else{const i=LC(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Vu(s)}function $C(e,t){const r=Oo(e);return r===t||!Kn(r)||La(r)?!1:Xn(r).position==="fixed"||$C(r,t)}function OU(e,t){const r=t.get(e);if(r)return r;let s=mc(e,[],!1).filter(f=>Kn(f)&&Ha(f)!=="body"),i=null;const c=Xn(e).position==="fixed";let u=c?Oo(e):e;for(;Kn(u)&&!La(u);){const f=Xn(u),h=ug(u);!h&&f.position==="fixed"&&(i=null),(c?!h&&!i:!h&&f.position==="static"&&!!i&&TU.has(i.position)||Ec(u)&&!h&&$C(e,u))?s=s.filter(y=>y!==u):i=f,u=Oo(u)}return t.set(e,s),s}function kU(e){let{element:t,boundary:r,rootBoundary:s,strategy:i}=e;const u=[...r==="clippingAncestors"?vf(t)?[]:OU(t,this._c):[].concat(r),s],f=u[0],h=u.reduce((p,y)=>{const v=PS(t,y,i);return p.top=yn(v.top,p.top),p.right=Ao(v.right,p.right),p.bottom=Ao(v.bottom,p.bottom),p.left=yn(v.left,p.left),p},PS(t,f,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function MU(e){const{width:t,height:r}=PC(e);return{width:t,height:r}}function NU(e,t,r){const s=fr(t),i=pr(t),c=r==="fixed",u=vs(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const h=lr(0);function p(){h.x=wf(i)}if(s||!s&&!c)if((Ha(t)!=="body"||Ec(i))&&(f=bf(t)),s){const _=vs(t,!0,c,t);h.x=_.x+t.clientLeft,h.y=_.y+t.clientTop}else i&&p();c&&!s&&i&&p();const y=i&&!s&&!c?IC(i,f):lr(0),v=u.left+f.scrollLeft-h.x-y.x,b=u.top+f.scrollTop-h.y-y.y;return{x:v,y:b,width:u.width,height:u.height}}function kp(e){return Xn(e).position==="static"}function LS(e,t){if(!fr(e)||Xn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pr(e)===r&&(r=r.ownerDocument.body),r}function UC(e,t){const r=bn(e);if(vf(e))return r;if(!fr(e)){let i=Oo(e);for(;i&&!La(i);){if(Kn(i)&&!kp(i))return i;i=Oo(i)}return r}let s=LS(e,t);for(;s&&pU(s)&&kp(s);)s=LS(s,t);return s&&La(s)&&kp(s)&&!ug(s)?r:s||bU(e)||r}const jU=async function(e){const t=this.getOffsetParent||UC,r=this.getDimensions,s=await r(e.floating);return{reference:NU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function zU(e){return Xn(e).direction==="rtl"}const DU={convertOffsetParentRelativeRectToViewportRelativeRect:_U,getDocumentElement:pr,getClippingRect:kU,getOffsetParent:UC,getElementRects:jU,getClientRects:CU,getDimensions:MU,getScale:Na,isElement:Kn,isRTL:zU};function BC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PU(e,t){let r=null,s;const i=pr(e);function c(){var f;clearTimeout(s),(f=r)==null||f.disconnect(),r=null}function u(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),c();const p=e.getBoundingClientRect(),{left:y,top:v,width:b,height:_}=p;if(f||t(),!b||!_)return;const E=lu(v),x=lu(i.clientWidth-(y+b)),C=lu(i.clientHeight-(v+_)),O=lu(y),k={rootMargin:-E+"px "+-x+"px "+-C+"px "+-O+"px",threshold:yn(0,Ao(1,h))||1};let D=!0;function U(H){const L=H[0].intersectionRatio;if(L!==h){if(!D)return u();L?u(!1,L):s=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!BC(p,e.getBoundingClientRect())&&u(),D=!1}try{r=new IntersectionObserver(U,{...k,root:i.ownerDocument})}catch{r=new IntersectionObserver(U,k)}r.observe(e)}return u(!0),c}function LU(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=dg(e),y=i||c?[...p?mc(p):[],...mc(t)]:[];y.forEach(O=>{i&&O.addEventListener("scroll",r,{passive:!0}),c&&O.addEventListener("resize",r)});const v=p&&f?PU(p,r):null;let b=-1,_=null;u&&(_=new ResizeObserver(O=>{let[M]=O;M&&M.target===p&&_&&(_.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var k;(k=_)==null||k.observe(t)})),r()}),p&&!h&&_.observe(p),_.observe(t));let E,x=h?vs(e):null;h&&C();function C(){const O=vs(e);x&&!BC(x,O)&&r(),x=O,E=requestAnimationFrame(C)}return r(),()=>{var O;y.forEach(M=>{i&&M.removeEventListener("scroll",r),c&&M.removeEventListener("resize",r)}),v?.(),(O=_)==null||O.disconnect(),_=null,h&&cancelAnimationFrame(E)}}const IU=cU,$U=lU,UU=sU,BU=fU,qU=aU,IS=oU,FU=uU,VU=(e,t,r)=>{const s=new Map,i={platform:DU,...r},c={...i.platform,_c:s};return rU(e,t,{...i,platform:c})};var HU=typeof document<"u",ZU=function(){},yu=HU?w.useLayoutEffect:ZU;function Hu(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 r,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!Hu(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=r;s--!==0;){const c=i[s];if(!(c==="_owner"&&e.$$typeof)&&!Hu(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function qC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $S(e,t){const r=qC(e);return Math.round(t*r)/r}function Mp(e){const t=w.useRef(e);return yu(()=>{t.current=e}),t}function QU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:i,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:h,open:p}=e,[y,v]=w.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,_]=w.useState(s);Hu(b,s)||_(s);const[E,x]=w.useState(null),[C,O]=w.useState(null),M=w.useCallback(V=>{V!==H.current&&(H.current=V,x(V))},[]),k=w.useCallback(V=>{V!==L.current&&(L.current=V,O(V))},[]),D=c||E,U=u||C,H=w.useRef(null),L=w.useRef(null),j=w.useRef(y),G=h!=null,ie=Mp(h),ae=Mp(i),te=Mp(p),ce=w.useCallback(()=>{if(!H.current||!L.current)return;const V={placement:t,strategy:r,middleware:b};ae.current&&(V.platform=ae.current),VU(H.current,L.current,V).then(re=>{const ve={...re,isPositioned:te.current!==!1};le.current&&!Hu(j.current,ve)&&(j.current=ve,$a.flushSync(()=>{v(ve)}))})},[b,t,r,ae,te]);yu(()=>{p===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,v(V=>({...V,isPositioned:!1})))},[p]);const le=w.useRef(!1);yu(()=>(le.current=!0,()=>{le.current=!1}),[]),yu(()=>{if(D&&(H.current=D),U&&(L.current=U),D&&U){if(ie.current)return ie.current(D,U,ce);ce()}},[D,U,ce,ie,G]);const me=w.useMemo(()=>({reference:H,floating:L,setReference:M,setFloating:k}),[M,k]),I=w.useMemo(()=>({reference:D,floating:U}),[D,U]),K=w.useMemo(()=>{const V={position:r,left:0,top:0};if(!I.floating)return V;const re=$S(I.floating,y.x),ve=$S(I.floating,y.y);return f?{...V,transform:"translate("+re+"px, "+ve+"px)",...qC(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:re,top:ve}},[r,f,I.floating,y.x,y.y]);return w.useMemo(()=>({...y,update:ce,refs:me,elements:I,floatingStyles:K}),[y,ce,me,I,K])}const GU=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:i}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?IS({element:s.current,padding:i}).fn(r):{}:s?IS({element:s,padding:i}).fn(r):{}}}},YU=(e,t)=>({...IU(e),options:[e,t]}),KU=(e,t)=>({...$U(e),options:[e,t]}),XU=(e,t)=>({...FU(e),options:[e,t]}),JU=(e,t)=>({...UU(e),options:[e,t]}),WU=(e,t)=>({...BU(e),options:[e,t]}),eB=(e,t)=>({...qU(e),options:[e,t]}),tB=(e,t)=>({...GU(e),options:[e,t]});var nB="Arrow",FC=w.forwardRef((e,t)=>{const{children:r,width:s=10,height:i=5,...c}=e;return g.jsx(ke.svg,{...c,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});FC.displayName=nB;var rB=FC,hg="Popper",[VC,Za]=hr(hg),[oB,HC]=VC(hg),ZC=e=>{const{__scopePopper:t,children:r}=e,[s,i]=w.useState(null);return g.jsx(oB,{scope:t,anchor:s,onAnchorChange:i,children:r})};ZC.displayName=hg;var QC="PopperAnchor",GC=w.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...i}=e,c=HC(QC,r),u=w.useRef(null),f=Ve(t,u),h=w.useRef(null);return w.useEffect(()=>{const p=h.current;h.current=s?.current||u.current,p!==h.current&&c.onAnchorChange(h.current)}),s?null:g.jsx(ke.div,{...i,ref:f})});GC.displayName=QC;var pg="PopperContent",[sB,aB]=VC(pg),YC=w.forwardRef((e,t)=>{const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:c="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:_="optimized",onPlaced:E,...x}=e,C=HC(pg,r),[O,M]=w.useState(null),k=Ve(t,X=>M(X)),[D,U]=w.useState(null),H=_C(D),L=H?.width??0,j=H?.height??0,G=s+(c!=="center"?"-"+c:""),ie=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ae=Array.isArray(p)?p:[p],te=ae.length>0,ce={padding:ie,boundary:ae.filter(cB),altBoundary:te},{refs:le,floatingStyles:me,placement:I,isPositioned:K,middlewareData:V}=QU({strategy:"fixed",placement:G,whileElementsMounted:(...X)=>LU(...X,{animationFrame:_==="always"}),elements:{reference:C.anchor},middleware:[YU({mainAxis:i+j,alignmentAxis:u}),h&&KU({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?XU():void 0,...ce}),h&&JU({...ce}),WU({...ce,apply:({elements:X,rects:_e,availableWidth:xe,availableHeight:Re})=>{const{width:Ae,height:Le}=_e.reference,yt=X.floating.style;yt.setProperty("--radix-popper-available-width",`${xe}px`),yt.setProperty("--radix-popper-available-height",`${Re}px`),yt.setProperty("--radix-popper-anchor-width",`${Ae}px`),yt.setProperty("--radix-popper-anchor-height",`${Le}px`)}}),D&&tB({element:D,padding:f}),lB({arrowWidth:L,arrowHeight:j}),b&&eB({strategy:"referenceHidden",...ce})]}),[re,ve]=JC(I),z=Yn(E);Rt(()=>{K&&z?.()},[K,z]);const Q=V.arrow?.x,ne=V.arrow?.y,oe=V.arrow?.centerOffset!==0,[pe,ye]=w.useState();return Rt(()=>{O&&ye(window.getComputedStyle(O).zIndex)},[O]),g.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...me,transform:K?me.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:pe,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(sB,{scope:r,placedSide:re,onArrowChange:U,arrowX:Q,arrowY:ne,shouldHideArrow:oe,children:g.jsx(ke.div,{"data-side":re,"data-align":ve,...x,ref:k,style:{...x.style,animation:K?void 0:"none"}})})})});YC.displayName=pg;var KC="PopperArrow",iB={top:"bottom",right:"left",bottom:"top",left:"right"},XC=w.forwardRef(function(t,r){const{__scopePopper:s,...i}=t,c=aB(KC,s),u=iB[c.placedSide];return g.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:g.jsx(rB,{...i,ref:r,style:{...i.style,display:"block"}})})});XC.displayName=KC;function cB(e){return e!==null}var lB=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:s,middlewareData:i}=t,u=i.arrow?.centerOffset!==0,f=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[p,y]=JC(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(i.arrow?.x??0)+f/2,_=(i.arrow?.y??0)+h/2;let E="",x="";return p==="bottom"?(E=u?v:`${b}px`,x=`${-h}px`):p==="top"?(E=u?v:`${b}px`,x=`${s.floating.height+h}px`):p==="right"?(E=`${-h}px`,x=u?v:`${_}px`):p==="left"&&(E=`${s.floating.width+h}px`,x=u?v:`${_}px`),{data:{x:E,y:x}}}});function JC(e){const[t,r="center"]=e.split("-");return[t,r]}var mg=ZC,Sf=GC,gg=YC,yg=XC,WC=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"}),uB="VisuallyHidden",fB=w.forwardRef((e,t)=>g.jsx(ke.span,{...e,ref:t,style:{...WC,...e.style}}));fB.displayName=uB;var dB=[" ","Enter","ArrowUp","ArrowDown"],hB=[" ","Enter"],bs="Select",[xf,_f,pB]=sg(bs),[Qa]=hr(bs,[pB,Za]),Cf=Za(),[mB,Do]=Qa(bs),[gB,yB]=Qa(bs),eE=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:i,onOpenChange:c,value:u,defaultValue:f,onValueChange:h,dir:p,name:y,autoComplete:v,disabled:b,required:_,form:E}=e,x=Cf(t),[C,O]=w.useState(null),[M,k]=w.useState(null),[D,U]=w.useState(!1),H=ag(p),[L,j]=To({prop:s,defaultProp:i??!1,onChange:c,caller:bs}),[G,ie]=To({prop:u,defaultProp:f,onChange:h,caller:bs}),ae=w.useRef(null),te=C?E||!!C.closest("form"):!0,[ce,le]=w.useState(new Set),me=Array.from(ce).map(I=>I.props.value).join(";");return g.jsx(mg,{...x,children:g.jsxs(mB,{required:_,scope:t,trigger:C,onTriggerChange:O,valueNode:M,onValueNodeChange:k,valueNodeHasChildren:D,onValueNodeHasChildrenChange:U,contentId:Qn(),value:G,onValueChange:ie,open:L,onOpenChange:j,dir:H,triggerPointerDownPosRef:ae,disabled:b,children:[g.jsx(xf.Provider,{scope:t,children:g.jsx(gB,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(I=>{le(K=>new Set(K).add(I))},[]),onNativeOptionRemove:w.useCallback(I=>{le(K=>{const V=new Set(K);return V.delete(I),V})},[]),children:r})}),te?g.jsxs(xE,{"aria-hidden":!0,required:_,tabIndex:-1,name:y,autoComplete:v,value:G,onChange:I=>ie(I.target.value),disabled:b,form:E,children:[G===void 0?g.jsx("option",{value:""}):null,Array.from(ce)]},me):null]})})};eE.displayName=bs;var tE="SelectTrigger",nE=w.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...i}=e,c=Cf(r),u=Do(tE,r),f=u.disabled||s,h=Ve(t,u.onTriggerChange),p=_f(r),y=w.useRef("touch"),[v,b,_]=CE(x=>{const C=p().filter(k=>!k.disabled),O=C.find(k=>k.value===u.value),M=EE(C,x,O);M!==void 0&&u.onValueChange(M.value)}),E=x=>{f||(u.onOpenChange(!0),_()),x&&(u.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return g.jsx(Sf,{asChild:!0,...c,children:g.jsx(ke.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":_E(u.value)?"":void 0,...i,ref:h,onClick:he(i.onClick,x=>{x.currentTarget.focus(),y.current!=="mouse"&&E(x)}),onPointerDown:he(i.onPointerDown,x=>{y.current=x.pointerType;const C=x.target;C.hasPointerCapture(x.pointerId)&&C.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(E(x),x.preventDefault())}),onKeyDown:he(i.onKeyDown,x=>{const C=v.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&b(x.key),!(C&&x.key===" ")&&dB.includes(x.key)&&(E(),x.preventDefault())})})})});nE.displayName=tE;var rE="SelectValue",oE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,children:c,placeholder:u="",...f}=e,h=Do(rE,r),{onValueNodeHasChildrenChange:p}=h,y=c!==void 0,v=Ve(t,h.onValueNodeChange);return Rt(()=>{p(y)},[p,y]),g.jsx(ke.span,{...f,ref:v,style:{pointerEvents:"none"},children:_E(h.value)?g.jsx(g.Fragment,{children:u}):c})});oE.displayName=rE;var vB="SelectIcon",sE=w.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...i}=e;return g.jsx(ke.span,{"aria-hidden":!0,...i,ref:t,children:s||"▼"})});sE.displayName=vB;var bB="SelectPortal",aE=e=>g.jsx(_c,{asChild:!0,...e});aE.displayName=bB;var ws="SelectContent",iE=w.forwardRef((e,t)=>{const r=Do(ws,e.__scopeSelect),[s,i]=w.useState();if(Rt(()=>{i(new DocumentFragment)},[]),!r.open){const c=s;return c?$a.createPortal(g.jsx(cE,{scope:e.__scopeSelect,children:g.jsx(xf.Slot,{scope:e.__scopeSelect,children:g.jsx("div",{children:e.children})})}),c):null}return g.jsx(lE,{...e,ref:t})});iE.displayName=ws;var Hn=10,[cE,Po]=Qa(ws),wB="SelectContentImpl",SB=gs("SelectContent.RemoveScroll"),lE=w.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:u,side:f,sideOffset:h,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:_,sticky:E,hideWhenDetached:x,avoidCollisions:C,...O}=e,M=Do(ws,r),[k,D]=w.useState(null),[U,H]=w.useState(null),L=Ve(t,X=>D(X)),[j,G]=w.useState(null),[ie,ae]=w.useState(null),te=_f(r),[ce,le]=w.useState(!1),me=w.useRef(!1);w.useEffect(()=>{if(k)return hf(k)},[k]),ff();const I=w.useCallback(X=>{const[_e,...xe]=te().map(Le=>Le.ref.current),[Re]=xe.slice(-1),Ae=document.activeElement;for(const Le of X)if(Le===Ae||(Le?.scrollIntoView({block:"nearest"}),Le===_e&&U&&(U.scrollTop=0),Le===Re&&U&&(U.scrollTop=U.scrollHeight),Le?.focus(),document.activeElement!==Ae))return},[te,U]),K=w.useCallback(()=>I([j,k]),[I,j,k]);w.useEffect(()=>{ce&&K()},[ce,K]);const{onOpenChange:V,triggerPointerDownPosRef:re}=M;w.useEffect(()=>{if(k){let X={x:0,y:0};const _e=Re=>{X={x:Math.abs(Math.round(Re.pageX)-(re.current?.x??0)),y:Math.abs(Math.round(Re.pageY)-(re.current?.y??0))}},xe=Re=>{X.x<=10&&X.y<=10?Re.preventDefault():k.contains(Re.target)||V(!1),document.removeEventListener("pointermove",_e),re.current=null};return re.current!==null&&(document.addEventListener("pointermove",_e),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",xe,{capture:!0})}}},[k,V,re]),w.useEffect(()=>{const X=()=>V(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[V]);const[ve,z]=CE(X=>{const _e=te().filter(Ae=>!Ae.disabled),xe=_e.find(Ae=>Ae.ref.current===document.activeElement),Re=EE(_e,X,xe);Re&&setTimeout(()=>Re.ref.current.focus())}),Q=w.useCallback((X,_e,xe)=>{const Re=!me.current&&!xe;(M.value!==void 0&&M.value===_e||Re)&&(G(X),Re&&(me.current=!0))},[M.value]),ne=w.useCallback(()=>k?.focus(),[k]),oe=w.useCallback((X,_e,xe)=>{const Re=!me.current&&!xe;(M.value!==void 0&&M.value===_e||Re)&&ae(X)},[M.value]),pe=s==="popper"?am:uE,ye=pe===am?{side:f,sideOffset:h,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:_,sticky:E,hideWhenDetached:x,avoidCollisions:C}:{};return g.jsx(cE,{scope:r,content:k,viewport:U,onViewportChange:H,itemRefCallback:Q,selectedItem:j,onItemLeave:ne,itemTextRefCallback:oe,focusSelectedItem:K,selectedItemText:ie,position:s,isPositioned:ce,searchRef:ve,children:g.jsx(Cc,{as:SB,allowPinchZoom:!0,children:g.jsx(xc,{asChild:!0,trapped:M.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:he(i,X=>{M.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:g.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:g.jsx(pe,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:X=>X.preventDefault(),...O,...ye,onPlaced:()=>le(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...O.style},onKeyDown:he(O.onKeyDown,X=>{const _e=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!_e&&X.key.length===1&&z(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let Re=te().filter(Ae=>!Ae.disabled).map(Ae=>Ae.ref.current);if(["ArrowUp","End"].includes(X.key)&&(Re=Re.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const Ae=X.target,Le=Re.indexOf(Ae);Re=Re.slice(Le+1)}setTimeout(()=>I(Re)),X.preventDefault()}})})})})})})});lE.displayName=wB;var xB="SelectItemAlignedPosition",uE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...i}=e,c=Do(ws,r),u=Po(ws,r),[f,h]=w.useState(null),[p,y]=w.useState(null),v=Ve(t,L=>y(L)),b=_f(r),_=w.useRef(!1),E=w.useRef(!0),{viewport:x,selectedItem:C,selectedItemText:O,focusSelectedItem:M}=u,k=w.useCallback(()=>{if(c.trigger&&c.valueNode&&f&&p&&x&&C&&O){const L=c.trigger.getBoundingClientRect(),j=p.getBoundingClientRect(),G=c.valueNode.getBoundingClientRect(),ie=O.getBoundingClientRect();if(c.dir!=="rtl"){const Ae=ie.left-j.left,Le=G.left-Ae,yt=L.left-Le,vt=L.width+yt,Sn=Math.max(vt,j.width),Yt=window.innerWidth-Hn,nt=AS(Le,[Hn,Math.max(Hn,Yt-Sn)]);f.style.minWidth=vt+"px",f.style.left=nt+"px"}else{const Ae=j.right-ie.right,Le=window.innerWidth-G.right-Ae,yt=window.innerWidth-L.right-Le,vt=L.width+yt,Sn=Math.max(vt,j.width),Yt=window.innerWidth-Hn,nt=AS(Le,[Hn,Math.max(Hn,Yt-Sn)]);f.style.minWidth=vt+"px",f.style.right=nt+"px"}const ae=b(),te=window.innerHeight-Hn*2,ce=x.scrollHeight,le=window.getComputedStyle(p),me=parseInt(le.borderTopWidth,10),I=parseInt(le.paddingTop,10),K=parseInt(le.borderBottomWidth,10),V=parseInt(le.paddingBottom,10),re=me+I+ce+V+K,ve=Math.min(C.offsetHeight*5,re),z=window.getComputedStyle(x),Q=parseInt(z.paddingTop,10),ne=parseInt(z.paddingBottom,10),oe=L.top+L.height/2-Hn,pe=te-oe,ye=C.offsetHeight/2,X=C.offsetTop+ye,_e=me+I+X,xe=re-_e;if(_e<=oe){const Ae=ae.length>0&&C===ae[ae.length-1].ref.current;f.style.bottom="0px";const Le=p.clientHeight-x.offsetTop-x.offsetHeight,yt=Math.max(pe,ye+(Ae?ne:0)+Le+K),vt=_e+yt;f.style.height=vt+"px"}else{const Ae=ae.length>0&&C===ae[0].ref.current;f.style.top="0px";const yt=Math.max(oe,me+x.offsetTop+(Ae?Q:0)+ye)+xe;f.style.height=yt+"px",x.scrollTop=_e-oe+x.offsetTop}f.style.margin=`${Hn}px 0`,f.style.minHeight=ve+"px",f.style.maxHeight=te+"px",s?.(),requestAnimationFrame(()=>_.current=!0)}},[b,c.trigger,c.valueNode,f,p,x,C,O,c.dir,s]);Rt(()=>k(),[k]);const[D,U]=w.useState();Rt(()=>{p&&U(window.getComputedStyle(p).zIndex)},[p]);const H=w.useCallback(L=>{L&&E.current===!0&&(k(),M?.(),E.current=!1)},[k,M]);return g.jsx(CB,{scope:r,contentWrapper:f,shouldExpandOnScrollRef:_,onScrollButtonChange:H,children:g.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:D},children:g.jsx(ke.div,{...i,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});uE.displayName=xB;var _B="SelectPopperPosition",am=w.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:i=Hn,...c}=e,u=Cf(r);return g.jsx(gg,{...u,...c,ref:t,align:s,collisionPadding:i,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)"}})});am.displayName=_B;var[CB,vg]=Qa(ws,{}),im="SelectViewport",fE=w.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...i}=e,c=Po(im,r),u=vg(im,r),f=Ve(t,c.onViewportChange),h=w.useRef(0);return g.jsxs(g.Fragment,{children:[g.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:s}),g.jsx(xf.Slot,{scope:r,children:g.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:he(i.onScroll,p=>{const y=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const _=Math.abs(h.current-y.scrollTop);if(_>0){const E=window.innerHeight-Hn*2,x=parseFloat(v.style.minHeight),C=parseFloat(v.style.height),O=Math.max(x,C);if(O<E){const M=O+_,k=Math.min(E,M),D=M-k;v.style.height=k+"px",v.style.bottom==="0px"&&(y.scrollTop=D>0?D:0,v.style.justifyContent="flex-end")}}}h.current=y.scrollTop})})})]})});fE.displayName=im;var dE="SelectGroup",[EB,RB]=Qa(dE),TB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=Qn();return g.jsx(EB,{scope:r,id:i,children:g.jsx(ke.div,{role:"group","aria-labelledby":i,...s,ref:t})})});TB.displayName=dE;var hE="SelectLabel",AB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=RB(hE,r);return g.jsx(ke.div,{id:i.id,...s,ref:t})});AB.displayName=hE;var Zu="SelectItem",[OB,pE]=Qa(Zu),mE=w.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:i=!1,textValue:c,...u}=e,f=Do(Zu,r),h=Po(Zu,r),p=f.value===s,[y,v]=w.useState(c??""),[b,_]=w.useState(!1),E=Ve(t,M=>h.itemRefCallback?.(M,s,i)),x=Qn(),C=w.useRef("touch"),O=()=>{i||(f.onValueChange(s),f.onOpenChange(!1))};if(s==="")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 g.jsx(OB,{scope:r,value:s,disabled:i,textId:x,isSelected:p,onItemTextChange:w.useCallback(M=>{v(k=>k||(M?.textContent??"").trim())},[]),children:g.jsx(xf.ItemSlot,{scope:r,value:s,disabled:i,textValue:y,children:g.jsx(ke.div,{role:"option","aria-labelledby":x,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:E,onFocus:he(u.onFocus,()=>_(!0)),onBlur:he(u.onBlur,()=>_(!1)),onClick:he(u.onClick,()=>{C.current!=="mouse"&&O()}),onPointerUp:he(u.onPointerUp,()=>{C.current==="mouse"&&O()}),onPointerDown:he(u.onPointerDown,M=>{C.current=M.pointerType}),onPointerMove:he(u.onPointerMove,M=>{C.current=M.pointerType,i?h.onItemLeave?.():C.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:he(u.onPointerLeave,M=>{M.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:he(u.onKeyDown,M=>{h.searchRef?.current!==""&&M.key===" "||(hB.includes(M.key)&&O(),M.key===" "&&M.preventDefault())})})})})});mE.displayName=Zu;var Xi="SelectItemText",gE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,...c}=e,u=Do(Xi,r),f=Po(Xi,r),h=pE(Xi,r),p=yB(Xi,r),[y,v]=w.useState(null),b=Ve(t,O=>v(O),h.onItemTextChange,O=>f.itemTextRefCallback?.(O,h.value,h.disabled)),_=y?.textContent,E=w.useMemo(()=>g.jsx("option",{value:h.value,disabled:h.disabled,children:_},h.value),[h.disabled,h.value,_]),{onNativeOptionAdd:x,onNativeOptionRemove:C}=p;return Rt(()=>(x(E),()=>C(E)),[x,C,E]),g.jsxs(g.Fragment,{children:[g.jsx(ke.span,{id:h.textId,...c,ref:b}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?$a.createPortal(c.children,u.valueNode):null]})});gE.displayName=Xi;var yE="SelectItemIndicator",vE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return pE(yE,r).isSelected?g.jsx(ke.span,{"aria-hidden":!0,...s,ref:t}):null});vE.displayName=yE;var cm="SelectScrollUpButton",bE=w.forwardRef((e,t)=>{const r=Po(cm,e.__scopeSelect),s=vg(cm,e.__scopeSelect),[i,c]=w.useState(!1),u=Ve(t,s.onScrollButtonChange);return Rt(()=>{if(r.viewport&&r.isPositioned){let f=function(){const p=h.scrollTop>0;c(p)};const h=r.viewport;return f(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[r.viewport,r.isPositioned]),i?g.jsx(SE,{...e,ref:u,onAutoScroll:()=>{const{viewport:f,selectedItem:h}=r;f&&h&&(f.scrollTop=f.scrollTop-h.offsetHeight)}}):null});bE.displayName=cm;var lm="SelectScrollDownButton",wE=w.forwardRef((e,t)=>{const r=Po(lm,e.__scopeSelect),s=vg(lm,e.__scopeSelect),[i,c]=w.useState(!1),u=Ve(t,s.onScrollButtonChange);return Rt(()=>{if(r.viewport&&r.isPositioned){let f=function(){const p=h.scrollHeight-h.clientHeight,y=Math.ceil(h.scrollTop)<p;c(y)};const h=r.viewport;return f(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[r.viewport,r.isPositioned]),i?g.jsx(SE,{...e,ref:u,onAutoScroll:()=>{const{viewport:f,selectedItem:h}=r;f&&h&&(f.scrollTop=f.scrollTop+h.offsetHeight)}}):null});wE.displayName=lm;var SE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...i}=e,c=Po("SelectScrollButton",r),u=w.useRef(null),f=_f(r),h=w.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return w.useEffect(()=>()=>h(),[h]),Rt(()=>{f().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[f]),g.jsx(ke.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:he(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:he(i.onPointerMove,()=>{c.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:he(i.onPointerLeave,()=>{h()})})}),kB="SelectSeparator",MB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return g.jsx(ke.div,{"aria-hidden":!0,...s,ref:t})});MB.displayName=kB;var um="SelectArrow",NB=w.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=Cf(r),c=Do(um,r),u=Po(um,r);return c.open&&u.position==="popper"?g.jsx(yg,{...i,...s,ref:t}):null});NB.displayName=um;var jB="SelectBubbleInput",xE=w.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const i=w.useRef(null),c=Ve(s,i),u=xC(t);return w.useEffect(()=>{const f=i.current;if(!f)return;const h=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&y){const v=new Event("change",{bubbles:!0});y.call(f,t),f.dispatchEvent(v)}},[u,t]),g.jsx(ke.select,{...r,style:{...WC,...r.style},ref:c,defaultValue:t})});xE.displayName=jB;function _E(e){return e===""||e===void 0}function CE(e){const t=Yn(e),r=w.useRef(""),s=w.useRef(0),i=w.useCallback(u=>{const f=r.current+u;t(f),(function h(p){r.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>h(""),1e3))})(f)},[t]),c=w.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,i,c]}function EE(e,t,r){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,c=r?e.indexOf(r):-1;let u=zB(e,Math.max(c,0));i.length===1&&(u=u.filter(p=>p!==r));const h=u.find(p=>p.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function zB(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var DB=eE,PB=nE,LB=oE,IB=sE,$B=aE,UB=iE,BB=fE,qB=mE,FB=gE,VB=vE,HB=bE,ZB=wE;function Np({...e}){return g.jsx(DB,{"data-slot":"select",...e})}function jp({...e}){return g.jsx(LB,{"data-slot":"select-value",...e})}function zp({className:e,size:t="default",children:r,...s}){return g.jsxs(PB,{"data-slot":"select-trigger","data-size":t,className:je("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),...s,children:[r,g.jsx(IB,{asChild:!0,children:g.jsx(_s,{className:"size-4 opacity-50"})})]})}function Dp({className:e,children:t,position:r="item-aligned",align:s="center",...i}){return g.jsx($B,{children:g.jsxs(UB,{"data-slot":"select-content",className:je("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",r==="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:r,align:s,...i,children:[g.jsx(QB,{}),g.jsx(BB,{className:je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),g.jsx(GB,{})]})})}function Qi({className:e,children:t,...r}){return g.jsxs(qB,{"data-slot":"select-item",className:je("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),...r,children:[g.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:g.jsx(VB,{children:g.jsx(M1,{className:"size-4"})})}),g.jsx(FB,{children:t})]})}function QB({className:e,...t}){return g.jsx(HB,{"data-slot":"select-scroll-up-button",className:je("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(N1,{className:"size-4"})})}function GB({className:e,...t}){return g.jsx(ZB,{"data-slot":"select-scroll-down-button",className:je("flex cursor-default items-center justify-center py-1",e),...t,children:g.jsx(_s,{className:"size-4"})})}function YB({isOpen:e,onClose:t,breakingChanges:r,onForceUpdate:s,onCancel:i,isLoading:c}){const u=()=>{i(),t()};return g.jsx(rg,{open:e,onOpenChange:f=>!f&&!c&&u(),title:"Breaking Changes Detected",size:"lg",footer:g.jsxs(g.Fragment,{children:[g.jsx($r,{variant:"outline",onClick:u,disabled:c,children:"Cancel"}),g.jsx($r,{variant:"danger",onClick:s,loading:c,children:"Force Update"})]}),children:g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"diff-modified flex items-start gap-3 rounded-lg border p-3",children:[g.jsx(jD,{className:"mt-0.5 size-5 shrink-0 text-diff-modified"}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("p",{className:"text-sm font-medium text-diff-modified",children:"These changes may affect existing content"}),g.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."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"text-sm font-medium text-foreground",children:[r.length," breaking change",r.length!==1?"s":""," detected:"]}),g.jsx("ul",{className:"space-y-2",children:r.map((f,h)=>g.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[g.jsx("span",{className:"mt-0.5 size-1.5 shrink-0 rounded-full bg-warning"}),g.jsx("span",{className:"text-muted-foreground",children:f})]},h))})]}),g.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 Pp={text:{label:"Text",icon:g.jsx(AD,{className:"size-4"}),description:"Single line text input"},richText:{label:"Rich Text",icon:g.jsx(O3,{className:"size-4"}),description:"Multi-line formatted text"},number:{label:"Number",icon:g.jsx(z1,{className:"size-4"}),description:"Numeric value"},boolean:{label:"Boolean",icon:g.jsx($1,{className:"size-4"}),description:"True/false toggle"},date:{label:"Date",icon:g.jsx(Kp,{className:"size-4"}),description:"Date picker"},datetime:{label:"Date & Time",icon:g.jsx(Kp,{className:"size-4"}),description:"Date and time picker"},reference:{label:"Reference",icon:g.jsx(Q3,{className:"size-4"}),description:"Link to another content entry"},media:{label:"Media",icon:g.jsx(P1,{className:"size-4"}),description:"Image, video, or file"},json:{label:"JSON",icon:g.jsx(k1,{className:"size-4"}),description:"Custom JSON data"},select:{label:"Select",icon:g.jsx(_s,{className:"size-4"}),description:"Dropdown selection"},multiSelect:{label:"Multi-Select",icon:g.jsx(X3,{className:"size-4"}),description:"Multiple selections"},tags:{label:"Tags",icon:g.jsx(CD,{className:"size-4"}),description:"Free-form tag list"},category:{label:"Category",icon:g.jsx(j3,{className:"size-4"}),description:"Taxonomy category selection"}};function US(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"_").replace(/^[0-9]/,"_$&").slice(0,64)}function BS(e){return/^[a-z][a-z0-9_]{0,63}$/.test(e)}function KB({isOpen:e,onClose:t,onCreated:r,onUpdated:s,contentType:i}){const c=!!i,u=i?.source==="code",f=u,[h,p]=w.useState(""),[y,v]=w.useState(""),[b,_]=w.useState(!1),[E,x]=w.useState(""),[C,O]=w.useState(!1),[M,k]=w.useState([{name:"title",label:"Title",type:"text",required:!0}]),[D,U]=w.useState("title"),[H,L]=w.useState("title"),[j,G]=w.useState(!1),[ie,ae]=w.useState(null),[te,ce]=w.useState(null),[le,me]=w.useState(!1),[I,K]=w.useState([]),[V,re]=w.useState(!1),[ve,z]=w.useState(!1),Q=Ow($u.admin.createContentType),ne=Ow($u.admin.updateContentType);w.useEffect(()=>{i&&e&&(p(i.displayName),v(i.name),_(!0),x(i.description||""),O(i.singleton||!1),k(i.fields),U(i.titleField||""),L(i.slugField||""))},[i,e]);const oe=w.useCallback(()=>{p(""),v(""),_(!1),x(""),O(!1),k([{name:"title",label:"Title",type:"text",required:!0}]),U("title"),L("title"),G(!1),ae(null),ce(null),me(!1),K([]),re(!1),z(!1)},[]),pe=w.useCallback(se=>{p(se),b||v(US(se))},[b]),ye=w.useCallback(se=>{_(!0),v(se.toLowerCase().replace(/[^a-z0-9_]/g,""))},[]),X=w.useCallback(()=>{const se=`field_${M.length+1}`;k(Ee=>[...Ee,{name:se,label:`Field ${Ee.length+1}`,type:"text",required:!1}]),ce(M.length),me(!0)},[M.length]),_e=w.useCallback(se=>{const Ee=M[se];if(k(Ue=>Ue.filter((ze,Mt)=>Mt!==se)),D===Ee.name){const Ue=M.find((ze,Mt)=>Mt!==se&&ze.type==="text");U(Ue?.name||"")}if(H===Ee.name){const Ue=M.find((ze,Mt)=>Mt!==se&&ze.type==="text");L(Ue?.name||"")}te===se?(ce(null),me(!1)):te!==null&&te>se&&ce(te-1)},[M,te,D,H]),xe=w.useCallback((se,Ee)=>{k(Ue=>Ue.map((ze,Mt)=>Mt===se?{...ze,...Ee}:ze))},[]),Re=w.useCallback((se,Ee)=>{k(Ue=>{const ze=[...Ue],[Mt]=ze.splice(se,1);return ze.splice(Ee,0,Mt),ze}),ce(Ee)},[]),Ae=w.useMemo(()=>{const se=[];h.trim()||se.push("Display name is required"),y.trim()?BS(y)||se.push("System Name must start with a letter and contain only lowercase letters, numbers, and underscores"):se.push("System Name is required"),M.length===0&&se.push("At least one field is required");const Ee=M.map(ze=>ze.name),Ue=Ee.filter((ze,Mt)=>Ee.indexOf(ze)!==Mt);Ue.length>0&&se.push(`Duplicate field names: ${[...new Set(Ue)].join(", ")}`);for(const ze of M)ze.name.trim()?/^[a-z][a-z0-9_]{0,63}$/.test(ze.name)||se.push(`Field "${ze.name}" has an invalid name format`):se.push(`Field "${ze.label}" has an empty name`),ze.label.trim()||se.push(`Field with name "${ze.name}" has an empty label`),(ze.type==="select"||ze.type==="multiSelect")&&(!ze.options?.options||ze.options.options.length===0)&&se.push(`${ze.type} field "${ze.label}" requires at least one option`);return se},[h,y,M]),Le=w.useMemo(()=>M.filter(se=>se.type==="text"),[M]),yt=se=>se.split(`
|
|
102
|
+
`).filter(Ue=>Ue.trim().startsWith("-")).map(Ue=>Ue.trim().substring(2)),vt=w.useCallback(async(se,Ee=!1)=>{if(se.preventDefault(),Ae.length>0){ae(Ae.join(". "));return}G(!0),ae(null);try{if(c&&i){const Ue=await ne({id:i._id,displayName:h.trim(),description:E.trim()||void 0,fields:M,singleton:C,titleField:D||void 0,slugField:H||void 0,force:Ee});s?.(Ue),oe(),t()}else{const Ue=await Q({name:y,displayName:h.trim(),description:E.trim()||void 0,fields:M,singleton:C,titleField:D||void 0,slugField:H||void 0});r?.(Ue),oe(),t()}}catch(Ue){const ze=Ue instanceof Error?Ue.message:c?"Failed to update content type":"Failed to create content type";if(c&&!Ee&&ze.includes("breaking change")){const Mt=yt(ze);K(Mt),re(!0)}else ae(ze)}finally{G(!1)}},[Ae,c,i,Q,ne,y,h,E,M,C,D,H,r,s,oe,t]),Sn=w.useCallback(async()=>{z(!0);try{if(i){const se=await ne({id:i._id,displayName:h.trim(),description:E.trim()||void 0,fields:M,singleton:C,titleField:D||void 0,slugField:H||void 0,force:!0});s?.(se),oe(),re(!1),t()}}catch(se){const Ee=se instanceof Error?se.message:"Failed to update content type";ae(Ee),re(!1)}finally{z(!1)}},[i,ne,h,E,M,C,D,H,s,oe,t]),Yt=w.useCallback(()=>{j||(oe(),t())},[j,oe,t]);if(!e)return null;const nt=te!==null?M[te]:null;return g.jsxs(g.Fragment,{children:[g.jsx(rg,{open:e,onOpenChange:se=>!se&&Yt(),title:u?"View Content Type":c?"Edit Content Type":"Create Content Type",size:"2xl",footer:f?g.jsx($r,{variant:"outline",onClick:Yt,children:"Close"}):g.jsxs(g.Fragment,{children:[g.jsx($r,{variant:"outline",onClick:Yt,disabled:j,children:"Cancel"}),g.jsx($r,{variant:"primary",onClick:vt,disabled:Ae.length>0,loading:j,"data-testid":c?"update-content-type-submit":"create-content-type-submit",children:c?"Save Changes":"Create Content Type"})]}),children:g.jsxs("form",{onSubmit:vt,className:"space-y-6",children:[u&&g.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-violet-200 bg-violet-50 p-3",children:[g.jsx(m3,{className:"mt-0.5 size-5 shrink-0 text-violet-600"}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("p",{className:"text-sm font-medium text-violet-900",children:"Managed by Code"}),g.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."})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Basic Information"}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"displayName",children:["Display Name ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"displayName",value:h,onChange:se=>pe(se.target.value),placeholder:"e.g., Blog Post",disabled:j||f,autoFocus:!f,"data-testid":"display-name-input"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"machineName",children:["System Name ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"machineName",value:y,onChange:se=>ye(se.target.value),placeholder:"e.g., blog_post",disabled:j||c||f,className:je(!BS(y)&&y&&"border-destructive"),"data-testid":"machine-name-input"}),g.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."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"description",children:"Description"}),g.jsx(U8,{id:"description",value:E,onChange:se=>x(se.target.value),placeholder:"Optional description of this content type",disabled:j||f,rows:2})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(TS,{id:"singleton",checked:C,onCheckedChange:se=>O(se),disabled:j||f}),g.jsx(jn,{htmlFor:"singleton",className:"cursor-pointer",children:"Singleton (only one entry allowed)"})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Fields"}),!f&&g.jsxs($r,{type:"button",variant:"secondary",size:"sm",onClick:X,disabled:j,"data-testid":"add-field-button",children:[g.jsx(I1,{className:"size-3.5"}),"Add Field"]})]}),g.jsx("div",{className:"space-y-2",children:M.map((se,Ee)=>g.jsxs("div",{className:je("flex items-center gap-2 rounded-lg border p-2 transition-colors",!f&&"cursor-pointer hover:bg-muted/50",te===Ee&&"border-primary bg-primary/5"),onClick:()=>{f||(ce(Ee),me(!0))},"data-testid":`field-item-${Ee}`,children:[!f&&g.jsxs("div",{className:"flex flex-col gap-0.5",children:[Ee>0&&g.jsx("button",{type:"button",onClick:Ue=>{Ue.stopPropagation(),Re(Ee,Ee-1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:g.jsx(N1,{className:"size-3"})}),Ee<M.length-1&&g.jsx("button",{type:"button",onClick:Ue=>{Ue.stopPropagation(),Re(Ee,Ee+1)},className:"rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:g.jsx(_s,{className:"size-3"})})]}),g.jsx("div",{className:"flex size-8 items-center justify-center rounded bg-muted text-muted-foreground",children:Pp[se.type].icon}),g.jsxs("div",{className:"min-w-0 flex-1",children:[g.jsx("p",{className:"truncate text-sm font-medium",children:se.label}),g.jsxs("p",{className:"text-xs text-muted-foreground",children:[Pp[se.type].label,se.required&&" *"]})]}),!f&&g.jsx("button",{type:"button",onClick:Ue=>{Ue.stopPropagation(),_e(Ee)},disabled:j||M.length===1,className:"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-50",children:g.jsx(ju,{className:"size-4"})})]},Ee))}),!f&&le&&nt&&te!==null&&g.jsxs("div",{className:"rounded-lg border bg-muted/30 p-4","data-testid":"field-editor",children:[g.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[g.jsxs("h5",{className:"font-medium",children:["Edit Field: ",nt.label]}),g.jsx("button",{type:"button",onClick:()=>{me(!1),ce(null)},className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:g.jsx(ju,{className:"size-4"})})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"fieldLabel",children:["Label ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"fieldLabel",value:nt.label,onChange:se=>xe(te,{label:se.target.value,name:b?nt.name:US(se.target.value)||nt.name}),disabled:j,"data-testid":"field-label-input"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"fieldName",children:["Name ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx(os,{id:"fieldName",value:nt.name,onChange:se=>xe(te,{name:se.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),disabled:j,"data-testid":"field-name-input"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{htmlFor:"fieldType",children:["Type ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsxs(Np,{value:nt.type,onValueChange:se=>xe(te,{type:se,options:void 0}),disabled:j,children:[g.jsx(zp,{"data-testid":"field-type-select",children:g.jsx(jp,{})}),g.jsx(Dp,{children:Object.entries(Pp).map(([se,Ee])=>g.jsx(Qi,{value:se,children:g.jsxs("div",{className:"flex items-center gap-2",children:[Ee.icon,g.jsx("span",{children:Ee.label}),g.jsxs("span",{className:"text-muted-foreground",children:["- ",Ee.description]})]})},se))})]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(TS,{id:"fieldRequired",checked:nt.required,onCheckedChange:se=>xe(te,{required:se}),disabled:j}),g.jsx(jn,{htmlFor:"fieldRequired",className:"cursor-pointer",children:"Required"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"fieldDescription",children:"Help Text"}),g.jsx(os,{id:"fieldDescription",value:nt.description||"",onChange:se=>xe(te,{description:se.target.value||void 0}),placeholder:"Help text shown below the field",disabled:j})]}),(nt.type==="select"||nt.type==="multiSelect")&&g.jsx(XB,{options:nt.options?.options||[],onChange:se=>xe(te,{options:{...nt.options,options:se}}),disabled:j})]})]})]}),Le.length>0&&g.jsxs("div",{className:"space-y-4",children:[g.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Display Settings"}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"titleField",children:"Title Field"}),g.jsxs(Np,{value:D||"none",onValueChange:se=>U(se==="none"?"":se),disabled:j,children:[g.jsx(zp,{children:g.jsx(jp,{placeholder:"None"})}),g.jsxs(Dp,{children:[g.jsx(Qi,{value:"none",children:"None"}),Le.map(se=>g.jsx(Qi,{value:se.name,children:se.label},se.name))]})]}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to display as the entry title in lists"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jn,{htmlFor:"slugField",children:"Slug Field"}),g.jsxs(Np,{value:H||"none",onValueChange:se=>L(se==="none"?"":se),disabled:j,children:[g.jsx(zp,{children:g.jsx(jp,{placeholder:"None (auto-generate)"})}),g.jsxs(Dp,{children:[g.jsx(Qi,{value:"none",children:"None (auto-generate)"}),Le.map(se=>g.jsx(Qi,{value:se.name,children:se.label},se.name))]})]}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"Field to use for generating URL-friendly slugs"})]})]}),ie&&g.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",role:"alert","data-testid":"submit-error",children:ie})]})}),g.jsx(YB,{isOpen:V,onClose:()=>re(!1),breakingChanges:I,onForceUpdate:Sn,onCancel:()=>{re(!1),K([])},isLoading:ve})]})}function XB({options:e,onChange:t,disabled:r}){const s=()=>{t([...e,{value:`option_${e.length+1}`,label:""}])},i=u=>{t(e.filter((f,h)=>h!==u))},c=(u,f)=>{t(e.map((h,p)=>p===u?{...h,...f}:h))};return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(jn,{children:["Options ",g.jsx("span",{className:"text-destructive",children:"*"})]}),g.jsx("div",{className:"space-y-2",children:e.map((u,f)=>g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(os,{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:r,className:"flex-1"}),g.jsx(os,{value:u.value,onChange:h=>c(f,{value:h.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"")}),placeholder:"value",disabled:r,className:"w-32"}),g.jsx("button",{type:"button",onClick:()=>i(f),disabled:r,className:"rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:g.jsx(ju,{className:"size-4"})})]},f))}),g.jsxs($r,{type:"button",variant:"secondary",size:"sm",onClick:s,disabled:r,children:[g.jsx(I1,{className:"size-3.5"}),"Add Option"]})]})}function JB(){const t=lt().location.pathname,r=Km(),{navItems:s,branding:i,layout:c}=r,[u,f]=w.useState(!1),h=A1($u.admin.listContentTypes,{isActive:!0}),p=h?.page??[],y=(x,C)=>C?t===x:t.startsWith(x),v=t==="/content"||t.startsWith("/entries/type/")||t.startsWith("/entries/new/")||t.startsWith("/entries/"),b=x=>x.id==="content"?_(x):g.jsxs(cs,{to:x.path,className:je("flex items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",y(x.path,x.exact)?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground"),children:[g.jsx(uS,{name:x.icon,className:"size-5"}),g.jsx("span",{className:"flex-1",children:x.label}),x.badge&&g.jsx("span",{className:"rounded-full bg-sidebar-primary px-2 py-0.5 text-xs text-sidebar-primary-foreground",children:x.badge})]},x.id),_=x=>g.jsxs(YI,{defaultOpen:v,children:[g.jsxs(KI,{className:je("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm font-medium transition-colors",v?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground","group"),children:[g.jsx(uS,{name:x.icon,className:"size-5"}),g.jsx("span",{className:"flex-1 text-left",children:x.label}),g.jsx(_s,{className:"size-4 transition-transform duration-200 group-data-[state=open]:rotate-180"})]}),g.jsx(XI,{children:g.jsxs("div",{className:"ml-5 mt-1 space-y-1 border-l border-sidebar-border pl-3",children:[g.jsx(cs,{to:"/content",className:je("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"}),p.map(C=>g.jsx(cs,{to:"/entries/type/$contentTypeId",params:{contentTypeId:C._id},className:je("flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors",t===`/entries/type/${C._id}`?"bg-sidebar-accent/60 text-sidebar-accent-foreground":"text-sidebar-foreground/80 hover:bg-sidebar-accent/30 hover:text-sidebar-accent-foreground"),children:C.displayName},C._id)),p.length===0&&h!==void 0&&g.jsx("button",{type:"button",onClick:()=>f(!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"})]})})]},x.id),E=c.sidebarWidth;return g.jsxs(g.Fragment,{children:[g.jsxs("aside",{className:"fixed inset-y-0 left-0 z-50 flex flex-col border-r border-sidebar-border bg-sidebar",style:{width:E},children:[g.jsx("div",{className:"flex h-14 items-center gap-2 border-b border-sidebar-border px-4",children:g.jsxs(cs,{to:"/",className:"flex items-center gap-2 font-semibold text-sidebar-foreground",children:[i.logo?g.jsx("img",{src:i.logo,alt:i.appName,className:"size-8"}):g.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground",children:g.jsx(L1,{className:"size-4"})}),g.jsx("span",{className:"text-base",children:i.appName})]})}),g.jsxs("nav",{className:"flex-1 space-y-6 overflow-y-auto p-4",children:[s.main.length>0&&g.jsxs("div",{className:"space-y-1",children:[g.jsx("span",{className:"px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60",children:"Main"}),g.jsx("div",{className:"space-y-1 pt-2",children:s.main.map(b)})]}),s.config.length>0&&g.jsxs("div",{className:"space-y-1",children:[g.jsx("span",{className:"px-2 text-xs font-medium uppercase tracking-wider text-sidebar-foreground/60",children:"Configuration"}),g.jsx("div",{className:"space-y-1 pt-2",children:s.config.map(b)})]})]}),g.jsx("div",{className:"border-t border-sidebar-border p-4",children:g.jsxs("div",{className:"flex items-center justify-between text-xs text-sidebar-foreground/60",children:[g.jsx("span",{children:"Version"}),g.jsx("span",{className:"font-mono",children:"0.1.0"})]})})]}),g.jsx(KB,{isOpen:u,onClose:()=>f(!1)})]})}function WB({...e}){return g.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function e9({className:e,...t}){return g.jsx("ol",{"data-slot":"breadcrumb-list",className:je("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function t9({className:e,...t}){return g.jsx("li",{"data-slot":"breadcrumb-item",className:je("inline-flex items-center gap-1.5",e),...t})}function n9({asChild:e,className:t,...r}){const s=e?wC:"a";return g.jsx(s,{"data-slot":"breadcrumb-link",className:je("hover:text-foreground transition-colors",t),...r})}function r9({className:e,...t}){return g.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:je("text-foreground font-normal",e),...t})}function o9({children:e,className:t,...r}){return g.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:je("[&>svg]:size-3.5",t),...r,children:e??g.jsx(i3,{})})}var Lp="rovingFocusGroup.onEntryFocus",s9={bubbles:!1,cancelable:!0},Rc="RovingFocusGroup",[fm,RE,a9]=sg(Rc),[i9,TE]=hr(Rc,[a9]),[c9,l9]=i9(Rc),AE=w.forwardRef((e,t)=>g.jsx(fm.Provider,{scope:e.__scopeRovingFocusGroup,children:g.jsx(fm.Slot,{scope:e.__scopeRovingFocusGroup,children:g.jsx(u9,{...e,ref:t})})}));AE.displayName=Rc;var u9=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:i=!1,dir:c,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...v}=e,b=w.useRef(null),_=Ve(t,b),E=ag(c),[x,C]=To({prop:u,defaultProp:f??null,onChange:h,caller:Rc}),[O,M]=w.useState(!1),k=Yn(p),D=RE(r),U=w.useRef(!1),[H,L]=w.useState(0);return w.useEffect(()=>{const j=b.current;if(j)return j.addEventListener(Lp,k),()=>j.removeEventListener(Lp,k)},[k]),g.jsx(c9,{scope:r,orientation:s,dir:E,loop:i,currentTabStopId:x,onItemFocus:w.useCallback(j=>C(j),[C]),onItemShiftTab:w.useCallback(()=>M(!0),[]),onFocusableItemAdd:w.useCallback(()=>L(j=>j+1),[]),onFocusableItemRemove:w.useCallback(()=>L(j=>j-1),[]),children:g.jsx(ke.div,{tabIndex:O||H===0?-1:0,"data-orientation":s,...v,ref:_,style:{outline:"none",...e.style},onMouseDown:he(e.onMouseDown,()=>{U.current=!0}),onFocus:he(e.onFocus,j=>{const G=!U.current;if(j.target===j.currentTarget&&G&&!O){const ie=new CustomEvent(Lp,s9);if(j.currentTarget.dispatchEvent(ie),!ie.defaultPrevented){const ae=D().filter(I=>I.focusable),te=ae.find(I=>I.active),ce=ae.find(I=>I.id===x),me=[te,ce,...ae].filter(Boolean).map(I=>I.ref.current);ME(me,y)}}U.current=!1}),onBlur:he(e.onBlur,()=>M(!1))})})}),OE="RovingFocusGroupItem",kE=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:i=!1,tabStopId:c,children:u,...f}=e,h=Qn(),p=c||h,y=l9(OE,r),v=y.currentTabStopId===p,b=RE(r),{onFocusableItemAdd:_,onFocusableItemRemove:E,currentTabStopId:x}=y;return w.useEffect(()=>{if(s)return _(),()=>E()},[s,_,E]),g.jsx(fm.ItemSlot,{scope:r,id:p,focusable:s,active:i,children:g.jsx(ke.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...f,ref:t,onMouseDown:he(e.onMouseDown,C=>{s?y.onItemFocus(p):C.preventDefault()}),onFocus:he(e.onFocus,()=>y.onItemFocus(p)),onKeyDown:he(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){y.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const O=h9(C,y.orientation,y.dir);if(O!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let k=b().filter(D=>D.focusable).map(D=>D.ref.current);if(O==="last")k.reverse();else if(O==="prev"||O==="next"){O==="prev"&&k.reverse();const D=k.indexOf(C.currentTarget);k=y.loop?p9(k,D+1):k.slice(D+1)}setTimeout(()=>ME(k))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:x!=null}):u})})});kE.displayName=OE;var f9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function d9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function h9(e,t,r){const s=d9(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return f9[s]}function ME(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function p9(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var m9=AE,g9=kE,dm=["Enter"," "],y9=["ArrowDown","PageUp","Home"],NE=["ArrowUp","PageDown","End"],v9=[...y9,...NE],b9={ltr:[...dm,"ArrowRight"],rtl:[...dm,"ArrowLeft"]},w9={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tc="Menu",[gc,S9,x9]=sg(Tc),[Es,jE]=hr(Tc,[x9,Za,TE]),Ef=Za(),zE=TE(),[_9,Rs]=Es(Tc),[C9,Ac]=Es(Tc),DE=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:i,onOpenChange:c,modal:u=!0}=e,f=Ef(t),[h,p]=w.useState(null),y=w.useRef(!1),v=Yn(c),b=ag(i);return w.useEffect(()=>{const _=()=>{y.current=!0,document.addEventListener("pointerdown",E,{capture:!0,once:!0}),document.addEventListener("pointermove",E,{capture:!0,once:!0})},E=()=>y.current=!1;return document.addEventListener("keydown",_,{capture:!0}),()=>{document.removeEventListener("keydown",_,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),g.jsx(mg,{...f,children:g.jsx(_9,{scope:t,open:r,onOpenChange:v,content:h,onContentChange:p,children:g.jsx(C9,{scope:t,onClose:w.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:s})})})};DE.displayName=Tc;var E9="MenuAnchor",bg=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=Ef(r);return g.jsx(Sf,{...i,...s,ref:t})});bg.displayName=E9;var wg="MenuPortal",[R9,PE]=Es(wg,{forceMount:void 0}),LE=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:i}=e,c=Rs(wg,t);return g.jsx(R9,{scope:t,forceMount:r,children:g.jsx(Un,{present:r||c.open,children:g.jsx(_c,{asChild:!0,container:i,children:s})})})};LE.displayName=wg;var Ln="MenuContent",[T9,Sg]=Es(Ln),IE=w.forwardRef((e,t)=>{const r=PE(Ln,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,c=Rs(Ln,e.__scopeMenu),u=Ac(Ln,e.__scopeMenu);return g.jsx(gc.Provider,{scope:e.__scopeMenu,children:g.jsx(Un,{present:s||c.open,children:g.jsx(gc.Slot,{scope:e.__scopeMenu,children:u.modal?g.jsx(A9,{...i,ref:t}):g.jsx(O9,{...i,ref:t})})})})}),A9=w.forwardRef((e,t)=>{const r=Rs(Ln,e.__scopeMenu),s=w.useRef(null),i=Ve(t,s);return w.useEffect(()=>{const c=s.current;if(c)return hf(c)},[]),g.jsx(xg,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:he(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),O9=w.forwardRef((e,t)=>{const r=Rs(Ln,e.__scopeMenu);return g.jsx(xg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),k9=gs("MenuContent.ScrollLock"),xg=w.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:i,onOpenAutoFocus:c,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:_,disableOutsideScroll:E,...x}=e,C=Rs(Ln,r),O=Ac(Ln,r),M=Ef(r),k=zE(r),D=S9(r),[U,H]=w.useState(null),L=w.useRef(null),j=Ve(t,L,C.onContentChange),G=w.useRef(0),ie=w.useRef(""),ae=w.useRef(0),te=w.useRef(null),ce=w.useRef("right"),le=w.useRef(0),me=E?Cc:w.Fragment,I=E?{as:k9,allowPinchZoom:!0}:void 0,K=re=>{const ve=ie.current+re,z=D().filter(X=>!X.disabled),Q=document.activeElement,ne=z.find(X=>X.ref.current===Q)?.textValue,oe=z.map(X=>X.textValue),pe=q9(oe,ve,ne),ye=z.find(X=>X.textValue===pe)?.ref.current;(function X(_e){ie.current=_e,window.clearTimeout(G.current),_e!==""&&(G.current=window.setTimeout(()=>X(""),1e3))})(ve),ye&&setTimeout(()=>ye.focus())};w.useEffect(()=>()=>window.clearTimeout(G.current),[]),ff();const V=w.useCallback(re=>ce.current===te.current?.side&&V9(re,te.current?.area),[]);return g.jsx(T9,{scope:r,searchRef:ie,onItemEnter:w.useCallback(re=>{V(re)&&re.preventDefault()},[V]),onItemLeave:w.useCallback(re=>{V(re)||(L.current?.focus(),H(null))},[V]),onTriggerLeave:w.useCallback(re=>{V(re)&&re.preventDefault()},[V]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:w.useCallback(re=>{te.current=re},[]),children:g.jsx(me,{...I,children:g.jsx(xc,{asChild:!0,trapped:i,onMountAutoFocus:he(c,re=>{re.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:g.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:_,children:g.jsx(m9,{asChild:!0,...k,dir:O.dir,orientation:"vertical",loop:s,currentTabStopId:U,onCurrentTabStopIdChange:H,onEntryFocus:he(h,re=>{O.isUsingKeyboardRef.current||re.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(gg,{role:"menu","aria-orientation":"vertical","data-state":eR(C.open),"data-radix-menu-content":"",dir:O.dir,...M,...x,ref:j,style:{outline:"none",...x.style},onKeyDown:he(x.onKeyDown,re=>{const z=re.target.closest("[data-radix-menu-content]")===re.currentTarget,Q=re.ctrlKey||re.altKey||re.metaKey,ne=re.key.length===1;z&&(re.key==="Tab"&&re.preventDefault(),!Q&&ne&&K(re.key));const oe=L.current;if(re.target!==oe||!v9.includes(re.key))return;re.preventDefault();const ye=D().filter(X=>!X.disabled).map(X=>X.ref.current);NE.includes(re.key)&&ye.reverse(),U9(ye)}),onBlur:he(e.onBlur,re=>{re.currentTarget.contains(re.target)||(window.clearTimeout(G.current),ie.current="")}),onPointerMove:he(e.onPointerMove,yc(re=>{const ve=re.target,z=le.current!==re.clientX;if(re.currentTarget.contains(ve)&&z){const Q=re.clientX>le.current?"right":"left";ce.current=Q,le.current=re.clientX}}))})})})})})})});IE.displayName=Ln;var M9="MenuGroup",_g=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return g.jsx(ke.div,{role:"group",...s,ref:t})});_g.displayName=M9;var N9="MenuLabel",$E=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return g.jsx(ke.div,{...s,ref:t})});$E.displayName=N9;var Qu="MenuItem",qS="menu.itemSelect",Rf=w.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...i}=e,c=w.useRef(null),u=Ac(Qu,e.__scopeMenu),f=Sg(Qu,e.__scopeMenu),h=Ve(t,c),p=w.useRef(!1),y=()=>{const v=c.current;if(!r&&v){const b=new CustomEvent(qS,{bubbles:!0,cancelable:!0});v.addEventListener(qS,_=>s?.(_),{once:!0}),B_(v,b),b.defaultPrevented?p.current=!1:u.onClose()}};return g.jsx(UE,{...i,ref:h,disabled:r,onClick:he(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),p.current=!0},onPointerUp:he(e.onPointerUp,v=>{p.current||v.currentTarget?.click()}),onKeyDown:he(e.onKeyDown,v=>{const b=f.searchRef.current!=="";r||b&&v.key===" "||dm.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Rf.displayName=Qu;var UE=w.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:i,...c}=e,u=Sg(Qu,r),f=zE(r),h=w.useRef(null),p=Ve(t,h),[y,v]=w.useState(!1),[b,_]=w.useState("");return w.useEffect(()=>{const E=h.current;E&&_((E.textContent??"").trim())},[c.children]),g.jsx(gc.ItemSlot,{scope:r,disabled:s,textValue:i??b,children:g.jsx(g9,{asChild:!0,...f,focusable:!s,children:g.jsx(ke.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...c,ref:p,onPointerMove:he(e.onPointerMove,yc(E=>{s?u.onItemLeave(E):(u.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:he(e.onPointerLeave,yc(E=>u.onItemLeave(E))),onFocus:he(e.onFocus,()=>v(!0)),onBlur:he(e.onBlur,()=>v(!1))})})})}),j9="MenuCheckboxItem",BE=w.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...i}=e;return g.jsx(ZE,{scope:e.__scopeMenu,checked:r,children:g.jsx(Rf,{role:"menuitemcheckbox","aria-checked":Gu(r)?"mixed":r,...i,ref:t,"data-state":Eg(r),onSelect:he(i.onSelect,()=>s?.(Gu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});BE.displayName=j9;var qE="MenuRadioGroup",[z9,D9]=Es(qE,{value:void 0,onValueChange:()=>{}}),FE=w.forwardRef((e,t)=>{const{value:r,onValueChange:s,...i}=e,c=Yn(s);return g.jsx(z9,{scope:e.__scopeMenu,value:r,onValueChange:c,children:g.jsx(_g,{...i,ref:t})})});FE.displayName=qE;var VE="MenuRadioItem",HE=w.forwardRef((e,t)=>{const{value:r,...s}=e,i=D9(VE,e.__scopeMenu),c=r===i.value;return g.jsx(ZE,{scope:e.__scopeMenu,checked:c,children:g.jsx(Rf,{role:"menuitemradio","aria-checked":c,...s,ref:t,"data-state":Eg(c),onSelect:he(s.onSelect,()=>i.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});HE.displayName=VE;var Cg="MenuItemIndicator",[ZE,P9]=Es(Cg,{checked:!1}),QE=w.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...i}=e,c=P9(Cg,r);return g.jsx(Un,{present:s||Gu(c.checked)||c.checked===!0,children:g.jsx(ke.span,{...i,ref:t,"data-state":Eg(c.checked)})})});QE.displayName=Cg;var L9="MenuSeparator",GE=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return g.jsx(ke.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});GE.displayName=L9;var I9="MenuArrow",YE=w.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=Ef(r);return g.jsx(yg,{...i,...s,ref:t})});YE.displayName=I9;var $9="MenuSub",[T7,KE]=Es($9),Ji="MenuSubTrigger",XE=w.forwardRef((e,t)=>{const r=Rs(Ji,e.__scopeMenu),s=Ac(Ji,e.__scopeMenu),i=KE(Ji,e.__scopeMenu),c=Sg(Ji,e.__scopeMenu),u=w.useRef(null),{pointerGraceTimerRef:f,onPointerGraceIntentChange:h}=c,p={__scopeMenu:e.__scopeMenu},y=w.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return w.useEffect(()=>y,[y]),w.useEffect(()=>{const v=f.current;return()=>{window.clearTimeout(v),h(null)}},[f,h]),g.jsx(bg,{asChild:!0,...p,children:g.jsx(UE,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":eR(r.open),...e,ref:wc(t,i.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:he(e.onPointerMove,yc(v=>{c.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(c.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:he(e.onPointerLeave,yc(v=>{y();const b=r.content?.getBoundingClientRect();if(b){const _=r.content?.dataset.side,E=_==="right",x=E?-5:5,C=b[E?"left":"right"],O=b[E?"right":"left"];c.onPointerGraceIntentChange({area:[{x:v.clientX+x,y:v.clientY},{x:C,y:b.top},{x:O,y:b.top},{x:O,y:b.bottom},{x:C,y:b.bottom}],side:_}),window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(v),v.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:he(e.onKeyDown,v=>{const b=c.searchRef.current!=="";e.disabled||b&&v.key===" "||b9[s.dir].includes(v.key)&&(r.onOpenChange(!0),r.content?.focus(),v.preventDefault())})})})});XE.displayName=Ji;var JE="MenuSubContent",WE=w.forwardRef((e,t)=>{const r=PE(Ln,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,c=Rs(Ln,e.__scopeMenu),u=Ac(Ln,e.__scopeMenu),f=KE(JE,e.__scopeMenu),h=w.useRef(null),p=Ve(t,h);return g.jsx(gc.Provider,{scope:e.__scopeMenu,children:g.jsx(Un,{present:s||c.open,children:g.jsx(gc.Slot,{scope:e.__scopeMenu,children:g.jsx(xg,{id:f.contentId,"aria-labelledby":f.triggerId,...i,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:he(e.onFocusOutside,y=>{y.target!==f.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:he(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:he(e.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),b=w9[u.dir].includes(y.key);v&&b&&(c.onOpenChange(!1),f.trigger?.focus(),y.preventDefault())})})})})})});WE.displayName=JE;function eR(e){return e?"open":"closed"}function Gu(e){return e==="indeterminate"}function Eg(e){return Gu(e)?"indeterminate":e?"checked":"unchecked"}function U9(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function B9(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function q9(e,t,r){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,c=r?e.indexOf(r):-1;let u=B9(e,Math.max(c,0));i.length===1&&(u=u.filter(p=>p!==r));const h=u.find(p=>p.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function F9(e,t){const{x:r,y:s}=e;let i=!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,v=h.x,b=h.y;y>s!=b>s&&r<(v-p)*(s-y)/(b-y)+p&&(i=!i)}return i}function V9(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return F9(r,t)}function yc(e){return t=>t.pointerType==="mouse"?e(t):void 0}var H9=DE,Z9=bg,Q9=LE,G9=IE,Y9=_g,K9=$E,X9=Rf,J9=BE,W9=FE,eq=HE,tq=QE,nq=GE,rq=YE,oq=XE,sq=WE,Tf="DropdownMenu",[aq]=hr(Tf,[jE]),Gt=jE(),[iq,tR]=aq(Tf),nR=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:i,defaultOpen:c,onOpenChange:u,modal:f=!0}=e,h=Gt(t),p=w.useRef(null),[y,v]=To({prop:i,defaultProp:c??!1,onChange:u,caller:Tf});return g.jsx(iq,{scope:t,triggerId:Qn(),triggerRef:p,contentId:Qn(),open:y,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(b=>!b),[v]),modal:f,children:g.jsx(H9,{...h,open:y,onOpenChange:v,dir:s,modal:f,children:r})})};nR.displayName=Tf;var rR="DropdownMenuTrigger",oR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...i}=e,c=tR(rR,r),u=Gt(r);return g.jsx(Z9,{asChild:!0,...u,children:g.jsx(ke.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":s?"":void 0,disabled:s,...i,ref:wc(t,c.triggerRef),onPointerDown:he(e.onPointerDown,f=>{!s&&f.button===0&&f.ctrlKey===!1&&(c.onOpenToggle(),c.open||f.preventDefault())}),onKeyDown:he(e.onKeyDown,f=>{s||(["Enter"," "].includes(f.key)&&c.onOpenToggle(),f.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(f.key)&&f.preventDefault())})})})});oR.displayName=rR;var cq="DropdownMenuPortal",sR=e=>{const{__scopeDropdownMenu:t,...r}=e,s=Gt(t);return g.jsx(Q9,{...s,...r})};sR.displayName=cq;var aR="DropdownMenuContent",iR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=tR(aR,r),c=Gt(r),u=w.useRef(!1);return g.jsx(G9,{id:i.contentId,"aria-labelledby":i.triggerId,...c,...s,ref:t,onCloseAutoFocus:he(e.onCloseAutoFocus,f=>{u.current||i.triggerRef.current?.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:he(e.onInteractOutside,f=>{const h=f.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,y=h.button===2||p;(!i.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)"}})});iR.displayName=aR;var lq="DropdownMenuGroup",uq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(Y9,{...i,...s,ref:t})});uq.displayName=lq;var fq="DropdownMenuLabel",cR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(K9,{...i,...s,ref:t})});cR.displayName=fq;var dq="DropdownMenuItem",lR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(X9,{...i,...s,ref:t})});lR.displayName=dq;var hq="DropdownMenuCheckboxItem",pq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(J9,{...i,...s,ref:t})});pq.displayName=hq;var mq="DropdownMenuRadioGroup",gq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(W9,{...i,...s,ref:t})});gq.displayName=mq;var yq="DropdownMenuRadioItem",vq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(eq,{...i,...s,ref:t})});vq.displayName=yq;var bq="DropdownMenuItemIndicator",wq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(tq,{...i,...s,ref:t})});wq.displayName=bq;var Sq="DropdownMenuSeparator",uR=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(nq,{...i,...s,ref:t})});uR.displayName=Sq;var xq="DropdownMenuArrow",_q=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(rq,{...i,...s,ref:t})});_q.displayName=xq;var Cq="DropdownMenuSubTrigger",Eq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(oq,{...i,...s,ref:t})});Eq.displayName=Cq;var Rq="DropdownMenuSubContent",Tq=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=Gt(r);return g.jsx(sq,{...i,...s,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)"}})});Tq.displayName=Rq;var Aq=nR,Oq=oR,kq=sR,Mq=iR,Nq=cR,jq=lR,zq=uR;function Dq({...e}){return g.jsx(Aq,{"data-slot":"dropdown-menu",...e})}function Pq({...e}){return g.jsx(Oq,{"data-slot":"dropdown-menu-trigger",...e})}function Lq({className:e,sideOffset:t=4,...r}){return g.jsx(kq,{children:g.jsx(Mq,{"data-slot":"dropdown-menu-content",sideOffset:t,className:je("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),...r})})}function FS({className:e,inset:t,variant:r="default",...s}){return g.jsx(jq,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:je("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),...s})}function Iq({className:e,inset:t,...r}){return g.jsx(Nq,{"data-slot":"dropdown-menu-label","data-inset":t,className:je("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function VS({className:e,...t}){return g.jsx(zq,{"data-slot":"dropdown-menu-separator",className:je("bg-border -mx-1 my-1 h-px",e),...t})}function $q(e,t=[]){let r=[];function s(c,u){const f=w.createContext(u);f.displayName=c+"Context";const h=r.length;r=[...r,u];const p=v=>{const{scope:b,children:_,...E}=v,x=b?.[e]?.[h]||f,C=w.useMemo(()=>E,Object.values(E));return g.jsx(x.Provider,{value:C,children:_})};p.displayName=c+"Provider";function y(v,b){const _=b?.[e]?.[h]||f,E=w.useContext(_);if(E)return E;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${c}\``)}return[p,y]}const i=()=>{const c=r.map(u=>w.createContext(u));return function(f){const h=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:h}}),[f,h])}};return i.scopeName=e,[s,Uq(i,...t)]}function Uq(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(c){const u=s.reduce((f,{useScope:h,scopeName:p})=>{const v=h(c)[`__scope${p}`];return{...f,...v}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var Bq=t1();function qq(){return Bq.useSyncExternalStore(Fq,()=>!0,()=>!1)}function Fq(){return()=>{}}var Rg="Avatar",[Vq]=$q(Rg),[Hq,fR]=Vq(Rg),dR=w.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[i,c]=w.useState("idle");return g.jsx(Hq,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:c,children:g.jsx(mf.span,{...s,ref:t})})});dR.displayName=Rg;var hR="AvatarImage",pR=w.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:i=()=>{},...c}=e,u=fR(hR,r),f=Zq(s,c),h=Yn(p=>{i(p),u.onImageLoadingStatusChange(p)});return Rt(()=>{f!=="idle"&&h(f)},[f,h]),f==="loaded"?g.jsx(mf.img,{...c,ref:t,src:s}):null});pR.displayName=hR;var mR="AvatarFallback",gR=w.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...i}=e,c=fR(mR,r),[u,f]=w.useState(s===void 0);return w.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>f(!0),s);return()=>window.clearTimeout(h)}},[s]),u&&c.imageLoadingStatus!=="loaded"?g.jsx(mf.span,{...i,ref:t}):null});gR.displayName=mR;function HS(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Zq(e,{referrerPolicy:t,crossOrigin:r}){const s=qq(),i=w.useRef(null),c=s?(i.current||(i.current=new window.Image),i.current):null,[u,f]=w.useState(()=>HS(c,e));return Rt(()=>{f(HS(c,e))},[c,e]),Rt(()=>{const h=v=>()=>{f(v)};if(!c)return;const p=h("loaded"),y=h("error");return c.addEventListener("load",p),c.addEventListener("error",y),t&&(c.referrerPolicy=t),typeof r=="string"&&(c.crossOrigin=r),()=>{c.removeEventListener("load",p),c.removeEventListener("error",y)}},[c,r,t]),u}var Qq=dR,Gq=pR,Yq=gR;function Kq({className:e,...t}){return g.jsx(Qq,{"data-slot":"avatar",className:je("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function Xq({className:e,...t}){return g.jsx(Gq,{"data-slot":"avatar-image",className:je("aspect-square size-full",e),...t})}function Jq({className:e,...t}){return g.jsx(Yq,{"data-slot":"avatar-fallback",className:je("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}var Af="Popover",[yR]=hr(Af,[Za]),Oc=Za(),[Wq,Lo]=yR(Af),vR=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:i,onOpenChange:c,modal:u=!1}=e,f=Oc(t),h=w.useRef(null),[p,y]=w.useState(!1),[v,b]=To({prop:s,defaultProp:i??!1,onChange:c,caller:Af});return g.jsx(mg,{...f,children:g.jsx(Wq,{scope:t,contentId:Qn(),triggerRef:h,open:v,onOpenChange:b,onOpenToggle:w.useCallback(()=>b(_=>!_),[b]),hasCustomAnchor:p,onCustomAnchorAdd:w.useCallback(()=>y(!0),[]),onCustomAnchorRemove:w.useCallback(()=>y(!1),[]),modal:u,children:r})})};vR.displayName=Af;var bR="PopoverAnchor",eF=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Lo(bR,r),c=Oc(r),{onCustomAnchorAdd:u,onCustomAnchorRemove:f}=i;return w.useEffect(()=>(u(),()=>f()),[u,f]),g.jsx(Sf,{...c,...s,ref:t})});eF.displayName=bR;var wR="PopoverTrigger",SR=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Lo(wR,r),c=Oc(r),u=Ve(t,i.triggerRef),f=g.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":RR(i.open),...s,ref:u,onClick:he(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?f:g.jsx(Sf,{asChild:!0,...c,children:f})});SR.displayName=wR;var Tg="PopoverPortal",[tF,nF]=yR(Tg,{forceMount:void 0}),xR=e=>{const{__scopePopover:t,forceMount:r,children:s,container:i}=e,c=Lo(Tg,t);return g.jsx(tF,{scope:t,forceMount:r,children:g.jsx(Un,{present:r||c.open,children:g.jsx(_c,{asChild:!0,container:i,children:s})})})};xR.displayName=Tg;var Ia="PopoverContent",_R=w.forwardRef((e,t)=>{const r=nF(Ia,e.__scopePopover),{forceMount:s=r.forceMount,...i}=e,c=Lo(Ia,e.__scopePopover);return g.jsx(Un,{present:s||c.open,children:c.modal?g.jsx(oF,{...i,ref:t}):g.jsx(sF,{...i,ref:t})})});_R.displayName=Ia;var rF=gs("PopoverContent.RemoveScroll"),oF=w.forwardRef((e,t)=>{const r=Lo(Ia,e.__scopePopover),s=w.useRef(null),i=Ve(t,s),c=w.useRef(!1);return w.useEffect(()=>{const u=s.current;if(u)return hf(u)},[]),g.jsx(Cc,{as:rF,allowPinchZoom:!0,children:g.jsx(CR,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:he(e.onCloseAutoFocus,u=>{u.preventDefault(),c.current||r.triggerRef.current?.focus()}),onPointerDownOutside:he(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:he(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),sF=w.forwardRef((e,t)=>{const r=Lo(Ia,e.__scopePopover),s=w.useRef(!1),i=w.useRef(!1);return g.jsx(CR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(s.current||r.triggerRef.current?.focus(),c.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(s.current=!0,c.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=c.target;r.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&i.current&&c.preventDefault()}})}),CR=w.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:y,...v}=e,b=Lo(Ia,r),_=Oc(r);return ff(),g.jsx(xc,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:c,children:g.jsx(Sc,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:y,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:g.jsx(gg,{"data-state":RR(b.open),role:"dialog",id:b.contentId,..._,...v,ref:t,style:{...v.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)"}})})})}),ER="PopoverClose",aF=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Lo(ER,r);return g.jsx(ke.button,{type:"button",...s,ref:t,onClick:he(e.onClick,()=>i.onOpenChange(!1))})});aF.displayName=ER;var iF="PopoverArrow",cF=w.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=Oc(r);return g.jsx(yg,{...i,...s,ref:t})});cF.displayName=iF;function RR(e){return e?"open":"closed"}var lF=vR,uF=SR,fF=xR,dF=_R;function ZS({...e}){return g.jsx(lF,{"data-slot":"popover",...e})}function QS({...e}){return g.jsx(uF,{"data-slot":"popover-trigger",...e})}function GS({className:e,align:t="center",sideOffset:r=4,...s}){return g.jsx(fF,{children:g.jsx(dF,{"data-slot":"popover-content",align:t,sideOffset:r,className:je("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),...s})})}const hF=[{keys:["⌘","S"],description:"Save entry"},{keys:["⌘","⇧","P"],description:"Publish entry"},{keys:["⌘","K"],description:"Quick search"},{keys:["Esc"],description:"Close modal/panel"}],pF=[{label:"Documentation",url:"https://docs.convex.dev",icon:Wz},{label:"API Reference",url:"https://docs.convex.dev/api",icon:y3},{label:"Community Discord",url:"https://discord.gg/convex",icon:lD}],mF={"/":"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 gF(e,t,r){const s=[{label:t,to:"/"}],i=decodeURIComponent(e);if(i==="/")return s;const c=i.split("/").filter(Boolean);let u="";return c.forEach((f,h)=>{u+=`/${f}`;const p=h===c.length-1;let y=r.get(u)??mF[u];y||(y=f.charAt(0).toUpperCase()+f.slice(1).replace(/-/g," ")),p?s.push({label:y}):s.push({label:y,to:u})}),s}function yF(){const e=lt(),t=of(),{branding:r}=Km();let s=new Map;try{s=TI().overrides}catch{}const i=gF(e.location.pathname,r.appName,s);let c=null,u=null,f=async()=>{},h=!1;try{const x=r_();c=x.user,u=x.role,f=x.logout,h=x.isAuthenticated}catch{}const y=(u?j4(u):null)?.displayName??u??"No Role",v=c?.name??c?.email??"User",b=x=>{const C=x.split(" ");return C.length>=2?`${C[0][0]}${C[1][0]}`.toUpperCase():x.slice(0,2).toUpperCase()},_=c?.name?b(c.name):"U",E=async()=>{await f()};return g.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:[g.jsx(WB,{children:g.jsx(e9,{children:i.map((x,C)=>g.jsxs(w.Fragment,{children:[C>0&&g.jsx(o9,{}),g.jsx(t9,{children:x.to?g.jsx(n9,{asChild:!0,children:g.jsxs(cs,{to:x.to,className:"flex items-center gap-1.5",children:[C===0&&g.jsx(D1,{className:"size-3.5"}),g.jsx("span",{children:x.label})]})}):g.jsx(r9,{children:x.label})})]},C))})}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsxs(ZS,{children:[g.jsx(QS,{asChild:!0,children:g.jsxs(sc,{variant:"ghost",size:"icon",className:"size-9",children:[g.jsx(Yp,{className:"size-4"}),g.jsx("span",{className:"sr-only",children:"Notifications"})]})}),g.jsxs(GS,{align:"end",className:"w-80",children:[g.jsx("div",{className:"flex items-center justify-between pb-2",children:g.jsx("h4",{className:"font-medium",children:"Notifications"})}),g.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[g.jsx(Yp,{className:"size-8 text-muted-foreground/50"}),g.jsx("p",{className:"mt-2 text-sm font-medium",children:"No notifications yet"}),g.jsx("p",{className:"text-xs text-muted-foreground",children:"You're all caught up!"})]})]})]}),g.jsxs(ZS,{children:[g.jsx(QS,{asChild:!0,children:g.jsxs(sc,{variant:"ghost",size:"icon",className:"size-9",children:[g.jsx(j1,{className:"size-4"}),g.jsx("span",{className:"sr-only",children:"Help"})]})}),g.jsxs(GS,{align:"end",className:"w-72",children:[g.jsx("div",{className:"pb-2",children:g.jsx("h4",{className:"font-medium",children:"Help & Resources"})}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Keyboard Shortcuts"}),g.jsx("div",{className:"space-y-1",children:hF.map((x,C)=>g.jsxs("div",{className:"flex items-center justify-between text-sm",children:[g.jsx("span",{className:"text-muted-foreground",children:x.description}),g.jsx("div",{className:"flex gap-0.5",children:x.keys.map((O,M)=>g.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-xs",children:O},M))})]},C))})]}),g.jsxs("div",{children:[g.jsx("h5",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Resources"}),g.jsx("div",{className:"space-y-1",children:pF.map(x=>g.jsxs("a",{href:x.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:[g.jsx(x.icon,{className:"size-4 text-muted-foreground"}),g.jsx("span",{className:"flex-1",children:x.label}),g.jsx(S3,{className:"size-3 text-muted-foreground"})]},x.label))})]})]})]})]}),g.jsxs(Dq,{children:[g.jsx(Pq,{asChild:!0,children:g.jsxs(sc,{variant:"ghost",className:"h-9 gap-2 pl-2 pr-3",children:[g.jsxs(Kq,{className:"size-6",children:[g.jsx(Xq,{src:c?.avatarUrl,alt:v}),g.jsx(Jq,{className:"text-xs",children:_})]}),g.jsx("span",{className:"text-sm font-medium",children:v}),g.jsx(_s,{className:"size-3.5 text-muted-foreground"})]})}),g.jsxs(Lq,{align:"end",className:"w-56",children:[g.jsx(Iq,{className:"font-normal",children:g.jsxs("div",{className:"flex flex-col space-y-1",children:[g.jsx("p",{className:"text-sm font-medium",children:v}),c?.email&&g.jsx("p",{className:"text-xs text-muted-foreground",children:c.email}),g.jsx("p",{className:"text-xs text-muted-foreground",children:y})]})}),g.jsx(VS,{}),g.jsxs(FS,{onClick:()=>t({to:"/settings"}),children:[g.jsx(U1,{className:"mr-2 size-4"}),g.jsx("span",{children:"Profile & Settings"})]}),h&&g.jsxs(g.Fragment,{children:[g.jsx(VS,{}),g.jsxs(FS,{onClick:E,className:"text-destructive focus:text-destructive",children:[g.jsx(rD,{className:"mr-2 size-4"}),g.jsx("span",{children:"Logout"})]})]})]})]})]})]})}function vF({children:e}){const{layout:t}=Km();return g.jsxs("div",{className:"flex min-h-screen bg-background",children:[g.jsx(JB,{}),g.jsxs("div",{className:"flex flex-1 flex-col",style:{marginLeft:t.sidebarWidth},children:[g.jsx(yF,{}),g.jsx("main",{className:"flex-1 overflow-auto p-6",children:e})]})]})}function bF(){return g.jsx("div",{className:"route-guard route-guard--loading bg-background flex items-center justify-center min-h-screen",children:g.jsx(W3,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function wF(){return g.jsxs("div",{className:"route-guard route-guard--unauthenticated",children:[g.jsx("div",{className:"route-guard-icon",children:g.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:[g.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),g.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),g.jsx("h2",{children:"Authentication Required"}),g.jsx("p",{children:"Please log in to access the admin panel."})]})}function Ip({requiredRole:e,requiredPermission:t}){return g.jsxs("div",{className:"route-guard route-guard--unauthorized",children:[g.jsx("div",{className:"route-guard-icon",children:g.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:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("line",{x1:"4.93",y1:"4.93",x2:"19.07",y2:"19.07"})]})}),g.jsx("h2",{children:"Access Denied"}),g.jsx("p",{children:"You don't have permission to access this page."}),e&&g.jsxs("p",{className:"route-guard-detail",children:["Required role: ",g.jsx("strong",{children:e})]}),t&&g.jsxs("p",{className:"route-guard-detail",children:["Required permission:"," ",g.jsxs("strong",{children:[t.action," on ",t.resource]})]})]})}function SF({error:e}){return g.jsxs("div",{className:"route-guard route-guard--error",children:[g.jsx("div",{className:"route-guard-icon",children:g.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:[g.jsx("circle",{cx:"12",cy:"12",r:"10"}),g.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),g.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),g.jsx("h2",{children:"Authentication Error"}),g.jsx("p",{children:e})]})}function xF({children:e,requiredPermission:t,requiredRole:r,loadingComponent:s,unauthenticatedComponent:i,unauthorizedComponent:c,onUnauthenticated:u,onUnauthorized:f}){const{authState:h,role:p,checkPermission:y,error:v}=r_();return h==="loading"?g.jsx(g.Fragment,{children:s??g.jsx(bF,{})}):h==="error"?g.jsx(SF,{error:v??"An error occurred"}):h==="unauthenticated"?(u?.(),g.jsx(g.Fragment,{children:i??g.jsx(wF,{})})):p?r&&p!==r?(f?.(),g.jsx(g.Fragment,{children:c??g.jsx(Ip,{requiredRole:r,requiredPermission:t})})):t&&!y(t)?(f?.(),g.jsx(g.Fragment,{children:c??g.jsx(Ip,{requiredRole:r,requiredPermission:t})})):g.jsx(g.Fragment,{children:e}):(f?.(),g.jsx(g.Fragment,{children:c??g.jsx(Ip,{requiredRole:r,requiredPermission:t})}))}const TR=()=>{throw new Error("createServerOnlyFn() functions can only be called on the server!")};function YS(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function hm(e,t){const r=Object.create(null);if(e)for(const s of Object.keys(e))YS(s)&&(r[s]=e[s]);if(t&&typeof t=="object")for(const s of Object.keys(t))YS(s)&&(r[s]=t[s]);return r}function AR(e){return Object.create(null)}const vu=(e,t)=>{const r=t||e||{};return typeof r.method>"u"&&(r.method="GET"),Object.assign(c=>{const u={...r,...c};return vu(void 0,u)},{options:r,middleware:c=>{const u=[...r.middleware||[]];c.map(p=>{cw in p?p.options.middleware&&u.push(...p.options.middleware):u.push(p)});const f={...r,middleware:u},h=vu(void 0,f);return h[cw]=!0,h},inputValidator:c=>{const u={...r,inputValidator:c};return vu(void 0,u)},handler:(...c)=>{const[u,f]=c,h={...r,extractedFn:u,serverFn:f},p=[...h.middleware||[],EF(h)];return Object.assign(async y=>{const v=await KS(p,"client",{...u,...h,data:y?.data,headers:y?.headers,signal:y?.signal,fetch:y?.fetch,context:AR()}),b=dx(v.error);if(b)throw b;if(v.error)throw v.error;return v.result},{...u,__executeServer:async(y,v)=>{const b=TR(),_=b.contextAfterGlobalMiddlewares,E={...u,...y,serverFnMeta:u.serverFnMeta,context:hm(_,y.context),signal:v,request:b.request};return await KS(p,"server",E).then(C=>({result:C.result,error:C.error,context:C.sendContext}))}})}})};async function KS(e,t,r){const s=Tm()?.functionMiddleware||[];let i=_F([...s,...e]);if(t==="server"){const u=TR();u?.executedRequestMiddlewares&&(i=i.filter(f=>!u.executedRequestMiddlewares.has(f)))}const c=async u=>{const f=i.shift();if(!f)return u;try{"inputValidator"in f.options&&f.options.inputValidator&&t==="server"&&(u.data=await CF(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(v={})=>{const b={...u,...v,context:hm(u.context,v.context),sendContext:hm(u.sendContext,v.sendContext),headers:QN(u.headers,v.headers),_callSiteFetch:u._callSiteFetch,fetch:u._callSiteFetch??v.fetch??u.fetch,result:v.result!==void 0?v.result:v instanceof Response?v:u.result,error:v.error??u.error},_=await c(b);if(_.error)throw _.error;return _}});if(vn(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({...r,headers:r.headers||{},sendContext:r.sendContext||{},context:r.context||AR(),_callSiteFetch:r.fetch})}function _F(e,t=100){const r=new Set,s=[],i=(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&&i(f.options.middleware,u+1),r.has(f)||(r.add(f),s.push(f))})};return i(e,0),s}async function CF(e,t){if(e==null)return{};if("~standard"in e){const r=await e["~standard"].validate(t);if(r.issues)throw new Error(JSON.stringify(r.issues,void 0,2));return r.value}if("parse"in e)return e.parse(t);if(typeof e=="function")return e(t);throw new Error("Invalid validator type!")}function EF(e){return{"~types":void 0,options:{inputValidator:e.inputValidator,client:async({next:t,sendContext:r,fetch:s,...i})=>{const c={...i,context:r,fetch:s},u=await e.extractedFn?.(c);return t(u)},server:async({next:t,...r})=>{const s=await e.serverFn?.(r);return t({...r,result:s})}}}}const RF=vu({method:"GET"}).handler(d1("dff4e5b7f7b29b6a323200a2df0a5335d739cf583e83c9e514598af6b5ade819")),XS=()=>({id:"mock_user_123",name:"Demo Admin",email:"admin@example.com"}),JS=()=>"admin",WS=()=>{console.log("Logout called (mock mode)")},TF=()=>null,AF=()=>null,OF=()=>{};function kF(e){switch(e){case"mock":case"demo":return{getUser:XS,getUserRole:JS,onLogout:WS};case"none":case"disabled":return{getUser:TF,getUserRole:AF,onLogout:OF};default:return{getUser:XS,getUserRole:JS,onLogout:WS}}}const Bn=ON({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:Fz},{rel:"icon",href:"/favicon.ico"}]}),loader:async()=>({config:await RF()}),component:MF});function MF(){const{config:e}=Bn.useLoaderData(),t=w.useMemo(()=>kF(e.authMode),[e.authMode]),r=w.useMemo(()=>SI(e.adminConfig),[e.adminConfig]);return g.jsx(jF,{children:g.jsx(P4,{children:g.jsx(RI,{children:g.jsx(NF,{config:e,adminConfig:r,children:g.jsx(D4,{getUser:t.getUser,getUserRole:t.getUserRole,onLogout:t.onLogout,children:g.jsx(xF,{children:g.jsx(vF,{children:g.jsx(s1,{})})})})})})})})}function NF({children:e,config:t,adminConfig:r}){const s=w.useMemo(()=>t.convexUrl?new zz(t.convexUrl):null,[t.convexUrl]);return s?g.jsx(Pz,{client:s,children:g.jsx(EI,{baseConfig:r,children:e})}):g.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-6",children:g.jsxs("div",{className:"diff-modified max-w-lg space-y-4 rounded-lg border p-6 text-center",children:[g.jsx("h2",{className:"text-xl font-semibold text-diff-modified",children:"Convex Configuration Required"}),g.jsx("p",{className:"text-sm text-diff-modified-foreground",children:"Please provide a Convex deployment URL to connect to your backend."}),g.jsxs("div",{className:"space-y-2 text-left text-sm text-diff-modified-foreground",children:[g.jsx("p",{className:"font-medium",children:"Options:"}),g.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[g.jsxs("li",{children:["Run with URL:"," ",g.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"npx convex-cms admin --url YOUR_URL"})]}),g.jsxs("li",{children:["Set environment variable:"," ",g.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"CONVEX_URL=YOUR_URL"})]}),g.jsxs("li",{children:["Add to"," ",g.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:".env.local"}),":"," ",g.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"CONVEX_URL=YOUR_URL"})]})]})]}),g.jsxs("p",{className:"text-sm text-diff-modified-foreground",children:["Run"," ",g.jsx("code",{className:"rounded bg-diff-modified-bg/50 px-1",children:"npx convex dev"})," to start Convex and get your URL."]})]})})}function jF({children:e}){return g.jsxs("html",{lang:"en",children:[g.jsx("head",{children:g.jsx(VN,{})}),g.jsxs("body",{children:[e,g.jsx(HN,{})]})]})}const zF="modulepreload",DF=function(e){return"/"+e},ex={},mr=function(t,r,s){let i=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=u?.nonce||u?.getAttribute("nonce");i=h(r.map(p=>{if(p=DF(p),p in ex)return;ex[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":zF,y||(b.as="script"),b.crossOrigin="",b.href=p,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((_,E)=>{b.addEventListener("load",_),b.addEventListener("error",()=>E(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 i.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},PF=()=>mr(()=>import("./trash-D7e0uKd9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),LF=In("/trash")({component:dr(PF,"component")}),IF=()=>mr(()=>import("./taxonomies-DvMppdiD.js"),__vite__mapDeps([10,4,11,1,5,6,12,9])),$F=In("/taxonomies")({component:dr(IF,"component")}),UF=()=>mr(()=>import("./settings-CGVDEV1r.js"),__vite__mapDeps([13,14,1,5,15,6,7,9])),BF=In("/settings")({component:dr(UF,"component")}),qF=()=>mr(()=>import("./media-B2i-mCbx.js"),__vite__mapDeps([16,17,18,1,2,3,4,19,20,6,11,8,9])),FF=In("/media")({component:dr(qF,"component")}),VF=()=>mr(()=>import("./content-types-BrttaLpc.js"),__vite__mapDeps([21,1,2,3,4,6,11,9])),HF=In("/content-types")({component:dr(VF,"component")}),ZF=()=>mr(()=>import("./content-CKQ4QwW2.js"),__vite__mapDeps([22,14,23,6,1,2,3,4,24,9])),QF=In("/content")({component:dr(ZF,"component")}),GF=()=>mr(()=>import("./index-DOkgTSx0.js"),__vite__mapDeps([25,1,7,18,9])),YF=In("/")({component:dr(GF,"component")}),KF=()=>mr(()=>import("./_entryId-D3lr5Dvy.js"),__vite__mapDeps([26,27,15,17,18,4,11,3,20,6,24,12,23,14,28])),XF=In("/entries/$entryId")({component:dr(KF,"component")}),JF=()=>mr(()=>import("./_contentTypeId-DTv8UoTp.js"),__vite__mapDeps([29,14,28,1,2,3,24,6,4,19,20])),WF=In("/entries/type/$contentTypeId")({component:dr(JF,"component")}),e7=()=>mr(()=>import("./new._contentTypeId-VF63rpic.js"),__vite__mapDeps([30,27,15,17,18,4,11,3,20,6,24,12,23,28])),t7=In("/entries/new/$contentTypeId")({component:dr(e7,"component")}),n7=LF.update({id:"/trash",path:"/trash",getParentRoute:()=>Bn}),r7=$F.update({id:"/taxonomies",path:"/taxonomies",getParentRoute:()=>Bn}),o7=BF.update({id:"/settings",path:"/settings",getParentRoute:()=>Bn}),s7=FF.update({id:"/media",path:"/media",getParentRoute:()=>Bn}),a7=HF.update({id:"/content-types",path:"/content-types",getParentRoute:()=>Bn}),i7=QF.update({id:"/content",path:"/content",getParentRoute:()=>Bn}),c7=YF.update({id:"/",path:"/",getParentRoute:()=>Bn}),l7=XF.update({id:"/entries/$entryId",path:"/entries/$entryId",getParentRoute:()=>Bn}),u7=WF.update({id:"/entries/type/$contentTypeId",path:"/entries/type/$contentTypeId",getParentRoute:()=>Bn}),f7=t7.update({id:"/entries/new/$contentTypeId",path:"/entries/new/$contentTypeId",getParentRoute:()=>Bn}),d7={IndexRoute:c7,ContentRoute:i7,ContentTypesRoute:a7,MediaRoute:s7,SettingsRoute:o7,TaxonomiesRoute:r7,TrashRoute:n7,EntriesEntryIdRoute:l7,EntriesNewContentTypeIdRoute:f7,EntriesTypeContentTypeIdRoute:u7},h7=Bn._addFileChildren(d7);function p7(){return LN({routeTree:h7,scrollRestoration:!0,defaultPreload:"intent"})}async function m7(){const e=await p7();let t;return t=[],window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(fj),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:"",serializationAdapters:t}),e.state.matches.length||await YN(e),e}async function g7(){const e=await m7();return window.$_TSR?.h(),e}let $p;function y7(){return $p||($p=g7()),g.jsx(oN,{promise:$p,children:e=>g.jsx(UN,{router:e})})}w.startTransition(()=>{nA.hydrateRoot(document,g.jsx(w.StrictMode,{children:g.jsx(y7,{})}))});export{O3 as $,x8 as A,P1 as B,$r as C,g8 as D,sc as E,T3 as F,W3 as G,Dq as H,os as I,Pq as J,Lq as K,jn as L,FS as M,_3 as N,VS as O,I1 as P,Q3 as Q,xF as R,Np as S,MD as T,D1 as U,D3 as V,w8 as W,ju as X,S8 as Y,C7 as Z,X3 as _,Ow as a,m3 as a0,AD as a1,KB as a2,j3 as a3,k1 as a4,Kp as a5,$1 as a6,z1 as a7,u3 as a8,L1 as a9,hr as aA,he as aB,Yn as aC,Rt as aD,AS as aE,To as aF,xC as aG,_C as aH,Qn as aI,m9 as aJ,g9 as aK,TE as aL,TI as aM,l8 as aN,u8 as aO,f8 as aP,d8 as aQ,wc as aR,wC as aS,gD as aa,M8 as ab,lt as ac,of as ad,Em as ae,XF as af,WF as ag,cs as ah,N1 as ai,ZS as aj,QS as ak,GS as al,r_ as am,z4 as an,x7 as ao,M4 as ap,t7 as aq,qt as ar,N8 as as,Y3 as at,y3 as au,h3 as av,Ve as aw,ag as ax,ke as ay,Un as az,zp as b,jp as c,Dp as d,Qi as e,jD as f,TS as g,je as h,R7 as i,g as j,$u as k,Se as l,rg as m,U8 as n,RD as o,_s as p,i3 as q,w as r,CD as s,Km as t,A1 as u,tD as v,M1 as w,_7 as x,mf as y,b8 as z};
|