@buildbase/sdk 0.0.12 → 0.0.13
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 +34 -13
- package/dist/index.d.ts +28 -194
- package/dist/index.esm.js +5 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -11
- package/dist/index.js.map +1 -1
- package/dist/types/components/dropdowns/country/selectCountry.d.ts +2 -2
- package/dist/types/components/dropdowns/currency/selectCurrency.d.ts +2 -2
- package/dist/types/components/dropdowns/language/selectLanguage.d.ts +2 -2
- package/dist/types/components/dropdowns/timezone/selectTimeZone.d.ts +2 -2
- package/dist/types/components/ui/command-select.d.ts +13 -0
- package/dist/types/components/ui/command.d.ts +2 -2
- package/dist/types/contexts/WorkspaceContext/actions.d.ts +1 -1
- package/dist/types/contexts/WorkspaceContext/types.d.ts +3 -3
- package/dist/types/contexts/shared/useSelectWithEquality.d.ts +10 -0
- package/dist/types/index.d.ts +1 -3
- package/dist/types/lib/api-utils.d.ts +18 -0
- package/dist/types/lib/error-handler.d.ts +18 -0
- package/dist/types/lib/logger.d.ts +27 -0
- package/dist/types/lib/useAsyncEffect.d.ts +29 -0
- package/dist/types/lib/utils.d.ts +5 -0
- package/dist/types/providers/auth/types.d.ts +12 -0
- package/dist/types/providers/auth/utils.d.ts +7 -2
- package/dist/types/providers/constants.d.ts +1 -0
- package/dist/types/providers/workspace/hooks.d.ts +10 -7
- package/dist/types/providers/workspace/provider.d.ts +0 -1
- package/dist/types/providers/workspace/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,createContext as i,useReducer as s,useMemo as c,useCallback as l,useEffect as d,useState as u,forwardRef as f,createElement as p,useRef as m,useLayoutEffect as h,Suspense as g,lazy as v,useContext as y}from"react";import*as b from"react-dom";import w from"react-dom";var x;!function(e){e.V1="v1"}(x||(x={}));class S extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,S)}}const k=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e}}handleError(e,t={}){const r=e instanceof Error?e:new S("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof S?r:new S(r.message,r.name,t,r),a=(()=>{try{return"undefined"!=typeof process&&"development"===process.env?.NODE_ENV}catch{return!1}})();if(this.config.enableConsoleLogging&&a&&console.error(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){console.error("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function E(e,t={}){k.handleError(e,t)}function A(e,t,r,n){return new S(e,t,r,n)}class N extends o{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(E(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){console.error("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const C=()=>({type:"AUTHENTICATION_STARTED"}),_=()=>({type:"AUTHENTICATION_PROCESSING"}),T=()=>({type:"AUTHENTICATION_FAILED"}),R=e=>({type:"SET_SESSION",payload:e}),P=()=>({type:"REMOVE_SESSION"});function O({name:e,initialState:r,reducer:n,initializer:o}){const l=i(null),d=i(null),u=i(null),f=a.memo(({children:e})=>{const[a,i]=s(n,r,o||(e=>e)),f=c(()=>({state:a,dispatch:i}),[a,i]);return t(u.Provider,{value:f,children:t(l.Provider,{value:a,children:t(d.Provider,{value:i,children:e})})})});f.displayName=`${e}Provider`;const p=()=>{const t=a.useContext(l);if(null===t)throw new Error(`use${e}State must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t};return{Provider:f,useContext:()=>{const t=a.useContext(u);if(!t)throw new Error(`use${e}Context must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useState:p,useDispatch:()=>{const t=a.useContext(d);if(null===t)throw new Error(`use${e}Dispatch must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useSelector:(e,t)=>{const r=p(),n=e||(e=>e),o=a.useRef(n),i=a.useRef(t),s=a.useRef(void 0),l=a.useRef(r);e&&(o.current=n),t&&(i.current=t);return c(()=>{const e=o.current(r);if(void 0!==s.current){if((i.current?i.current(s.current,e):Object.is(s.current,e))&&l.current===r)return s.current}return s.current=e,l.current=r,e},[r])}}}var I;function D(e){return{isAuthenticated:e===I.authenticated,isLoading:e===I.loading||e===I.redirecting||e===I.authenticating,isRedirecting:e===I.redirecting}}function U(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return console.warn(`Failed to load ${e} from localStorage:`,t),null}}function M(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function z(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){console.warn(`Failed to remove ${e} from localStorage:`,t)}}!function(e){e.loading="loading",e.redirecting="redirecting",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(I||(I={}));const F="code",L="saas-session-id";function j(){z(L)}function $(){if("undefined"==typeof window)return null;try{return U(L)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function V(){const e=$(),t={};return e&&(t["x-session-id"]=e),t}function B(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(F)}catch(e){return console.error("Error getting token from URL:",e),null}}function W(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const G=()=>({session:null,status:I.loading}),{Provider:H,useState:K,useDispatch:Z}=O({name:"Auth",initialState:G(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,status:I.redirecting};case"AUTHENTICATION_PROCESSING":return{...e,status:I.authenticating};case"AUTHENTICATION_FAILED":return{...e,session:null,status:I.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,M(L,r),{...e,session:n,status:I.authenticated}}case"REMOVE_SESSION":return j(),{...e,session:null,status:I.unauthenticated};default:return e}var r},initializer:G}),J=H,q=K,Y=Z,X=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),Q=e=>({type:"SET_SETTINGS",payload:e}),ee=()=>({serverUrl:"",version:x.V1,orgId:"",settings:null}),{Provider:te,useState:re,useDispatch:ne}=O({name:"OS",initialState:ee(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return ee();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),ae=te,oe=re,ie=ne,se=e=>({type:"SET_WORKSPACES",payload:e}),ce=e=>({type:"SET_ALL_FEATURES",payload:e}),le=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),de=()=>({type:"RESET_CURRENT_WORKSPACE"}),ue=e=>({type:"SET_IS_INITIALIZED",payload:e}),fe=e=>({type:"SET_LOADING",payload:e}),pe=e=>({type:"SET_ERROR",payload:e}),me=e=>({type:"SET_REFRESHING",payload:e}),he="saas-workspace-current";const{Provider:ge,useState:ve,useDispatch:ye}=O({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switching:!1,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return{...e,workspaces:t.payload};case"SET_ALL_FEATURES":return{...e,allFeatures:t.payload};case"SET_CURRENT_WORKSPACE":return(r=t.payload._id)?M(he,r):z(he),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return z(he),{...e,currentWorkspace:null};case"SET_IS_INITIALIZED":return{...e,isInitialized:t.payload};case"SET_LOADING":return{...e,loading:t.payload};case"SET_ERROR":return{...e,error:t.payload};case"SET_REFRESHING":return{...e,refreshing:t.payload};case"SET_SWITCHING":return{...e,switching:t.payload};default:return e}var r}}),be=ge,we=ve,xe=ye,Se=a.memo(({children:e})=>t(ae,{children:t(J,{children:t(be,{children:e})})}));function ke(e,t){const r=oe(),n=q(),o=we(),i=c(()=>({os:r,auth:n,workspaces:o}),[r,n,o]),s=e||(e=>e),l=a.useRef(s),d=a.useRef(t),u=a.useRef(void 0),f=a.useRef(i);e&&(l.current=s);return c(()=>{const e=l.current(i);if(void 0!==u.current){if((d.current?d.current(u.current,e):Object.is(u.current,e))&&f.current===i)return u.current}return u.current=e,f.current=i,e},[i])}function Ee(){const e=Y(),t=ie(),r=xe();return c(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}function Ae(e){if(null==e)return e;if("object"!=typeof e)return e;const t=new Set(["authorization","token","password","accessToken","refreshToken"]);if(Array.isArray(e))return e.map(Ae);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":Ae(a);return r}function Ne(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function Ce(e,t){try{const r=await fetch(e,t);if(function(){try{const e="undefined"!=typeof globalThis?globalThis:null,t=e?.process;return null!=t&&null!=t.env&&"development"===t.env.NODE_ENV}catch{return!1}}()){const n=(t?.method??"GET").toUpperCase();let a;if(null!=t?.body)try{a="string"==typeof t.body?JSON.parse(t.body):{body:"(non-JSON)"}}catch{a={body:"(parse failed)"}}const o=r.clone();let i;try{const e=await o.text();if(e)try{i=JSON.parse(e)}catch{i=e.substring(0,200)+(e.length>200?"...":"")}}catch{i="(read failed)"}console.log("[SDK API]",n,e,{request:Ae(a),response:Ae(i),status:r.status})}return r}catch(e){if(Ne(e))throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new Error("Network error: Please check your internet connection");throw e}}async function _e(e){const t=await e.text();if(!t)throw new Error("Empty response body");try{return JSON.parse(t)}catch(e){throw new Error(`Invalid JSON response: ${t.substring(0,100)}${t.length>100?"...":""}`)}}async function Te(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await _e(e);r=t.message||t.error||r}catch{r=function(e,t){const r={400:"Bad Request",401:"Unauthorized - Please check your session",403:"Forbidden - You do not have permission",404:"Resource not found",500:"Internal server error",502:"Bad Gateway",503:"Service unavailable"}[e.status]||e.statusText||t;return new Error(`${t} (${e.status}: ${r})`)}(e,t).message}throw new Error(r)}try{return await _e(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}Se.displayName="SDKContextProvider";const Re=a.memo(({children:e,callbacks:n})=>{const o=Ee(),i=ke(e=>e.auth),s=ke(e=>e.os),u=D(i.status).isAuthenticated,f=a.useRef(!1),p=a.useRef(null),m=a.useRef(!1),h=c(()=>n,[n]),g=l(async e=>{try{if(h?.handleAuthentication){const{sessionId:t}=await h.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=s,{serverUrl:n,version:a,orgId:i}=r;if(!n||!a||!i)throw new Error("OS configuration is not available");const c=await Ce(`${n}/api/${a}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}}),l=await Te(c,"Failed to fetch user profile"),d=l._id||l.id;if(!d||"string"!=typeof d)throw new Error("User data missing required ID field");if(!l.email||"string"!=typeof l.email)throw new Error("User data missing required email field");const u=W({id:d,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);o.auth(R(u)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(F),window.history.replaceState({},"",e.toString())}catch(e){console.error("Error removing token from URL:",e)}}()}}catch(t){throw E(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(T()),t}},[o,h,s]);return d(()=>{if("undefined"==typeof window)return;if(u)return;if(m.current)return;if(B())return;const e=$();if(!e)return void o.auth(T());const t=new AbortController;return(async()=>{m.current=!0;try{const{serverUrl:r,version:n,orgId:a}=s;if(!r||!n||!a)return m.current=!1,void E(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});let i;try{const a=await Ce(`${r}/api/${n}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"},signal:t.signal});i=await Te(a,"Failed to fetch user profile")}catch(e){if(Ne(e))return;return m.current=!1,E(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}),j(),void o.auth(T())}const c=i._id||i.id;if(!c||"string"!=typeof c)return m.current=!1,E(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),j(),void o.auth(T());if(!i.email||"string"!=typeof i.email)return m.current=!1,E(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),j(),void o.auth(T());const l=W({id:c,name:i.name||"",org:a,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);o.auth(R(l))}catch(e){if(Ne(e))return;E(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),j(),o.auth(T())}finally{m.current=!1}})(),()=>{t.abort()}},[u,o,s]),d(()=>{const e=B();if(!e)return;if(f.current||p.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(f.current=!0,p.current=e,o.auth(_()),g(e).then(()=>{p.current=null}).catch(t=>{E(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),p.current=null}).finally(()=>{f.current=!1}))},[g,s.serverUrl,s.version,s.orgId]),t(r,{children:e})});Re.displayName="AuthProviderWrapper";const Pe=a.memo(({config:e,auth:n,children:o})=>{const i=Ee(),s=ke(e=>e.os),c=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return d(()=>{i.os(X({...e,auth:c}))},[e,c,i]),d(()=>{const{serverUrl:e,version:t,orgId:r,settings:n}=s;if(!e||!t||!r||n)return;const a=new AbortController;return(async()=>{try{const n=V(),o=await Ce(`${e}/api/${t}/public/${r}/settings`,{headers:n,signal:a.signal});if(o.ok){const e=await o.json();i.os(Q(e))}}catch(n){if(Ne(n))return;E(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})(),()=>{a.abort()}},[s.serverUrl,s.version,s.orgId,s.settings,i]),t(r,{children:o})});Pe.displayName="ContextConfigProvider";const Oe=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){E(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}},Ie=i({container:null,setContainer:()=>{}}),De=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(Ie.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});De.displayName="PortalProvider";const Ue=a.createContext(void 0),Me=a.memo(({children:e})=>{const r=ke(e=>e.os),n=ke(e=>e.auth),{serverUrl:o,version:i}=r,s=D(n.status).isAuthenticated,[c,f]=u({}),[p,m]=u({}),[h,g]=u(!1),[v,y]=u(null),b=l(async()=>{if(o&&i&&s)try{const e=await Ce(`${o}/api/${i}/public/users/attributes`,{headers:V()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user attributes")}const t=await e.json();t&&"object"==typeof t&&!Array.isArray(t)?f(t):f({})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user attributes");y(t),E(e,{component:"UserProvider",action:"fetchAttributes"})}else f({})},[o,i,s]),w=l(async()=>{if(o&&i&&s){g(!0),y(null);try{await b()}finally{g(!1)}}},[o,i,s,b]),x=l(async e=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),y(null);try{const t=await Ce(`${o}/api/${i}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...V()},body:JSON.stringify({attributes:e})});if(!t.ok){const e=await t.json().catch(()=>({}));throw new Error(e.message||"Failed to update user attributes")}const r=await t.json();return await b(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw y(r),E(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{g(!1)}},[o,i,b]),S=l(async(e,t)=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),y(null);try{const r=await Ce(`${o}/api/${i}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...V()},body:JSON.stringify({value:t})});if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.message||"Failed to update user attribute")}const n=await r.json();return await b(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw y(n),E(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{g(!1)}},[o,i,b]),k=l(async()=>{if(o&&i&&s)try{const e=await Ce(`${o}/api/${i}/public/users/features`,{headers:V()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user features")}const t=await e.json();m("object"==typeof t?t:{})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user features");y(t),E(e,{component:"UserProvider",action:"fetchFeatures"})}else m({})},[o,i,s]),A=l(async()=>{if(o&&i&&s){g(!0),y(null);try{await k()}finally{g(!1)}}},[o,i,s,k]);d(()=>{s&&o&&i?(g(!0),y(null),Promise.all([b(),k()]).finally(()=>{g(!1)})):(f({}),m({}))},[s,o,i,b,k]);const N=a.useMemo(()=>({attributes:c,features:p,isLoading:h,error:v,updateAttributes:x,updateAttribute:S,refreshAttributes:w,refreshFeatures:A}),[c,p,h,v,x,S,w,A]);return t(Ue.Provider,{value:N,children:e})});Me.displayName="UserProvider";class ze{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return V()}async getWorkspaces(){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()}),"Failed to fetch workspaces")}async createWorkspace(e){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)}),"Failed to create workspace")}async updateWorkspace(e,t){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)}),"Failed to update workspace")}async deleteWorkspace(e){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to delete workspace")}async getWorkspaceUsers(e){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()}),"Failed to fetch workspace users")}async addUser(e,t){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)}),"Failed to invite member")}async removeUser(e,t){return Te(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to remove user")}async updateUser(e,t,r){const n=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(r)});if(!n.ok){const e=await n.json();throw new Error(e.message||"Failed to update user")}return n.json()}async getFeatures(){const e=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/features`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch features");return e.json()}async updateFeature(e,t,r){const n=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/features`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify({features:{[t]:r}})});if(!n.ok)throw new Error("Failed to update feature");return n.json()}async getWorkspace(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace");return t.json()}async getProfile(){const e=await Ce(`${this.serverUrl}/api/${this.version}/public/profile`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch profile");return e.json()}async updateUserProfile(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/profile`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to update user profile");return t.json()}async getCurrentSubscription(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Workspace not found or no subscription available":401===t.status?"Unauthorized - Please check your session":`Failed to fetch subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch subscription");return r.data}return r}async getPlanGroup(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group found for this workspace":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group");return r.data}return r}async getPlanGroupByVersion(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group?groupVersionId=${t}`,{headers:this.getAuthHeader()});if(!r.ok){let e="Failed to fetch plan group version";try{e=(await r.json()).message||e}catch{e=404===r.status?"Plan group version not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch plan group version");return n.data}return n}async getPlanGroupVersions(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group/versions`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group versions";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group versions found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group versions (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group versions");return r.data}return r}async getPlanGroupVersion(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/plan-group-versions/${e}`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group version";try{e=(await t.json()).message||e}catch{e=404===t.status?"Plan group version not found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group version");return r.data}return r}async createCheckoutSession(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/checkout`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){let e="Failed to create checkout session";try{e=(await r.json()).message||e}catch{e=`Failed to create checkout session (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to create checkout session");return n.data||n}return n}async updateSubscription(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){let e="Failed to update subscription";try{e=(await r.json()).message||e}catch{e=`Failed to update subscription (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to update subscription");return n.data?.checkoutUrl||n.checkoutUrl?n.data||n:n.data}return n.checkoutUrl,n}async listInvoices(e,t=10,r){const n=new URLSearchParams;n.append("limit",t.toString()),r&&n.append("starting_after",r);const a=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/invoices?${n.toString()}`,{headers:this.getAuthHeader()});if(!a.ok){let e="Failed to fetch invoices";try{e=(await a.json()).message||e}catch{e=404===a.status?"Workspace not found or no invoices available":401===a.status?"Unauthorized - Please check your session":`Failed to fetch invoices (${a.status}: ${a.statusText})`}throw new Error(e)}const o=await a.json();if(void 0!==o.success){if(!o.success)throw new Error(o.message||"Failed to fetch invoices");return o}return o}async getInvoice(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/invoices/${t}`,{headers:this.getAuthHeader()});if(!r.ok){let e="Failed to fetch invoice";try{e=(await r.json()).message||e}catch{e=404===r.status?"Invoice not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch invoice (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch invoice");return n}return n}}var Fe=e=>"checkbox"===e.type,Le=e=>e instanceof Date,je=e=>null==e;const $e=e=>"object"==typeof e;var Ve=e=>!je(e)&&!Array.isArray(e)&&$e(e)&&!Le(e),Be=e=>Ve(e)&&e.target?Fe(e.target)?e.target.checked:e.target.value:e,We=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Ge="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function He(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(Ge&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||Ve(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Ve(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=He(e[t]));return n}var Ke=e=>/^\w*$/.test(e),Ze=e=>void 0===e,Je=e=>Array.isArray(e)?e.filter(Boolean):[],qe=e=>Je(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ye=(e,t,r)=>{if(!t||!Ve(e))return r;const n=(Ke(t)?[t]:qe(t)).reduce((e,t)=>je(e)?e:e[t],e);return Ze(n)||n===e?Ze(e[t])?r:e[t]:n},Xe=e=>"boolean"==typeof e,Qe=e=>"function"==typeof e,et=(e,t,r)=>{let n=-1;const a=Ke(t)?[t]:qe(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Ve(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const tt="blur",rt="focusout",nt="change",at="onBlur",ot="onChange",it="onSubmit",st="onTouched",ct="all",lt="max",dt="min",ut="maxLength",ft="minLength",pt="pattern",mt="required",ht="validate",gt=a.createContext(null);gt.displayName="HookFormContext";const vt=()=>a.useContext(gt),yt=e=>{const{children:t,...r}=e;return a.createElement(gt.Provider,{value:r},t)};var bt=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const a=o;return t._proxyFormState[a]!==ct&&(t._proxyFormState[a]=!n||ct),r&&(r[a]=!0),e[a]}});return a};const wt="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var xt=e=>"string"==typeof e,St=(e,t,r,n,a)=>xt(e)?(n&&t.watch.add(e),Ye(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Ye(r,e))):(n&&(t.watchAll=!0),r),kt=e=>je(e)||!$e(e);function Et(e,t,r=new WeakSet){if(kt(e)||kt(t))return Object.is(e,t);if(Le(e)&&Le(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const n=e[o];if(!a.includes(o))return!1;if("ref"!==o){const e=t[o];if(Le(n)&&Le(e)||Ve(n)&&Ve(e)||Array.isArray(n)&&Array.isArray(e)?!Et(n,e,r):!Object.is(n,e))return!1}}return!0}function At(e){const t=vt(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s,exact:c=!0}=e,l=We(o._names.array,r),d=a.useMemo(()=>Ye(o._formValues,r,Ye(o._defaultValues,r,s)),[o,r,s]),u=function(e){const t=vt(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},l=a.useRef(o),d=a.useRef(c),u=a.useRef(void 0),f=a.useRef(r),p=a.useRef(n);d.current=c;const[m,h]=a.useState(()=>{const e=r._getWatch(n,l.current);return d.current?d.current(e):e}),g=a.useCallback(e=>{const t=St(n,r._names,e||r._formValues,!1,l.current);return d.current?d.current(t):t},[r._formValues,r._names,n]),v=a.useCallback(e=>{if(!i){const t=St(n,r._names,e||r._formValues,!1,l.current);if(d.current){const e=d.current(t);Et(e,u.current)||(h(e),u.current=e)}else h(t)}},[r._formValues,r._names,i,n]);wt(()=>(f.current===r&&Et(p.current,n)||(f.current=r,p.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{v(e.values)}})),[r,s,n,v]),a.useEffect(()=>r._removeUnmounted());const y=f.current!==r,b=p.current,w=a.useMemo(()=>{if(i)return null;const e=!y&&!Et(b,n);return y||e?g():null},[i,y,n,b,g]);return null!==w?w:m}({control:o,name:r,defaultValue:d,exact:c}),f=function(e){const t=vt(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,c]=a.useState(r._formState),l=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return wt(()=>r._subscribe({name:o,formState:l.current,exact:i,callback:e=>{!n&&c({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>bt(s,r,l.current,!1),[s,r])}({control:o,name:r,exact:c}),p=a.useRef(e),m=a.useRef(void 0),h=a.useRef(o.register(r,{...e.rules,value:u,...Xe(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ye(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Ye(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Ye(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Ye(f.validatingFields,r)},error:{enumerable:!0,get:()=>Ye(f.errors,r)}}),[f,r]),v=a.useCallback(e=>h.current.onChange({target:{value:Be(e),name:r},type:nt}),[r]),y=a.useCallback(()=>h.current.onBlur({target:{value:Ye(o._formValues,r),name:r},type:tt}),[r,o._formValues]),b=a.useCallback(e=>{const t=Ye(o._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>Qe(e.focus)&&e.focus(),select:()=>Qe(e.select)&&e.select(),setCustomValidity:t=>Qe(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Qe(e.reportValidity)&&e.reportValidity()})},[o._fields,r]),w=a.useMemo(()=>({name:r,value:u,...Xe(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:y,ref:b}),[r,n,f.disabled,v,y,b,u]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i,t=m.current;t&&t!==r&&!l&&o.unregister(t),o.register(r,{...p.current.rules,...Xe(p.current.disabled)?{disabled:p.current.disabled}:{}});const n=(e,t)=>{const r=Ye(o._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=He(Ye(o._options.defaultValues,r,p.current.defaultValue));et(o._defaultValues,r,e),Ze(Ye(o._formValues,r))&&et(o._formValues,r,e)}return!l&&o.register(r),m.current=r,()=>{(l?e&&!o._state.action:e)?o.unregister(r):n(r,!1)}},[r,o,l,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:w,formState:f,fieldState:g}),[w,f,g])}const Nt=e=>e.render(At(e));var Ct=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},_t=e=>Array.isArray(e)?e:[e],Tt=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Rt(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&Ve(a)&&o){const e=Rt(a,o);Ve(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var Pt=e=>Ve(e)&&!Object.keys(e).length,Ot=e=>"file"===e.type,It=e=>{if(!Ge)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Dt=e=>"select-multiple"===e.type,Ut=e=>"radio"===e.type,Mt=e=>It(e)&&e.isConnected;function zt(e,t){const r=Array.isArray(t)?t:Ke(t)?[t]:qe(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Ze(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Ve(n)&&Pt(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ze(e[t]))return!1;return!0}(n))&&zt(e,r.slice(0,-1)),e}function Ft(e){return Array.isArray(e)||Ve(e)&&!(e=>{for(const t in e)if(Qe(e[t]))return!0;return!1})(e)}function Lt(e,t={}){for(const r in e){const n=e[r];Ft(n)?(t[r]=Array.isArray(n)?[]:{},Lt(n,t[r])):Ze(n)||(t[r]=!0)}return t}function jt(e,t,r){r||(r=Lt(t));for(const n in e){const a=e[n];if(Ft(a))Ze(t)||kt(r[n])?r[n]=Lt(a,Array.isArray(a)?[]:{}):jt(a,je(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Et(a,e)}}return r}const $t={value:!1,isValid:!1},Vt={value:!0,isValid:!0};var Bt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ze(e[0].attributes.value)?Ze(e[0].value)||""===e[0].value?Vt:{value:e[0].value,isValid:!0}:Vt:$t}return $t},Wt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ze(e)?e:t?""===e?NaN:e?+e:e:r&&xt(e)?new Date(e):n?n(e):e;const Gt={isValid:!1,value:null};var Ht=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Gt):Gt;function Kt(e){const t=e.ref;return Ot(t)?t.files:Ut(t)?Ht(e.refs).value:Dt(t)?[...t.selectedOptions].map(({value:e})=>e):Fe(t)?Bt(e.refs).value:Wt(Ze(t.value)?e.ref.value:t.value,e)}var Zt=e=>e instanceof RegExp,Jt=e=>Ze(e)?e:Zt(e)?e.source:Ve(e)?Zt(e.value)?e.value.source:e.value:e,qt=e=>({isOnSubmit:!e||e===it,isOnBlur:e===at,isOnChange:e===ot,isOnAll:e===ct,isOnTouch:e===st});const Yt="AsyncFunction";var Xt=e=>!!e&&!!e.validate&&!!(Qe(e.validate)&&e.validate.constructor.name===Yt||Ve(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Yt)),Qt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const er=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Ye(e,a);if(r){const{_f:e,...o}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(er(o,t))break}else if(Ve(o)&&er(o,t))break}}};function tr(e,t,r){const n=Ye(e,r);if(n||Ke(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Ye(t,n),i=Ye(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var rr=(e,t,r)=>{const n=_t(Ye(e,r));return et(n,"root",t[r]),et(e,r,n),e};function nr(e,t,r="validate"){if(xt(e)||Array.isArray(e)&&e.every(xt)||Xe(e)&&!e)return{type:r,message:xt(e)?e:"",ref:t}}var ar=e=>Ve(e)&&!Zt(e)?e:{value:e,message:""},or=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,y=Ye(r,h);if(!v||t.has(h))return{};const b=s?s[0]:i,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(Xe(e)?"":e||""),b.reportValidity())},x={},S=Ut(i),k=Fe(i),E=S||k,A=(g||Ot(i))&&Ze(i.value)&&Ze(y)||It(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,N=Ct.bind(null,h,n,x),C=(e,t,r,n=ut,a=ft)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:i,...N(e?n:a,o)}};if(o?!Array.isArray(y)||!y.length:c&&(!E&&(A||je(y))||Xe(y)&&!y||k&&!Bt(s).isValid||S&&!Ht(s).isValid)){const{value:e,message:t}=xt(c)?{value:!!c,message:c}:ar(c);if(e&&(x[h]={type:mt,message:t,ref:b,...N(mt,t)},!n))return w(t),x}if(!(A||je(u)&&je(f))){let e,t;const r=ar(f),a=ar(u);if(je(y)||isNaN(y)){const n=i.valueAsDate||new Date(y),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;xt(r.value)&&y&&(e=s?o(y)>o(r.value):c?y>r.value:n>new Date(r.value)),xt(a.value)&&y&&(t=s?o(y)<o(a.value):c?y<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(y?+y:y);je(r.value)||(e=n>r.value),je(a.value)||(t=n<a.value)}if((e||t)&&(C(!!e,r.message,a.message,lt,dt),!n))return w(x[h].message),x}if((l||d)&&!A&&(xt(y)||o&&Array.isArray(y))){const e=ar(l),t=ar(d),r=!je(e.value)&&y.length>+e.value,a=!je(t.value)&&y.length<+t.value;if((r||a)&&(C(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!A&&xt(y)){const{value:e,message:t}=ar(p);if(Zt(e)&&!y.match(e)&&(x[h]={type:pt,message:t,ref:i,...N(pt,t)},!n))return w(t),x}if(m)if(Qe(m)){const e=nr(await m(y,r),b);if(e&&(x[h]={...e,...N(ht,e.message)},!n))return w(e.message),x}else if(Ve(m)){let e={};for(const t in m){if(!Pt(e)&&!n)break;const a=nr(await m[t](y,r),b,t);a&&(e={...a,...N(t,a.message)},w(a.message),n&&(x[h]=e))}if(!Pt(e)&&(x[h]={ref:b,...e},!n))return x}return w(!0),x};const ir={mode:it,reValidateMode:ot,shouldFocusError:!0};function sr(e={}){let t,r={...ir,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Qe(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Ve(r.defaultValues)||Ve(r.values))&&He(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:He(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...d};let f={...u};const p={array:Tt(),state:Tt()},m=r.criteriaMode===ct,h=async e=>{if(!s.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=Pt((await w()).errors),g()):e=await x(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?et(n.validatingFields,e,t):zt(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Pt(n.validatingFields)}))},v=(e,t,r,n)=>{const c=Ye(a,e);if(c){const a=Ye(i,e,Ze(r)?Ye(o,e):r);Ze(a)||n&&n.defaultChecked||t?et(i,e,t?a:Kt(c._f)):E(e,a),s.mount&&!s.action&&h()}},y=(e,t,a,i,s)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||i){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=Et(Ye(o,e),t);l=!!Ye(n.dirtyFields,e),r?zt(n.dirtyFields,e):et(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=Ye(n.touchedFields,e);t||(et(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(d)}return c?d:{}},b=(e,a,o,i)=>{const s=Ye(n.errors,e),c=(u.isValid||f.isValid)&&Xe(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{et(n.errors,e,t),p.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(l),l=setTimeout(d,e)},t(r.delayError)):(clearTimeout(l),t=null,o?et(n.errors,e,o):zt(n.errors,e)),(o?!Et(s,o):s)||!Pt(i)||c){const t={...i,...c&&Xe(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{g(e,!0);const t=await r.resolver(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Ye(t,r);e&&et(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(t,a,o={valid:!0})=>{for(const s in t){const l=t[s];if(l){const{_f:t,...s}=l;if(t){const s=c.array.has(t.name),d=l._f&&Xt(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await or(l,c.disabled,i,m,r.shouldUseNativeValidation&&!a,s);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Ye(f,t.name)?s?rr(n.errors,f,t.name):et(n.errors,t.name,f[t.name]):zt(n.errors,t.name))}!Pt(s)&&await x(s,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&et(i,e,t),!Et(R(),o)),k=(e,t,r)=>St(e,c,{...s.mount?i:Ze(t)?o:xt(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=Ye(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&et(i,e,Wt(t,r)),o=It(r.ref)&&je(t)?"":t,Dt(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?Fe(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):Ot(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:He(i)})))}(r.shouldDirty||r.shouldTouch)&&y(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&T(e)},A=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=Ye(a,i);(c.array.has(e)||Ve(o)||s&&!s._f)&&!Le(o)?A(i,o,r):E(i,o,r)}},N=(e,t,r={})=>{const l=Ye(a,e),d=c.array.has(e),m=He(t);et(i,e,m),d?(p.array.next({name:e,values:He(i)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:jt(o,i),isDirty:S(e,m)})):!l||l._f||je(m)?E(e,m,r):A(e,m,r),Qt(e,c)?p.state.next({...n,name:e,values:He(i)}):p.state.next({name:s.mount?e:void 0,values:He(i)})},C=async e=>{s.mount=!0;const o=e.target;let l=o.name,d=!0;const v=Ye(a,l),S=e=>{d=Number.isNaN(e)||Le(e)&&isNaN(e.getTime())||Et(e,Ye(i,l,e))},k=qt(r.mode),E=qt(r.reValidateMode);if(v){let s,A;const N=o.type?Kt(v._f):Be(e),C=e.type===tt||e.type===rt,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(v._f)&&!r.resolver&&!Ye(n.errors,l)&&!v._f.deps||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(C,Ye(n.touchedFields,l),n.isSubmitted,E,k),R=Qt(l,c,C);et(i,l,N),C?o&&o.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);const P=y(l,N,C),O=!Pt(P)||R;if(!C&&p.state.next({name:l,type:e.type,values:He(i)}),_)return(u.isValid||f.isValid)&&("onBlur"===r.mode?C&&h():C||h()),O&&p.state.next({name:l,...R?{}:P});if(!C&&R&&p.state.next({...n}),r.resolver){const{errors:e}=await w([l]);if(g([l]),S(N),d){const t=tr(n.errors,a,l),r=tr(e,a,t.name||l);s=r.error,l=r.name,A=Pt(e)}}else g([l],!0),s=(await or(v,c.disabled,i,m,r.shouldUseNativeValidation))[l],g([l]),S(N),d&&(s?A=!1:(u.isValid||f.isValid)&&(A=await x(a,!0)));d&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&T(v._f.deps),b(l,A,s,P))}},_=(e,t)=>{if(Ye(n.errors,t)&&e.focus)return e.focus(),1},T=async(e,t={})=>{let o,i;const s=_t(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(g(e),e)for(const r of e){const e=Ye(t,r);e?et(n.errors,r,e):zt(n.errors,r)}else n.errors=t;return t})(Ze(e)?e:s);o=Pt(t),i=e?!s.some(e=>Ye(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=Ye(a,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&h()):i=o=await x(a);return p.state.next({...!xt(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&er(a,_,e?s:c.mount),i},R=(e,t)=>{let r={...s.mount?i:o};return t&&(r=Rt(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Ze(e)?r:xt(e)?Ye(r,e):e.map(e=>Ye(r,e))},P=(e,t)=>({invalid:!!Ye((t||n).errors,e),isDirty:!!Ye((t||n).dirtyFields,e),error:Ye((t||n).errors,e),isValidating:!!Ye(n.validatingFields,e),isTouched:!!Ye((t||n).touchedFields,e)}),O=(e,t,r)=>{const o=(Ye(a,e,{_f:{}})._f||{}).ref,i=Ye(n.errors,e)||{},{ref:s,message:c,type:l,...d}=i;et(n.errors,e,{...d,...t,ref:o}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},I=e=>p.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!_t(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return Pt(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||ct))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const s of e?_t(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(zt(a,s),zt(i,s)),!t.keepError&&zt(n.errors,s),!t.keepDirty&&zt(n.dirtyFields,s),!t.keepTouched&&zt(n.touchedFields,s),!t.keepIsValidating&&zt(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&zt(o,s);p.state.next({values:He(i)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},U=({disabled:e,name:t})=>{(Xe(e)&&s.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},M=(e,t={})=>{let n=Ye(a,e);const i=Xe(t.disabled)||Xe(r.disabled);return et(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?U({disabled:Xe(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Jt(t.min),max:Jt(t.max),minLength:Jt(t.minLength),maxLength:Jt(t.maxLength),pattern:Jt(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:i=>{if(i){M(e,t),n=Ye(a,e);const r=Ze(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>Ut(e)||Fe(e))(r),c=n._f.refs||[];if(s?c.find(e=>e===r):r===n._f.ref)return;et(a,e,{_f:{...n._f,...s?{refs:[...c.filter(Mt),r,...Array.isArray(Ye(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=Ye(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!We(c.array,e)||!s.action)&&c.unMount.add(e)}}},z=()=>r.shouldFocusError&&er(a,_,c.mount),F=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=He(i);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();g(),n.errors=e,l=He(t)}else await x(a);if(c.disabled.size)for(const e of c.disabled)zt(l,e);if(zt(n.errors,"root"),Pt(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){s=e}}else t&&await t({...n.errors},o),z(),setTimeout(z);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Pt(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},L=(e,t={})=>{const l=e?He(e):o,d=He(l),f=Pt(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(jt(o,i))]);for(const t of Array.from(e)){const e=Ye(n.dirtyFields,t),r=Ye(i,t),a=Ye(m,t);e&&!Ze(r)?et(m,t,r):e||Ze(a)||N(t,a)}}else{if(Ge&&Ze(e))for(const e of c.mount){const t=Ye(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(It(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)N(e,Ye(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?He(o):{}:He(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Pt(m),s.watch=!!r.shouldUnregister,s.keepIsValid=!!t.keepIsValid,s.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Et(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&i?jt(o,i):n.dirtyFields:t.keepDefaultValues&&e?jt(o,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>L(Qe(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:M,unregister:D,getFieldState:P,handleSubmit:F,setError:O,_subscribe:I,_runSchema:w,_updateIsValidating:g,_focusError:z,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(s.action=!0,m&&Array.isArray(Ye(a,e))){const t=c(Ye(a,e),l.argA,l.argB);d&&et(a,e,t)}if(m&&Array.isArray(Ye(n.errors,e))){const t=c(Ye(n.errors,e),l.argA,l.argB);d&&et(n.errors,e,t),((e,t)=>{!Je(Ye(e,t)).length&&zt(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Ye(n.touchedFields,e))){const t=c(Ye(n.touchedFields,e),l.argA,l.argB);d&&et(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=jt(o,i)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else et(i,e,t)},_setDisabledField:U,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Je(Ye(s.mount?i:o,e,r.shouldUnregister?Ye(o,e,[]):[])),_reset:L,_resetDefaultValues:()=>Qe(r.defaultValues)&&r.defaultValues().then(e=>{j(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Ye(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Mt(e)):!Mt(t._f.ref))&&D(e)}c.unMount=new Set},_disableForm:e=>{Xe(e)&&(p.state.next({disabled:e}),er(a,(t,r)=>{const n=Ye(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(s.mount=!0,f={...f,...e.formState},I({...e,formState:{...d,...e.formState}})),trigger:T,register:M,handleSubmit:F,watch:(e,t)=>Qe(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:N,getValues:R,reset:j,resetField:(e,t={})=>{Ye(a,e)&&(Ze(t.defaultValue)?N(e,He(Ye(o,e))):(N(e,t.defaultValue),et(o,e,He(t.defaultValue))),t.keepTouched||zt(n.touchedFields,e),t.keepDirty||(zt(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,He(Ye(o,e))):S()),t.keepError||(zt(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&_t(e).forEach(e=>zt(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:O,setFocus:(e,t={})=>{const r=Ye(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Qe(e.select)&&e.select()})}},getFieldState:P};return{...V,formControl:V}}function cr(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:Qe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Qe(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Qe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=sr(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,wt(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{var t;e.values&&!Et(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),(null===(t=i._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||i._setValid(),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=bt(n,i),t.current}const lr=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Ye(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},dr=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?lr(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>lr(t,r,e))}},ur=(e,t)=>{t.shouldUseNativeValidation&&dr(e,t);const r={};for(const n in e){const a=Ye(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(fr(t.names||Object.keys(e),n)){const e=Object.assign({},Ye(r,n));et(e,"root",o),et(r,n,e)}else et(r,n,o)}return r},fr=(e,t)=>{const r=pr(t);return e.some(e=>pr(e).match(`^${r}\\.\\d+`))};function pr(e){return e.replace(/\]|\[/g,"")}function mr(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:i,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=i.prototype,o=Object.keys(a);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class hr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class gr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const vr={};function yr(e){return vr}function br(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function wr(e,t){return"bigint"==typeof t?t.toString():t}function xr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Sr(e){return null==e}function kr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Er=Symbol("evaluating");function Ar(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Er)return void 0===n&&(n=Er,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Nr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Cr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function _r(e){return JSON.stringify(e)}const Tr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Rr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Pr=xr(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Or(e){if(!1===Rr(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==Rr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Ir(e){return Or(e)?{...e}:Array.isArray(e)?[...e]:e}const Dr=new Set(["string","number","symbol"]);function Ur(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Mr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function zr(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function Fr(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function Lr(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function jr(e){return"string"==typeof e?e:e?.message}function $r(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=jr(e.inst?._zod.def?.error?.(e))??jr(t?.error?.(e))??jr(r.customError?.(e))??jr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Vr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Br(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Wr=(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,wr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Gr=mr("$ZodError",Wr),Hr=mr("$ZodError",Wr,{Parent:Error});const Kr=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new hr;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>$r(e,o,yr())));throw Tr(t,a?.callee),t}return i.value},Zr=Kr(Hr),Jr=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>$r(e,o,yr())));throw Tr(t,a?.callee),t}return i.value},qr=Jr(Hr),Yr=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new hr;return o.issues.length?{success:!1,error:new(e??Gr)(o.issues.map(e=>$r(e,a,yr())))}:{success:!0,data:o.value}},Xr=Yr(Hr),Qr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>$r(e,a,yr())))}:{success:!0,data:o.value}},en=Qr(Hr),tn=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Kr(e)(t,r,a)},rn=e=>(t,r,n)=>Kr(e)(t,r,n),nn=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Jr(e)(t,r,a)},an=e=>async(t,r,n)=>Jr(e)(t,r,n),on=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yr(e)(t,r,a)},sn=e=>(t,r,n)=>Yr(e)(t,r,n),cn=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qr(e)(t,r,a)},ln=e=>async(t,r,n)=>Qr(e)(t,r,n),dn=/^[cC][^\s-]{8,}$/,un=/^[0-9a-z]+$/,fn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pn=/^[0-9a-vA-V]{20}$/,mn=/^[A-Za-z0-9]{27}$/,hn=/^[a-zA-Z0-9_-]{21}$/,gn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vn=/^([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})$/,yn=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)$/,bn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const wn=/^(?:(?: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])$/,xn=/^(([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}|:))$/,Sn=/^((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])$/,kn=/^(([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])$/,En=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,An=/^[A-Za-z0-9_-]*$/,Nn=/^\+[1-9]\d{6,14}$/,Cn="(?:(?:\\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])))",_n=new RegExp(`^${Cn}$`);function Tn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Rn=/^[^A-Z]*$/,Pn=/^[^a-z]*$/,On=mr("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),In=mr("$ZodCheckMaxLength",(e,t)=>{var r;On.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Sr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=Vr(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Dn=mr("$ZodCheckMinLength",(e,t)=>{var r;On.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Sr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=Vr(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Un=mr("$ZodCheckLengthEquals",(e,t)=>{var r;On.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Sr(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const o=Vr(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Mn=mr("$ZodCheckStringFormat",(e,t)=>{var r,n;On.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),zn=mr("$ZodCheckRegex",(e,t)=>{Mn.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})}}),Fn=mr("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Rn),Mn.init(e,t)}),Ln=mr("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pn),Mn.init(e,t)}),jn=mr("$ZodCheckIncludes",(e,t)=>{On.init(e,t);const r=Ur(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),$n=mr("$ZodCheckStartsWith",(e,t)=>{On.init(e,t);const r=new RegExp(`^${Ur(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Vn=mr("$ZodCheckEndsWith",(e,t)=>{On.init(e,t);const r=new RegExp(`.*${Ur(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Bn=mr("$ZodCheckOverwrite",(e,t)=>{On.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Wn{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Gn={major:4,minor:3,patch:6},Hn=mr("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gn;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,a=Fr(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new hr;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=Fr(e,t)))});else{if(e.issues.length===t)continue;a||(a=Fr(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(Fr(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new hr;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new hr;return i.then(e=>t(e,n,o))}return t(i,n,o)}}Ar(e,"~standard",()=>({validate:t=>{try{const r=Xr(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return en(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Kn=mr("$ZodString",(e,t)=>{var r;Hn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Zn=mr("$ZodStringFormat",(e,t)=>{Mn.init(e,t),Kn.init(e,t)}),Jn=mr("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vn),Zn.init(e,t)}),qn=mr("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yn(e))}else t.pattern??(t.pattern=yn());Zn.init(e,t)}),Yn=mr("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bn),Zn.init(e,t)}),Xn=mr("$ZodURL",(e,t)=>{Zn.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=a.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Qn=mr("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Zn.init(e,t)}),ea=mr("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=hn),Zn.init(e,t)}),ta=mr("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=dn),Zn.init(e,t)}),ra=mr("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=un),Zn.init(e,t)}),na=mr("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fn),Zn.init(e,t)}),aa=mr("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pn),Zn.init(e,t)}),oa=mr("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mn),Zn.init(e,t)}),ia=mr("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Tn({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Cn}T(?:${n})$`)}(t)),Zn.init(e,t)}),sa=mr("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=_n),Zn.init(e,t)}),ca=mr("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Tn(t)}$`)),Zn.init(e,t)}),la=mr("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gn),Zn.init(e,t)}),da=mr("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wn),Zn.init(e,t),e._zod.bag.format="ipv4"}),ua=mr("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=xn),Zn.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})}}}),fa=mr("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Sn),Zn.init(e,t)}),pa=mr("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kn),Zn.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ma(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ha=mr("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=En),Zn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ma(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const ga=mr("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=An),Zn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!An.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ma(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),va=mr("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nn),Zn.init(e,t)});const ya=mr("$ZodJWT",(e,t)=>{Zn.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ba=mr("$ZodUnknown",(e,t)=>{Hn.init(e,t),e._zod.parse=e=>e}),wa=mr("$ZodNever",(e,t)=>{Hn.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function xa(e,t,r){e.issues.length&&t.issues.push(...Lr(r,e.issues)),t.value[r]=e.value}const Sa=mr("$ZodArray",(e,t)=>{Hn.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>xa(t,r,e))):xa(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function ka(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Lr(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Ea(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Aa(e,t,r,n,a,o){const i=[],s=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(s.has(a))continue;if("never"===l){i.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>ka(e,r,a,t,d))):ka(o,r,a,t,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const Na=mr("$ZodObject",(e,t)=>{Hn.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=xr(()=>Ea(t));Ar(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const a=Rr,o=t.catchall;let i;e._zod.parse=(t,r)=>{i??(i=n.value);const s=t.value;if(!a(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=i.shape;for(const e of i.keys){const n=l[e],a="optional"===n._zod.optout,o=n._zod.run({value:s[e],issues:[]},r);o instanceof Promise?c.push(o.then(r=>ka(r,t,e,s,a))):ka(o,t,e,s,a)}return o?Aa(c,s,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ca=mr("$ZodObjectJIT",(e,t)=>{Na.init(e,t);const r=e._zod.parse,n=xr(()=>Ea(t));let a;const o=Rr,i=!vr.jitless,s=i&&Pr.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new Wn(["shape","payload","ctx"]),r=n.value,a=e=>{const t=_r(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],i=_r(n),s=e[n],c="optional"===s?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),c?Aa([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function _a(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const a=e.filter(e=>!Fr(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>$r(e,n,yr())))}),t)}const Ta=mr("$ZodUnion",(e,t)=>{Hn.init(e,t),Ar(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Ar(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Ar(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ar(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>kr(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>_a(t,a,e,o)):_a(s,a,e,o)}}),Ra=mr("$ZodIntersection",(e,t)=>{Hn.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,r])=>Oa(e,t,r)):Oa(e,a,o)}});function Pa(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(Or(e)&&Or(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),a={...e,...t};for(const r of n){const n=Pa(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};a[r]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=Pa(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Oa(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&a&&e.issues.push({...a,keys:o}),Fr(e))return e;const i=Pa(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Ia=mr("$ZodEnum",(e,t)=>{Hn.init(e,t);const r=br(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Dr.has(typeof e)).map(e=>"string"==typeof e?Ur(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Da=mr("$ZodTransform",(e,t)=>{Hn.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new gr(e.constructor.name);const a=t.transform(r.value,r);if(n.async){return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r))}if(a instanceof Promise)throw new hr;return r.value=a,r}});function Ua(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ma=mr("$ZodOptional",(e,t)=>{Hn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ar(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ar(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${kr(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>Ua(t,e.value)):Ua(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),za=mr("$ZodExactOptional",(e,t)=>{Ma.init(e,t),Ar(e._zod,"values",()=>t.innerType._zod.values),Ar(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),Fa=mr("$ZodNullable",(e,t)=>{Hn.init(e,t),Ar(e._zod,"optin",()=>t.innerType._zod.optin),Ar(e._zod,"optout",()=>t.innerType._zod.optout),Ar(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${kr(e.source)}|null)$`):void 0}),Ar(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),La=mr("$ZodDefault",(e,t)=>{Hn.init(e,t),e._zod.optin="optional",Ar(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>ja(e,t)):ja(n,t)}});function ja(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const $a=mr("$ZodPrefault",(e,t)=>{Hn.init(e,t),e._zod.optin="optional",Ar(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Va=mr("$ZodNonOptional",(e,t)=>{Hn.init(e,t),Ar(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>Ba(t,e)):Ba(a,e)}});function Ba(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Wa=mr("$ZodCatch",(e,t)=>{Hn.init(e,t),Ar(e._zod,"optin",()=>t.innerType._zod.optin),Ar(e._zod,"optout",()=>t.innerType._zod.optout),Ar(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>$r(e,r,yr()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>$r(e,r,yr()))},input:e.value}),e.issues=[]),e)}}),Ga=mr("$ZodPipe",(e,t)=>{Hn.init(e,t),Ar(e._zod,"values",()=>t.in._zod.values),Ar(e._zod,"optin",()=>t.in._zod.optin),Ar(e._zod,"optout",()=>t.out._zod.optout),Ar(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Ha(e,t.in,r)):Ha(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ha(e,t.out,r)):Ha(n,t.out,r)}});function Ha(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ka=mr("$ZodReadonly",(e,t)=>{Hn.init(e,t),Ar(e._zod,"propValues",()=>t.innerType._zod.propValues),Ar(e._zod,"values",()=>t.innerType._zod.values),Ar(e._zod,"optin",()=>t.innerType?._zod?.optin),Ar(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Za):Za(n)}});function Za(e){return e.value=Object.freeze(e.value),e}const Ja=mr("$ZodCustom",(e,t)=>{On.init(e,t),Hn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(t=>qa(t,r,n,e));qa(a,r,n,e)}});function qa(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Br(e))}}var Ya;class Xa{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(Ya=globalThis).__zod_globalRegistry??(Ya.__zod_globalRegistry=new Xa);const Qa=globalThis.__zod_globalRegistry;function eo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...zr(t)})}function to(e,t){return new In({check:"max_length",...zr(t),maximum:e})}function ro(e,t){return new Dn({check:"min_length",...zr(t),minimum:e})}function no(e,t){return new Un({check:"length_equals",...zr(t),length:e})}function ao(e){return new Bn({check:"overwrite",tx:e})}function oo(e){const t=function(e,t){const r=new On({check:"custom",...zr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Br(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Br(n))}},e(r.value,r)));return t}function io(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Qa,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 so(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,o=t.seen.get(e);if(o){o.count++;return r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema}const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const s=e._zod.toJSONSchema?.();if(s)i.schema=s;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,n);else{const r=i.schema,o=t.processors[a.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(i.ref||(i.ref=o),so(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(i.schema,c),"input"===t.io&&uo(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function co(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:o}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${a("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:a+o}})(t);n.def={...n.schema},o&&(n.defId=o);const i=n.schema;for(const e in i)delete i[e];i.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const o=e.metadataRegistry.get(r[0])?.id;o?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function lo(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,o={...a},i=r.ref;if(r.ref=null,i){n(i);const r=e.seen.get(i),s=r.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,s):(a.allOf=a.allOf??[],a.allOf.push(s)),Object.assign(a,o);if(t._zod.parent===i)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(s.$ref&&r.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const s=t._zod.parent;if(s&&s!==i){n(s);const t=e.seen.get(s);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const o=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?a.$defs=o:a.definitions=o);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:fo(t,"input",e.processors),output:fo(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function uo(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return uo(n.element,r);if("set"===n.type)return uo(n.valueType,r);if("lazy"===n.type)return uo(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return uo(n.innerType,r);if("intersection"===n.type)return uo(n.left,r)||uo(n.right,r);if("record"===n.type||"map"===n.type)return uo(n.keyType,r)||uo(n.valueType,r);if("pipe"===n.type)return uo(n.in,r)||uo(n.out,r);if("object"===n.type){for(const e in n.shape)if(uo(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(uo(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(uo(e,r))return!0;return!(!n.rest||!uo(n.rest,r))}return!1}const fo=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},i=io({...a??{},target:o,io:t,processors:r});return so(e,i),co(i,e),lo(i,e)},po={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mo=(e,t,r,n)=>{const a=e._zod.def;so(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function ho(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function go(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=Ct(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function vo(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=Ct(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function yo(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,o){try{return Promise.resolve(ho(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&dr({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:ur(go(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,o){try{return Promise.resolve(ho(function(){return Promise.resolve(("sync"===r.mode?Zr:qr)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&dr({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Gr}(e))return{values:{},errors:ur(vo(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}
|
|
2
|
-
/**
|
|
3
|
-
* @license lucide-react v0.544.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const bo=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wo=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},xo=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),So=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,useRef as i,useMemo as s,createContext as c,useReducer as l,useEffect as d,useCallback as u,useState as f,Suspense as p,lazy as m,forwardRef as h,createElement as g,useContext as v,useLayoutEffect as y}from"react";import*as b from"react-dom";import w from"react-dom";var x;function S(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=S(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function k(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=S(e))&&(n&&(n+=" "),n+=t);return n}!function(e){e.V1="v1"}(x||(x={}));const E=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),A="-",N=[],C=e=>{const t=R(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return T(e);const r=e.split(A),n=""===r[0]&&r.length>1?1:0;return _(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||N}return r[e]||N}}},_=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=_(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const i=0===t?e.join(A):e.slice(t).join(A),s=o.length;for(let e=0;e<s;e++){const t=o[e];if(t.validator(i))return t.classGroupId}},T=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),R=e=>{const{theme:t,classGroups:r}=e;return P(r,t)},P=(e,t)=>{const r=E();for(const n in e){const a=e[n];O(a,r,n,t)}return r},O=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];I(a,t,r,n)}},I=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?M(e,t,r,n):U(e,t,r,n):D(e,t,r)},D=(e,t,r)=>{(""===e?t:z(t,e)).classGroupId=r},U=(e,t,r,n)=>{F(e)?O(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},M=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,i]=a[e];O(i,z(t,o),r,n)}},z=(e,t)=>{let r=e;const n=t.split(A),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=E(),r.nextPart.set(t,a)),r=a}return r},F=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,L=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},j=[],$=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),V=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const i=e.length;for(let s=0;s<i;s++){const i=e[s];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,s)),o=s+1;continue}if("/"===i){r=s;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.slice(o);let c=s,l=!1;s.endsWith("!")?(c=s.slice(0,-1),l=!0):s.startsWith("!")&&(c=s.slice(1),l=!0);return $(t,l,c,r&&r>o?r-o:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):$(j,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},W=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},B=/\s+/,G=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=G(e[n]))&&(r&&(r+=" "),r+=t);return r},H=(e,...t)=>{let r,n,a,o;const i=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(B);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:o(d).join(":"),v=u?g+"!":g,y=v+h;if(i.indexOf(y)>-1)continue;i.push(y);const b=a(h,m);for(let e=0;e<b.length;++e){const t=b[e];i.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:L(e.cacheSize),parseClassName:V(e),sortModifiers:W(e),...C(e)}))(c),n=r.cache.get,a=r.cache.set,o=i,i(s)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=G(t))&&(a&&(a+=" "),a+=r);return a})(...e))},K=[],Z=e=>{const t=t=>t[e]||K;return t.isThemeGetter=!0,t},J=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,q=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Y=/^\d+\/\d+$/,X=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q=/\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$/,ee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,te=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,re=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ne=e=>Y.test(e),ae=e=>!!e&&!Number.isNaN(Number(e)),oe=e=>!!e&&Number.isInteger(Number(e)),ie=e=>e.endsWith("%")&&ae(e.slice(0,-1)),se=e=>X.test(e),ce=()=>!0,le=e=>Q.test(e)&&!ee.test(e),de=()=>!1,ue=e=>te.test(e),fe=e=>re.test(e),pe=e=>!he(e)&&!xe(e),me=e=>_e(e,Oe,de),he=e=>J.test(e),ge=e=>_e(e,Ie,le),ve=e=>_e(e,De,ae),ye=e=>_e(e,Re,de),be=e=>_e(e,Pe,fe),we=e=>_e(e,Me,ue),xe=e=>q.test(e),Se=e=>Te(e,Ie),ke=e=>Te(e,Ue),Ee=e=>Te(e,Re),Ae=e=>Te(e,Oe),Ne=e=>Te(e,Pe),Ce=e=>Te(e,Me,!0),_e=(e,t,r)=>{const n=J.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Te=(e,t,r=!1)=>{const n=q.exec(e);return!!n&&(n[1]?t(n[1]):r)},Re=e=>"position"===e||"percentage"===e,Pe=e=>"image"===e||"url"===e,Oe=e=>"length"===e||"size"===e||"bg-size"===e,Ie=e=>"length"===e,De=e=>"number"===e,Ue=e=>"family-name"===e,Me=e=>"shadow"===e,ze=H(()=>{const e=Z("color"),t=Z("font"),r=Z("text"),n=Z("font-weight"),a=Z("tracking"),o=Z("leading"),i=Z("breakpoint"),s=Z("container"),c=Z("spacing"),l=Z("radius"),d=Z("shadow"),u=Z("inset-shadow"),f=Z("text-shadow"),p=Z("drop-shadow"),m=Z("blur"),h=Z("perspective"),g=Z("aspect"),v=Z("ease"),y=Z("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",xe,he],w=()=>[xe,he,c],x=()=>[ne,"full","auto",...w()],S=()=>[oe,"none","subgrid",xe,he],k=()=>["auto",{span:["full",oe,xe,he]},oe,xe,he],E=()=>[oe,"auto",xe,he],A=()=>["auto","min","max","fr",xe,he],N=()=>["auto",...w()],C=()=>[ne,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],_=()=>[e,xe,he],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ee,ye,{position:[xe,he]}],R=()=>["auto","cover","contain",Ae,me,{size:[xe,he]}],P=()=>[ie,Se,ge],O=()=>["","none","full",l,xe,he],I=()=>["",ae,Se,ge],D=()=>[ae,ie,Ee,ye],U=()=>["","none",m,xe,he],M=()=>["none",ae,xe,he],z=()=>["none",ae,xe,he],F=()=>[ae,xe,he],L=()=>[ne,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[se],breakpoint:[se],color:[ce],container:[se],"drop-shadow":[se],ease:["in","out","in-out"],font:[pe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[se],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[se],shadow:[se],spacing:["px",ae],text:[se],"text-shadow":[se],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ne,he,xe,g]}],container:["container"],columns:[{columns:[ae,he,xe,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"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:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[oe,"auto",xe,he]}],basis:[{basis:[ne,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ae,ne,"auto","initial","none",he]}],grow:[{grow:["",ae,xe,he]}],shrink:[{shrink:["",ae,xe,he]}],order:[{order:[oe,"first","last","none",xe,he]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],w:[{w:[s,"screen",...C()]}],"min-w":[{"min-w":[s,"screen","none",...C()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",r,Se,ge]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,xe,ve]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ie,he]}],"font-family":[{font:[ke,he,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:[a,xe,he]}],"line-clamp":[{"line-clamp":[ae,"none",xe,ve]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",xe,he]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,he]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[ae,"from-font","auto",xe,ge]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[ae,"auto",xe,he]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,he]}],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",xe,he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},oe,xe,he],radial:["",xe,he],conic:[oe,xe,he]},Ne,be]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[ae,xe,he]}],"outline-w":[{outline:["",ae,Se,ge]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,Ce,we]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,Ce,we]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[ae,ge]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,Ce,we]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[ae,xe,he]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"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":[ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[xe,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,he]}],filter:[{filter:["","none",xe,he]}],blur:[{blur:U()}],brightness:[{brightness:[ae,xe,he]}],contrast:[{contrast:[ae,xe,he]}],"drop-shadow":[{"drop-shadow":["","none",p,Ce,we]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",ae,xe,he]}],"hue-rotate":[{"hue-rotate":[ae,xe,he]}],invert:[{invert:["",ae,xe,he]}],saturate:[{saturate:[ae,xe,he]}],sepia:[{sepia:["",ae,xe,he]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,he]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[ae,xe,he]}],"backdrop-contrast":[{"backdrop-contrast":[ae,xe,he]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ae,xe,he]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ae,xe,he]}],"backdrop-invert":[{"backdrop-invert":["",ae,xe,he]}],"backdrop-opacity":[{"backdrop-opacity":[ae,xe,he]}],"backdrop-saturate":[{"backdrop-saturate":[ae,xe,he]}],"backdrop-sepia":[{"backdrop-sepia":["",ae,xe,he]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,he]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ae,"initial",xe,he]}],ease:[{ease:["linear","initial",v,xe,he]}],delay:[{delay:[ae,xe,he]}],animate:[{animate:["none",y,xe,he]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,xe,he]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:M()}],"rotate-x":[{"rotate-x":M()}],"rotate-y":[{"rotate-y":M()}],"rotate-z":[{"rotate-z":M()}],scale:[{scale:z()}],"scale-x":[{"scale-x":z()}],"scale-y":[{"scale-y":z()}],"scale-z":[{"scale-z":z()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[xe,he,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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",xe,he]}],"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":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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",xe,he]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[ae,Se,ge,ve]}],stroke:[{stroke:["none",..._()]}],"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"]}});function Fe(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function Le(...e){return ze(k(e))}let je=!0;function $e(e,...t){console.error(e,...t)}function Ve(e){if(null==e)return e;if("object"!=typeof e)return e;const t=new Set(["authorization","token","password","accessToken","refreshToken"]);if(Array.isArray(e))return e.map(Ve);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":Ve(a);return r}function We(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function Be(e,t){try{const r=await fetch(e,t);if(Fe()){const n=(t?.method??"GET").toUpperCase();let a;if(null!=t?.body)try{a="string"==typeof t.body?JSON.parse(t.body):{body:"(non-JSON)"}}catch{a={body:"(parse failed)"}}const o=r.clone();let i;try{const e=await o.text();if(e)try{i=JSON.parse(e)}catch{i=e.substring(0,200)+(e.length>200?"...":"")}}catch{i="(read failed)"}!function(e,...t){je&&Fe()&&console.log(e,...t)}("[SDK API]",n,e,{request:Ve(a),response:Ve(i),status:r.status})}return r}catch(e){if(We(e))throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new Error("Network error: Please check your internet connection");throw e}}async function Ge(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function He(e){const t=await e.text();if(!t)throw new Error("Empty response body");try{return JSON.parse(t)}catch(e){throw new Error(`Invalid JSON response: ${t.substring(0,100)}${t.length>100?"...":""}`)}}async function Ke(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await He(e);r=t.message||t.error||r}catch{r=function(e,t){const r={400:"Bad Request",401:"Unauthorized - Please check your session",403:"Forbidden - You do not have permission",404:"Resource not found",500:"Internal server error",502:"Bad Gateway",503:"Service unavailable"}[e.status]||e.statusText||t;return new Error(`${t} (${e.status}: ${r})`)}(e,t).message}throw new Error(r)}try{return await He(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class Ze extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,Ze)}}const Je=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e},void 0!==e.enableConsoleLogging&&function(e){void 0!==e.enableLogging&&(je=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(We(e))return;const r=e instanceof Error?e:new Ze("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof Ze?r:new Ze(r.message,r.name,t,r);if(this.config.enableConsoleLogging&&function(e,...t){je&&Fe()&&console.error(e,...t)}(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){$e("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function qe(e,t={}){Je.handleError(e,t)}function Ye(e,t={}){return!We(e)&&(Je.handleError(e,t),!0)}class Xe extends o{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(qe(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){$e("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const Qe=()=>({type:"AUTHENTICATION_STARTED"}),et=()=>({type:"AUTHENTICATION_PROCESSING"}),tt=()=>({type:"AUTHENTICATION_FAILED"}),rt=e=>({type:"SET_SESSION",payload:e}),nt=()=>({type:"REMOVE_SESSION"});function at(e,t,r){const n=i(t),a=i(r),o=i(void 0),c=i(e);return n.current=t,a.current=r,s(()=>{const t=n.current(e);if(void 0!==o.current){if((a.current?a.current(o.current,t):Object.is(o.current,t))&&c.current===e)return o.current}return o.current=t,c.current=e,t},[e])}function ot({name:e,initialState:r,reducer:n,initializer:o}){const i=c(null),d=c(null),u=c(null),f=a.memo(({children:e})=>{const[a,c]=l(n,r,o||(e=>e)),f=s(()=>({state:a,dispatch:c}),[a,c]);return t(u.Provider,{value:f,children:t(i.Provider,{value:a,children:t(d.Provider,{value:c,children:e})})})});f.displayName=`${e}Provider`;const p=()=>{const t=a.useContext(i);if(null===t)throw new Error(`use${e}State must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t};return{Provider:f,useContext:()=>{const t=a.useContext(u);if(!t)throw new Error(`use${e}Context must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useState:p,useDispatch:()=>{const t=a.useContext(d);if(null===t)throw new Error(`use${e}Dispatch must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useSelector:(e,t)=>{const r=e||(e=>e);return at(p(),r,t)}}}function it(e,t,r){return{...e,[t]:r}}function st(e,t){return{...e,...t}}var ct;function lt(e){return{isAuthenticated:e===ct.authenticated,isLoading:e===ct.loading||e===ct.redirecting||e===ct.authenticating,isRedirecting:e===ct.redirecting}}function dt(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return qe(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function ut(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){qe(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function ft(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){qe(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}!function(e){e.loading="loading",e.redirecting="redirecting",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(ct||(ct={}));const pt="code",mt="saas-session-id",ht="saas-workspace-current";function gt(e,t,r){const n=e._id||e.id;if(!n||"string"!=typeof n)throw new Error("User data missing required ID field");if(!e.email||"string"!=typeof e.email)throw new Error("User data missing required email field");return{id:n,name:e.name||"",org:t,email:e.email,emailVerified:!0,clientId:r,role:e.role||"",image:e.image}}function vt(){ft(mt)}function yt(){if("undefined"==typeof window)return null;try{return dt(mt)}catch(e){return qe(e,{component:"auth/utils",action:"getSessionId",metadata:{key:mt}}),null}}function bt(){const e=yt(),t={};return e&&(t["x-session-id"]=e),t}function wt(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(pt)}catch(e){return qe(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:pt}}),null}}function xt(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const St=()=>({session:null,status:ct.loading}),{Provider:kt,useState:Et,useDispatch:At}=ot({name:"Auth",initialState:St(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return it(e,"status",ct.redirecting);case"AUTHENTICATION_PROCESSING":return it(e,"status",ct.authenticating);case"AUTHENTICATION_FAILED":return st(e,{session:null,status:ct.unauthenticated});case"SET_SESSION":{const n=t.payload;return r=n.sessionId,ut(mt,r),st(e,{session:n,status:ct.authenticated})}case"REMOVE_SESSION":return vt(),st(e,{session:null,status:ct.unauthenticated});default:return e}var r},initializer:St}),Nt=kt,Ct=Et,_t=At,Tt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),Rt=e=>({type:"SET_SETTINGS",payload:e}),Pt=()=>({serverUrl:"",version:x.V1,orgId:"",settings:null}),{Provider:Ot,useState:It,useDispatch:Dt}=ot({name:"OS",initialState:Pt(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return st(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return Pt();case"SET_SETTINGS":return it(e,"settings",t.payload);default:return e}}}),Ut=Ot,Mt=It,zt=Dt,Ft=e=>({type:"SET_WORKSPACES",payload:e}),Lt=e=>({type:"SET_ALL_FEATURES",payload:e}),jt=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),$t=()=>({type:"RESET_CURRENT_WORKSPACE"}),Vt=e=>({type:"SET_IS_INITIALIZED",payload:e}),Wt=e=>({type:"SET_LOADING",payload:e}),Bt=e=>({type:"SET_ERROR",payload:e}),Gt=e=>({type:"SET_REFRESHING",payload:e}),Ht=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),Kt=e=>{e?ut(ht,e._id):ft(ht)},Zt=()=>dt(ht),Jt=()=>{ft(ht)},qt=(e,t)=>!!e&&t.some(t=>t._id===e);function Yt(e,t){if(!t)return!1;const r=(n=e.createdBy)?"string"==typeof n?n:"object"==typeof n&&null!==n&&"_id"in n&&"string"==typeof n._id?n._id:null:null;var n;return null!==r&&r===t}function Xt(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>{if("string"==typeof e)return e===t;if("object"==typeof e&&null!==e&&"_id"in e){return e._id===t}return!1});return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}const{Provider:Qt,useState:er,useDispatch:tr}=ot({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switchingToId:null,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return it(e,"workspaces",t.payload);case"SET_ALL_FEATURES":return it(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return Kt(t.payload),it(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return Jt(),it(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return it(e,"isInitialized",t.payload);case"SET_LOADING":return it(e,"loading",t.payload);case"SET_ERROR":return it(e,"error",t.payload);case"SET_REFRESHING":return it(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return it(e,"switchingToId",t.payload);default:return e}}}),rr=Qt,nr=er,ar=tr,or=a.memo(({children:e})=>t(Ut,{children:t(Nt,{children:t(rr,{children:e})})}));function ir(e,t){const r=Mt(),n=Ct(),a=nr(),o=e||(e=>e);return at(s(()=>({os:r,auth:n,workspaces:a}),[r,n,a]),o,t)}function sr(){const e=_t(),t=zt(),r=ar();return s(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}function cr(e,t,r){d(()=>{const t=new AbortController;return e(t.signal).catch(e=>{We(e)||(r?.onError?r.onError(e):qe(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},t)}or.displayName="SDKContextProvider";const lr=a.memo(({children:e,callbacks:n})=>{const o=sr(),i=ir(e=>e.auth),c=ir(e=>e.os),l=lt(i.status).isAuthenticated,f=a.useRef(!1),p=a.useRef(null),m=a.useRef(!1),h=s(()=>n,[n]),g=u(async e=>{try{if(h?.handleAuthentication){const{sessionId:t}=await h.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=c,{serverUrl:n,version:a,orgId:i}=r;if(!n||!a||!i)throw new Error("OS configuration is not available");const s=await Be(`${n}/api/${a}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}}),l=await Ke(s,"Failed to fetch user profile"),d=xt(gt(l,i,r.auth?.clientId||""),t);o.auth(rt(d)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(pt),window.history.replaceState({},"",e.toString())}catch(e){qe(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:pt}})}}()}}catch(t){throw qe(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(tt()),t}},[o,h,c]);return cr(async e=>{if("undefined"==typeof window)return;if(l)return;if(m.current)return;if(wt())return;const t=yt();if(t){m.current=!0;try{const{serverUrl:r,version:n,orgId:a}=c;if(!r||!n||!a)return m.current=!1,void qe(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});let i;try{const a=await Be(`${r}/api/${n}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"},signal:e});i=await Ke(a,"Failed to fetch user profile")}catch(e){if(!Ye(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return m.current=!1,vt(),void o.auth(tt())}const s=xt(gt(i,a,c.auth?.clientId||""),t);o.auth(rt(s))}catch(e){if(!Ye(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:e instanceof Error&&("User data missing required ID field"===e.message||"User data missing required email field"===e.message)?"validateUserData":"pageLoad"}}))return;vt(),o.auth(tt())}finally{m.current=!1}}else o.auth(tt())},[l,o,c]),d(()=>{const e=wt();if(!e)return;if(f.current||p.current===e)return;const{serverUrl:t,version:r,orgId:n}=c;t&&r&&n&&(f.current=!0,p.current=e,o.auth(et()),g(e).then(()=>{p.current=null}).catch(t=>{qe(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),p.current=null}).finally(()=>{f.current=!1}))},[g,c.serverUrl,c.version,c.orgId]),t(r,{children:e})});lr.displayName="AuthProviderWrapper";const dr=a.memo(({config:e,auth:n,children:o})=>{const i=sr(),s=ir(e=>e.os),c=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return d(()=>{i.os(Tt({...e,auth:c}))},[e,c,i]),cr(async e=>{const{serverUrl:t,version:r,orgId:n,settings:a}=s;if(!t||!r||!n||a)return;const o=bt(),c=await Be(`${t}/api/${r}/public/${n}/settings`,{headers:o,signal:e});if(c.ok){const e=await c.json();i.os(Rt(e))}},[s.serverUrl,s.version,s.orgId,s.settings,i],{onError:e=>qe(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:s.serverUrl,version:s.version,orgId:s.orgId}})}),t(r,{children:o})});dr.displayName="ContextConfigProvider";const ur=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){qe(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}},fr=c({container:null,setContainer:()=>{}}),pr=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(fr.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});pr.displayName="PortalProvider";const mr=a.createContext(void 0),hr=a.memo(({children:e})=>{const r=ir(e=>e.os),n=ir(e=>e.auth),{serverUrl:o,version:i}=r,s=lt(n.status).isAuthenticated,[c,l]=f({}),[d,p]=f({}),[m,h]=f(!1),[g,v]=f(null),y=u(async e=>{if(o&&i&&s)try{const t=await Be(`${o}/api/${i}/public/users/attributes`,{headers:bt(),signal:e});if(!t.ok)throw new Error(await Ge(t,"Failed to fetch user attributes"));const r=await t.json();r&&"object"==typeof r&&!Array.isArray(r)?l(r):l({})}catch(e){if(We(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");v(t),qe(e,{component:"UserProvider",action:"fetchAttributes"})}else l({})},[o,i,s]),b=u(async()=>{if(o&&i&&s){h(!0),v(null);try{await y()}finally{h(!1)}}},[o,i,s,y]),w=u(async e=>{if(!o||!i)throw new Error("Server URL or version is missing");h(!0),v(null);try{const t=await Be(`${o}/api/${i}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...bt()},body:JSON.stringify({attributes:e})});if(!t.ok)throw new Error(await Ge(t,"Failed to update user attributes"));const r=await t.json();return await y(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw v(r),qe(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{h(!1)}},[o,i,y]),x=u(async(e,t)=>{if(!o||!i)throw new Error("Server URL or version is missing");h(!0),v(null);try{const r=await Be(`${o}/api/${i}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...bt()},body:JSON.stringify({value:t})});if(!r.ok)throw new Error(await Ge(r,"Failed to update user attribute"));const n=await r.json();return await y(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw v(n),qe(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{h(!1)}},[o,i,y]),S=u(async e=>{if(o&&i&&s)try{const t=await Be(`${o}/api/${i}/public/users/features`,{headers:bt(),signal:e});if(!t.ok)throw new Error(await Ge(t,"Failed to fetch user features"));const r=await t.json();p("object"==typeof r?r:{})}catch(e){if(We(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");v(t),qe(e,{component:"UserProvider",action:"fetchFeatures"})}else p({})},[o,i,s]),k=u(async()=>{if(o&&i&&s){h(!0),v(null);try{await S()}finally{h(!1)}}},[o,i,s,S]);cr(async e=>{if(!s||!o||!i)return l({}),void p({});h(!0),v(null);try{await Promise.all([y(e),S(e)])}finally{h(!1)}},[s,o,i,y,S],{onError:e=>qe(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const E=a.useMemo(()=>({attributes:c,features:d,isLoading:m,error:g,updateAttributes:w,updateAttribute:x,refreshAttributes:b,refreshFeatures:k}),[c,d,m,g,w,x,b,k]);return t(mr.Provider,{value:E,children:e})});hr.displayName="UserProvider";class gr{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return bt()}async getWorkspaces(){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()}),"Failed to fetch workspaces")}async createWorkspace(e){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)}),"Failed to create workspace")}async updateWorkspace(e,t){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)}),"Failed to update workspace")}async deleteWorkspace(e){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to delete workspace")}async getWorkspaceUsers(e){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()}),"Failed to fetch workspace users")}async addUser(e,t){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)}),"Failed to invite member")}async removeUser(e,t){return Ke(await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to remove user")}async updateUser(e,t,r){const n=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(r)});if(!n.ok){const e=await n.json();throw new Error(e.message||"Failed to update user")}return n.json()}async getFeatures(){const e=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/features`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch features");return e.json()}async updateFeature(e,t,r){const n=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/features`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify({features:{[t]:r}})});if(!n.ok)throw new Error("Failed to update feature");return n.json()}async getWorkspace(e){const t=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace");return t.json()}async getProfile(){const e=await Be(`${this.serverUrl}/api/${this.version}/public/profile`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch profile");return e.json()}async updateUserProfile(e){const t=await Be(`${this.serverUrl}/api/${this.version}/public/profile`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to update user profile");return t.json()}async getCurrentSubscription(e){const t=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Workspace not found or no subscription available":401===t.status?"Unauthorized - Please check your session":`Failed to fetch subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch subscription");return r.data}return r}async getPlanGroup(e){const t=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group found for this workspace":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group");return r.data}return r}async getPlanGroupByVersion(e,t){const r=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group?groupVersionId=${t}`,{headers:this.getAuthHeader()});if(!r.ok){let e="Failed to fetch plan group version";try{e=(await r.json()).message||e}catch{e=404===r.status?"Plan group version not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch plan group version");return n.data}return n}async getPlanGroupVersions(e){const t=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group/versions`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group versions";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group versions found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group versions (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group versions");return r.data}return r}async getPlanGroupVersion(e){const t=await Be(`${this.serverUrl}/api/${this.version}/public/plan-group-versions/${e}`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group version";try{e=(await t.json()).message||e}catch{e=404===t.status?"Plan group version not found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group version");return r.data}return r}async createCheckoutSession(e,t){const r=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/checkout`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){let e="Failed to create checkout session";try{e=(await r.json()).message||e}catch{e=`Failed to create checkout session (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to create checkout session");return n.data||n}return n}async updateSubscription(e,t){const r=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){let e="Failed to update subscription";try{e=(await r.json()).message||e}catch{e=`Failed to update subscription (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to update subscription");return n.data?.checkoutUrl||n.checkoutUrl?n.data||n:n.data}return n.checkoutUrl,n}async listInvoices(e,t=10,r){const n=new URLSearchParams;n.append("limit",t.toString()),r&&n.append("starting_after",r);const a=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/invoices?${n.toString()}`,{headers:this.getAuthHeader()});if(!a.ok){let e="Failed to fetch invoices";try{e=(await a.json()).message||e}catch{e=404===a.status?"Workspace not found or no invoices available":401===a.status?"Unauthorized - Please check your session":`Failed to fetch invoices (${a.status}: ${a.statusText})`}throw new Error(e)}const o=await a.json();if(void 0!==o.success){if(!o.success)throw new Error(o.message||"Failed to fetch invoices");return o}return o}async getInvoice(e,t){const r=await Be(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/invoices/${t}`,{headers:this.getAuthHeader()});if(!r.ok){let e="Failed to fetch invoice";try{e=(await r.json()).message||e}catch{e=404===r.status?"Invoice not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch invoice (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch invoice");return n}return n}}const vr=()=>{const e=sr(),t=ir(e=>e.os),r=s(()=>new gr(t),[t.serverUrl,t.version,t.orgId]),n=ir(e=>e.workspaces),o=ir(e=>e.auth.session?.user),i=u((t,r)=>{if((!(t._id===n.currentWorkspace?._id)||r?.forceEmit)&&t){const r=n.currentWorkspace;e.workspaces(jt(t)),ur.emitWorkspaceChanged(t,r).catch(e=>{qe(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]),c=u(async(r,n)=>{const a=++m.current;e.workspaces(Ht(r._id));try{const e=t.auth?.callbacks?.onWorkspaceChange;if(e){const t=Xt(r,o?.id);try{await e({workspace:r,user:o??null,role:t})}catch(e){throw qe(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:r._id}}),e}if(a!==m.current)return}i(r,n)}finally{a===m.current&&e.workspaces(Ht(null))}},[e,t.auth?.callbacks?.onWorkspaceChange,i,o]);d(()=>{if(!n.isInitialized){const t=Zt();if(e.workspaces(Vt(!0)),t){const e=n.workspaces.find(e=>e._id===t);e&&c(e,{forceEmit:!0}).catch(()=>{})}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,c]);const l=u(()=>{e.workspaces($t())},[e]),f=a.useRef(!1),p=a.useRef(!1),m=a.useRef(0),h=u(async()=>{if(!n.loading&&!f.current){f.current=!0,e.workspaces(Wt(!0)),e.workspaces(Bt(null));try{const t=await r.getWorkspaces();if(e.workspaces(Ft(t)),t.length>0){const e=Zt();if(e&&qt(e,t)){const r=t.find(t=>t._id===e);if(r)try{await c(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await c(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(Bt(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(Wt(!1)),f.current=!1}}},[r,n.loading,n.currentWorkspace?._id,e,c]),g=u(async()=>{if(!n.refreshing&&!f.current){f.current=!0,e.workspaces(Gt(!0));try{const t=await r.getWorkspaces();e.workspaces(Ft(t))}catch(e){}finally{e.workspaces(Gt(!1)),f.current=!1}}},[r,n.refreshing,e]),v=u(async(t,a)=>{const o=await r.createWorkspace({name:t,image:a});e.workspaces(Ft([...n.workspaces,o])),ur.emitWorkspaceCreated(o).catch(e=>{qe(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),y=u(async(t,a)=>{const o=await r.updateWorkspace(t._id,a);e.workspaces(Ft(n.workspaces.map(e=>e._id===t._id?o:e))),ur.emitWorkspaceUpdated(o).catch(e=>{qe(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),b=u(async()=>{if(p.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;p.current=!0;try{const t=await r.getFeatures();return e.workspaces(Lt(t)),t}catch(e){return qe(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{p.current=!1}},[r,e,n.allFeatures]),w=u(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const e=n.currentWorkspace._id,t=n.workspaces.find(t=>t._id===e);if(t)t!==n.currentWorkspace&&i(t);else if(n.workspaces.length>0){const t=n.workspaces[0];t._id!==e&&c(t).catch(()=>{})}},[n.workspaces,n.currentWorkspace,i,c]);const x=u(async e=>await r.getWorkspaceUsers(e),[r]),S=u(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&ur.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{qe(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),o},[r,n.workspaces]),k=u(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&Yt(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;ur.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{qe(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return i},[r,n.workspaces]),E=u(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&Yt(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&ur.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{qe(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),A=u(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return ur.emitUserUpdated(n,t||void 0).catch(e=>{qe(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),N=u(async()=>await r.getProfile(),[r]),C=u(async e=>await r.getWorkspace(e),[r]),_=u(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!Yt(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(Ft(n.workspaces.filter(e=>e._id!==t))),n.currentWorkspace?._id===t&&e.workspaces($t()),a&&ur.emitWorkspaceDeleted(a).catch(e=>{qe(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:h,refreshWorkspaces:g,refreshing:n.refreshing,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,switchToWorkspace:c,resetCurrentWorkspace:l,createWorkspace:v,allFeatures:n.allFeatures,getFeatures:b,updateFeature:w,getWorkspace:C,updateWorkspace:y,getUsers:x,addUser:S,removeUser:k,updateUser:E,getProfile:N,updateUserProfile:A,deleteWorkspace:_,switching:null!==n.switchingToId}};const yr=new class{constructor(){this.listeners=new Set,this.currentState={open:!1,section:"profile"}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getState(){return{...this.currentState}}openWorkspaceSettings(e){this.currentState={open:!0,section:e||"profile"},this.notifyListeners()}closeSettings(){this.currentState={...this.currentState,open:!1},this.notifyListeners()}setSection(e){this.currentState={...this.currentState,section:e},this.notifyListeners()}notifyListeners(){this.listeners.forEach(e=>{e(this.currentState.open,this.currentState.section)})}},br=m(()=>Promise.resolve().then(function(){return Kk}).then(e=>({default:e.default}))),wr=({children:n})=>{const{currentWorkspace:a}=vr(),[o,i]=f(!1),[s,c]=f("profile");return d(()=>{const e=yr.getState();i(e.open),c(e.section);return yr.subscribe((e,t)=>{i(e),c(t)})},[]),e(r,{children:[n,a&&o&&t(p,{fallback:null,children:t(br,{workspace:a,open:o,onOpenChange:e=>{e||yr.closeSettings()},section:s,onSectionChange:e=>{yr.setSection(e)},showTrigger:!1})})]})},xr=(e,t,r)=>{if(t!==x.V1)throw new Error(`Invalid version: "${t}". Only "${x.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},Sr=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{xr(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),c=a.useMemo(()=>o?.callbacks,[o?.callbacks]),l=a.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return d(()=>(ur.setCallbacks(l?{handleEvent:l}:null),()=>{ur.setCallbacks(null)}),[l]),t(Xe,{children:t(or,{children:t(lr,{callbacks:c,children:t(pr,{children:t(dr,{config:s,auth:o,children:t(hr,{children:t(wr,{children:i})})})})})})})});Sr.displayName="SaaSOSProvider";var kr=e=>"checkbox"===e.type,Er=e=>e instanceof Date,Ar=e=>null==e;const Nr=e=>"object"==typeof e;var Cr=e=>!Ar(e)&&!Array.isArray(e)&&Nr(e)&&!Er(e),_r=e=>Cr(e)&&e.target?kr(e.target)?e.target.checked:e.target.value:e,Tr=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Rr="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Pr(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(Rr&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||Cr(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Cr(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=Pr(e[t]));return n}var Or=e=>/^\w*$/.test(e),Ir=e=>void 0===e,Dr=e=>Array.isArray(e)?e.filter(Boolean):[],Ur=e=>Dr(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Mr=(e,t,r)=>{if(!t||!Cr(e))return r;const n=(Or(t)?[t]:Ur(t)).reduce((e,t)=>Ar(e)?e:e[t],e);return Ir(n)||n===e?Ir(e[t])?r:e[t]:n},zr=e=>"boolean"==typeof e,Fr=e=>"function"==typeof e,Lr=(e,t,r)=>{let n=-1;const a=Or(t)?[t]:Ur(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Cr(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const jr="blur",$r="focusout",Vr="change",Wr="onBlur",Br="onChange",Gr="onSubmit",Hr="onTouched",Kr="all",Zr="max",Jr="min",qr="maxLength",Yr="minLength",Xr="pattern",Qr="required",en="validate",tn=a.createContext(null);tn.displayName="HookFormContext";const rn=()=>a.useContext(tn),nn=e=>{const{children:t,...r}=e;return a.createElement(tn.Provider,{value:r},t)};var an=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const a=o;return t._proxyFormState[a]!==Kr&&(t._proxyFormState[a]=!n||Kr),r&&(r[a]=!0),e[a]}});return a};const on="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var sn=e=>"string"==typeof e,cn=(e,t,r,n,a)=>sn(e)?(n&&t.watch.add(e),Mr(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Mr(r,e))):(n&&(t.watchAll=!0),r),ln=e=>Ar(e)||!Nr(e);function dn(e,t,r=new WeakSet){if(ln(e)||ln(t))return Object.is(e,t);if(Er(e)&&Er(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const n=e[o];if(!a.includes(o))return!1;if("ref"!==o){const e=t[o];if(Er(n)&&Er(e)||Cr(n)&&Cr(e)||Array.isArray(n)&&Array.isArray(e)?!dn(n,e,r):!Object.is(n,e))return!1}}return!0}function un(e){const t=rn(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s,exact:c=!0}=e,l=Tr(o._names.array,r),d=a.useMemo(()=>Mr(o._formValues,r,Mr(o._defaultValues,r,s)),[o,r,s]),u=function(e){const t=rn(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},l=a.useRef(o),d=a.useRef(c),u=a.useRef(void 0),f=a.useRef(r),p=a.useRef(n);d.current=c;const[m,h]=a.useState(()=>{const e=r._getWatch(n,l.current);return d.current?d.current(e):e}),g=a.useCallback(e=>{const t=cn(n,r._names,e||r._formValues,!1,l.current);return d.current?d.current(t):t},[r._formValues,r._names,n]),v=a.useCallback(e=>{if(!i){const t=cn(n,r._names,e||r._formValues,!1,l.current);if(d.current){const e=d.current(t);dn(e,u.current)||(h(e),u.current=e)}else h(t)}},[r._formValues,r._names,i,n]);on(()=>(f.current===r&&dn(p.current,n)||(f.current=r,p.current=n,v()),r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{v(e.values)}})),[r,s,n,v]),a.useEffect(()=>r._removeUnmounted());const y=f.current!==r,b=p.current,w=a.useMemo(()=>{if(i)return null;const e=!y&&!dn(b,n);return y||e?g():null},[i,y,n,b,g]);return null!==w?w:m}({control:o,name:r,defaultValue:d,exact:c}),f=function(e){const t=rn(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,c]=a.useState(r._formState),l=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return on(()=>r._subscribe({name:o,formState:l.current,exact:i,callback:e=>{!n&&c({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>an(s,r,l.current,!1),[s,r])}({control:o,name:r,exact:c}),p=a.useRef(e),m=a.useRef(void 0),h=a.useRef(o.register(r,{...e.rules,value:u,...zr(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Mr(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Mr(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Mr(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Mr(f.validatingFields,r)},error:{enumerable:!0,get:()=>Mr(f.errors,r)}}),[f,r]),v=a.useCallback(e=>h.current.onChange({target:{value:_r(e),name:r},type:Vr}),[r]),y=a.useCallback(()=>h.current.onBlur({target:{value:Mr(o._formValues,r),name:r},type:jr}),[r,o._formValues]),b=a.useCallback(e=>{const t=Mr(o._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>Fr(e.focus)&&e.focus(),select:()=>Fr(e.select)&&e.select(),setCustomValidity:t=>Fr(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Fr(e.reportValidity)&&e.reportValidity()})},[o._fields,r]),w=a.useMemo(()=>({name:r,value:u,...zr(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:v,onBlur:y,ref:b}),[r,n,f.disabled,v,y,b,u]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i,t=m.current;t&&t!==r&&!l&&o.unregister(t),o.register(r,{...p.current.rules,...zr(p.current.disabled)?{disabled:p.current.disabled}:{}});const n=(e,t)=>{const r=Mr(o._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=Pr(Mr(o._options.defaultValues,r,p.current.defaultValue));Lr(o._defaultValues,r,e),Ir(Mr(o._formValues,r))&&Lr(o._formValues,r,e)}return!l&&o.register(r),m.current=r,()=>{(l?e&&!o._state.action:e)?o.unregister(r):n(r,!1)}},[r,o,l,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:w,formState:f,fieldState:g}),[w,f,g])}const fn=e=>e.render(un(e));var pn=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},mn=e=>Array.isArray(e)?e:[e],hn=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function gn(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&Cr(a)&&o){const e=gn(a,o);Cr(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var vn=e=>Cr(e)&&!Object.keys(e).length,yn=e=>"file"===e.type,bn=e=>{if(!Rr)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},wn=e=>"select-multiple"===e.type,xn=e=>"radio"===e.type,Sn=e=>bn(e)&&e.isConnected;function kn(e,t){const r=Array.isArray(t)?t:Or(t)?[t]:Ur(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Ir(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Cr(n)&&vn(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ir(e[t]))return!1;return!0}(n))&&kn(e,r.slice(0,-1)),e}function En(e){return Array.isArray(e)||Cr(e)&&!(e=>{for(const t in e)if(Fr(e[t]))return!0;return!1})(e)}function An(e,t={}){for(const r in e){const n=e[r];En(n)?(t[r]=Array.isArray(n)?[]:{},An(n,t[r])):Ir(n)||(t[r]=!0)}return t}function Nn(e,t,r){r||(r=An(t));for(const n in e){const a=e[n];if(En(a))Ir(t)||ln(r[n])?r[n]=An(a,Array.isArray(a)?[]:{}):Nn(a,Ar(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!dn(a,e)}}return r}const Cn={value:!1,isValid:!1},_n={value:!0,isValid:!0};var Tn=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ir(e[0].attributes.value)?Ir(e[0].value)||""===e[0].value?_n:{value:e[0].value,isValid:!0}:_n:Cn}return Cn},Rn=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ir(e)?e:t?""===e?NaN:e?+e:e:r&&sn(e)?new Date(e):n?n(e):e;const Pn={isValid:!1,value:null};var On=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Pn):Pn;function In(e){const t=e.ref;return yn(t)?t.files:xn(t)?On(e.refs).value:wn(t)?[...t.selectedOptions].map(({value:e})=>e):kr(t)?Tn(e.refs).value:Rn(Ir(t.value)?e.ref.value:t.value,e)}var Dn=e=>e instanceof RegExp,Un=e=>Ir(e)?e:Dn(e)?e.source:Cr(e)?Dn(e.value)?e.value.source:e.value:e,Mn=e=>({isOnSubmit:!e||e===Gr,isOnBlur:e===Wr,isOnChange:e===Br,isOnAll:e===Kr,isOnTouch:e===Hr});const zn="AsyncFunction";var Fn=e=>!!e&&!!e.validate&&!!(Fr(e.validate)&&e.validate.constructor.name===zn||Cr(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===zn)),Ln=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const jn=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Mr(e,a);if(r){const{_f:e,...o}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(jn(o,t))break}else if(Cr(o)&&jn(o,t))break}}};function $n(e,t,r){const n=Mr(e,r);if(n||Or(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Mr(t,n),i=Mr(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var Vn=(e,t,r)=>{const n=mn(Mr(e,r));return Lr(n,"root",t[r]),Lr(e,r,n),e};function Wn(e,t,r="validate"){if(sn(e)||Array.isArray(e)&&e.every(sn)||zr(e)&&!e)return{type:r,message:sn(e)?e:"",ref:t}}var Bn=e=>Cr(e)&&!Dn(e)?e:{value:e,message:""},Gn=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,y=Mr(r,h);if(!v||t.has(h))return{};const b=s?s[0]:i,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(zr(e)?"":e||""),b.reportValidity())},x={},S=xn(i),k=kr(i),E=S||k,A=(g||yn(i))&&Ir(i.value)&&Ir(y)||bn(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,N=pn.bind(null,h,n,x),C=(e,t,r,n=qr,a=Yr)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:i,...N(e?n:a,o)}};if(o?!Array.isArray(y)||!y.length:c&&(!E&&(A||Ar(y))||zr(y)&&!y||k&&!Tn(s).isValid||S&&!On(s).isValid)){const{value:e,message:t}=sn(c)?{value:!!c,message:c}:Bn(c);if(e&&(x[h]={type:Qr,message:t,ref:b,...N(Qr,t)},!n))return w(t),x}if(!(A||Ar(u)&&Ar(f))){let e,t;const r=Bn(f),a=Bn(u);if(Ar(y)||isNaN(y)){const n=i.valueAsDate||new Date(y),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;sn(r.value)&&y&&(e=s?o(y)>o(r.value):c?y>r.value:n>new Date(r.value)),sn(a.value)&&y&&(t=s?o(y)<o(a.value):c?y<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(y?+y:y);Ar(r.value)||(e=n>r.value),Ar(a.value)||(t=n<a.value)}if((e||t)&&(C(!!e,r.message,a.message,Zr,Jr),!n))return w(x[h].message),x}if((l||d)&&!A&&(sn(y)||o&&Array.isArray(y))){const e=Bn(l),t=Bn(d),r=!Ar(e.value)&&y.length>+e.value,a=!Ar(t.value)&&y.length<+t.value;if((r||a)&&(C(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!A&&sn(y)){const{value:e,message:t}=Bn(p);if(Dn(e)&&!y.match(e)&&(x[h]={type:Xr,message:t,ref:i,...N(Xr,t)},!n))return w(t),x}if(m)if(Fr(m)){const e=Wn(await m(y,r),b);if(e&&(x[h]={...e,...N(en,e.message)},!n))return w(e.message),x}else if(Cr(m)){let e={};for(const t in m){if(!vn(e)&&!n)break;const a=Wn(await m[t](y,r),b,t);a&&(e={...a,...N(t,a.message)},w(a.message),n&&(x[h]=e))}if(!vn(e)&&(x[h]={ref:b,...e},!n))return x}return w(!0),x};const Hn={mode:Gr,reValidateMode:Br,shouldFocusError:!0};function Kn(e={}){let t,r={...Hn,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Fr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Cr(r.defaultValues)||Cr(r.values))&&Pr(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:Pr(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...d};let f={...u};const p={array:hn(),state:hn()},m=r.criteriaMode===Kr,h=async e=>{if(!s.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=vn((await w()).errors),g()):e=await x(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?Lr(n.validatingFields,e,t):kn(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!vn(n.validatingFields)}))},v=(e,t,r,n)=>{const c=Mr(a,e);if(c){const a=Mr(i,e,Ir(r)?Mr(o,e):r);Ir(a)||n&&n.defaultChecked||t?Lr(i,e,t?a:In(c._f)):E(e,a),s.mount&&!s.action&&h()}},y=(e,t,a,i,s)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||i){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=dn(Mr(o,e),t);l=!!Mr(n.dirtyFields,e),r?kn(n.dirtyFields,e):Lr(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=Mr(n.touchedFields,e);t||(Lr(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(d)}return c?d:{}},b=(e,a,o,i)=>{const s=Mr(n.errors,e),c=(u.isValid||f.isValid)&&zr(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{Lr(n.errors,e,t),p.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(l),l=setTimeout(d,e)},t(r.delayError)):(clearTimeout(l),t=null,o?Lr(n.errors,e,o):kn(n.errors,e)),(o?!dn(s,o):s)||!vn(i)||c){const t={...i,...c&&zr(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{g(e,!0);const t=await r.resolver(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Mr(t,r);e&&Lr(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(t,a,o={valid:!0})=>{for(const s in t){const l=t[s];if(l){const{_f:t,...s}=l;if(t){const s=c.array.has(t.name),d=l._f&&Fn(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await Gn(l,c.disabled,i,m,r.shouldUseNativeValidation&&!a,s);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Mr(f,t.name)?s?Vn(n.errors,f,t.name):Lr(n.errors,t.name,f[t.name]):kn(n.errors,t.name))}!vn(s)&&await x(s,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&Lr(i,e,t),!dn(R(),o)),k=(e,t,r)=>cn(e,c,{...s.mount?i:Ir(t)?o:sn(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=Mr(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Lr(i,e,Rn(t,r)),o=bn(r.ref)&&Ar(t)?"":t,wn(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?kr(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):yn(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:Pr(i)})))}(r.shouldDirty||r.shouldTouch)&&y(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&T(e)},A=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=Mr(a,i);(c.array.has(e)||Cr(o)||s&&!s._f)&&!Er(o)?A(i,o,r):E(i,o,r)}},N=(e,t,r={})=>{const l=Mr(a,e),d=c.array.has(e),m=Pr(t);Lr(i,e,m),d?(p.array.next({name:e,values:Pr(i)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:Nn(o,i),isDirty:S(e,m)})):!l||l._f||Ar(m)?E(e,m,r):A(e,m,r),Ln(e,c)?p.state.next({...n,name:e,values:Pr(i)}):p.state.next({name:s.mount?e:void 0,values:Pr(i)})},C=async e=>{s.mount=!0;const o=e.target;let l=o.name,d=!0;const v=Mr(a,l),S=e=>{d=Number.isNaN(e)||Er(e)&&isNaN(e.getTime())||dn(e,Mr(i,l,e))},k=Mn(r.mode),E=Mn(r.reValidateMode);if(v){let s,A;const N=o.type?In(v._f):_r(e),C=e.type===jr||e.type===$r,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(v._f)&&!r.resolver&&!Mr(n.errors,l)&&!v._f.deps||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(C,Mr(n.touchedFields,l),n.isSubmitted,E,k),R=Ln(l,c,C);Lr(i,l,N),C?o&&o.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);const P=y(l,N,C),O=!vn(P)||R;if(!C&&p.state.next({name:l,type:e.type,values:Pr(i)}),_)return(u.isValid||f.isValid)&&("onBlur"===r.mode?C&&h():C||h()),O&&p.state.next({name:l,...R?{}:P});if(!C&&R&&p.state.next({...n}),r.resolver){const{errors:e}=await w([l]);if(g([l]),S(N),d){const t=$n(n.errors,a,l),r=$n(e,a,t.name||l);s=r.error,l=r.name,A=vn(e)}}else g([l],!0),s=(await Gn(v,c.disabled,i,m,r.shouldUseNativeValidation))[l],g([l]),S(N),d&&(s?A=!1:(u.isValid||f.isValid)&&(A=await x(a,!0)));d&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&T(v._f.deps),b(l,A,s,P))}},_=(e,t)=>{if(Mr(n.errors,t)&&e.focus)return e.focus(),1},T=async(e,t={})=>{let o,i;const s=mn(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(g(e),e)for(const r of e){const e=Mr(t,r);e?Lr(n.errors,r,e):kn(n.errors,r)}else n.errors=t;return t})(Ir(e)?e:s);o=vn(t),i=e?!s.some(e=>Mr(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=Mr(a,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&h()):i=o=await x(a);return p.state.next({...!sn(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&jn(a,_,e?s:c.mount),i},R=(e,t)=>{let r={...s.mount?i:o};return t&&(r=gn(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Ir(e)?r:sn(e)?Mr(r,e):e.map(e=>Mr(r,e))},P=(e,t)=>({invalid:!!Mr((t||n).errors,e),isDirty:!!Mr((t||n).dirtyFields,e),error:Mr((t||n).errors,e),isValidating:!!Mr(n.validatingFields,e),isTouched:!!Mr((t||n).touchedFields,e)}),O=(e,t,r)=>{const o=(Mr(a,e,{_f:{}})._f||{}).ref,i=Mr(n.errors,e)||{},{ref:s,message:c,type:l,...d}=i;Lr(n.errors,e,{...d,...t,ref:o}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},I=e=>p.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!mn(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return vn(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Kr))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const s of e?mn(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(kn(a,s),kn(i,s)),!t.keepError&&kn(n.errors,s),!t.keepDirty&&kn(n.dirtyFields,s),!t.keepTouched&&kn(n.touchedFields,s),!t.keepIsValidating&&kn(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&kn(o,s);p.state.next({values:Pr(i)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},U=({disabled:e,name:t})=>{(zr(e)&&s.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},M=(e,t={})=>{let n=Mr(a,e);const i=zr(t.disabled)||zr(r.disabled);return Lr(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?U({disabled:zr(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Un(t.min),max:Un(t.max),minLength:Un(t.minLength),maxLength:Un(t.maxLength),pattern:Un(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:i=>{if(i){M(e,t),n=Mr(a,e);const r=Ir(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>xn(e)||kr(e))(r),c=n._f.refs||[];if(s?c.find(e=>e===r):r===n._f.ref)return;Lr(a,e,{_f:{...n._f,...s?{refs:[...c.filter(Sn),r,...Array.isArray(Mr(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=Mr(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Tr(c.array,e)||!s.action)&&c.unMount.add(e)}}},z=()=>r.shouldFocusError&&jn(a,_,c.mount),F=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=Pr(i);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();g(),n.errors=e,l=Pr(t)}else await x(a);if(c.disabled.size)for(const e of c.disabled)kn(l,e);if(kn(n.errors,"root"),vn(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){s=e}}else t&&await t({...n.errors},o),z(),setTimeout(z);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:vn(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},L=(e,t={})=>{const l=e?Pr(e):o,d=Pr(l),f=vn(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(Nn(o,i))]);for(const t of Array.from(e)){const e=Mr(n.dirtyFields,t),r=Mr(i,t),a=Mr(m,t);e&&!Ir(r)?Lr(m,t,r):e||Ir(a)||N(t,a)}}else{if(Rr&&Ir(e))for(const e of c.mount){const t=Mr(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(bn(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)N(e,Mr(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?Pr(o):{}:Pr(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!vn(m),s.watch=!!r.shouldUnregister,s.keepIsValid=!!t.keepIsValid,s.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||dn(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&i?Nn(o,i):n.dirtyFields:t.keepDefaultValues&&e?Nn(o,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>L(Fr(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:M,unregister:D,getFieldState:P,handleSubmit:F,setError:O,_subscribe:I,_runSchema:w,_updateIsValidating:g,_focusError:z,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(s.action=!0,m&&Array.isArray(Mr(a,e))){const t=c(Mr(a,e),l.argA,l.argB);d&&Lr(a,e,t)}if(m&&Array.isArray(Mr(n.errors,e))){const t=c(Mr(n.errors,e),l.argA,l.argB);d&&Lr(n.errors,e,t),((e,t)=>{!Dr(Mr(e,t)).length&&kn(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Mr(n.touchedFields,e))){const t=c(Mr(n.touchedFields,e),l.argA,l.argB);d&&Lr(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Nn(o,i)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Lr(i,e,t)},_setDisabledField:U,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Dr(Mr(s.mount?i:o,e,r.shouldUnregister?Mr(o,e,[]):[])),_reset:L,_resetDefaultValues:()=>Fr(r.defaultValues)&&r.defaultValues().then(e=>{j(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Mr(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Sn(e)):!Sn(t._f.ref))&&D(e)}c.unMount=new Set},_disableForm:e=>{zr(e)&&(p.state.next({disabled:e}),jn(a,(t,r)=>{const n=Mr(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(s.mount=!0,f={...f,...e.formState},I({...e,formState:{...d,...e.formState}})),trigger:T,register:M,handleSubmit:F,watch:(e,t)=>Fr(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:N,getValues:R,reset:j,resetField:(e,t={})=>{Mr(a,e)&&(Ir(t.defaultValue)?N(e,Pr(Mr(o,e))):(N(e,t.defaultValue),Lr(o,e,Pr(t.defaultValue))),t.keepTouched||kn(n.touchedFields,e),t.keepDirty||(kn(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Pr(Mr(o,e))):S()),t.keepError||(kn(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&mn(e).forEach(e=>kn(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:O,setFocus:(e,t={})=>{const r=Mr(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Fr(e.select)&&e.select()})}},getFieldState:P};return{...V,formControl:V}}function Zn(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:Fr(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Fr(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Fr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=Kn(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,on(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{var t;e.values&&!dn(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),(null===(t=i._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||i._setValid(),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=an(n,i),t.current}const Jn=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Mr(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},qn=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Jn(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>Jn(t,r,e))}},Yn=(e,t)=>{t.shouldUseNativeValidation&&qn(e,t);const r={};for(const n in e){const a=Mr(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(Xn(t.names||Object.keys(e),n)){const e=Object.assign({},Mr(r,n));Lr(e,"root",o),Lr(r,n,e)}else Lr(r,n,o)}return r},Xn=(e,t)=>{const r=Qn(t);return e.some(e=>Qn(e).match(`^${r}\\.\\d+`))};function Qn(e){return e.replace(/\]|\[/g,"")}function ea(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:i,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=i.prototype,o=Object.keys(a);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ta extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ra extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const na={};function aa(e){return na}function oa(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function ia(e,t){return"bigint"==typeof t?t.toString():t}function sa(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ca(e){return null==e}function la(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const da=Symbol("evaluating");function ua(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==da)return void 0===n&&(n=da,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function fa(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function pa(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function ma(e){return JSON.stringify(e)}const ha="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ga(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const va=sa(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ya(e){if(!1===ga(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==ga(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ba(e){return ya(e)?{...e}:Array.isArray(e)?[...e]:e}const wa=new Set(["string","number","symbol"]);function xa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sa(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function ka(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function Ea(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function Aa(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Na(e){return"string"==typeof e?e:e?.message}function Ca(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=Na(e.inst?._zod.def?.error?.(e))??Na(t?.error?.(e))??Na(r.customError?.(e))??Na(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function _a(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Ta(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ra=(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,ia,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pa=ea("$ZodError",Ra),Oa=ea("$ZodError",Ra,{Parent:Error});const Ia=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ta;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Ca(e,o,aa())));throw ha(t,a?.callee),t}return i.value},Da=Ia(Oa),Ua=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Ca(e,o,aa())));throw ha(t,a?.callee),t}return i.value},Ma=Ua(Oa),za=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new ta;return o.issues.length?{success:!1,error:new(e??Pa)(o.issues.map(e=>Ca(e,a,aa())))}:{success:!0,data:o.value}},Fa=za(Oa),La=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Ca(e,a,aa())))}:{success:!0,data:o.value}},ja=La(Oa),$a=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ia(e)(t,r,a)},Va=e=>(t,r,n)=>Ia(e)(t,r,n),Wa=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ua(e)(t,r,a)},Ba=e=>async(t,r,n)=>Ua(e)(t,r,n),Ga=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return za(e)(t,r,a)},Ha=e=>(t,r,n)=>za(e)(t,r,n),Ka=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return La(e)(t,r,a)},Za=e=>async(t,r,n)=>La(e)(t,r,n),Ja=/^[cC][^\s-]{8,}$/,qa=/^[0-9a-z]+$/,Ya=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Xa=/^[0-9a-vA-V]{20}$/,Qa=/^[A-Za-z0-9]{27}$/,eo=/^[a-zA-Z0-9_-]{21}$/,to=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ro=/^([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})$/,no=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)$/,ao=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const oo=/^(?:(?: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])$/,io=/^(([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}|:))$/,so=/^((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])$/,co=/^(([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])$/,lo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uo=/^[A-Za-z0-9_-]*$/,fo=/^\+[1-9]\d{6,14}$/,po="(?:(?:\\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])))",mo=new RegExp(`^${po}$`);function ho(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const go=/^[^A-Z]*$/,vo=/^[^a-z]*$/,yo=ea("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),bo=ea("$ZodCheckMaxLength",(e,t)=>{var r;yo.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ca(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=_a(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),wo=ea("$ZodCheckMinLength",(e,t)=>{var r;yo.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ca(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=_a(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),xo=ea("$ZodCheckLengthEquals",(e,t)=>{var r;yo.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ca(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const o=_a(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),So=ea("$ZodCheckStringFormat",(e,t)=>{var r,n;yo.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ko=ea("$ZodCheckRegex",(e,t)=>{So.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})}}),Eo=ea("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=go),So.init(e,t)}),Ao=ea("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vo),So.init(e,t)}),No=ea("$ZodCheckIncludes",(e,t)=>{yo.init(e,t);const r=xa(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Co=ea("$ZodCheckStartsWith",(e,t)=>{yo.init(e,t);const r=new RegExp(`^${xa(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),_o=ea("$ZodCheckEndsWith",(e,t)=>{yo.init(e,t);const r=new RegExp(`.*${xa(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),To=ea("$ZodCheckOverwrite",(e,t)=>{yo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Ro{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Po={major:4,minor:3,patch:6},Oo=ea("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Po;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,a=Ea(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new ta;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=Ea(e,t)))});else{if(e.issues.length===t)continue;a||(a=Ea(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(Ea(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new ta;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new ta;return i.then(e=>t(e,n,o))}return t(i,n,o)}}ua(e,"~standard",()=>({validate:t=>{try{const r=Fa(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return ja(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Io=ea("$ZodString",(e,t)=>{var r;Oo.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Do=ea("$ZodStringFormat",(e,t)=>{So.init(e,t),Io.init(e,t)}),Uo=ea("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ro),Do.init(e,t)}),Mo=ea("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=no(e))}else t.pattern??(t.pattern=no());Do.init(e,t)}),zo=ea("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ao),Do.init(e,t)}),Fo=ea("$ZodURL",(e,t)=>{Do.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=a.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Lo=ea("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Do.init(e,t)}),jo=ea("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=eo),Do.init(e,t)}),$o=ea("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ja),Do.init(e,t)}),Vo=ea("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qa),Do.init(e,t)}),Wo=ea("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ya),Do.init(e,t)}),Bo=ea("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Xa),Do.init(e,t)}),Go=ea("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qa),Do.init(e,t)}),Ho=ea("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ho({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${po}T(?:${n})$`)}(t)),Do.init(e,t)}),Ko=ea("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=mo),Do.init(e,t)}),Zo=ea("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ho(t)}$`)),Do.init(e,t)}),Jo=ea("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=to),Do.init(e,t)}),qo=ea("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=oo),Do.init(e,t),e._zod.bag.format="ipv4"}),Yo=ea("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=io),Do.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})}}}),Xo=ea("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=so),Do.init(e,t)}),Qo=ea("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=co),Do.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ei(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ti=ea("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=lo),Do.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ei(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const ri=ea("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=uo),Do.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!uo.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ei(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ni=ea("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fo),Do.init(e,t)});const ai=ea("$ZodJWT",(e,t)=>{Do.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),oi=ea("$ZodUnknown",(e,t)=>{Oo.init(e,t),e._zod.parse=e=>e}),ii=ea("$ZodNever",(e,t)=>{Oo.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function si(e,t,r){e.issues.length&&t.issues.push(...Aa(r,e.issues)),t.value[r]=e.value}const ci=ea("$ZodArray",(e,t)=>{Oo.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>si(t,r,e))):si(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function li(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Aa(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function di(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ui(e,t,r,n,a,o){const i=[],s=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(s.has(a))continue;if("never"===l){i.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>li(e,r,a,t,d))):li(o,r,a,t,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const fi=ea("$ZodObject",(e,t)=>{Oo.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=sa(()=>di(t));ua(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const a=ga,o=t.catchall;let i;e._zod.parse=(t,r)=>{i??(i=n.value);const s=t.value;if(!a(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=i.shape;for(const e of i.keys){const n=l[e],a="optional"===n._zod.optout,o=n._zod.run({value:s[e],issues:[]},r);o instanceof Promise?c.push(o.then(r=>li(r,t,e,s,a))):li(o,t,e,s,a)}return o?ui(c,s,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),pi=ea("$ZodObjectJIT",(e,t)=>{fi.init(e,t);const r=e._zod.parse,n=sa(()=>di(t));let a;const o=ga,i=!na.jitless,s=i&&va.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new Ro(["shape","payload","ctx"]),r=n.value,a=e=>{const t=ma(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],i=ma(n),s=e[n],c="optional"===s?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),c?ui([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function mi(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const a=e.filter(e=>!Ea(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>Ca(e,n,aa())))}),t)}const hi=ea("$ZodUnion",(e,t)=>{Oo.init(e,t),ua(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ua(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ua(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ua(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>la(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>mi(t,a,e,o)):mi(s,a,e,o)}}),gi=ea("$ZodIntersection",(e,t)=>{Oo.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,r])=>yi(e,t,r)):yi(e,a,o)}});function vi(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(ya(e)&&ya(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),a={...e,...t};for(const r of n){const n=vi(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};a[r]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=vi(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function yi(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&a&&e.issues.push({...a,keys:o}),Ea(e))return e;const i=vi(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const bi=ea("$ZodEnum",(e,t)=>{Oo.init(e,t);const r=oa(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>wa.has(typeof e)).map(e=>"string"==typeof e?xa(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),wi=ea("$ZodTransform",(e,t)=>{Oo.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ra(e.constructor.name);const a=t.transform(r.value,r);if(n.async){return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r))}if(a instanceof Promise)throw new ta;return r.value=a,r}});function xi(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Si=ea("$ZodOptional",(e,t)=>{Oo.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ua(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ua(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${la(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>xi(t,e.value)):xi(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),ki=ea("$ZodExactOptional",(e,t)=>{Si.init(e,t),ua(e._zod,"values",()=>t.innerType._zod.values),ua(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),Ei=ea("$ZodNullable",(e,t)=>{Oo.init(e,t),ua(e._zod,"optin",()=>t.innerType._zod.optin),ua(e._zod,"optout",()=>t.innerType._zod.optout),ua(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${la(e.source)}|null)$`):void 0}),ua(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Ai=ea("$ZodDefault",(e,t)=>{Oo.init(e,t),e._zod.optin="optional",ua(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Ni(e,t)):Ni(n,t)}});function Ni(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Ci=ea("$ZodPrefault",(e,t)=>{Oo.init(e,t),e._zod.optin="optional",ua(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),_i=ea("$ZodNonOptional",(e,t)=>{Oo.init(e,t),ua(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>Ti(t,e)):Ti(a,e)}});function Ti(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Ri=ea("$ZodCatch",(e,t)=>{Oo.init(e,t),ua(e._zod,"optin",()=>t.innerType._zod.optin),ua(e._zod,"optout",()=>t.innerType._zod.optout),ua(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ca(e,r,aa()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ca(e,r,aa()))},input:e.value}),e.issues=[]),e)}}),Pi=ea("$ZodPipe",(e,t)=>{Oo.init(e,t),ua(e._zod,"values",()=>t.in._zod.values),ua(e._zod,"optin",()=>t.in._zod.optin),ua(e._zod,"optout",()=>t.out._zod.optout),ua(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Oi(e,t.in,r)):Oi(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Oi(e,t.out,r)):Oi(n,t.out,r)}});function Oi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ii=ea("$ZodReadonly",(e,t)=>{Oo.init(e,t),ua(e._zod,"propValues",()=>t.innerType._zod.propValues),ua(e._zod,"values",()=>t.innerType._zod.values),ua(e._zod,"optin",()=>t.innerType?._zod?.optin),ua(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Di):Di(n)}});function Di(e){return e.value=Object.freeze(e.value),e}const Ui=ea("$ZodCustom",(e,t)=>{yo.init(e,t),Oo.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(t=>Mi(t,r,n,e));Mi(a,r,n,e)}});function Mi(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Ta(e))}}var zi;class Fi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(zi=globalThis).__zod_globalRegistry??(zi.__zod_globalRegistry=new Fi);const Li=globalThis.__zod_globalRegistry;function ji(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ka(t)})}function $i(e,t){return new bo({check:"max_length",...ka(t),maximum:e})}function Vi(e,t){return new wo({check:"min_length",...ka(t),minimum:e})}function Wi(e,t){return new xo({check:"length_equals",...ka(t),length:e})}function Bi(e){return new To({check:"overwrite",tx:e})}function Gi(e){const t=function(e,t){const r=new yo({check:"custom",...ka(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Ta(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Ta(n))}},e(r.value,r)));return t}function Hi(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Li,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 Ki(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,o=t.seen.get(e);if(o){o.count++;return r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema}const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const s=e._zod.toJSONSchema?.();if(s)i.schema=s;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,n);else{const r=i.schema,o=t.processors[a.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(i.ref||(i.ref=o),Ki(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(i.schema,c),"input"===t.io&&qi(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function Zi(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:o}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${a("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:a+o}})(t);n.def={...n.schema},o&&(n.defId=o);const i=n.schema;for(const e in i)delete i[e];i.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const o=e.metadataRegistry.get(r[0])?.id;o?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function Ji(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,o={...a},i=r.ref;if(r.ref=null,i){n(i);const r=e.seen.get(i),s=r.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,s):(a.allOf=a.allOf??[],a.allOf.push(s)),Object.assign(a,o);if(t._zod.parent===i)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(s.$ref&&r.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const s=t._zod.parent;if(s&&s!==i){n(s);const t=e.seen.get(s);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const o=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?a.$defs=o:a.definitions=o);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yi(t,"input",e.processors),output:Yi(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function qi(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return qi(n.element,r);if("set"===n.type)return qi(n.valueType,r);if("lazy"===n.type)return qi(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return qi(n.innerType,r);if("intersection"===n.type)return qi(n.left,r)||qi(n.right,r);if("record"===n.type||"map"===n.type)return qi(n.keyType,r)||qi(n.valueType,r);if("pipe"===n.type)return qi(n.in,r)||qi(n.out,r);if("object"===n.type){for(const e in n.shape)if(qi(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(qi(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(qi(e,r))return!0;return!(!n.rest||!qi(n.rest,r))}return!1}const Yi=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},i=Hi({...a??{},target:o,io:t,processors:r});return Ki(e,i),Zi(i,e),Ji(i,e)},Xi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qi=(e,t,r,n)=>{const a=e._zod.def;Ki(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function es(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function ts(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=pn(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function rs(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=pn(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function ns(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,o){try{return Promise.resolve(es(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&qn({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:Yn(ts(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,o){try{return Promise.resolve(es(function(){return Promise.resolve(("sync"===r.mode?Da:Ma)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&qn({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Pa}(e))return{values:{},errors:Yn(rs(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function as(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function os(...e){return t=>{let r=!1;const n=e.map(e=>{const n=as(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():as(e[t],null)}}}}function is(...e){return n.useCallback(os(...e),e)}var ss=Symbol.for("react.lazy"),cs=n[" use ".trim().toString()];function ls(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===ss&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function ds(e){const r=fs(e),a=n.forwardRef((e,a)=>{let{children:o,...i}=e;ls(o)&&"function"==typeof cs&&(o=cs(o._payload));const s=n.Children.toArray(o),c=s.find(ms);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var us=ds("Slot");function fs(e){const t=n.forwardRef((e,t)=>{let{children:r,...a}=e;if(ls(r)&&"function"==typeof cs&&(r=cs(r._payload)),n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?os(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ps=Symbol("radix.slottable");function ms(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ps}const hs=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,gs=k,vs=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return gs(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=hs(t)||hs(n);return a[e][i]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return gs(e,i,c,null==r?void 0:r.class,null==r?void 0:r.className)},ys=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bs=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},ws=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),xs=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
|
|
8
2
|
/**
|
|
9
3
|
* @license lucide-react v0.544.0 - ISC
|
|
10
4
|
*
|
|
11
5
|
* This source code is licensed under the ISC license.
|
|
12
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
13
7
|
*/
|
|
14
|
-
var
|
|
8
|
+
var Ss={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"};
|
|
15
9
|
/**
|
|
16
10
|
* @license lucide-react v0.544.0 - ISC
|
|
17
11
|
*
|
|
18
12
|
* This source code is licensed under the ISC license.
|
|
19
13
|
* See the LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/const
|
|
14
|
+
*/const ks=h(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...s},c)=>g("svg",{ref:c,...Ss,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:ws("lucide",a),...!o&&!xs(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>g(e,t)),...Array.isArray(o)?o:[o]])),Es=(e,t)=>{const r=h(({className:r,...n},a)=>g(ks,{ref:a,iconNode:t,className:ws(`lucide-${ys(bs(e))}`,`lucide-${e}`,r),...n}));return r.displayName=bs(e),r},As=Es("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),Ns=Es("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),Cs=Es("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),_s=Es("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),Ts=Es("external-link",[["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"}]]),Rs=Es("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),Ps=Es("image",[["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"}]]),Os=Es("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Is=Es("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Ds=Es("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),Us=Es("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Ms=Es("settings",[["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"}]]),zs=Es("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),Fs=Es("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),Ls=Es("trash-2",[["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"}]]),js=Es("trash",[["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"}]]),$s=Es("triangle-alert",[["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"}]]),Vs=Es("user",[["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"}]]),Ws=Es("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Bs=vs("inline-flex items-center justify-center rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"underline-offset-4 hover:underline text-primary"},withIcon:{true:"flex"},fullWidth:{true:"w-full"},size:{default:"h-9 py-2 px-4 text-sm",sm:"h-8 px-3 text-xs",lg:"h-10 px-6 text-base",icon:"h-9 w-9"}},compoundVariants:[{size:"lg",withIcon:!0,className:"gap-x-1.5"},{size:"default",withIcon:!0,className:"gap-x-1"},{size:"sm",withIcon:!0,className:"gap-x-0.5"}],defaultVariants:{variant:"default",size:"default"}}),Gs=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?us:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:Le(Bs({variant:a,size:i,withIcon:null!=o||null!=s||null!=c,className:r})),ref:u,...d,children:[o&&t(Os,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,c&&n.cloneElement(c,{size:p})]})});
|
|
21
15
|
/**
|
|
22
16
|
* @license lucide-react v0.544.0 - ISC
|
|
23
17
|
*
|
|
24
18
|
* This source code is licensed under the ISC license.
|
|
25
19
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/function Ho(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...zr(t)})}(Go,e)}const Ko=mr("ZodISODate",(e,t)=>{sa.init(e,t),gi.init(e,t)});function Zo(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...zr(t)})}(Ko,e)}const Jo=mr("ZodISOTime",(e,t)=>{ca.init(e,t),gi.init(e,t)});function qo(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...zr(t)})}(Jo,e)}const Yo=mr("ZodISODuration",(e,t)=>{la.init(e,t),gi.init(e,t)});function Xo(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...zr(t)})}(Yo,e)}const Qo=mr("ZodError",(e,t)=>{Gr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e}));else if("invalid_key"===a.code)n({issues:a.issues});else if("invalid_element"===a.code)n({issues:a.issues});else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,wr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,wr,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),ei=Kr(Qo),ti=Jr(Qo),ri=Yr(Qo),ni=Qr(Qo),ai=tn(Qo),oi=rn(Qo),ii=nn(Qo),si=an(Qo),ci=on(Qo),li=sn(Qo),di=cn(Qo),ui=ln(Qo),fi=mr("ZodType",(e,t)=>(Hn.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fo(e,"input"),output:fo(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=io({...r,processors:t});return so(e,n),co(n,e),lo(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Cr(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>Mr(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>ei(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>ri(e,t,r),e.parseAsync=async(t,r)=>ti(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ni(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>ai(e,t,r),e.decode=(t,r)=>oi(e,t,r),e.encodeAsync=async(t,r)=>ii(e,t,r),e.decodeAsync=async(t,r)=>si(e,t,r),e.safeEncode=(t,r)=>ci(e,t,r),e.safeDecode=(t,r)=>li(e,t,r),e.safeEncodeAsync=async(t,r)=>di(e,t,r),e.safeDecodeAsync=async(t,r)=>ui(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...zr(r)})}(os,e,t)}(t,r)),e.superRefine=t=>e.check(oo(t)),e.overwrite=t=>e.check(ao(t)),e.optional=()=>Zi(e),e.exactOptional=()=>new Ji({type:"optional",innerType:e}),e.nullable=()=>Yi(e),e.nullish=()=>Zi(Yi(e)),e.nonoptional=t=>function(e,t){return new es({type:"nonoptional",innerType:e,...zr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...zr(r)})}(ji,e,t);var t},e.or=t=>function(e,t){return new Bi({type:"union",options:e,...zr(t)})}([e,t]),e.and=t=>new Wi({type:"intersection",left:e,right:t}),e.transform=t=>ns(e,new Hi({type:"transform",transform:t})),e.default=t=>{return r=t,new Xi({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():Ir(r)}});var r},e.prefault=t=>{return r=t,new Qi({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():Ir(r)}});var r},e.catch=t=>{return new ts({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>ns(e,t),e.readonly=()=>new as({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Qa.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Qa.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Qa.get(e);const r=e.clone();return Qa.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),pi=mr("_ZodString",(e,t)=>{Kn.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=po[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),c&&(n.contentEncoding=c),s&&s.size>0){const e=[...s];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new zn({check:"string_format",format:"regex",...zr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new jn({check:"string_format",format:"includes",...zr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new $n({check:"string_format",format:"starts_with",...zr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Vn({check:"string_format",format:"ends_with",...zr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(ro(...t)),e.max=(...t)=>e.check(to(...t)),e.length=(...t)=>e.check(no(...t)),e.nonempty=(...t)=>e.check(ro(1,...t)),e.lowercase=t=>e.check(function(e){return new Fn({check:"string_format",format:"lowercase",...zr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ln({check:"string_format",format:"uppercase",...zr(e)})}(t)),e.trim=()=>e.check(ao(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return ao(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(ao(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(ao(e=>e.toUpperCase())),e.slugify=()=>e.check(ao(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),mi=mr("ZodString",(e,t)=>{Kn.init(e,t),pi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...zr(t)})}(vi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...zr(t)})}(wi,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...zr(t)})}(Ui,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...zr(t)})}(xi,t)),e.guid=t=>e.check(eo(yi,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...zr(t)})}(bi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...zr(t)})}(bi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...zr(t)})}(bi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...zr(t)})}(bi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...zr(t)})}(Si,t)),e.guid=t=>e.check(eo(yi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...zr(t)})}(ki,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...zr(t)})}(Ei,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...zr(t)})}(Ai,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...zr(t)})}(Oi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...zr(t)})}(Ii,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...zr(t)})}(Ni,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...zr(t)})}(Ci,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...zr(t)})}(_i,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...zr(t)})}(Ti,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...zr(t)})}(Ri,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...zr(t)})}(Pi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...zr(t)})}(Di,t)),e.datetime=t=>e.check(Ho(t)),e.date=t=>e.check(Zo(t)),e.time=t=>e.check(qo(t)),e.duration=t=>e.check(Xo(t))});function hi(e){return function(e,t){return new e({type:"string",...zr(t)})}(mi,e)}const gi=mr("ZodStringFormat",(e,t)=>{Zn.init(e,t),pi.init(e,t)}),vi=mr("ZodEmail",(e,t)=>{Yn.init(e,t),gi.init(e,t)}),yi=mr("ZodGUID",(e,t)=>{Jn.init(e,t),gi.init(e,t)}),bi=mr("ZodUUID",(e,t)=>{qn.init(e,t),gi.init(e,t)}),wi=mr("ZodURL",(e,t)=>{Xn.init(e,t),gi.init(e,t)}),xi=mr("ZodEmoji",(e,t)=>{Qn.init(e,t),gi.init(e,t)}),Si=mr("ZodNanoID",(e,t)=>{ea.init(e,t),gi.init(e,t)}),ki=mr("ZodCUID",(e,t)=>{ta.init(e,t),gi.init(e,t)}),Ei=mr("ZodCUID2",(e,t)=>{ra.init(e,t),gi.init(e,t)}),Ai=mr("ZodULID",(e,t)=>{na.init(e,t),gi.init(e,t)}),Ni=mr("ZodXID",(e,t)=>{aa.init(e,t),gi.init(e,t)}),Ci=mr("ZodKSUID",(e,t)=>{oa.init(e,t),gi.init(e,t)}),_i=mr("ZodIPv4",(e,t)=>{da.init(e,t),gi.init(e,t)}),Ti=mr("ZodIPv6",(e,t)=>{ua.init(e,t),gi.init(e,t)}),Ri=mr("ZodCIDRv4",(e,t)=>{fa.init(e,t),gi.init(e,t)}),Pi=mr("ZodCIDRv6",(e,t)=>{pa.init(e,t),gi.init(e,t)}),Oi=mr("ZodBase64",(e,t)=>{ha.init(e,t),gi.init(e,t)}),Ii=mr("ZodBase64URL",(e,t)=>{ga.init(e,t),gi.init(e,t)}),Di=mr("ZodE164",(e,t)=>{va.init(e,t),gi.init(e,t)}),Ui=mr("ZodJWT",(e,t)=>{ya.init(e,t),gi.init(e,t)}),Mi=mr("ZodUnknown",(e,t)=>{ba.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function zi(){return new Mi({type:"unknown"})}const Fi=mr("ZodNever",(e,t)=>{wa.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function Li(e){return function(e,t){return new e({type:"never",...zr(t)})}(Fi,e)}const ji=mr("ZodArray",(e,t)=>{Sa.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=so(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(ro(t,r)),e.nonempty=t=>e.check(ro(1,t)),e.max=(t,r)=>e.check(to(t,r)),e.length=(t,r)=>e.check(no(t,r)),e.unwrap=()=>e.element});const $i=mr("ZodObject",(e,t)=>{Ca.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def;a.type="object",a.properties={};const i=o.shape;for(const e in i)a.properties[e]=so(i[e],t,{...n,path:[...n.path,"properties",e]});const s=new Set(Object.keys(i)),c=new Set([...s].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(a.required=Array.from(c)),"never"===o.catchall?._zod.def.type?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=so(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),Ar(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Gi({type:"enum",entries:r,...zr(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:zi()}),e.loose=()=>e.clone({...e._zod.def,catchall:zi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Li()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Or(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Nr(this,"shape",r),r}});return Mr(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!Or(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Nr(this,"shape",r),r}});return Mr(e,r)}(e,t),e.merge=t=>function(e,t){const r=Cr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Nr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Mr(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Mr(e,Cr(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return Nr(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=Cr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return Nr(this,"shape",n),n},checks:[]});return Mr(e,a)}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Cr(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)a[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Nr(this,"shape",a),a},checks:[]});return Mr(t,a)}(Ki,e,t[0]),e.required=(...t)=>function(e,t,r){const n=Cr(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)a[t]=new e({type:"nonoptional",innerType:n[t]});return Nr(this,"shape",a),a}});return Mr(t,n)}(es,e,t[0])});function Vi(e,t){const r={type:"object",shape:e??{},...zr(t)};return new $i(r)}const Bi=mr("ZodUnion",(e,t)=>{Ta.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,i=a.options.map((e,r)=>so(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=i:r.anyOf=i})(e,t,r,n),e.options=t.options});const Wi=mr("ZodIntersection",(e,t)=>{Ra.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=so(a.left,t,{...n,path:[...n.path,"allOf",0]}),i=so(a.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(o)?o.allOf:[o],...s(i)?i.allOf:[i]];r.allOf=c})(e,t,r,n)});const Gi=mr("ZodEnum",(e,t)=>{Ia.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=br(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const a={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);a[n]=t.entries[n]}return new Gi({...t,checks:[],...zr(n),entries:a})},e.exclude=(e,n)=>{const a={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Gi({...t,checks:[],...zr(n),entries:a})}});const Hi=mr("ZodTransform",(e,t)=>{Da.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new gr(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Br(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Br(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Ki=mr("ZodOptional",(e,t)=>{Ma.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>mo(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Zi(e){return new Ki({type:"optional",innerType:e})}const Ji=mr("ZodExactOptional",(e,t)=>{za.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>mo(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const qi=mr("ZodNullable",(e,t)=>{Fa.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=so(a.innerType,t,n),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function Yi(e){return new qi({type:"nullable",innerType:e})}const Xi=mr("ZodDefault",(e,t)=>{La.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;so(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Qi=mr("ZodPrefault",(e,t)=>{$a.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;so(a.innerType,t,n),t.seen.get(e).ref=a.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const es=mr("ZodNonOptional",(e,t)=>{Va.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;so(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const ts=mr("ZodCatch",(e,t)=>{Wa.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;so(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const rs=mr("ZodPipe",(e,t)=>{Ga.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;so(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function ns(e,t){return new rs({type:"pipe",in:e,out:t})}const as=mr("ZodReadonly",(e,t)=>{Ka.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;so(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const os=mr("ZodCustom",(e,t)=>{Ja.init(e,t),fi.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function is(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function ss(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}var cs=globalThis?.document?n.useLayoutEffect:()=>{};function ls(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ds(...e){return t=>{let r=!1;const n=e.map(e=>{const n=ls(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():ls(e[t],null)}}}}function us(...e){return n.useCallback(ds(...e),e)}var fs=Symbol.for("react.lazy"),ps=n[" use ".trim().toString()];function ms(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===fs&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function hs(e){const r=vs(e),a=n.forwardRef((e,a)=>{let{children:o,...i}=e;ms(o)&&"function"==typeof ps&&(o=ps(o._payload));const s=n.Children.toArray(o),c=s.find(bs);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var gs=hs("Slot");function vs(e){const t=n.forwardRef((e,t)=>{let{children:r,...a}=e;if(ms(r)&&"function"==typeof ps&&(r=ps(r._payload)),n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ds(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ys=Symbol("radix.slottable");function bs(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ys}var ws,xs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=hs(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),Ss={exports:{}},ks={};function Es(){if(ws)return ks;ws=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),c=r({inst:{value:a,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=a,l.getSnapshot=t,s(l)&&d({inst:l})},[e,a,t]),n(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(a),a};return ks.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,ks}var As,Ns,Cs={};
|
|
20
|
+
*/Gs.displayName="Button";var Hs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=ds(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),Ks=n.forwardRef((e,r)=>t(Hs.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Ks.displayName="Label";var Zs=Ks;const Js=vs("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),qs=n.forwardRef(({className:e,...r},n)=>t(Zs,{ref:n,className:Le(Js(),e),...r}));qs.displayName=Zs.displayName;const Ys=nn,Xs=n.createContext({}),Qs=({...e})=>t(Xs.Provider,{value:{name:e.name},children:t(fn,{...e})}),ec=()=>{const e=n.useContext(Xs),t=n.useContext(tc),{getFieldState:r,formState:a}=rn(),o=r(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},tc=n.createContext({}),rc=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(tc.Provider,{value:{id:o},children:t("div",{ref:a,className:Le("space-y-2",e),...r})})});rc.displayName="FormItem";const nc=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=ec();return t(qs,{ref:n,className:Le(a&&"text-destructive",e),htmlFor:o,...r})});nc.displayName="FormLabel";const ac=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=ec();return t(us,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});ac.displayName="FormControl";const oc=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=ec();return t("p",{ref:n,id:a,className:Le("text-sm text-muted-foreground",e),...r})});oc.displayName="FormDescription";const ic=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=ec(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:Le("text-sm font-medium text-destructive",e),...n,children:s}):null});ic.displayName="FormMessage";const sc=n.forwardRef(({className:e,type:r,...n},a)=>t("input",{type:r,className:Le("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));function cc({className:e,...r}){return t("div",{className:Le("animate-pulse rounded-md bg-primary/10",e),...r})}sc.displayName="Input";let lc=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await Be(`${this.serverUrl}/api/${this.version}/beta/config?orgId=${this.orgId}`);if(!e.ok)throw new Error(await Ge(e,"Failed to fetch beta form configuration"));return e.json()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),o=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0),i=await Be(`${this.serverUrl}/api/${this.version}/beta/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:o}})});if(!i.ok)throw new Error(await Ge(i,"Failed to submit beta user request"));return i.json()}};const dc=ea("ZodISODateTime",(e,t)=>{Ho.init(e,t),Uc.init(e,t)});function uc(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ka(t)})}(dc,e)}const fc=ea("ZodISODate",(e,t)=>{Ko.init(e,t),Uc.init(e,t)});function pc(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...ka(t)})}(fc,e)}const mc=ea("ZodISOTime",(e,t)=>{Zo.init(e,t),Uc.init(e,t)});function hc(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ka(t)})}(mc,e)}const gc=ea("ZodISODuration",(e,t)=>{Jo.init(e,t),Uc.init(e,t)});function vc(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...ka(t)})}(gc,e)}const yc=ea("ZodError",(e,t)=>{Pa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e}));else if("invalid_key"===a.code)n({issues:a.issues});else if("invalid_element"===a.code)n({issues:a.issues});else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ia,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ia,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),bc=Ia(yc),wc=Ua(yc),xc=za(yc),Sc=La(yc),kc=$a(yc),Ec=Va(yc),Ac=Wa(yc),Nc=Ba(yc),Cc=Ga(yc),_c=Ha(yc),Tc=Ka(yc),Rc=Za(yc),Pc=ea("ZodType",(e,t)=>(Oo.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yi(e,"input"),output:Yi(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Hi({...r,processors:t});return Ki(e,n),Zi(n,e),Ji(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(pa(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>Sa(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>bc(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>xc(e,t,r),e.parseAsync=async(t,r)=>wc(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Sc(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>kc(e,t,r),e.decode=(t,r)=>Ec(e,t,r),e.encodeAsync=async(t,r)=>Ac(e,t,r),e.decodeAsync=async(t,r)=>Nc(e,t,r),e.safeEncode=(t,r)=>Cc(e,t,r),e.safeDecode=(t,r)=>_c(e,t,r),e.safeEncodeAsync=async(t,r)=>Tc(e,t,r),e.safeDecodeAsync=async(t,r)=>Rc(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ka(r)})}(El,e,t)}(t,r)),e.superRefine=t=>e.check(Gi(t)),e.overwrite=t=>e.check(Bi(t)),e.optional=()=>pl(e),e.exactOptional=()=>new ml({type:"optional",innerType:e}),e.nullable=()=>gl(e),e.nullish=()=>pl(gl(e)),e.nonoptional=t=>function(e,t){return new bl({type:"nonoptional",innerType:e,...ka(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...ka(r)})}(ol,e,t);var t},e.or=t=>function(e,t){return new cl({type:"union",options:e,...ka(t)})}([e,t]),e.and=t=>new ll({type:"intersection",left:e,right:t}),e.transform=t=>Sl(e,new ul({type:"transform",transform:t})),e.default=t=>{return r=t,new vl({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():ba(r)}});var r},e.prefault=t=>{return r=t,new yl({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():ba(r)}});var r},e.catch=t=>{return new wl({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Sl(e,t),e.readonly=()=>new kl({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Li.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Li.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Li.get(e);const r=e.clone();return Li.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Oc=ea("_ZodString",(e,t)=>{Io.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=Xi[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),c&&(n.contentEncoding=c),s&&s.size>0){const e=[...s];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ko({check:"string_format",format:"regex",...ka(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new No({check:"string_format",format:"includes",...ka(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Co({check:"string_format",format:"starts_with",...ka(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new _o({check:"string_format",format:"ends_with",...ka(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Vi(...t)),e.max=(...t)=>e.check($i(...t)),e.length=(...t)=>e.check(Wi(...t)),e.nonempty=(...t)=>e.check(Vi(1,...t)),e.lowercase=t=>e.check(function(e){return new Eo({check:"string_format",format:"lowercase",...ka(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ao({check:"string_format",format:"uppercase",...ka(e)})}(t)),e.trim=()=>e.check(Bi(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Bi(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Bi(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Bi(e=>e.toUpperCase())),e.slugify=()=>e.check(Bi(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Ic=ea("ZodString",(e,t)=>{Io.init(e,t),Oc.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ka(t)})}(Mc,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ka(t)})}(Lc,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ka(t)})}(el,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ka(t)})}(jc,t)),e.guid=t=>e.check(ji(zc,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ka(t)})}(Fc,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ka(t)})}(Fc,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ka(t)})}(Fc,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ka(t)})}(Fc,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ka(t)})}($c,t)),e.guid=t=>e.check(ji(zc,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ka(t)})}(Vc,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ka(t)})}(Wc,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ka(t)})}(Bc,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ka(t)})}(Yc,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ka(t)})}(Xc,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ka(t)})}(Gc,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ka(t)})}(Hc,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ka(t)})}(Kc,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ka(t)})}(Zc,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ka(t)})}(Jc,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ka(t)})}(qc,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ka(t)})}(Qc,t)),e.datetime=t=>e.check(uc(t)),e.date=t=>e.check(pc(t)),e.time=t=>e.check(hc(t)),e.duration=t=>e.check(vc(t))});function Dc(e){return function(e,t){return new e({type:"string",...ka(t)})}(Ic,e)}const Uc=ea("ZodStringFormat",(e,t)=>{Do.init(e,t),Oc.init(e,t)}),Mc=ea("ZodEmail",(e,t)=>{zo.init(e,t),Uc.init(e,t)}),zc=ea("ZodGUID",(e,t)=>{Uo.init(e,t),Uc.init(e,t)}),Fc=ea("ZodUUID",(e,t)=>{Mo.init(e,t),Uc.init(e,t)}),Lc=ea("ZodURL",(e,t)=>{Fo.init(e,t),Uc.init(e,t)}),jc=ea("ZodEmoji",(e,t)=>{Lo.init(e,t),Uc.init(e,t)}),$c=ea("ZodNanoID",(e,t)=>{jo.init(e,t),Uc.init(e,t)}),Vc=ea("ZodCUID",(e,t)=>{$o.init(e,t),Uc.init(e,t)}),Wc=ea("ZodCUID2",(e,t)=>{Vo.init(e,t),Uc.init(e,t)}),Bc=ea("ZodULID",(e,t)=>{Wo.init(e,t),Uc.init(e,t)}),Gc=ea("ZodXID",(e,t)=>{Bo.init(e,t),Uc.init(e,t)}),Hc=ea("ZodKSUID",(e,t)=>{Go.init(e,t),Uc.init(e,t)}),Kc=ea("ZodIPv4",(e,t)=>{qo.init(e,t),Uc.init(e,t)}),Zc=ea("ZodIPv6",(e,t)=>{Yo.init(e,t),Uc.init(e,t)}),Jc=ea("ZodCIDRv4",(e,t)=>{Xo.init(e,t),Uc.init(e,t)}),qc=ea("ZodCIDRv6",(e,t)=>{Qo.init(e,t),Uc.init(e,t)}),Yc=ea("ZodBase64",(e,t)=>{ti.init(e,t),Uc.init(e,t)}),Xc=ea("ZodBase64URL",(e,t)=>{ri.init(e,t),Uc.init(e,t)}),Qc=ea("ZodE164",(e,t)=>{ni.init(e,t),Uc.init(e,t)}),el=ea("ZodJWT",(e,t)=>{ai.init(e,t),Uc.init(e,t)}),tl=ea("ZodUnknown",(e,t)=>{oi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function rl(){return new tl({type:"unknown"})}const nl=ea("ZodNever",(e,t)=>{ii.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function al(e){return function(e,t){return new e({type:"never",...ka(t)})}(nl,e)}const ol=ea("ZodArray",(e,t)=>{ci.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=Ki(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Vi(t,r)),e.nonempty=t=>e.check(Vi(1,t)),e.max=(t,r)=>e.check($i(t,r)),e.length=(t,r)=>e.check(Wi(t,r)),e.unwrap=()=>e.element});const il=ea("ZodObject",(e,t)=>{pi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def;a.type="object",a.properties={};const i=o.shape;for(const e in i)a.properties[e]=Ki(i[e],t,{...n,path:[...n.path,"properties",e]});const s=new Set(Object.keys(i)),c=new Set([...s].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(a.required=Array.from(c)),"never"===o.catchall?._zod.def.type?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=Ki(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),ua(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new dl({type:"enum",entries:r,...ka(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rl()}),e.loose=()=>e.clone({...e._zod.def,catchall:rl()}),e.strict=()=>e.clone({...e._zod.def,catchall:al()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ya(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=pa(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return fa(this,"shape",r),r}});return Sa(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!ya(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=pa(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return fa(this,"shape",r),r}});return Sa(e,r)}(e,t),e.merge=t=>function(e,t){const r=pa(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return fa(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Sa(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return Sa(e,pa(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return fa(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=pa(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return fa(this,"shape",n),n},checks:[]});return Sa(e,a)}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=pa(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)a[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return fa(this,"shape",a),a},checks:[]});return Sa(t,a)}(fl,e,t[0]),e.required=(...t)=>function(e,t,r){const n=pa(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)a[t]=new e({type:"nonoptional",innerType:n[t]});return fa(this,"shape",a),a}});return Sa(t,n)}(bl,e,t[0])});function sl(e,t){const r={type:"object",shape:e??{},...ka(t)};return new il(r)}const cl=ea("ZodUnion",(e,t)=>{hi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,i=a.options.map((e,r)=>Ki(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=i:r.anyOf=i})(e,t,r,n),e.options=t.options});const ll=ea("ZodIntersection",(e,t)=>{gi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ki(a.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ki(a.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(o)?o.allOf:[o],...s(i)?i.allOf:[i]];r.allOf=c})(e,t,r,n)});const dl=ea("ZodEnum",(e,t)=>{bi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=oa(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const a={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);a[n]=t.entries[n]}return new dl({...t,checks:[],...ka(n),entries:a})},e.exclude=(e,n)=>{const a={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new dl({...t,checks:[],...ka(n),entries:a})}});const ul=ea("ZodTransform",(e,t)=>{wi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ra(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Ta(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Ta(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const fl=ea("ZodOptional",(e,t)=>{Si.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Qi(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function pl(e){return new fl({type:"optional",innerType:e})}const ml=ea("ZodExactOptional",(e,t)=>{ki.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Qi(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const hl=ea("ZodNullable",(e,t)=>{Ei.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ki(a.innerType,t,n),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function gl(e){return new hl({type:"nullable",innerType:e})}const vl=ea("ZodDefault",(e,t)=>{Ai.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ki(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const yl=ea("ZodPrefault",(e,t)=>{Ci.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ki(a.innerType,t,n),t.seen.get(e).ref=a.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const bl=ea("ZodNonOptional",(e,t)=>{_i.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ki(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const wl=ea("ZodCatch",(e,t)=>{Ri.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;Ki(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const xl=ea("ZodPipe",(e,t)=>{Pi.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;Ki(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function Sl(e,t){return new xl({type:"pipe",in:e,out:t})}const kl=ea("ZodReadonly",(e,t)=>{Ii.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ki(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const El=ea("ZodCustom",(e,t)=>{Ui.init(e,t),Pc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});const Al=sl({name:Dc().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[a-zA-Z\s]*$/,"Name can only contain letters and spaces"),email:Dc().min(1,"Please enter your email address").email("Please enter a valid email address").max(100,"Email must be less than 100 characters").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"Please enter a valid email format (e.g., name@domain.com)")}),Nl={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}},Cl=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:c={},autoFocus:l=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,v]=f("en"),[y,b]=f(!1),[w,x]=f(!1),{submitBetaForm:S,isLoading:k,isSubmitting:E,error:A,config:N,success:C,message:_}=(()=>{const e=ir(e=>e.os),[t,r]=f(null),[n,a]=f(!0),[o,i]=f(!1),[s,c]=f(null),[l,p]=f(!1),[m,h]=f(null);return d(()=>{(async()=>{a(!0);const t=new lc(e),n=await t.fetchConfig();r(n),a(!1)})()},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:l,message:m,submitBetaForm:u(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),p(!1),h(null);const r=new lc(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{v((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Nl).indexOf(e)?e:"en"})())},[]),d(()=>{C&&p&&(b(!0),x(!0)),A&&x(!0)},[C,p,A]);const T={...Nl[s||g],...c},R=Zn({resolver:ns(Al),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{l&&R.setFocus("name")},[l,R]);const P=R.formState.isValid&&!E;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{className:Le("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",o),children:[t(cc,{className:"h-24 w-24 rounded-lg"}),t(cc,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(cc,{className:"h-4 w-16"}),t(cc,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(cc,{className:"h-4 w-16"}),t(cc,{className:"h-10 w-full"})]}),t(cc,{className:"h-10 w-full"})]})]}:{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[N?.logo&&t(Tl,{logo:N?.logo}),N?.name&&t("div",{children:N?.name})]}),t(nn,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await S(e);t.success?(n?.(),R.reset(),p&&b(!0),x(!0)):(a?.(t.message),x(!0))}catch(e){a?.(e instanceof Error?e.message:T.errorMessage),x(!0)}}),className:o,noValidate:!0,"aria-busy":E,children:[!w&&e(r,{children:[!h&&N?.screen?.register&&t(_l,{screen:N?.screen?.register}),t(Qs,{control:R.control,name:"name",render:({field:r})=>e(rc,{className:i,children:[t(nc,{children:T.nameLabel}),t(ac,{children:t(sc,{...r})}),t(oc,{}),t(ic,{})]})}),t(Qs,{control:R.control,name:"email",render:({field:r})=>e(rc,{className:i,children:[t(nc,{children:T.emailLabel}),t(ac,{children:t(sc,{...r})}),t(oc,{}),t(ic,{})]})}),t(Gs,{type:"submit",disabled:!P,className:i,children:E?T.submittingText:T.submitText})]}),w&&A&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),A]}),t("div",{className:"mt-4 flex justify-center",children:t(Gs,{type:"button",onClick:()=>{x(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&y&&_&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:N?.screen?.thankYou&&t(_l,{screen:N?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:N?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:N?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function _l({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function Tl({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function Rl(e,t){return function(){return e.apply(t,arguments)}}const{toString:Pl}=Object.prototype,{getPrototypeOf:Ol}=Object,{iterator:Il,toStringTag:Dl}=Symbol,Ul=(Ml=Object.create(null),e=>{const t=Pl.call(e);return Ml[t]||(Ml[t]=t.slice(8,-1).toLowerCase())});var Ml;const zl=e=>(e=e.toLowerCase(),t=>Ul(t)===e),Fl=e=>t=>typeof t===e,{isArray:Ll}=Array,jl=Fl("undefined");function $l(e){return null!==e&&!jl(e)&&null!==e.constructor&&!jl(e.constructor)&&Bl(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Vl=zl("ArrayBuffer");const Wl=Fl("string"),Bl=Fl("function"),Gl=Fl("number"),Hl=e=>null!==e&&"object"==typeof e,Kl=e=>{if("object"!==Ul(e))return!1;const t=Ol(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Dl in e||Il in e)},Zl=zl("Date"),Jl=zl("File"),ql=zl("Blob"),Yl=zl("FileList"),Xl=zl("URLSearchParams"),[Ql,ed,td,rd]=["ReadableStream","Request","Response","Headers"].map(zl);function nd(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Ll(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if($l(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function ad(e,t){if($l(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const od="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,id=e=>!jl(e)&&e!==od;const sd=(cd="undefined"!=typeof Uint8Array&&Ol(Uint8Array),e=>cd&&e instanceof cd);var cd;const ld=zl("HTMLFormElement"),dd=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ud=zl("RegExp"),fd=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};nd(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const pd=zl("AsyncFunction"),md=(hd="function"==typeof setImmediate,gd=Bl(od.postMessage),hd?setImmediate:gd?(vd=`axios@${Math.random()}`,yd=[],od.addEventListener("message",({source:e,data:t})=>{e===od&&t===vd&&yd.length&&yd.shift()()},!1),e=>{yd.push(e),od.postMessage(vd,"*")}):e=>setTimeout(e));var hd,gd,vd,yd;const bd="undefined"!=typeof queueMicrotask?queueMicrotask.bind(od):"undefined"!=typeof process&&process.nextTick||md;var wd={isArray:Ll,isArrayBuffer:Vl,isBuffer:$l,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Bl(e.append)&&("formdata"===(t=Ul(e))||"object"===t&&Bl(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Vl(e.buffer),t},isString:Wl,isNumber:Gl,isBoolean:e=>!0===e||!1===e,isObject:Hl,isPlainObject:Kl,isEmptyObject:e=>{if(!Hl(e)||$l(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ql,isRequest:ed,isResponse:td,isHeaders:rd,isUndefined:jl,isDate:Zl,isFile:Jl,isBlob:ql,isRegExp:ud,isFunction:Bl,isStream:e=>Hl(e)&&Bl(e.pipe),isURLSearchParams:Xl,isTypedArray:sd,isFileList:Yl,forEach:nd,merge:function e(){const{caseless:t,skipUndefined:r}=id(this)&&this||{},n={},a=(a,o)=>{const i=t&&ad(n,o)||o;Kl(n[i])&&Kl(a)?n[i]=e(n[i],a):Kl(a)?n[i]=e({},a):Ll(a)?n[i]=a.slice():r&&jl(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&nd(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(nd(t,(t,n)=>{r&&Bl(t)?Object.defineProperty(e,n,{value:Rl(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Ol(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Ul,kindOfTest:zl,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Ll(e))return e;let t=e.length;if(!Gl(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Il]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:ld,hasOwnProperty:dd,hasOwnProp:dd,reduceDescriptors:fd,freezeMethods:e=>{fd(e,(t,r)=>{if(Bl(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Bl(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return Ll(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ad,global:od,isContextDefined:id,isSpecCompliantForm:function(e){return!!(e&&Bl(e.append)&&"FormData"===e[Dl]&&e[Il])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Hl(e)){if(t.indexOf(e)>=0)return;if($l(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Ll(e)?[]:{};return nd(e,(e,t)=>{const o=r(e,n+1);!jl(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:pd,isThenable:e=>e&&(Hl(e)||Bl(e))&&Bl(e.then)&&Bl(e.catch),setImmediate:md,asap:bd,isIterable:e=>null!=e&&Bl(e[Il])};let xd=class e extends Error{static from(t,r,n,a,o,i){const s=new e(t.message,r||t.code,n,a,o);return s.cause=t,s.name=t.name,i&&Object.assign(s,i),s}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:wd.toJSONObject(this.config),code:this.code,status:this.status}}};xd.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",xd.ERR_BAD_OPTION="ERR_BAD_OPTION",xd.ECONNABORTED="ECONNABORTED",xd.ETIMEDOUT="ETIMEDOUT",xd.ERR_NETWORK="ERR_NETWORK",xd.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",xd.ERR_DEPRECATED="ERR_DEPRECATED",xd.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",xd.ERR_BAD_REQUEST="ERR_BAD_REQUEST",xd.ERR_CANCELED="ERR_CANCELED",xd.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",xd.ERR_INVALID_URL="ERR_INVALID_URL";function Sd(e){return wd.isPlainObject(e)||wd.isArray(e)}function kd(e){return wd.endsWith(e,"[]")?e.slice(0,-2):e}function Ed(e,t,r){return e?e.concat(t).map(function(e,t){return e=kd(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Ad=wd.toFlatObject(wd,{},null,function(e){return/^is[A-Z]/.test(e)});function Nd(e,t,r){if(!wd.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=wd.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!wd.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&wd.isSpecCompliantForm(t);if(!wd.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(wd.isDate(e))return e.toISOString();if(wd.isBoolean(e))return e.toString();if(!s&&wd.isBlob(e))throw new xd("Blob is not supported. Use a Buffer instead.");return wd.isArrayBuffer(e)||wd.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(wd.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(wd.isArray(e)&&function(e){return wd.isArray(e)&&!e.some(Sd)}(e)||(wd.isFileList(e)||wd.endsWith(r,"[]"))&&(s=wd.toArray(e)))return r=kd(r),s.forEach(function(e,n){!wd.isUndefined(e)&&null!==e&&t.append(!0===i?Ed([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!Sd(e)||(t.append(Ed(a,r,o),c(e)),!1)}const d=[],u=Object.assign(Ad,{defaultVisitor:l,convertValue:c,isVisitable:Sd});if(!wd.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!wd.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),wd.forEach(r,function(r,o){!0===(!(wd.isUndefined(r)||null===r)&&a.call(t,r,wd.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Cd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function _d(e,t){this._pairs=[],e&&Nd(e,this,t)}const Td=_d.prototype;function Rd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Pd(e,t,r){if(!t)return e;const n=r&&r.encode||Rd,a=wd.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let i;if(i=o?o(t,a):wd.isURLSearchParams(t)?t.toString():new _d(t,a).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Td.append=function(e,t){this._pairs.push([e,t])},Td.toString=function(e){const t=e?function(t){return e.call(this,t,Cd)}:Cd;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Od{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){wd.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Id={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Dd={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:_d,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Ud="undefined"!=typeof window&&"undefined"!=typeof document,Md="object"==typeof navigator&&navigator||void 0,zd=Ud&&(!Md||["ReactNative","NativeScript","NS"].indexOf(Md.product)<0),Fd="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ld=Ud&&window.location.href||"http://localhost";var jd={...Object.freeze({__proto__:null,hasBrowserEnv:Ud,hasStandardBrowserEnv:zd,hasStandardBrowserWebWorkerEnv:Fd,navigator:Md,origin:Ld}),...Dd};function $d(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&wd.isArray(n)?n.length:o,s)return wd.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&wd.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&wd.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(wd.isFormData(e)&&wd.isFunction(e.entries)){const r={};return wd.forEachEntry(e,(e,n)=>{t(function(e){return wd.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Vd={transitional:Id,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=wd.isObject(e);a&&wd.isHTMLForm(e)&&(e=new FormData(e));if(wd.isFormData(e))return n?JSON.stringify($d(e)):e;if(wd.isArrayBuffer(e)||wd.isBuffer(e)||wd.isStream(e)||wd.isFile(e)||wd.isBlob(e)||wd.isReadableStream(e))return e;if(wd.isArrayBufferView(e))return e.buffer;if(wd.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Nd(e,new jd.classes.URLSearchParams,{visitor:function(e,t,r,n){return jd.isNode&&wd.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=wd.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Nd(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(wd.isString(e))try{return(t||JSON.parse)(e),wd.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Vd.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(wd.isResponse(e)||wd.isReadableStream(e))return e;if(e&&wd.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw xd.from(e,xd.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jd.classes.FormData,Blob:jd.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};wd.forEach(["delete","get","head","post","put","patch"],e=>{Vd.headers[e]={}});const Wd=wd.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Bd=Symbol("internals");function Gd(e){return e&&String(e).trim().toLowerCase()}function Hd(e){return!1===e||null==e?e:wd.isArray(e)?e.map(Hd):String(e)}function Kd(e,t,r,n,a){return wd.isFunction(n)?n.call(this,t,r):(a&&(t=r),wd.isString(t)?wd.isString(n)?-1!==t.indexOf(n):wd.isRegExp(n)?n.test(t):void 0:void 0)}let Zd=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=Gd(t);if(!a)throw new Error("header name must be a non-empty string");const o=wd.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Hd(e))}const o=(e,t)=>wd.forEach(e,(e,r)=>a(e,r,t));if(wd.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(wd.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&Wd[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(wd.isObject(e)&&wd.isIterable(e)){let r,n,a={};for(const t of e){if(!wd.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?wd.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=Gd(e)){const r=wd.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(wd.isFunction(t))return t.call(this,e,r);if(wd.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Gd(e)){const r=wd.findKey(this,e);return!(!r||void 0===this[r]||t&&!Kd(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=Gd(e)){const a=wd.findKey(r,e);!a||t&&!Kd(0,r[a],a,t)||(delete r[a],n=!0)}}return wd.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!Kd(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return wd.forEach(this,(n,a)=>{const o=wd.findKey(r,a);if(o)return t[o]=Hd(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=Hd(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return wd.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&wd.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Bd]=this[Bd]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Gd(e);t[n]||(!function(e,t){const r=wd.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return wd.isArray(e)?e.forEach(n):n(e),this}};function Jd(e,t){const r=this||Vd,n=t||r,a=Zd.from(n.headers);let o=n.data;return wd.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function qd(e){return!(!e||!e.__CANCEL__)}Zd.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),wd.reduceDescriptors(Zd.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),wd.freezeMethods(Zd);let Yd=class extends xd{constructor(e,t,r){super(null==e?"canceled":e,xd.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Xd(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new xd("Request failed with status code "+r.status,[xd.ERR_BAD_REQUEST,xd.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Qd=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=n[i];a||(a=c),r[o]=s,n[o]=c;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,c=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},eu=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},tu=e=>(...t)=>wd.asap(()=>e(...t));var ru=jd.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,jd.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(jd.origin),jd.navigator&&/(msie|trident)/i.test(jd.navigator.userAgent)):()=>!0,nu=jd.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];wd.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),wd.isString(n)&&s.push(`path=${n}`),wd.isString(a)&&s.push(`domain=${a}`),!0===o&&s.push("secure"),wd.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function au(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const ou=e=>e instanceof Zd?{...e}:e;function iu(e,t){t=t||{};const r={};function n(e,t,r,n){return wd.isPlainObject(e)&&wd.isPlainObject(t)?wd.merge.call({caseless:n},e,t):wd.isPlainObject(t)?wd.merge({},t):wd.isArray(t)?t.slice():t}function a(e,t,r,a){return wd.isUndefined(t)?wd.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!wd.isUndefined(t))return n(void 0,t)}function i(e,t){return wd.isUndefined(t)?wd.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(ou(e),ou(t),0,!0)};return wd.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,i=o(e[n],t[n],n);wd.isUndefined(i)&&o!==s||(r[n]=i)}),r}var su=e=>{const t=iu({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=Zd.from(i),t.url=Pd(au(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),wd.isFormData(r))if(jd.hasStandardBrowserEnv||jd.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(wd.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(jd.hasStandardBrowserEnv&&(n&&wd.isFunction(n)&&(n=n(t)),n||!1!==n&&ru(t.url))){const e=a&&o&&nu.read(o);e&&i.set(a,e)}return t};var cu="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=su(e);let a=n.data;const o=Zd.from(n.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Zd.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Xd(function(e){t(e),m()},function(e){r(e),m()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new xd("Request aborted",xd.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new xd(n,xd.ERR_NETWORK,e,h);a.event=t||null,r(a),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||Id;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new xd(t,a.clarifyTimeoutError?xd.ETIMEDOUT:xd.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&wd.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),wd.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=Qd(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([s,l]=Qd(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new Yd(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===jd.protocols.indexOf(v)?r(new xd("Unsupported protocol "+v+":",xd.ERR_BAD_REQUEST,e)):h.send(a||null)})};const lu=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof xd?t:new Yd(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new xd(`timeout of ${t}ms exceeded`,xd.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>wd.asap(i),s}},du=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},uu=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},fu=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of uu(e))yield*du(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:pu}=wd,mu=(({Request:e,Response:t})=>({Request:e,Response:t}))(wd.global),{ReadableStream:hu,TextEncoder:gu}=wd.global,vu=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},yu=e=>{e=wd.merge.call({skipUndefined:!0},mu,e);const{fetch:t,Request:r,Response:n}=e,a=t?pu(t):"function"==typeof fetch,o=pu(r),i=pu(n);if(!a)return!1;const s=a&&pu(hu),c=a&&("function"==typeof gu?(l=new gu,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&s&&vu(()=>{let e=!1;const t=new r(jd.origin,{body:new hu,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&vu(()=>wd.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new xd(`Response type '${e}' is not supported`,xd.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=wd.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(wd.isBlob(e))return e.size;if(wd.isSpecCompliantForm(e)){const t=new r(jd.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return wd.isArrayBufferView(e)||wd.isArrayBuffer(e)?e.byteLength:(wd.isURLSearchParams(e)&&(e+=""),wd.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:y,withCredentials:b="same-origin",fetchOptions:w}=su(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let S=lu([c,l&&l.toAbortSignal()],m),k=null;const E=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let A;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(A=await p(y,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(wd.isFormData(s)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=eu(A,Qd(tu(g)));s=fu(t.body,65536,e,r)}}wd.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:S,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};k=o&&new r(a,c);let l=await(o?x(k,w):x(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=wd.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&eu(t,Qd(tu(h),!0))||[];l=new n(fu(l.body,65536,r,()=>{a&&a(),E&&E()}),e)}v=v||"text";let N=await f[wd.findKey(f,v)||"text"](l,e);return!m&&E&&E(),await new Promise((t,r)=>{Xd(t,r,{data:N,headers:Zd.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new xd("Network Error",xd.ERR_NETWORK,e,k),{cause:t.cause||t});throw xd.from(t,t&&t.code,e,k)}}},bu=new Map,wu=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,c=o.length,l=bu;for(;c--;)i=o[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:yu(t)),l=s;return s};wu();const xu={http:null,xhr:cu,fetch:{get:wu}};wd.forEach(xu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Su=e=>`- ${e}`,ku=e=>wd.isFunction(e)||null===e||!1===e;var Eu={getAdapter:function(e,t){e=wd.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!ku(n)&&(a=xu[(r=String(n)).toLowerCase()],void 0===a))throw new xd(`Unknown adapter '${r}'`);if(a&&(wd.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(Su).join("\n"):" "+Su(e[0]):"as no adapter specified";throw new xd("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:xu};function Au(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yd(null,e)}function Nu(e){Au(e),e.headers=Zd.from(e.headers),e.data=Jd.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Eu.getAdapter(e.adapter||Vd.adapter,e)(e).then(function(t){return Au(e),t.data=Jd.call(e,e.transformResponse,t),t.headers=Zd.from(t.headers),t},function(t){return qd(t)||(Au(e),t&&t.response&&(t.response.data=Jd.call(e,e.transformResponse,t.response),t.response.headers=Zd.from(t.response.headers))),Promise.reject(t)})}const Cu="1.13.4",_u={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{_u[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Tu={};_u.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Cu+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new xd(n(a," has been removed"+(t?" in "+t:"")),xd.ERR_DEPRECATED);return t&&!Tu[a]&&(Tu[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},_u.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Ru={assertOptions:function(e,t,r){if("object"!=typeof e)throw new xd("options must be an object",xd.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new xd("option "+o+" must be "+r,xd.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new xd("Unknown option "+o,xd.ERR_BAD_OPTION)}},validators:_u};const Pu=Ru.validators;let Ou=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Od,response:new Od}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=iu(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Ru.assertOptions(r,{silentJSONParsing:Pu.transitional(Pu.boolean),forcedJSONParsing:Pu.transitional(Pu.boolean),clarifyTimeoutError:Pu.transitional(Pu.boolean)},!1),null!=n&&(wd.isFunction(n)?t.paramsSerializer={serialize:n}:Ru.assertOptions(n,{encode:Pu.function,serialize:Pu.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ru.assertOptions(t,{baseUrl:Pu.spelling("baseURL"),withXsrfToken:Pu.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&wd.merge(a.common,a[t.method]);a&&wd.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=Zd.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[Nu.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=Nu.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return Pd(au((e=iu(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};wd.forEach(["delete","get","head","options"],function(e){Ou.prototype[e]=function(t,r){return this.request(iu(r||{},{method:e,url:t,data:(r||{}).data}))}}),wd.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(iu(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ou.prototype[e]=t(),Ou.prototype[e+"Form"]=t(!0)});const Iu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Iu).forEach(([e,t])=>{Iu[t]=e});const Du=function e(t){const r=new Ou(t),n=Rl(Ou.prototype.request,r);return wd.extend(n,Ou.prototype,r,{allOwnKeys:!0}),wd.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(iu(t,r))},n}(Vd);Du.Axios=Ou,Du.CanceledError=Yd,Du.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new Yd(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Du.isCancel=qd,Du.VERSION=Cu,Du.toFormData=Nd,Du.AxiosError=xd,Du.Cancel=Du.CanceledError,Du.all=function(e){return Promise.all(e)},Du.spread=function(e){return function(t){return e.apply(null,t)}},Du.isAxiosError=function(e){return wd.isObject(e)&&!0===e.isAxiosError},Du.mergeConfig=iu,Du.AxiosHeaders=Zd,Du.formToJSON=e=>$d(wd.isHTMLForm(e)?new FormData(e):e),Du.getAdapter=Eu.getAdapter,Du.HttpStatusCode=Iu,Du.default=Du;const{Axios:Uu,AxiosError:Mu,CanceledError:zu,isCancel:Fu,CancelToken:Lu,VERSION:ju,all:$u,Cancel:Vu,isAxiosError:Wu,spread:Bu,toFormData:Gu,AxiosHeaders:Hu,HttpStatusCode:Ku,formToJSON:Zu,getAdapter:Ju,mergeConfig:qu}=Du;const Yu=new class{constructor(e={}){this.client=Du.create({baseURL:e.baseURL||"https://api.example.com",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=yt();return t&&(e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const r=await this.client.get(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async post(e,t,r){const n=await this.client.post(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async put(e,t,r){const n=await this.client.put(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async delete(e,t){const r=await this.client.delete(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async patch(e,t,r){const n=await this.client.patch(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}setBaseURL(e){this.client.defaults.baseURL=e}setHeader(e,t){this.client.defaults.headers.common[e]=t}removeHeader(e){delete this.client.defaults.headers.common[e]}};function Xu(){const e=sr(),t=ir(e=>e.auth),r=ir(e=>e.os),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:c}=vr(),l=u(async()=>{e.auth(Qe());try{const t=await Yu.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(tt()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(tt()),qe(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),d=u(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth(nt()),i(),vt()}catch(e){qe(e,{component:"useSaaSAuth",action:"signOut"}),vt()}},[e,i,o?.callbacks?.onSignOut]),f=u(e=>{c?yr.openWorkspaceSettings(e):qe(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[c]),p=s(()=>lt(t.status),[t.status]);return s(()=>({user:t.session?.user,session:t.session,status:t.status,...p,signIn:l,signOut:d,openWorkspaceSettings:f}),[t.session,t.status,p,l,d,f])}const Qu=e=>{const{children:t}=e,{status:r}=Xu();return r!==ct.authenticated?null:t},ef=e=>{const{children:t}=e,{status:r}=Xu();return r===ct.authenticated?null:t},tf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Xu();return n.includes(a?.role??"")?t:r||null},rf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Xu(),{currentWorkspace:o}=vr(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function nf(){const e=v(mr);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function af(){const e=v(mr);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}const of=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=vr(),a=n?.features?.[r];return a?t:null},sf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=vr(),a=n?.features?.[r];return a?null:t},cf=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=af();return n(r)?t:null},lf=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=af();return n(r)?null:t};function df(){const e=sr(),t=ir(e=>e.os),{serverUrl:r,version:n,orgId:a,settings:o}=t,c=i(!1),l=u(async t=>{if(c.current)return o||null;if(o)return o;if(!r||!n||!a)return null;c.current=!0;try{const o=bt(),i=await Be(`${r}/api/${n}/public/${a}/settings`,{headers:o,signal:t});if(!i.ok)throw new Error("Failed to fetch settings");const s=await i.json();return e.os(Rt(s)),s}catch(e){return Ye(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:r,version:n,orgId:a}}),null}finally{c.current=!1}},[r,n,a,o,e]);return cr(async e=>{r&&n&&a&&!o&&!c.current&&await l(e)},[r,n,a,l],{onError:e=>Ye(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:r,version:n,orgId:a}})}),s(()=>({settings:o,getSettings:l}),[o,l])}function uf(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function ff(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}var pf,mf=globalThis?.document?n.useLayoutEffect:()=>{},hf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=ds(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),gf={exports:{}},vf={};function yf(){if(pf)return vf;pf=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),c=r({inst:{value:a,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=a,l.getSnapshot=t,s(l)&&d({inst:l})},[e,a,t]),n(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(a),a};return vf.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,vf}var bf,wf,xf={};
|
|
27
21
|
/**
|
|
28
22
|
* @license React
|
|
29
23
|
* use-sync-external-store-shim.development.js
|
|
@@ -32,5 +26,5 @@ var ko={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
|
|
|
32
26
|
*
|
|
33
27
|
* This source code is licensed under the MIT license found in the
|
|
34
28
|
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/function _s(){return As||(As=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){c||void 0===t.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};Cs.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Cs}function Ts(){return Ns||(Ns=1,"production"===process.env.NODE_ENV?Ss.exports=Es():Ss.exports=_s()),Ss.exports}var Rs=Ts();function Ps(){return()=>{}}var Os="Avatar",[Is]=function(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o);i.displayName=r+"Context";const s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},is(o,...r)]}(Os),[Ds,Us]=Is(Os),Ms=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(Ds,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(xs.span,{...o,ref:r})})});Ms.displayName=Os;var zs="AvatarImage",Fs=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,c=Us(zs,a),l=function(e,{referrerPolicy:t,crossOrigin:r}){const a=Rs.useSyncExternalStore(Ps,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,c]=n.useState(()=>$s(i,e));return cs(()=>{c($s(i,e))},[i,e]),cs(()=>{const e=e=>()=>{c(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=ss(e=>{i(e),c.onImageLoadingStatusChange(e)});return cs(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?t(xs.img,{...s,ref:r,src:o}):null});Fs.displayName=zs;var Ls="AvatarFallback",js=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=Us(Ls,a),[c,l]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==s.imageLoadingStatus?t(xs.span,{...i,ref:r}):null});function $s(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}js.displayName=Ls;var Vs=Ms,Bs=Fs,Ws=js;function Gs(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Gs(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Hs(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Gs(e))&&(n&&(n+=" "),n+=t);return n}const Ks=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Zs="-",Js=[],qs=e=>{const t=Qs(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Xs(e);const r=e.split(Zs),n=""===r[0]&&r.length>1?1:0;return Ys(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||Js}return r[e]||Js}}},Ys=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=Ys(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const i=0===t?e.join(Zs):e.slice(t).join(Zs),s=o.length;for(let e=0;e<s;e++){const t=o[e];if(t.validator(i))return t.classGroupId}},Xs=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),Qs=e=>{const{theme:t,classGroups:r}=e;return ec(r,t)},ec=(e,t)=>{const r=Ks();for(const n in e){const a=e[n];tc(a,r,n,t)}return r},tc=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];rc(a,t,r,n)}},rc=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?oc(e,t,r,n):ac(e,t,r,n):nc(e,t,r)},nc=(e,t,r)=>{(""===e?t:ic(t,e)).classGroupId=r},ac=(e,t,r,n)=>{sc(e)?tc(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},oc=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,i]=a[e];tc(i,ic(t,o),r,n)}},ic=(e,t)=>{let r=e;const n=t.split(Zs),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=Ks(),r.nextPart.set(t,a)),r=a}return r},sc=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,cc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},lc=[],dc=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),uc=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const i=e.length;for(let s=0;s<i;s++){const i=e[s];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,s)),o=s+1;continue}if("/"===i){r=s;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.slice(o);let c=s,l=!1;s.endsWith("!")?(c=s.slice(0,-1),l=!0):s.startsWith("!")&&(c=s.slice(1),l=!0);return dc(t,l,c,r&&r>o?r-o:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):dc(lc,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},fc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},pc=/\s+/,mc=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=mc(e[n]))&&(r&&(r+=" "),r+=t);return r},hc=(e,...t)=>{let r,n,a,o;const i=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(pc);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:o(d).join(":"),v=u?g+"!":g,y=v+h;if(i.indexOf(y)>-1)continue;i.push(y);const b=a(h,m);for(let e=0;e<b.length;++e){const t=b[e];i.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:cc(e.cacheSize),parseClassName:uc(e),sortModifiers:fc(e),...qs(e)}))(c),n=r.cache.get,a=r.cache.set,o=i,i(s)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=mc(t))&&(a&&(a+=" "),a+=r);return a})(...e))},gc=[],vc=e=>{const t=t=>t[e]||gc;return t.isThemeGetter=!0,t},yc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wc=/^\d+\/\d+$/,xc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sc=/\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$/,kc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ec=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ac=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nc=e=>wc.test(e),Cc=e=>!!e&&!Number.isNaN(Number(e)),_c=e=>!!e&&Number.isInteger(Number(e)),Tc=e=>e.endsWith("%")&&Cc(e.slice(0,-1)),Rc=e=>xc.test(e),Pc=()=>!0,Oc=e=>Sc.test(e)&&!kc.test(e),Ic=()=>!1,Dc=e=>Ec.test(e),Uc=e=>Ac.test(e),Mc=e=>!Fc(e)&&!Wc(e),zc=e=>Yc(e,tl,Ic),Fc=e=>yc.test(e),Lc=e=>Yc(e,rl,Oc),jc=e=>Yc(e,nl,Cc),$c=e=>Yc(e,Qc,Ic),Vc=e=>Yc(e,el,Uc),Bc=e=>Yc(e,ol,Dc),Wc=e=>bc.test(e),Gc=e=>Xc(e,rl),Hc=e=>Xc(e,al),Kc=e=>Xc(e,Qc),Zc=e=>Xc(e,tl),Jc=e=>Xc(e,el),qc=e=>Xc(e,ol,!0),Yc=(e,t,r)=>{const n=yc.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Xc=(e,t,r=!1)=>{const n=bc.exec(e);return!!n&&(n[1]?t(n[1]):r)},Qc=e=>"position"===e||"percentage"===e,el=e=>"image"===e||"url"===e,tl=e=>"length"===e||"size"===e||"bg-size"===e,rl=e=>"length"===e,nl=e=>"number"===e,al=e=>"family-name"===e,ol=e=>"shadow"===e,il=hc(()=>{const e=vc("color"),t=vc("font"),r=vc("text"),n=vc("font-weight"),a=vc("tracking"),o=vc("leading"),i=vc("breakpoint"),s=vc("container"),c=vc("spacing"),l=vc("radius"),d=vc("shadow"),u=vc("inset-shadow"),f=vc("text-shadow"),p=vc("drop-shadow"),m=vc("blur"),h=vc("perspective"),g=vc("aspect"),v=vc("ease"),y=vc("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Wc,Fc],w=()=>[Wc,Fc,c],x=()=>[Nc,"full","auto",...w()],S=()=>[_c,"none","subgrid",Wc,Fc],k=()=>["auto",{span:["full",_c,Wc,Fc]},_c,Wc,Fc],E=()=>[_c,"auto",Wc,Fc],A=()=>["auto","min","max","fr",Wc,Fc],N=()=>["auto",...w()],C=()=>[Nc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],_=()=>[e,Wc,Fc],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Kc,$c,{position:[Wc,Fc]}],R=()=>["auto","cover","contain",Zc,zc,{size:[Wc,Fc]}],P=()=>[Tc,Gc,Lc],O=()=>["","none","full",l,Wc,Fc],I=()=>["",Cc,Gc,Lc],D=()=>[Cc,Tc,Kc,$c],U=()=>["","none",m,Wc,Fc],M=()=>["none",Cc,Wc,Fc],z=()=>["none",Cc,Wc,Fc],F=()=>[Cc,Wc,Fc],L=()=>[Nc,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Rc],breakpoint:[Rc],color:[Pc],container:[Rc],"drop-shadow":[Rc],ease:["in","out","in-out"],font:[Mc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Rc],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Rc],shadow:[Rc],spacing:["px",Cc],text:[Rc],"text-shadow":[Rc],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nc,Fc,Wc,g]}],container:["container"],columns:[{columns:[Cc,Fc,Wc,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"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:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[_c,"auto",Wc,Fc]}],basis:[{basis:[Nc,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Cc,Nc,"auto","initial","none",Fc]}],grow:[{grow:["",Cc,Wc,Fc]}],shrink:[{shrink:["",Cc,Wc,Fc]}],order:[{order:[_c,"first","last","none",Wc,Fc]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],w:[{w:[s,"screen",...C()]}],"min-w":[{"min-w":[s,"screen","none",...C()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",r,Gc,Lc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Wc,jc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Tc,Fc]}],"font-family":[{font:[Hc,Fc,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:[a,Wc,Fc]}],"line-clamp":[{"line-clamp":[Cc,"none",Wc,jc]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",Wc,Fc]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Wc,Fc]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Cc,"from-font","auto",Wc,Lc]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[Cc,"auto",Wc,Fc]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Wc,Fc]}],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",Wc,Fc]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_c,Wc,Fc],radial:["",Wc,Fc],conic:[_c,Wc,Fc]},Jc,Vc]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Cc,Wc,Fc]}],"outline-w":[{outline:["",Cc,Gc,Lc]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,qc,Bc]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,qc,Bc]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[Cc,Lc]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,qc,Bc]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[Cc,Wc,Fc]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"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":[Cc]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[Wc,Fc]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Cc]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Wc,Fc]}],filter:[{filter:["","none",Wc,Fc]}],blur:[{blur:U()}],brightness:[{brightness:[Cc,Wc,Fc]}],contrast:[{contrast:[Cc,Wc,Fc]}],"drop-shadow":[{"drop-shadow":["","none",p,qc,Bc]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",Cc,Wc,Fc]}],"hue-rotate":[{"hue-rotate":[Cc,Wc,Fc]}],invert:[{invert:["",Cc,Wc,Fc]}],saturate:[{saturate:[Cc,Wc,Fc]}],sepia:[{sepia:["",Cc,Wc,Fc]}],"backdrop-filter":[{"backdrop-filter":["","none",Wc,Fc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Cc,Wc,Fc]}],"backdrop-contrast":[{"backdrop-contrast":[Cc,Wc,Fc]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Cc,Wc,Fc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Cc,Wc,Fc]}],"backdrop-invert":[{"backdrop-invert":["",Cc,Wc,Fc]}],"backdrop-opacity":[{"backdrop-opacity":[Cc,Wc,Fc]}],"backdrop-saturate":[{"backdrop-saturate":[Cc,Wc,Fc]}],"backdrop-sepia":[{"backdrop-sepia":["",Cc,Wc,Fc]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Wc,Fc]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Cc,"initial",Wc,Fc]}],ease:[{ease:["linear","initial",v,Wc,Fc]}],delay:[{delay:[Cc,Wc,Fc]}],animate:[{animate:["none",y,Wc,Fc]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Wc,Fc]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:M()}],"rotate-x":[{"rotate-x":M()}],"rotate-y":[{"rotate-y":M()}],"rotate-z":[{"rotate-z":M()}],scale:[{scale:z()}],"scale-x":[{"scale-x":z()}],"scale-y":[{"scale-y":z()}],"scale-z":[{"scale-z":z()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Wc,Fc,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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",Wc,Fc]}],"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":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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",Wc,Fc]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[Cc,Gc,Lc,jc]}],stroke:[{stroke:["none",..._()]}],"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"]}});function sl(...e){return il(Hs(e))}const cl=n.forwardRef(({className:e,...r},n)=>t(Vs,{ref:n,className:sl("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));cl.displayName=Vs.displayName;const ll=n.forwardRef(({className:e,...r},n)=>t(Bs,{ref:n,className:sl("aspect-square h-full w-full",e),...r}));ll.displayName=Bs.displayName;const dl=n.forwardRef(({className:e,...r},n)=>t(Ws,{ref:n,className:sl("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));dl.displayName=Ws.displayName;const ul=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,fl=Hs,pl=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return fl(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=ul(t)||ul(n);return a[e][i]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return fl(e,i,c,null==r?void 0:r.class,null==r?void 0:r.className)},ml=pl("inline-flex items-center justify-center rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"underline-offset-4 hover:underline text-primary"},withIcon:{true:"flex"},fullWidth:{true:"w-full"},size:{default:"h-9 py-2 px-4 text-sm",sm:"h-8 px-3 text-xs",lg:"h-10 px-6 text-base",icon:"h-9 w-9"}},compoundVariants:[{size:"lg",withIcon:!0,className:"gap-x-1.5"},{size:"default",withIcon:!0,className:"gap-x-1"},{size:"sm",withIcon:!0,className:"gap-x-0.5"}],defaultVariants:{variant:"default",size:"default"}}),hl=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?gs:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:sl(ml({variant:a,size:i,withIcon:null!=o||null!=s||null!=c,className:r})),ref:u,...d,children:[o&&t(Io,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,c&&n.cloneElement(c,{size:p})]})});function gl(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function vl(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},yl(o,...r)]}function yl(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}hl.displayName="Button";var bl=n[" useId ".trim().toString()]||(()=>{}),wl=0;function xl(e){const[t,r]=n.useState(bl());return cs(()=>{r(e=>e??String(wl++))},[e]),e||(t?`radix-${t}`:"")}var Sl=n[" useInsertionEffect ".trim().toString()]||cs;function kl({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return Sl(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${a} is changing from ${t} to ${r}. 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.`)}t.current=c},[c,a])}const d=n.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[c,e,i,s]);return[l,d]}function El(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ds(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Al=Symbol("radix.slottable");function Nl(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Al}var Cl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=function(e){const r=El(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Nl);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var _l,Tl="dismissableLayer.update",Rl="dismissableLayer.pointerDownOutside",Pl="dismissableLayer.focusOutside",Ol=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Il=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=e,u=n.useContext(Ol),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=us(r,e=>p(e)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=b,k=function(e,t=globalThis?.document){const r=ss(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){Ul(Rl,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},m),E=function(e,t=globalThis?.document){const r=ss(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){Ul(Pl,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=ss(e);n.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(_l=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Dl(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=_l)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Dl())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(Tl,e),()=>document.removeEventListener(Tl,e)},[]),t(Cl.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:gl(e.onFocusCapture,E.onFocusCapture),onBlurCapture:gl(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:gl(e.onPointerDownCapture,k.onPointerDownCapture)})});Il.displayName="DismissableLayer";function Dl(){const e=new CustomEvent(Tl);document.dispatchEvent(e)}function Ul(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&b.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(Ol),o=n.useRef(null),i=us(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(Cl.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var Ml="focusScope.autoFocusOnMount",zl="focusScope.autoFocusOnUnmount",Fl={bubbles:!1,cancelable:!0},Ll=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=e,[l,d]=n.useState(null),u=ss(i),f=ss(s),p=n.useRef(null),m=us(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:Bl(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Bl(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Bl(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[o,l,h.paused]),n.useEffect(()=>{if(l){Wl.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Ml,Fl);l.addEventListener(Ml,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Bl(n,{select:t}),document.activeElement!==r)return}((e=jl(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Bl(l))}return()=>{l.removeEventListener(Ml,u),setTimeout(()=>{const e=new CustomEvent(zl,Fl);l.addEventListener(zl,f),l.dispatchEvent(e),e.defaultPrevented||Bl(t??document.body,{select:!0}),l.removeEventListener(zl,f),Wl.remove(h)},0)}}var e},[l,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[n,o]=function(e){const t=jl(e),r=$l(t,e),n=$l(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&Bl(o,{select:!0})):(e.preventDefault(),a&&Bl(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(Cl.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function jl(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function $l(e,t){for(const r of e)if(!Vl(r,{upTo:t}))return r}function Vl(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Bl(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Ll.displayName="FocusScope";var Wl=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Gl(e,t),e.unshift(t)},remove(t){e=Gl(e,t),e[0]?.resume()}}}();function Gl(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Hl=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);cs(()=>s(!0),[]);const c=a||i&&globalThis?.document?.body;return c?w.createPortal(t(Cl.div,{...o,ref:r}),c):null});Hl.displayName="Portal";var Kl=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=Zl(a.current);i.current="mounted"===c?e:"none"},[c]),cs(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=Zl(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),cs(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=Zl(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(l("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=Zl(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=us(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function Zl(e){return e?.animationName||"none"}Kl.displayName="Presence";var Jl=0;function ql(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Yl()),document.body.insertAdjacentElement("beforeend",e[1]??Yl()),Jl++,()=>{1===Jl&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Jl--}},[])}function Yl(){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 Xl=function(){return Xl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Xl.apply(this,arguments)};function Ql(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var ed="right-scroll-bar-position",td="width-before-scroll-bar";function rd(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var nd="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,ad=new WeakMap;function od(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return rd(e,t)})},(a=u(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return nd(function(){var t=ad.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||rd(e,null)}),n.forEach(function(e){r.has(e)||rd(e,a)})}ad.set(o,e)},[e]),o}function id(e){return e}var sd=function(e){var t=e.sideCar,r=Ql(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,Xl({},r))};sd.isSideCarExport=!0;var cd=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=id);var r=[],n=!1;return{read:function(){if(n)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(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Xl({async:!0,ssr:!1},e),t}(),ld=function(){},dd=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:ld,onWheelCapture:ld,onTouchMoveCapture:ld}),o=a[0],i=a[1],s=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,v=e.allowPinchZoom,y=e.as,b=void 0===y?"div":y,w=e.gapMode,x=Ql(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=od([r,t]),E=Xl(Xl({},x),o);return n.createElement(n.Fragment,null,u&&n.createElement(S,{sideCar:cd,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(c),Xl(Xl({},E),{ref:k})):n.createElement(b,Xl({},E,{className:l,ref:k}),c))});dd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dd.classNames={fullWidth:td,zeroRight:ed};function ud(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var fd=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=ud())&&(a=r,(n=t).styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},pd=function(){var e,t=(e=fd(),function(t,r){n.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},md={left:0,top:0,right:0,gap:0},hd=function(e){return parseInt(e||"",10)||0},gd=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return md;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[hd(r),hd(n),hd(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},vd=pd(),yd="data-scroll-locked",bd=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(yd,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ed," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(td," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(ed," .").concat(ed," {\n right: 0 ").concat(n,";\n }\n \n .").concat(td," .").concat(td," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(yd,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},wd=function(){var e=parseInt(document.body.getAttribute(yd)||"0",10);return isFinite(e)?e:0},xd=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(yd,(wd()+1).toString()),function(){var e=wd()-1;e<=0?document.body.removeAttribute(yd):document.body.setAttribute(yd,e.toString())}},[]);var i=n.useMemo(function(){return gd(o)},[o]);return n.createElement(vd,{styles:bd(i,!t,o,r?"":"!important")})},Sd=!1;if("undefined"!=typeof window)try{var kd=Object.defineProperty({},"passive",{get:function(){return Sd=!0,!0}});window.addEventListener("test",kd,kd),window.removeEventListener("test",kd,kd)}catch(e){Sd=!1}var Ed=!!Sd&&{passive:!1},Ad=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},Nd=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Cd(e,n)){var a=_d(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Cd=function(e,t){return"v"===e?function(e){return Ad(e,"overflowY")}(t):function(e){return Ad(e,"overflowX")}(t)},_d=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Td=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Rd=function(e){return[e.deltaX,e.deltaY]},Pd=function(e){return e&&"current"in e?e.current:e},Od=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Id=0,Dd=[];function Ud(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Md,zd=(Md=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(Id++)[0],i=n.useState(pd)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Pd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=Td(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],l="deltaY"in e?e.deltaY:i[1]-o[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=Nd(u,d);if(!m)return!0;if(m?n=u:(n="v"===u?"h":"v",m=Nd(u,d)),!m)return!1;if(!a.current&&"changedTouches"in e&&(c||l)&&(a.current=n),!n)return!0;var h=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),c=!1,l=o>0,d=0,u=0;do{if(!i)break;var f=_d(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Cd(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=n.useCallback(function(e){var r=e;if(Dd.length&&Dd[Dd.length-1]===i){var n="deltaY"in r?Rd(r):Td(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var o=(s.current.shards||[]).map(Pd).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:Ud(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=Td(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,Rd(t),t.target,c(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,Td(t),t.target,c(t,e.lockRef.current))},[]);n.useEffect(function(){return Dd.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Ed),document.addEventListener("touchmove",l,Ed),document.addEventListener("touchstart",u,Ed),function(){Dd=Dd.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,Ed),document.removeEventListener("touchmove",l,Ed),document.removeEventListener("touchstart",u,Ed)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:Od(o)}):null,m?n.createElement(xd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},cd.useMedium(Md),sd),Fd=n.forwardRef(function(e,t){return n.createElement(dd,Xl({},e,{ref:t,sideCar:zd}))});Fd.classNames=dd.classNames;var Ld=new WeakMap,jd=new WeakMap,$d={},Vd=0,Bd=function(e){return e&&(e.host||Bd(e.parentNode))},Wd=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Bd(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);$d[r]||($d[r]=new WeakMap);var o=$d[r],i=[],s=new Set,c=new Set(a),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(Ld.get(e)||0)+1,l=(o.get(e)||0)+1;Ld.set(e,c),o.set(e,l),i.push(e),1===c&&a&&jd.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),Vd++,function(){i.forEach(function(e){var t=Ld.get(e)-1,a=o.get(e)-1;Ld.set(e,t),o.set(e,a),t||(jd.has(e)||e.removeAttribute(n),jd.delete(e)),a||e.removeAttribute(r)}),--Vd||(Ld=new WeakMap,Ld=new WeakMap,jd=new WeakMap,$d={})}},Gd=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Wd(n,a,r,"aria-hidden")):function(){return null}};function Hd(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ds(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Kd=Symbol("radix.slottable");function Zd(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Kd}var Jd="Dialog",[qd,Yd]=vl(Jd),[Xd,Qd]=qd(Jd),eu=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,l=n.useRef(null),d=n.useRef(null),[u,f]=kl({prop:o,defaultProp:i??!1,onChange:s,caller:Jd});return t(Xd,{scope:r,triggerRef:l,contentRef:d,contentId:xl(),titleId:xl(),descriptionId:xl(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:c,children:a})};eu.displayName=Jd;var tu="DialogTrigger",ru=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Qd(tu,n),i=us(r,o.triggerRef);return t(Cl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Su(o.open),...a,ref:i,onClick:gl(e.onClick,o.onOpenToggle)})});ru.displayName=tu;var nu="DialogPortal",[au,ou]=qd(nu,{forceMount:void 0}),iu=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=Qd(nu,r);return t(au,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(Kl,{present:a||s.open,children:t(Hl,{asChild:!0,container:i,children:e})}))})};iu.displayName=nu;var su="DialogOverlay",cu=n.forwardRef((e,r)=>{const n=ou(su,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=Qd(su,e.__scopeDialog);return i.modal?t(Kl,{present:a||i.open,children:t(du,{...o,ref:r})}):null});cu.displayName=su;var lu=function(e){const r=Hd(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Zd);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("DialogOverlay.RemoveScroll"),du=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Qd(su,n);return t(Fd,{as:lu,allowPinchZoom:!0,shards:[o.contentRef],children:t(Cl.div,{"data-state":Su(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),uu="DialogContent",fu=n.forwardRef((e,r)=>{const n=ou(uu,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=Qd(uu,e.__scopeDialog);return t(Kl,{present:a||i.open,children:i.modal?t(pu,{...o,ref:r}):t(mu,{...o,ref:r})})});fu.displayName=uu;var pu=n.forwardRef((e,r)=>{const a=Qd(uu,e.__scopeDialog),o=n.useRef(null),i=us(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return Gd(e)},[]),t(hu,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gl(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:gl(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:gl(e.onFocusOutside,e=>e.preventDefault())})}),mu=n.forwardRef((e,r)=>{const a=Qd(uu,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t(hu,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),hu=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=a,u=Qd(uu,i),f=n.useRef(null),p=us(o,f);return ql(),e(r,{children:[t(Ll,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:t(Il,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Su(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(Nu,{titleId:u.titleId}),t(Cu,{contentRef:f,descriptionId:u.descriptionId})]})]})}),gu="DialogTitle",vu=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Qd(gu,n);return t(Cl.h2,{id:o.titleId,...a,ref:r})});vu.displayName=gu;var yu="DialogDescription",bu=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Qd(yu,n);return t(Cl.p,{id:o.descriptionId,...a,ref:r})});bu.displayName=yu;var wu="DialogClose",xu=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Qd(wu,n);return t(Cl.button,{type:"button",...a,ref:r,onClick:gl(e.onClick,()=>o.onOpenChange(!1))})});function Su(e){return e?"open":"closed"}xu.displayName=wu;var ku="DialogTitleWarning",[Eu,Au]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(ku,{contentName:uu,titleName:gu,docsSlug:"dialog"}),Nu=({titleId:e})=>{const t=Au(ku),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Cu=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Au("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},_u=eu,Tu=ru,Ru=iu,Pu=cu,Ou=fu,Iu=vu,Du=bu,Uu=xu;function Mu(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var zu=["color"],Fu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Mu(e,zu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),Lu=["color"],ju=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Mu(e,Lu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),$u=["color"],Vu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Mu(e,$u);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),Bu=["color"],Wu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Mu(e,Bu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))});const Gu=_u,Hu=Tu,Ku=Ru,Zu=n.forwardRef(({className:e,...r},n)=>t(Pu,{ref:n,className:sl("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));Zu.displayName=Pu.displayName;const Ju=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(Ie);return e(Ku,{container:s,children:[t(Zu,{}),e(Ou,{ref:i,className:sl("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...o,children:[a,e(Uu,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t(Vu,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});Ju.displayName=Ou.displayName;const qu=({className:e,...r})=>t("div",{className:sl("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});qu.displayName="DialogHeader";const Yu=n.forwardRef(({className:e,...r},n)=>t(Iu,{ref:n,className:sl("text-lg font-semibold leading-none tracking-tight",e),...r}));Yu.displayName=Iu.displayName;const Xu=n.forwardRef(({className:e,...r},n)=>t(Du,{ref:n,className:sl("text-sm text-muted-foreground",e),...r}));Xu.displayName=Du.displayName;var Qu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=hs(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),ef=n.forwardRef((e,r)=>t(Qu.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));ef.displayName="Label";var tf=ef;const rf=pl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),nf=n.forwardRef(({className:e,...r},n)=>t(tf,{ref:n,className:sl(rf(),e),...r}));nf.displayName=tf.displayName;const af=yt,of=n.createContext({}),sf=({...e})=>t(of.Provider,{value:{name:e.name},children:t(Nt,{...e})}),cf=()=>{const e=n.useContext(of),t=n.useContext(lf),{getFieldState:r,formState:a}=vt(),o=r(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},lf=n.createContext({}),df=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(lf.Provider,{value:{id:o},children:t("div",{ref:a,className:sl("space-y-2",e),...r})})});df.displayName="FormItem";const uf=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=cf();return t(nf,{ref:n,className:sl(a&&"text-destructive",e),htmlFor:o,...r})});uf.displayName="FormLabel";const ff=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=cf();return t(gs,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});ff.displayName="FormControl";const pf=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=cf();return t("p",{ref:n,id:a,className:sl("text-sm text-muted-foreground",e),...r})});pf.displayName="FormDescription";const mf=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=cf(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:sl("text-sm font-medium text-destructive",e),...n,children:s}):null});mf.displayName="FormMessage";const hf=n.forwardRef(({className:e,type:r,...n},a)=>t("input",{type:r,className:sl("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));function gf(e){const r=vf(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(bf);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}function vf(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ds(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}hf.displayName="Input";var yf=Symbol("radix.slottable");function bf(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===yf}function wf(e){const r=e+"CollectionProvider",[n,o]=vl(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};c.displayName=r;const l=e+"CollectionSlot",d=gf(l),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=us(r,s(l,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=gf(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,c=a.useRef(null),l=us(r,c),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),t(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}var xf=n.createContext(void 0);function Sf(e){const t=n.useContext(xf);return e||t||"ltr"}var kf="rovingFocusGroup.onEntryFocus",Ef={bubbles:!1,cancelable:!0},Af="RovingFocusGroup",[Nf,Cf,_f]=wf(Af),[Tf,Rf]=vl(Af,[_f]),[Pf,Of]=Tf(Af),If=n.forwardRef((e,r)=>t(Nf.Provider,{scope:e.__scopeRovingFocusGroup,children:t(Nf.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Df,{...e,ref:r})})}));If.displayName=Af;var Df=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=us(r,m),g=Sf(s),[v,y]=kl({prop:c,defaultProp:l??null,onChange:d,caller:Af}),[b,w]=n.useState(!1),x=ss(u),S=Cf(a),k=n.useRef(!1),[E,A]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(kf,x),()=>e.removeEventListener(kf,x)},[x]),t(Pf,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:v,onItemFocus:n.useCallback(e=>y(e),[y]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>A(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>A(e=>e-1),[]),children:t(Cl.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:gl(e.onMouseDown,()=>{k.current=!0}),onFocus:gl(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!b){const t=new CustomEvent(kf,Ef);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Ff([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:gl(e.onBlur,()=>w(!1))})})}),Uf="RovingFocusGroupItem",Mf=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:c,...l}=e,d=xl(),u=s||d,f=Of(Uf,a),p=f.currentTabStopId===u,m=Cf(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(Nf.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(Cl.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:gl(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:gl(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:gl(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:zf[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const n=r.indexOf(e.currentTarget);r=f.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>Ff(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});Mf.displayName=Uf;var zf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ff(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Lf=If,jf=Mf;function $f(e){const[t,r]=n.useState(void 0);return cs(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Vf(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Bf="Radio",[Wf,Gf]=vl(Bf),[Hf,Kf]=Wf(Bf),Zf=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=us(a,e=>h(e)),v=n.useRef(!1),y=!m||(f||!!m.closest("form"));return e(Hf,{scope:o,checked:s,disabled:l,children:[t(Cl.button,{type:"button",role:"radio","aria-checked":s,"data-state":Xf(s),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:gl(r.onClick,e=>{s||u?.(),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),y&&t(Yf,{control:m,bubbles:!v.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Zf.displayName=Bf;var Jf="RadioIndicator",qf=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=Kf(Jf,n);return t(Kl,{present:a||i.checked,children:t(Cl.span,{"data-state":Xf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});qf.displayName=Jf;var Yf=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=us(c,s),d=Vf(a),u=$f(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(Cl.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Xf(e){return e?"checked":"unchecked"}Yf.displayName="RadioBubbleInput";var Qf=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ep="RadioGroup",[tp]=vl(ep,[Rf,Gf]),rp=Rf(),np=Gf(),[ap,op]=tp(ep),ip=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=rp(n),h=Sf(d),[g,v]=kl({prop:i,defaultProp:o??null,onChange:f,caller:ep});return t(ap,{scope:n,name:a,required:s,disabled:c,value:g,onValueChange:v,children:t(Lf,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:t(Cl.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});ip.displayName=ep;var sp="RadioGroupItem",cp=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=op(sp,a),c=s.disabled||o,l=rp(a),d=np(a),u=n.useRef(null),f=us(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{Qf.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),t(jf,{asChild:!0,...l,focusable:!c,active:p,children:t(Zf,{disabled:c,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:gl(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:gl(i.onFocus,()=>{m.current&&u.current?.click()})})})});cp.displayName=sp;var lp=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=np(n);return t(qf,{...o,...a,ref:r})});lp.displayName="RadioGroupIndicator";var dp=ip,up=cp,fp=lp;const pp=n.forwardRef(({className:e,...r},n)=>t(dp,{className:sl("grid gap-2",e),...r,ref:n}));pp.displayName=dp.displayName;const mp=n.forwardRef(({className:e,...r},n)=>t(up,{ref:n,className:sl("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:t(fp,{className:"flex items-center justify-center",children:t(ju,{className:"h-3.5 w-3.5 fill-primary"})})}));function hp(e,[t,r]){return Math.min(r,Math.max(t,e))}mp.displayName=up.displayName;var gp="ScrollArea",[vp]=vl(gp),[yp,bp]=vp(gp),wp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...c}=e,[l,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[v,y]=n.useState(null),[b,w]=n.useState(0),[x,S]=n.useState(0),[k,E]=n.useState(!1),[A,N]=n.useState(!1),C=us(r,e=>d(e)),_=Sf(i);return t(yp,{scope:a,type:o,dir:_,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:E,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:N,onCornerWidthChange:w,onCornerHeightChange:S,children:t(Cl.div,{dir:_,...c,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});wp.displayName=gp;var xp="ScrollAreaViewport",Sp=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:c,...l}=a,d=bp(xp,i),u=us(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),t(Cl.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Sp.displayName=xp;var kp="ScrollAreaScrollbar",Ep=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=bp(kp,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===e.orientation;return n.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?t(Ap,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(Np,{...o,ref:r,forceMount:a}):"auto"===i.type?t(Cp,{...o,ref:r,forceMount:a}):"always"===i.type?t(_p,{...o,ref:r}):null});Ep.displayName=kp;var Ap=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=bp(kp,e.__scopeScrollArea),[s,c]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(Kl,{present:a||s,children:t(Cp,{"data-state":s?"visible":"hidden",...o,ref:r})})}),Np=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=bp(kp,e.__scopeScrollArea),s="horizontal"===e.orientation,c=Kp(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,s,d,c]),t(Kl,{present:a||"hidden"!==l,children:t(_p,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:gl(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:gl(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Cp=n.forwardRef((e,r)=>{const a=bp(kp,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=n.useState(!1),l="horizontal"===e.orientation,d=Kp(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;c(l?e:t)}},10);return Zp(a.viewport,d),Zp(a.content,d),t(Kl,{present:o||s,children:t(_p,{"data-state":s?"visible":"hidden",...i,ref:r})})}),_p=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=bp(kp,e.__scopeScrollArea),s=n.useRef(null),c=n.useRef(0),[l,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=$p(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Vp(r),o=a/2,i=t||o,s=a-i,c=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Wp([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===a?t(Tp,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Bp(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(Rp,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Bp(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),Tp=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=bp(kp,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=us(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(Ip,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Vp(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),Gp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:jp(c.paddingLeft),paddingEnd:jp(c.paddingRight)}})}})}),Rp=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=bp(kp,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=us(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(Ip,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Vp(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),Gp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:jp(c.paddingTop),paddingEnd:jp(c.paddingBottom)}})}})}),[Pp,Op]=vp(kp),Ip=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=bp(kp,a),[g,v]=n.useState(null),y=us(r,e=>v(e)),b=n.useRef(null),w=n.useRef(""),x=h.viewport,S=o.content-o.viewport,k=ss(f),E=ss(d),A=Kp(p,10);function N(e){if(b.current){const t=e.clientX-b.current.left,r=e.clientY-b.current.top;u({x:t,y:r})}}return n.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,g,S,k]),n.useEffect(E,[o,E]),Zp(g,A),Zp(h.content,A),t(Pp,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:ss(s),onThumbPointerUp:ss(c),onThumbPositionChange:E,onThumbPointerDown:ss(l),children:t(Cl.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:gl(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),N(e)}}),onPointerMove:gl(e.onPointerMove,N),onPointerUp:gl(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),Dp="ScrollAreaThumb",Up=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=Op(Dp,e.__scopeScrollArea);return t(Kl,{present:n||o.hasThumb,children:t(Mp,{ref:r,...a})})}),Mp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=bp(Dp,a),c=Op(Dp,a),{onThumbPositionChange:l}=c,d=us(r,e=>c.onThumbChange(e)),u=n.useRef(void 0),f=Kp(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Hp(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),t(Cl.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:gl(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:gl(e.onPointerUp,c.onThumbPointerUp)})});Up.displayName=Dp;var zp="ScrollAreaCorner",Fp=n.forwardRef((e,r)=>{const n=bp(zp,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Lp,{...e,ref:r}):null});Fp.displayName=zp;var Lp=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=bp(zp,a),[s,c]=n.useState(0),[l,d]=n.useState(0),u=Boolean(s&&l);return Zp(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),Zp(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?t(Cl.div,{...o,ref:r,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function jp(e){return e?parseInt(e,10):0}function $p(e,t){const r=e/t;return isNaN(r)?0:r}function Vp(e){const t=$p(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Bp(e,t,r="ltr"){const n=Vp(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,c=hp(e,"ltr"===r?[0,i]:[-1*i,0]);return Wp([0,i],[0,s])(c)}function Wp(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function Gp(e,t){return e>0&&e<t}var Hp=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Kp(e,t){const r=ss(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function Zp(e,t){const r=ss(t);cs(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var Jp=wp,qp=Sp,Yp=Fp;const Xp=n.forwardRef(({className:r,children:n,...a},o)=>e(Jp,{ref:o,className:sl("relative overflow-hidden",r),...a,children:[t(qp,{className:"h-full w-full rounded-[inherit]",children:n}),t(Qp,{}),t(Yp,{})]}));Xp.displayName=Jp.displayName;const Qp=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(Ep,{ref:a,orientation:r,className:sl("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",e),...n,children:t(Up,{className:sl("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Qp.displayName=Ep.displayName;var em=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=hs(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),tm="horizontal",rm=["horizontal","vertical"],nm=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=tm,...o}=e,i=function(e){return rm.includes(e)}(a)?a:tm,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t(em.div,{"data-orientation":i,...s,...o,ref:r})});nm.displayName="Separator";var am=nm;const om=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(am,{ref:o,decorative:n,orientation:r,className:sl("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));function im(){const e=Ee(),t=ke(e=>e.os),{serverUrl:r,version:n,orgId:a,settings:o}=t,i=m(!1),s=l(async t=>{if(i.current)return o||null;if(o)return o;if(!r||!n||!a)return null;i.current=!0;try{const o=V(),i=await Ce(`${r}/api/${n}/public/${a}/settings`,{headers:o,signal:t});if(!i.ok)throw new Error("Failed to fetch settings");const s=await i.json();return e.os(Q(s)),s}catch(e){return Ne(e)||console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[r,n,a,o,e]);return d(()=>{if(!r||!n||!a||o||i.current)return;const e=new AbortController;return s(e.signal),()=>{e.abort()}},[r,n,a,s]),c(()=>({settings:o,getSettings:s}),[o,s])}om.displayName=am.displayName;var sm=Symbol("radix.slottable");var cm="AlertDialog",[lm]=vl(cm,[Yd]),dm=Yd(),um=e=>{const{__scopeAlertDialog:r,...n}=e,a=dm(r);return t(_u,{...a,...n,modal:!0})};um.displayName=cm;var fm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=dm(n);return t(Tu,{...o,...a,ref:r})});fm.displayName="AlertDialogTrigger";var pm=e=>{const{__scopeAlertDialog:r,...n}=e,a=dm(r);return t(Ru,{...a,...n})};pm.displayName="AlertDialogPortal";var mm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=dm(n);return t(Pu,{...o,...a,ref:r})});mm.displayName="AlertDialogOverlay";var hm="AlertDialogContent",[gm,vm]=lm(hm),ym=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=sm,n}("AlertDialogContent"),bm=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,c=dm(o),l=n.useRef(null),d=us(a,l),u=n.useRef(null);return t(Eu,{contentName:hm,titleName:wm,docsSlug:"alert-dialog",children:t(gm,{scope:o,cancelRef:u,children:e(Ou,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:gl(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(ym,{children:i}),t(Cm,{contentRef:l})]})})})});bm.displayName=hm;var wm="AlertDialogTitle",xm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=dm(n);return t(Iu,{...o,...a,ref:r})});xm.displayName=wm;var Sm="AlertDialogDescription",km=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=dm(n);return t(Du,{...o,...a,ref:r})});km.displayName=Sm;var Em=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=dm(n);return t(Uu,{...o,...a,ref:r})});Em.displayName="AlertDialogAction";var Am="AlertDialogCancel",Nm=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=vm(Am,n),i=dm(n),s=us(r,o);return t(Uu,{...i,...a,ref:s})});Nm.displayName=Am;var Cm=({contentRef:e})=>{const t=`\`${hm}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${hm}\` by passing a \`${Sm}\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${hm}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},_m=mm,Tm=bm,Rm=Em,Pm=Nm,Om=xm,Im=km;const Dm=um,Um=fm,Mm=pm,zm=n.forwardRef(({className:e,...r},n)=>t(_m,{className:sl("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r,ref:n}));zm.displayName=_m.displayName;const Fm=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(Ie);return e(Mm,{container:i,children:[t(zm,{}),t(Tm,{ref:o,className:sl("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...a})]})});Fm.displayName=Tm.displayName;const Lm=({className:e,...r})=>t("div",{className:sl("flex flex-col space-y-2 text-center sm:text-left",e),...r});Lm.displayName="AlertDialogHeader";const jm=({className:e,...r})=>t("div",{className:sl("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});jm.displayName="AlertDialogFooter";const $m=n.forwardRef(({className:e,...r},n)=>t(Om,{ref:n,className:sl("text-lg font-semibold",e),...r}));$m.displayName=Om.displayName;const Vm=n.forwardRef(({className:e,...r},n)=>t(Im,{ref:n,className:sl("text-sm text-muted-foreground",e),...r}));Vm.displayName=Im.displayName;const Bm=n.forwardRef(({className:e,...r},n)=>t(Rm,{ref:n,className:sl(ml(),e),...r}));Bm.displayName=Rm.displayName;const Wm=n.forwardRef(({className:e,...r},n)=>t(Pm,{ref:n,className:sl(ml({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));Wm.displayName=Pm.displayName;const Gm="saas-workspace-current",Hm=()=>U(Gm),Km=(e,t)=>!!e&&t.some(t=>t._id===e);function Zm(e,t){if(!t)return!1;const r=(n=e.createdBy)?"string"==typeof n?n:"object"==typeof n&&null!==n&&"_id"in n&&"string"==typeof n._id?n._id:null:null;var n;return null!==r&&r===t}function Jm({className:e,...r}){return t("div",{className:sl("animate-pulse rounded-md bg-primary/10",e),...r})}function qm(){return e("div",{className:"space-y-3.5",children:[t(Jm,{className:"h-10 w-full"}),t(Jm,{className:"h-10 w-full"}),t(Jm,{className:"h-10 w-full"})]})}const Ym=({workspace:n})=>{const[a,o]=u(!1),{deleteWorkspace:i}=Kw(),s=ke(e=>e.auth.session?.user||null);if(!n)return t(qm,{});const c=function(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>"string"==typeof e?e===t:"object"==typeof e&&null!==e&&"_id"in e&&e._id===t);return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}(n,s?.id??null);return"admin"===c?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e(Dm,{children:[t(Um,{asChild:!0,children:e(hl,{variant:"destructive",disabled:a,progress:a,children:[t(jo,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e(Fm,{children:[e(Lm,{children:[t($m,{children:"Are you absolutely sure?"}),e(Vm,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(jm,{children:[t(Wm,{disabled:a,children:"Cancel"}),t(Bm,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){E(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t(Io,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Xm="Switch",[Qm]=vl(Xm),[eh,th]=Qm(Xm),rh=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),v=us(a,e=>g(e)),y=n.useRef(!1),b=!h||(p||!!h.closest("form")),[w,x]=kl({prop:s,defaultProp:c??!1,onChange:f,caller:Xm});return e(eh,{scope:o,checked:w,disabled:d,children:[t(Cl.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":ih(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:v,onClick:gl(r.onClick,e=>{x(e=>!e),b&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),b&&t(oh,{control:h,bubbles:!y.current,name:i,value:u,checked:w,required:l,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});rh.displayName=Xm;var nh="SwitchThumb",ah=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=th(nh,n);return t(Cl.span,{"data-state":ih(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});ah.displayName=nh;var oh=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=us(c,s),d=Vf(a),u=$f(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ih(e){return e?"checked":"unchecked"}oh.displayName="SwitchBubbleInput";var sh=rh,ch=ah;const lh=n.forwardRef(({className:e,...r},n)=>t(sh,{className:sl("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:t(ch,{className:sl("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));lh.displayName=sh.displayName;const dh=({workspaceId:r})=>{const[n,a]=u({}),[o,i]=u(null),{allFeatures:s,updateFeature:c,getWorkspace:l}=Kw(),[f,p]=u(null),m=ke(e=>e.auth.session?.user||null);if(d(()=>{l(r).then(p)},[r]),!f)return t(qm,{});const h=Zm(f,m?.id??null);return e("div",{children:[o&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:o})]}),e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!h&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!s.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),s.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:s.map(r=>{const o=f?.features?.[r.slug],l=null!==n[r.slug]&&void 0!==n[r.slug],d=n[r.slug],u=!0===d?"Enabling":!1===d?"Disabling":"";return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),l?e("div",{className:"flex items-center gap-x-1",children:[t(Io,{className:"h-4 w-4 animate-spin text-gray-500"}),e("span",{className:"text-sm text-gray-600",children:[u,"..."]})]}):t(lh,{disabled:!h,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(f){a(r=>({...r,[e]:t})),i(null);try{const r=await c(f._id,e,t);p(r);const n=s.find(t=>t.slug===e);i(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{i(null)},5e3)}catch(e){console.error("Failed to update feature:",e)}finally{a(t=>({...t,[e]:null}))}}}(r.slug,e)})]},r._id)})})]})]})};function uh(e){return`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50%" y="50%" dominant-baseline="middle" alignment-baseline="middle" text-anchor="middle" font-size="50" font-family="sans-serif">${e}</text></svg>`}const fh=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑💻","👨💻","👩💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨💼","👩💼","👨🏫","👩🏫","👨🔬","👩🔬","👨🎨","👩🎨","👨🔧","👩🔧","👨🚀","👩🚀","👨⚖️","👩⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️🌈","🎟️","🎫"],ph=({workspace:r})=>{const[n,a]=u(!1),[o,i]=u("emoji"),[s,c]=u(),[l,d]=u(null),{updateWorkspace:f}=Kw(),p=ke(e=>e.auth.session?.user||null),m=cr({resolver:yo(Vi({name:hi().min(2,{message:"Workspace name must be at least 2 characters."}),image:hi().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(qm,{});const h=Zm(r,p?.id??null);return e("div",{children:[l&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:l})]}),!h&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(af,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await f(r,e),d("Workspace settings saved successfully"),setTimeout(()=>{d(null)},5e3)}catch(e){console.error("Failed to update workspace:",e)}finally{a(!1)}}),className:"space-y-6",children:[t(sf,{control:m.control,name:"name",render:({field:r})=>e(df,{children:[t(uf,{children:"Name"}),t(ff,{children:t(hf,{placeholder:"My Awesome Workspace",...r,disabled:!h})}),t(mf,{})]})}),e("div",{className:"space-y-4",children:[e("div",{children:[t(nf,{className:"text-sm font-medium",children:"Icon"}),t(pf,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(pp,{value:o,disabled:!h,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(mp,{value:"emoji",id:"emoji"}),e(nf,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Fo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(mp,{value:"url",id:"url"}),e(nf,{htmlFor:"url",className:"flex items-center gap-2",children:[t(Oo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&t("span",{className:"text-2xl",children:s}),!s&&m.watch("image")?.trim()&&t("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&t(Xp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:fh.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),m.setValue("image",uh(e))})(e),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(sf,{control:m.control,name:"image",render:({field:r})=>e(df,{children:[t(uf,{children:"Image URL"}),t(ff,{children:t(hf,{placeholder:"https://example.com/image.png",...r,disabled:!h})}),t(pf,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(mf,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:h&&t(hl,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var mh=.999,hh=/[\\\/_+.#"@\[\(\{&]/,gh=/[\\\/_+.#"@\[\(\{&]/g,vh=/[\s-]/,yh=/[\s-]/g;function bh(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=bh(e,t,r,n,p+1,o+1,i))>m&&(p===a?c*=1:hh.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(gh))&&a>0&&(c*=Math.pow(mh,d.length))):vh.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(yh))&&a>0&&(c*=Math.pow(mh,u.length))):(c*=.17,a>0&&(c*=Math.pow(mh,p-a))),e.charAt(p)!==t.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(p-1)!==n.charAt(o))&&(.1*(l=bh(e,t,r,n,p+1,o+2,i))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return i[s]=m,m}function wh(e){return e.toLowerCase().replace(yh," ")}function xh(e,t,r){return bh(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,wh(e),wh(t),0,0,{})}var Sh='[cmdk-group=""]',kh='[cmdk-group-items=""]',Eh='[cmdk-item=""]',Ah=`${Eh}:not([aria-disabled="true"])`,Nh="cmdk-item-select",Ch="data-value",_h=(e,t,r)=>xh(e,t,r),Th=n.createContext(void 0),Rh=()=>n.useContext(Th),Ph=n.createContext(void 0),Oh=()=>n.useContext(Ph),Ih=n.createContext(void 0),Dh=n.forwardRef((e,t)=>{let r=Zh(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Zh(()=>new Set),o=Zh(()=>new Map),i=Zh(()=>new Map),s=Zh(()=>new Set),c=Hh(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=xl(),w=xl(),x=xl(),S=n.useRef(null),k=Yh();Kh(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,E.emit()}},[u]),Kh(()=>{k(6,R)},[]);let E=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),C(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,E.emit()}),n||k(5,R),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}E.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),A=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,N(t,n)),k(2,()=>{C(),E.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{T(),C(),r.current.value||_(),E.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),E.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:x,labelId:w,listInnerRef:S}),[]);function N(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:_h;return e?o(e,r.current.search,t):0}function C(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(kh);t?t.appendChild(e.parentElement===t?e:e.closest(`${kh} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${kh} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Sh}[${Ch}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Ch);E.setState("value",t||void 0)}function T(){var e,t,n,s;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of a.current){let a=N(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&l++}for(let[e,t]of o.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function R(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Sh))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Eh}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Ah))||[])}function I(e){let t=O()[e];t&&E.setState("value",t.getAttribute(Ch))}function D(e){var t;let r=P(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&E.setState("value",o.getAttribute(Ch))}function U(e){let t,r=P(),n=null==r?void 0:r.closest(Sh);for(;n&&!t;)n=e>0?Wh(n,Sh):Gh(n,Sh),t=null==n?void 0:n.querySelector(Ah);t?E.setState("value",t.getAttribute(Ch)):D(e)}let M=()=>I(O().length-1),z=e=>{e.preventDefault(),e.metaKey?M():e.altKey?U(1):D(1)},F=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?U(-1):D(-1)};return n.createElement(Cl.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),M();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(Nh);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:Qh},l),Xh(e,e=>n.createElement(Ph.Provider,{value:E},n.createElement(Th.Provider,{value:A},e))))}),Uh=n.forwardRef((e,t)=>{var r,a;let o=xl(),i=n.useRef(null),s=n.useContext(Ih),c=Rh(),l=Hh(e),d=null!=(a=null==(r=l.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;Kh(()=>{if(!d)return c.item(o,null==s?void 0:s.id)},[d]);let u=qh(o,i,[e.value,e.children,i],e.keywords),f=Oh(),p=Jh(e=>e.value&&e.value===u.current),m=Jh(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Nh,h),()=>t.removeEventListener(Nh,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:x,...S}=e;return n.createElement(Cl.div,{ref:ds(i,t),...S,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||c.getDisablePointerSelection()?void 0:g,onClick:v?void 0:h},e.children)}),Mh=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=xl(),c=n.useRef(null),l=n.useRef(null),d=xl(),u=Rh(),f=Jh(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));Kh(()=>u.group(s),[]),qh(s,c,[e.value,e.heading,l]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(Cl.div,{ref:ds(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Xh(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement(Ih.Provider,{value:p},e))))}),zh=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=Jh(e=>!e.search);return r||i?n.createElement(Cl.div,{ref:ds(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),Fh=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=Oh(),s=Jh(e=>e.search),c=Jh(e=>e.selectedItemId),l=Rh();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(Cl.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),Lh=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),c=Jh(e=>e.selectedItemId),l=Rh();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),n.createElement(Cl.div,{ref:ds(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":a,id:l.listId},Xh(e,e=>n.createElement("div",{ref:ds(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),jh=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...c}=e;return n.createElement(_u,{open:r,onOpenChange:a},n.createElement(Ru,{container:s},n.createElement(Pu,{"cmdk-overlay":"",className:o}),n.createElement(Ou,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(Dh,{ref:t,...c}))))}),$h=n.forwardRef((e,t)=>Jh(e=>0===e.filtered.count)?n.createElement(Cl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Vh=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(Cl.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Xh(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),Bh=Object.assign(Dh,{List:Lh,Item:Uh,Input:Fh,Group:Mh,Separator:zh,Dialog:jh,Empty:$h,Loading:Vh});function Wh(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Gh(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Hh(e){let t=n.useRef(e);return Kh(()=>{t.current=e}),t}var Kh="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function Zh(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function Jh(e){let t=Oh(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function qh(e,t,r,a=[]){let o=n.useRef(),i=Rh();return Kh(()=>{var n;let s=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),c=a.map(e=>e.trim());i.value(e,s,c),null==(n=t.current)||n.setAttribute(Ch,s),o.current=s}),o}var Yh=()=>{let[e,t]=n.useState(),r=Zh(()=>new Map);return Kh(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Xh({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var Qh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const eg=n.forwardRef(({className:e,...r},n)=>t(Bh,{ref:n,className:sl("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));eg.displayName=Bh.displayName;const tg=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(Wu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(Bh.Input,{ref:a,className:sl("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...n})]}));tg.displayName=Bh.Input.displayName;const rg=n.forwardRef(({className:e,...r},n)=>t(Bh.List,{ref:n,className:sl("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));rg.displayName=Bh.List.displayName;n.forwardRef((e,r)=>t(Bh.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=Bh.Empty.displayName;const ng=n.forwardRef(({className:e,...r},n)=>t(Bh.Group,{ref:n,className:sl("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));ng.displayName=Bh.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(Bh.Separator,{ref:n,className:sl("-mx-1 h-px bg-border",e),...r})).displayName=Bh.Separator.displayName;const ag=n.forwardRef(({className:e,...r},n)=>t(Bh.Item,{ref:n,className:sl("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r}));ag.displayName=Bh.Item.displayName;const og=["top","right","bottom","left"],ig=Math.min,sg=Math.max,cg=Math.round,lg=Math.floor,dg=e=>({x:e,y:e}),ug={left:"right",right:"left",bottom:"top",top:"bottom"},fg={start:"end",end:"start"};function pg(e,t,r){return sg(e,ig(t,r))}function mg(e,t){return"function"==typeof e?e(t):e}function hg(e){return e.split("-")[0]}function gg(e){return e.split("-")[1]}function vg(e){return"x"===e?"y":"x"}function yg(e){return"y"===e?"height":"width"}const bg=new Set(["top","bottom"]);function wg(e){return bg.has(hg(e))?"y":"x"}function xg(e){return vg(wg(e))}function Sg(e){return e.replace(/start|end/g,e=>fg[e])}const kg=["left","right"],Eg=["right","left"],Ag=["top","bottom"],Ng=["bottom","top"];function Cg(e,t,r,n){const a=gg(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Eg:kg:t?kg:Eg;case"left":case"right":return t?Ag:Ng;default:return[]}}(hg(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Sg)))),o}function _g(e){return e.replace(/left|right|bottom|top/g,e=>ug[e])}function Tg(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Rg(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function Pg(e,t,r){let{reference:n,floating:a}=e;const o=wg(t),i=xg(t),s=yg(i),c=hg(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(gg(t)){case"start":p[i]-=f*(r&&l?-1:1);break;case"end":p[i]+=f*(r&&l?-1:1)}return p}async function Og(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=mg(t,e),m=Tg(p),h=s[f?"floating"===u?"reference":"floating":u],g=Rg(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),b=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=Rg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(g.top-w.top+m.top)/b.y,bottom:(w.bottom-g.bottom+m.bottom)/b.y,left:(g.left-w.left+m.left)/b.x,right:(w.right-g.right+m.right)/b.x}}function Ig(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Dg(e){return og.some(t=>e[t]>=0)}const Ug=new Set(["left","top"]);function Mg(){return"undefined"!=typeof window}function zg(e){return jg(e)?(e.nodeName||"").toLowerCase():"#document"}function Fg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Lg(e){var t;return null==(t=(jg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function jg(e){return!!Mg()&&(e instanceof Node||e instanceof Fg(e).Node)}function $g(e){return!!Mg()&&(e instanceof Element||e instanceof Fg(e).Element)}function Vg(e){return!!Mg()&&(e instanceof HTMLElement||e instanceof Fg(e).HTMLElement)}function Bg(e){return!(!Mg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Fg(e).ShadowRoot)}const Wg=new Set(["inline","contents"]);function Gg(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=nv(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Wg.has(a)}const Hg=new Set(["table","td","th"]);function Kg(e){return Hg.has(zg(e))}const Zg=[":popover-open",":modal"];function Jg(e){return Zg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const qg=["transform","translate","scale","rotate","perspective"],Yg=["transform","translate","scale","rotate","perspective","filter"],Xg=["paint","layout","strict","content"];function Qg(e){const t=ev(),r=$g(e)?nv(e):e;return qg.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Yg.some(e=>(r.willChange||"").includes(e))||Xg.some(e=>(r.contain||"").includes(e))}function ev(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const tv=new Set(["html","body","#document"]);function rv(e){return tv.has(zg(e))}function nv(e){return Fg(e).getComputedStyle(e)}function av(e){return $g(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ov(e){if("html"===zg(e))return e;const t=e.assignedSlot||e.parentNode||Bg(e)&&e.host||Lg(e);return Bg(t)?t.host:t}function iv(e){const t=ov(e);return rv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vg(t)&&Gg(t)?t:iv(t)}function sv(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=iv(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=Fg(a);if(o){const e=cv(i);return t.concat(i,i.visualViewport||[],Gg(a)?a:[],e&&r?sv(e):[])}return t.concat(a,sv(a,[],r))}function cv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function lv(e){const t=nv(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Vg(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=cg(r)!==o||cg(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function dv(e){return $g(e)?e:e.contextElement}function uv(e){const t=dv(e);if(!Vg(t))return dg(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=lv(t);let i=(o?cg(r.width):r.width)/n,s=(o?cg(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const fv=dg(0);function pv(e){const t=Fg(e);return ev()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:fv}function mv(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=dv(e);let i=dg(1);t&&(n?$g(n)&&(i=uv(n)):i=uv(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Fg(e))&&t}(o,r,n)?pv(o):dg(0);let c=(a.left+s.x)/i.x,l=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=Fg(o),t=n&&$g(n)?Fg(n):n;let r=e,a=cv(r);for(;a&&n&&t!==r;){const e=uv(a),t=a.getBoundingClientRect(),n=nv(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=i,r=Fg(a),a=cv(r)}}return Rg({width:d,height:u,x:c,y:l})}function hv(e,t){const r=av(e).scrollLeft;return t?t.left+r:mv(Lg(e)).left+r}function gv(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-hv(e,r),y:r.top+t.scrollTop}}const vv=new Set(["absolute","fixed"]);function yv(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Fg(e),n=Lg(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;const e=ev();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,c=a.offsetTop)}const l=hv(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else l<=25&&(o+=l);return{width:o,height:i,x:s,y:c}}(e,r);else if("document"===t)n=function(e){const t=Lg(e),r=av(e),n=e.ownerDocument.body,a=sg(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=sg(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+hv(e);const s=-r.scrollTop;return"rtl"===nv(n).direction&&(i+=sg(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Lg(e));else if($g(t))n=function(e,t){const r=mv(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Vg(e)?uv(e):dg(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{const r=pv(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Rg(n)}function bv(e,t){const r=ov(e);return!(r===t||!$g(r)||rv(r))&&("fixed"===nv(r).position||bv(r,t))}function wv(e,t,r){const n=Vg(t),a=Lg(t),o="fixed"===r,i=mv(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=dg(0);function l(){c.x=hv(a)}if(n||!n&&!o)if(("body"!==zg(t)||Gg(a))&&(s=av(t)),n){const e=mv(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();o&&!n&&a&&l();const d=!a||n||o?dg(0):gv(a,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function xv(e){return"static"===nv(e).position}function Sv(e,t){if(!Vg(e)||"fixed"===nv(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Lg(e)===r&&(r=r.ownerDocument.body),r}function kv(e,t){const r=Fg(e);if(Jg(e))return r;if(!Vg(e)){let t=ov(e);for(;t&&!rv(t);){if($g(t)&&!xv(t))return t;t=ov(t)}return r}let n=Sv(e,t);for(;n&&Kg(n)&&xv(n);)n=Sv(n,t);return n&&rv(n)&&xv(n)&&!Qg(n)?r:n||function(e){let t=ov(e);for(;Vg(t)&&!rv(t);){if(Qg(t))return t;if(Jg(t))return null;t=ov(t)}return null}(e)||r}const Ev={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=Lg(n),s=!!t&&Jg(t.floating);if(n===i||s&&o)return r;let c={scrollLeft:0,scrollTop:0},l=dg(1);const d=dg(0),u=Vg(n);if((u||!u&&!o)&&(("body"!==zg(n)||Gg(i))&&(c=av(n)),Vg(n))){const e=mv(n);l=uv(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?dg(0):gv(i,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Lg,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?Jg(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=sv(e,[],!1).filter(e=>$g(e)&&"body"!==zg(e)),a=null;const o="fixed"===nv(e).position;let i=o?ov(e):e;for(;$g(i)&&!rv(i);){const t=nv(i),r=Qg(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&vv.has(a.position)||Gg(i)&&!r&&bv(e,i))?n=n.filter(e=>e!==i):a=t,i=ov(i)}return t.set(e,n),n}(t,this._c):[].concat(r),n],i=o[0],s=o.reduce((e,r)=>{const n=yv(t,r,a);return e.top=sg(n.top,e.top),e.right=ig(n.right,e.right),e.bottom=ig(n.bottom,e.bottom),e.left=sg(n.left,e.left),e},yv(t,i,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:kv,getElementRects:async function(e){const t=this.getOffsetParent||kv,r=this.getDimensions,n=await r(e.floating);return{reference:wv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=lv(e);return{width:t,height:r}},getScale:uv,isElement:$g,isRTL:function(e){return"rtl"===nv(e).direction}};function Av(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Nv(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=dv(e),d=a||o?[...l?sv(l):[],...sv(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&s?function(e,t){let r,n=null;const a=Lg(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(s||t(),!f||!p)return;const m={rootMargin:-lg(u)+"px "+-lg(a.clientWidth-(d+f))+"px "+-lg(a.clientHeight-(u+p))+"px "+-lg(d)+"px",threshold:sg(0,ig(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||Av(l,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(l,r):null;let f,p=-1,m=null;i&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?mv(e):null;return c&&function t(){const n=mv(e);h&&!Av(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const Cv=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=hg(r),s=gg(r),c="y"===wg(r),l=Ug.has(i)?-1:1,d=o&&c?-1:1,u=mg(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},_v=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=mg(e,t),l={x:r,y:n},d=await Og(t,c),u=wg(hg(a)),f=vg(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=pg(p+d["y"===f?"top":"left"],p,p-d[e])}if(i){const e="y"===u?"bottom":"right";m=pg(m+d["y"===u?"top":"left"],m,m-d[e])}const h=s.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:i}}}}}},Tv=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=mg(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=hg(a),y=wg(s),b=hg(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(b||!h?[_g(s)]:function(e){const t=_g(e);return[Sg(e),t,Sg(t)]}(s)),S="none"!==m;!f&&S&&x.push(...Cg(s,h,m,w));const k=[s,...x],E=await Og(t,g),A=[];let N=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&A.push(E[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=gg(e),a=xg(e),o=yg(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=_g(i)),[i,_g(i)]}(a,i,w);A.push(E[e[0]],E[e[1]])}if(N=[...N,{placement:a,overflows:A}],!A.every(e=>e<=0)){var C,_;const e=((null==(C=o.flip)?void 0:C.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==wg(t))||N.every(e=>wg(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:N},reset:{placement:t}}}let r=null==(_=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!r)switch(p){case"bestFit":{var T;const e=null==(T=N.filter(e=>{if(S){const t=wg(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(r=e);break}case"initialPlacement":r=s}if(a!==r)return{reset:{placement:r}}}return{}}}},Rv=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...l}=mg(e,t),d=await Og(t,l),u=hg(a),f=gg(a),p="y"===wg(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,b=m-d.left-d.right,w=ig(h-d[g],y),x=ig(m-d[v],b),S=!t.middlewareData.shift;let k=w,E=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(E=b),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=sg(d.left,0),t=sg(d.right,0),r=sg(d.top,0),n=sg(d.bottom,0);p?E=m-2*(0!==e||0!==t?e+t:sg(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:sg(d.top,d.bottom))}await c({...t,availableWidth:E,availableHeight:k});const A=await i.getDimensions(s.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},Pv=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=mg(e,t);switch(n){case"referenceHidden":{const e=Ig(await Og(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Dg(e)}}}case"escaped":{const e=Ig(await Og(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Dg(e)}}}default:return{}}}}},Ov=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=mg(e,t)||{};if(null==l)return{};const u=Tg(d),f={x:r,y:n},p=xg(a),m=yg(p),h=await i.getDimensions(l),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=f[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let k=S?S[b]:0;k&&await(null==i.isElement?void 0:i.isElement(S))||(k=s.floating[b]||o.floating[m]);const E=w/2-x/2,A=k/2-h[m]/2-1,N=ig(u[v],A),C=ig(u[y],A),_=N,T=k-h[m]-C,R=k/2-h[m]/2+E,P=pg(_,R,T),O=!c.arrow&&null!=gg(a)&&R!==P&&o.reference[m]/2-(R<_?N:C)-h[m]/2<0,I=O?R<_?R-_:R-T:0;return{[p]:f[p]+I,data:{[p]:P,centerOffset:R-P-I,...O&&{alignmentOffset:I}},reset:O}}}),Iv=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=mg(e,t),d={x:r,y:n},u=wg(a),f=vg(u);let p=d[f],m=d[u];const h=mg(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var v,y;const e="y"===f?"width":"height",t=Ug.has(hg(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=i.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Dv=(e,t,r)=>{const n=new Map,a={platform:Ev,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Pg(l,n,c),f=n,p={},m=0;for(let r=0;r<s.length;r++){const{name:o,fn:h}=s[r],{x:g,y:v,data:y,reset:b}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...y}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):b.rects),({x:d,y:u}=Pg(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Uv="undefined"!=typeof document?h:function(){};function Mv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Mv(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){const r=a[n];if(("_owner"!==r||!e.$$typeof)&&!Mv(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function zv(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fv(e,t){const r=zv(e);return Math.round(t*r)/r}function Lv(e){const t=n.useRef(e);return Uv(()=>{t.current=e}),t}const jv=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(a=r,{}.hasOwnProperty.call(a,"current"))?null!=r.current?Ov({element:r.current,padding:n}).fn(t):{}:r?Ov({element:r,padding:n}).fn(t):{};var a}}),$v=(e,t)=>({...Cv(e),options:[e,t]}),Vv=(e,t)=>({..._v(e),options:[e,t]}),Bv=(e,t)=>({...Iv(e),options:[e,t]}),Wv=(e,t)=>({...Tv(e),options:[e,t]}),Gv=(e,t)=>({...Rv(e),options:[e,t]}),Hv=(e,t)=>({...Pv(e),options:[e,t]}),Kv=(e,t)=>({...jv(e),options:[e,t]});var Zv=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(Cl.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});Zv.displayName="Arrow";var Jv=Zv,qv="Popper",[Yv,Xv]=vl(qv),[Qv,ey]=Yv(qv),ty=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(Qv,{scope:r,anchor:o,onAnchorChange:i,children:a})};ty.displayName=qv;var ry="PopperAnchor",ny=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=ey(ry,a),c=n.useRef(null),l=us(r,c),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(Cl.div,{...i,ref:l})});ny.displayName=ry;var ay="PopperContent",[oy,iy]=Yv(ay),sy=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,y=ey(ay,a),[w,x]=n.useState(null),S=us(r,e=>x(e)),[k,E]=n.useState(null),A=$f(k),N=A?.width??0,C=A?.height??0,_=o+("center"!==s?"-"+s:""),T="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],P=R.length>0,O={padding:T,boundary:R.filter(uy),altBoundary:P},{refs:I,floatingStyles:D,placement:U,isPositioned:M,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);Mv(p,a)||m(a);const[h,g]=n.useState(null),[v,y]=n.useState(null),w=n.useCallback(e=>{e!==E.current&&(E.current=e,g(e))},[]),x=n.useCallback(e=>{e!==A.current&&(A.current=e,y(e))},[]),S=i||h,k=s||v,E=n.useRef(null),A=n.useRef(null),N=n.useRef(u),C=null!=l,_=Lv(l),T=Lv(o),R=Lv(d),P=n.useCallback(()=>{if(!E.current||!A.current)return;const e={placement:t,strategy:r,middleware:p};T.current&&(e.platform=T.current),Dv(E.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};O.current&&!Mv(N.current,t)&&(N.current=t,b.flushSync(()=>{f(t)}))})},[p,t,r,T,R]);Uv(()=>{!1===d&&N.current.isPositioned&&(N.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const O=n.useRef(!1);Uv(()=>(O.current=!0,()=>{O.current=!1}),[]),Uv(()=>{if(S&&(E.current=S),k&&(A.current=k),S&&k){if(_.current)return _.current(S,k,P);P()}},[S,k,P,_,C]);const I=n.useMemo(()=>({reference:E,floating:A,setReference:w,setFloating:x}),[w,x]),D=n.useMemo(()=>({reference:S,floating:k}),[S,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=Fv(D.floating,u.x),n=Fv(D.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...zv(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,D.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:P,refs:I,elements:D,floatingStyles:U}),[u,P,I,D,U])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Nv(...e,{animationFrame:"always"===h}),elements:{reference:y.anchor},middleware:[$v({mainAxis:i+C,alignmentAxis:c}),d&&Vv({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?Bv():void 0,...O}),d&&Wv({...O}),Gv({...O,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&Kv({element:k,padding:l}),fy({arrowWidth:N,arrowHeight:C}),m&&Hv({strategy:"referenceHidden",...O})]}),[F,L]=py(U),j=ss(g);cs(()=>{M&&j?.()},[M,j]);const $=z.arrow?.x,V=z.arrow?.y,B=0!==z.arrow?.centerOffset,[W,G]=n.useState();return cs(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:M?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:W,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t(oy,{scope:a,placedSide:F,onArrowChange:E,arrowX:$,arrowY:V,shouldHideArrow:B,children:t(Cl.div,{"data-side":F,"data-align":L,...v,ref:S,style:{...v.style,animation:M?void 0:"none"}})})})});sy.displayName=ay;var cy="PopperArrow",ly={top:"bottom",right:"left",bottom:"top",left:"right"},dy=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=iy(cy,n),i=ly[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(Jv,{...a,ref:r,style:{...a.style,display:"block"}})})});function uy(e){return null!==e}dy.displayName=cy;var fy=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[c,l]=py(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-s+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===c?(p=-s+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function py(e){const[t,r="center"]=e.split("-");return[t,r]}var my=ty,hy=ny,gy=sy,vy=dy;function yy(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ds(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var by=Symbol("radix.slottable");function wy(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===by}var xy="Popover",[Sy]=vl(xy,[Xv]),ky=Xv(),[Ey,Ay]=Sy(xy),Ny=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!1}=e,l=ky(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=kl({prop:o,defaultProp:i??!1,onChange:s,caller:xy});return t(my,{...l,children:t(Ey,{scope:r,contentId:xl(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:c,children:a})})};Ny.displayName=xy;var Cy="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=Ay(Cy,a),s=ky(a),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return n.useEffect(()=>(c(),()=>l()),[c,l]),t(hy,{...s,...o,ref:r})}).displayName=Cy;var _y="PopoverTrigger",Ty=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Ay(_y,n),i=ky(n),s=us(r,o.triggerRef),c=t(Cl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":$y(o.open),...a,ref:s,onClick:gl(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:t(hy,{asChild:!0,...i,children:c})});Ty.displayName=_y;var Ry="PopoverPortal",[Py,Oy]=Sy(Ry,{forceMount:void 0}),Iy=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=Ay(Ry,r);return t(Py,{scope:r,forceMount:n,children:t(Kl,{present:n||i.open,children:t(Hl,{asChild:!0,container:o,children:a})})})};Iy.displayName=Ry;var Dy="PopoverContent",Uy=n.forwardRef((e,r)=>{const n=Oy(Dy,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=Ay(Dy,e.__scopePopover);return t(Kl,{present:a||i.open,children:i.modal?t(zy,{...o,ref:r}):t(Fy,{...o,ref:r})})});Uy.displayName=Dy;var My=function(e){const r=yy(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(wy);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("PopoverContent.RemoveScroll"),zy=n.forwardRef((e,r)=>{const a=Ay(Dy,e.__scopePopover),o=n.useRef(null),i=us(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return Gd(e)},[]),t(Fd,{as:My,allowPinchZoom:!0,children:t(Ly,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gl(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:gl(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:gl(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Fy=n.forwardRef((e,r)=>{const a=Ay(Dy,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(Ly,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Ly=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=e,p=Ay(Dy,n),m=ky(n);return ql(),t(Ll,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(Il,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(gy,{"data-state":$y(p.open),role:"dialog",id:p.contentId,...m,...f,ref:r,style:{...f.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)"}})})})}),jy="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Ay(jy,n);return t(Cl.button,{type:"button",...a,ref:r,onClick:gl(e.onClick,()=>o.onOpenChange(!1))})}).displayName=jy;function $y(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=ky(n);return t(vy,{...o,...a,ref:r})}).displayName="PopoverArrow";var Vy=Iy,By=Uy;const Wy=Ny,Gy=Ty,Hy=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(Ie);return t(Vy,{container:s,children:t(By,{ref:i,align:r,sideOffset:a,className:sl("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...o})})});Hy.displayName=By.displayName;const Ky={USD:"$",EUR:"€",JPY:"¥",GBP:"£",AUD:"A$",CAD:"C$",CHF:"CHF",CNY:"¥",SEK:"kr",NZD:"NZ$",INR:"₹",RUB:"₽",KRW:"₩",BRL:"R$",ZAR:"R",HKD:"HK$",SGD:"S$",MXN:"Mex$",NOK:"kr",TRY:"₺",IDR:"Rp",PLN:"zł",THB:"฿",ILS:"₪",PHP:"₱",MYR:"RM",CZK:"Kč",HUF:"Ft",DKK:"kr",PKR:"₨",EGP:"£",NGN:"₦",BDT:"৳",UAH:"₴",KZT:"₸",VND:"₫",ARS:"$",BGN:"лв",COP:"COL$",HRK:"kn",ISK:"kr",KES:"KSh",LKR:"Rs",MAD:"د.م.",MNT:"₮",NPR:"रू",RSD:"дин.",SAR:"ر.س",TWD:"NT$",UYU:"$U",YER:"﷼",FJD:"FJ$",JMD:"J$",HTG:"G",BHD:"ب.د",KWD:"د.ك",OMR:"ر.ع.",BND:"B$",KPW:"₩",GHS:"₵",SYP:"ل.س",SLL:"Le",SSP:"£",AFN:"؋",MGA:"Ar",MDL:"lei",FOK:"kr",GMD:"D",LTL:"Lt",LVL:"Ls",HNL:"L",GEL:"₾",BMD:"$",AWG:"Afl",BTN:"Nu",GTQ:"Q",TZS:"TSh",BBD:"Bds$",NAD:"N$",BZD:"$",JEP:"£",WST:"T",PGK:"K",KGS:"лв",AZN:"₼",QAR:"ر.ق",XOF:"CFA",XPF:"CFP"},Zy={AF:"AFN",AX:"EUR",AL:"ALL",DZ:"DZD",AS:"USD",AD:"EUR",AO:"AOA",AI:"XCD",AQ:"USD",AG:"XCD",AR:"ARS",AM:"AMD",AW:"AWG",AU:"AUD",AT:"EUR",AZ:"AZN",BS:"BSD",BH:"BHD",BD:"BDT",BB:"BBD",BY:"BYN",BE:"EUR",BZ:"BZD",BJ:"XOF",BM:"BMD",BT:"BTN",BO:"BOB",BA:"BAM",BW:"BWP",BV:"NOK",BR:"BRL",IO:"USD",BN:"BND",BG:"BGN",BF:"XOF",BI:"BIF",KH:"KHR",CM:"XAF",CA:"CAD",CV:"CVE",KY:"KYD",CF:"XAF",TD:"XAF",CL:"CLP",CN:"CNY",CX:"AUD",CC:"AUD",CO:"COP",KM:"KMF",CG:"XAF",CD:"CDF",CK:"NZD",CR:"CRC",CI:"XOF",HR:"HRK",CU:"CUP",CY:"EUR",CZ:"CZK",DK:"DKK",DJ:"DJF",DM:"XCD",DO:"DOP",EC:"USD",EG:"EGP",SV:"USD",GQ:"XAF",ER:"ERN",EE:"EUR",ET:"ETB",FK:"FKP",FO:"DKK",FJ:"FJD",FI:"EUR",FR:"EUR",GF:"EUR",PF:"XPF",TF:"EUR",GA:"XAF",GM:"GMD",GE:"GEL",DE:"EUR",GH:"GHS",GI:"GIP",GR:"EUR",GL:"DKK",GD:"XCD",GP:"EUR",GU:"USD",GT:"GTQ",GG:"GBP",GN:"GNF",GW:"XOF",GY:"GYD",HT:"HTG",HM:"AUD",VA:"EUR",HN:"HNL",HK:"HKD",HU:"HUF",IS:"ISK",IN:"INR",ID:"IDR",IR:"IRR",IQ:"IQD",IE:"EUR",IM:"GBP",IL:"ILS",IT:"EUR",JM:"JMD",JP:"JPY",JE:"GBP",JO:"JOD",KZ:"KZT",KE:"KES",KI:"AUD",KP:"KPW",KR:"KRW",KW:"KWD",KG:"KGS",LA:"LAK",LV:"EUR",LB:"LBP",LS:"LSL",LR:"LRD",LY:"LYD",LI:"CHF",LT:"EUR",LU:"EUR",MO:"MOP",MK:"MKD",MG:"MGA",MW:"MWK",MY:"MYR",MV:"MVR",ML:"XOF",MT:"EUR",MH:"USD",MQ:"EUR",MR:"MRU",MU:"MUR",YT:"EUR",MX:"MXN",FM:"USD",MD:"MDL",MC:"EUR",MN:"MNT",ME:"EUR",MS:"XCD",MA:"MAD",MZ:"MZN",MM:"MMK",NA:"NAD",NR:"AUD",NP:"NPR",NL:"EUR",AN:"ANG",NC:"XPF",NZ:"NZD",NI:"NIO",NE:"XOF",NG:"NGN",NU:"NZD",NF:"AUD",MP:"USD",NO:"NOK",OM:"OMR",PK:"PKR",PW:"USD",PS:"ILS",PA:"PAB",PG:"PGK",PY:"PYG",PE:"PEN",PH:"PHP",PN:"NZD",PL:"PLN",PT:"EUR",PR:"USD",QA:"QAR",RE:"EUR",RO:"RON",RU:"RUB",RW:"RWF",SH:"SHP",KN:"XCD",LC:"XCD",PM:"EUR",VC:"XCD",WS:"WST",SM:"EUR",ST:"STN",SA:"SAR",SN:"XOF",RS:"RSD",SC:"SCR",SL:"SLL",SG:"SGD",SK:"EUR",SI:"EUR",SB:"SBD",SO:"SOS",ZA:"ZAR",GS:"GBP",ES:"EUR",LK:"LKR",SD:"SDG",SR:"SRD",SJ:"NOK",SZ:"SZL",SE:"SEK",CH:"CHF",SY:"SYP",TW:"TWD",TJ:"TJS",TZ:"TZS",TH:"THB"},Jy=[{name:"Afghanistan",code:"AF"},{name:"land Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:'Korea, Democratic People"S Republic of',code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:'Lao People"S Democratic Republic',code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}].map(e=>{const t=Zy[e.code]||"USD",r=Ky[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function qy(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=Jy.find(e=>e.value==n);return e(Wy,{open:o,onOpenChange:i,children:[t(Gy,{asChild:!0,children:e(hl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose country"}),t(_o,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Hy,{className:"p-0 overflow-hidden text-ellipsis",children:e(eg,{children:[t(tg,{placeholder:"Choose country..."}),t(rg,{children:t(ng,{children:Jy.map(o=>e(ag,{className:sl("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(Co,{className:sl("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const Yy=Jy.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),Xy=Array.from(new Set(Yy.map(e=>e.value))).map(e=>Yy.find(t=>t.value===e)).filter(e=>void 0!==e);function Qy(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=Xy.find(e=>e.value==n);return e(Wy,{open:o,onOpenChange:i,children:[t(Gy,{asChild:!0,children:e(hl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.icon})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose Currency"}),t(_o,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Hy,{className:"p-0 overflow-hidden text-ellipsis",children:e(eg,{children:[t(tg,{placeholder:"Choose currency..."}),t(rg,{children:t(ng,{children:Xy.map(o=>e(ag,{className:sl("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(Co,{className:sl("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.icon})]},o.value))})})]})})]})}let eb=[{code:"en",label:"English",flag:"🇬🇧"},{code:"en-GB",label:"English (United Kingdom)",flag:"🇬🇧"},{code:"en-US",label:"English (United States)",flag:"🇺🇸"},{code:"en-AU",label:"English (Australia)",flag:"🇦🇺"},{code:"en-CA",label:"English (Canada)",flag:"🇨🇦"},{code:"en-NZ",label:"English (New Zealand)",flag:"🇳🇿"},{code:"es",label:"Spanish",flag:"🇪🇸"},{code:"es-ES",label:"Spanish (Spain)",flag:"🇪🇸"},{code:"es-MX",label:"Spanish (Mexico)",flag:"🇲🇽"},{code:"fr",label:"French",flag:"🇫🇷"},{code:"fr-FR",label:"French (France)",flag:"🇫🇷"},{code:"de",label:"German",flag:"🇩🇪"},{code:"de-DE",label:"German (Germany)",flag:"🇩🇪"},{code:"it",label:"Italian",flag:"🇮🇹"},{code:"it-IT",label:"Italian (Italy)",flag:"🇮🇹"},{code:"pt",label:"Portuguese",flag:"🇵🇹"},{code:"pt-PT",label:"Portuguese (Portugal)",flag:"🇵🇹"},{code:"pt-BR",label:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"ru",label:"Russian",flag:"🇷🇺"},{code:"ru-RU",label:"Russian (Russia)",flag:"🇷🇺"},{code:"zh",label:"Chinese",flag:"🇨🇳"},{code:"zh-CN",label:"Chinese (Simplified)",flag:"🇨🇳"},{code:"zh-TW",label:"Chinese (Traditional)",flag:"🇹🇼"},{code:"ja",label:"Japanese",flag:"🇯🇵"},{code:"ja-JP",label:"Japanese (Japan)",flag:"🇯🇵"},{code:"ko",label:"Korean",flag:"🇰🇷"},{code:"ko-KR",label:"Korean (South Korea)",flag:"🇰🇷"},{code:"ar",label:"Arabic",flag:"🇸🇦"},{code:"ar-SA",label:"Arabic (Saudi Arabia)",flag:"🇸🇦"},{code:"hi",label:"Hindi",flag:"🇮🇳"},{code:"hi-IN",label:"Hindi (India)",flag:"🇮🇳"},{code:"bn",label:"Bengali",flag:"🇮🇳"},{code:"bn-IN",label:"Bengali (India)",flag:"🇮🇳"},{code:"gu",label:"Gujarati",flag:"🇮🇳"},{code:"gu-IN",label:"Gujarati (India)",flag:"🇮🇳"},{code:"ta",label:"Tamil",flag:"🇮🇳"},{code:"ta-IN",label:"Tamil (India)",flag:"🇮🇳"},{code:"te",label:"Telugu",flag:"🇮🇳"},{code:"te-IN",label:"Telugu (India)",flag:"🇮🇳"},{code:"ml",label:"Malayalam",flag:"🇮🇳"},{code:"ml-IN",label:"Malayalam (India)",flag:"🇮🇳"},{code:"kn",label:"Kannada",flag:"🇮🇳"},{code:"kn-IN",label:"Kannada (India)",flag:"🇮🇳"},{code:"mr",label:"Marathi",flag:"🇮🇳"},{code:"mr-IN",label:"Marathi (India)",flag:"🇮🇳"},{code:"pa",label:"Punjabi",flag:"🇮🇳"},{code:"pa-IN",label:"Punjabi (India)",flag:"🇮🇳"},{code:"ur",label:"Urdu",flag:"🇮🇳"},{code:"ur-IN",label:"Urdu (India)",flag:"🇮🇳"},{code:"or",label:"Odia",flag:"🇮🇳"},{code:"or-IN",label:"Odia (India)",flag:"🇮🇳"},{code:"as",label:"Assamese",flag:"🇮🇳"},{code:"as-IN",label:"Assamese (India)",flag:"🇮🇳"},{code:"zh-HK",label:"Chinese (Hong Kong)",flag:"🇭🇰"},{code:"nl",label:"Dutch",flag:"🇳🇱"},{code:"nl-NL",label:"Dutch (Netherlands)",flag:"🇳🇱"},{code:"pl",label:"Polish",flag:"🇵🇱"},{code:"pl-PL",label:"Polish (Poland)",flag:"🇵🇱"},{code:"sv",label:"Swedish",flag:"🇸🇪"},{code:"sv-SE",label:"Swedish (Sweden)",flag:"🇸🇪"},{code:"da",label:"Danish",flag:"🇩🇰"},{code:"da-DK",label:"Danish (Denmark)",flag:"🇩🇰"},{code:"no",label:"Norwegian",flag:"🇳🇴"},{code:"no-NO",label:"Norwegian (Norway)",flag:"🇳🇴"},{code:"fi",label:"Finnish",flag:"🇫🇮"},{code:"fi-FI",label:"Finnish (Finland)",flag:"🇫🇮"},{code:"tr",label:"Turkish",flag:"🇹🇷"},{code:"tr-TR",label:"Turkish (Turkey)",flag:"🇹🇷"},{code:"cs",label:"Czech",flag:"🇨🇿"},{code:"cs-CZ",label:"Czech (Czech Republic)",flag:"🇨🇿"},{code:"sk",label:"Slovak",flag:"🇸🇰"},{code:"sk-SK",label:"Slovak (Slovakia)",flag:"🇸🇰"},{code:"hu",label:"Hungarian",flag:"🇭🇺"},{code:"hu-HU",label:"Hungarian (Hungary)",flag:"🇭🇺"},{code:"ro",label:"Romanian",flag:"🇷🇴"},{code:"ro-RO",label:"Romanian (Romania)",flag:"🇷🇴"},{code:"el",label:"Greek",flag:"🇬🇷"},{code:"el-GR",label:"Greek (Greece)",flag:"🇬🇷"},{code:"th",label:"Thai",flag:"🇹🇭"},{code:"th-TH",label:"Thai (Thailand)",flag:"🇹🇭"},{code:"id",label:"Indonesian",flag:"🇮🇩"},{code:"id-ID",label:"Indonesian (Indonesia)",flag:"🇮🇩"},{code:"ms",label:"Malay",flag:"🇲🇾"},{code:"ms-MY",label:"Malay (Malaysia)",flag:"🇲🇾"},{code:"vi",label:"Vietnamese",flag:"🇻🇳"},{code:"vi-VN",label:"Vietnamese (Vietnam)",flag:"🇻🇳"},{code:"he",label:"Hebrew",flag:"🇮🇱"},{code:"he-IL",label:"Hebrew (Israel)",flag:"🇮🇱"}];eb=eb.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),eb.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const tb=eb.filter(e=>function(e){try{const t=new Intl.DateTimeFormat(e);return t.resolvedOptions().locale===e||t.resolvedOptions().locale.startsWith(e)}catch{return!1}}(e.code)).filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function rb(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=tb.find(e=>e.value==n);return e(Wy,{open:o,onOpenChange:i,children:[t(Gy,{asChild:!0,children:e(hl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s&&e("div",{children:[String(s.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&"Choose language",t(_o,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Hy,{className:"p-0 overflow-hidden text-ellipsis",children:e(eg,{children:[t(tg,{placeholder:"Choose timezone..."}),t(rg,{children:t(ng,{children:tb.map(o=>e(ag,{className:sl("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(Co,{className:sl("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const nb=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function ab(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=nb.find(e=>e.value==n);return e(Wy,{open:o,onOpenChange:i,children:[t(Gy,{asChild:!0,children:e(hl,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text||"Choose timezone",t(_o,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Hy,{className:"p-0 overflow-hidden text-ellipsis",children:e(eg,{children:[t(tg,{placeholder:"Choose timezone..."}),t(rg,{children:t(ng,{children:nb.map(o=>e(ag,{className:sl("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(Co,{className:sl("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim()]},o.value))})})]})})]})}const ob=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=Kw(),[o,i]=u(!1),[s,c]=u(),[l,f]=u(0),[p,m]=u(null),h=cr({resolver:yo(Vi({name:hi().min(2,{message:"Name must be at least 2 characters."}),country:hi().optional(),timezone:hi().optional(),language:hi().optional(),currency:hi().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return d(()=>{a().then(e=>{c(e),h.setValue("name",e.name),h.setValue("country",e.country),h.setValue("timezone",e.timezone),h.setValue("language",e.language),h.setValue("currency",e.currency)})},[l]),s?e("div",{children:[p&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:p})]}),t("div",{className:"space-y-4",children:t(af,{...h,children:e("form",{onSubmit:h.handleSubmit(async function(e){i(!0),m(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),m("Profile saved successfully"),setTimeout(()=>{m(null)},5e3)}catch(e){console.error("Failed to update profile:",e)}finally{i(!1)}}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(hf,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),t(sf,{disabled:o,control:h.control,name:"name",render:({field:r})=>e(df,{children:[t(uf,{children:"Name"}),t(ff,{children:t(hf,{...r})}),t(mf,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(rb,{value:h.getValues("language"),onChange:e=>{h.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(qy,{value:h.getValues("country"),onChange:e=>{h.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(Qy,{value:h.getValues("currency"),onChange:e=>{h.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(ab,{value:h.getValues("timezone"),onChange:e=>{h.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(hl,{type:"submit",progress:o,disabled:o,children:"Save"}),t(hl,{type:"button",variant:"outline",onClick:()=>{f(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),s?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):t(qm,{})},ib=e=>{const t=ke(e=>e.os),r=c(()=>new ze(t),[t.serverUrl,t.version,t.orgId]),[n,a]=u(null),[o,i]=u(!1),[s,f]=u(null),p=l(async()=>{if(e){i(!0),f(null);try{const t=await r.getCurrentSubscription(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";f(r),E(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{i(!1)}}else a(null)},[r,e]);return d(()=>{p()},[p]),{subscription:n,loading:o,error:s,refetch:p}},sb=(e,t)=>{const r=ke(e=>e.os),n=c(()=>new ze(r),[r.serverUrl,r.version,r.orgId]),[a,o]=u(null),[i,s]=u(!1),[f,p]=u(null),m=l(async()=>{if(e){s(!0),p(null);try{const r=t?await n.getPlanGroupByVersion(e,t):await n.getPlanGroup(e);o(r)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch plan group";p(n),E(r,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:t}})}finally{s(!1)}}else o(null)},[n,e,t]);return d(()=>{m()},[m]),{planGroup:a,loading:i,error:f,refetch:m}},cb=e=>{const t=ke(e=>e.os),r=c(()=>new ze(t),[t.serverUrl,t.version,t.orgId]),[n,a]=u(null),[o,i]=u(!1),[s,f]=u(null),p=l(async()=>{if(e){i(!0),f(null);try{const t=await r.getPlanGroupVersions(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";f(r),E(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{i(!1)}}else a(null)},[r,e]);return d(()=>{p()},[p]),{versions:n,loading:o,error:s,refetch:p}},lb=e=>{const t=ke(e=>e.os),r=c(()=>new ze(t),[t.serverUrl,t.version,t.orgId]),[n,a]=u(!1),[o,i]=u(null);return{createCheckoutSession:l(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),i(null);try{return await r.createCheckoutSession(e,t)}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw i(n),E(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:o}},db=e=>{const t=ke(e=>e.os),r=c(()=>new ze(t),[t.serverUrl,t.version,t.orgId]),[n,a]=u(!1),[o,i]=u(null),s=l(async(t,n)=>{if(!e)throw new Error("Workspace ID is required");a(!0),i(null);try{const a={planVersionId:t,...n?.billingInterval&&{billingInterval:n.billingInterval},...n?.successUrl&&{successUrl:n.successUrl},...n?.cancelUrl&&{cancelUrl:n.cancelUrl}};return await r.updateSubscription(e,a)}catch(r){const a=r instanceof Error?r.message:"Failed to update subscription";throw i(a),E(r,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:n}}),r}finally{a(!1)}},[r,e]);return{updateSubscription:s,loading:n,error:o}},ub=(e,t)=>{const r=ib(e),n=sb(e,t),a=db(e),o=l(async()=>{await Promise.all([r.refetch(),n.refetch()])},[r,n]);return{subscription:r.subscription,planGroup:n.planGroup,loading:r.loading||n.loading||a.loading,error:r.error||n.error||a.error,updateSubscription:a.updateSubscription,refetch:o}},fb=(e,t=10,r)=>{const n=ke(e=>e.os),a=c(()=>new ze(n),[n.serverUrl,n.version,n.orgId]),[o,i]=u([]),[s,f]=u(!1),[p,m]=u(!1),[h,g]=u(null),v=l(async()=>{if(!e)return i([]),void f(!1);m(!0),g(null);try{const n=await a.listInvoices(e,t,r);i(n.invoices||[]),f(n.has_more||!1)}catch(n){const a=n instanceof Error?n.message:"Failed to fetch invoices";g(a),E(n,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:t,startingAfter:r}})}finally{m(!1)}},[a,e,t,r]);return d(()=>{v()},[v]),{invoices:o,hasMore:s,loading:p,error:h,refetch:v}},pb=(e,t)=>{const r=ke(e=>e.os),n=c(()=>new ze(r),[r.serverUrl,r.version,r.orgId]),[a,o]=u(null),[i,s]=u(!1),[f,p]=u(null),m=l(async()=>{if(e&&t){s(!0),p(null);try{const r=await n.getInvoice(e,t);o(r.invoice)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch invoice";p(n),E(r,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:t}})}finally{s(!1)}}else o(null)},[n,e,t]);return d(()=>{m()},[m]),{invoice:a,loading:i,error:f,refetch:m}},mb=v(()=>Promise.resolve().then(function(){return Fk}).then(e=>({default:e.default}))),hb=(e,t="usd")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e/100),gb=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",vb=e=>{switch(e){case"paid":return"bg-green-100 text-green-800";case"open":return"bg-yellow-100 text-yellow-800";case"draft":case"void":default:return"bg-gray-100 text-gray-800";case"uncollectible":return"bg-red-100 text-red-800"}},yb=({workspace:n})=>{const a=n._id?.toString(),{subscription:o,loading:i,error:s,updateSubscription:l,refetch:d}=ub(a),{createCheckoutSession:f}=lb(a),{versions:p,loading:m,error:h,refetch:v}=cb(a),{invoices:y,loading:b,error:w,refetch:x}=fb(a,20),S=i||m,k=s||h,{currentVersion:E,latestVersion:A,hasNewerVersion:N,isDeprecated:C,whatsNew:_,plansToShow:T}=c(()=>{const e=p?.currentVersion,t=p?.availableVersions||[],r=null!==o?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const a=!!(r&&n&&e)&&n.version>e.version,i=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:a,isDeprecated:a&&r,whatsNew:n?.whatsNew,plansToShow:i}},[p,o?.subscription]),[R,P]=u(!1),[O,I]=u(null),[D,U]=u(null),[M,z]=u(!1),F=async()=>{await Promise.all([d(),v()])};if(S&&!o&&!p)return t(qm,{});const L=o?.planVersion?._id||null;return a?e("div",{className:"space-y-6",children:[k&&e("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[t("p",{className:"font-medium",children:"Error loading subscription data"}),t("p",{className:"text-sm",children:k}),t("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try refreshing the page."})]}),O&&e("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[t("p",{className:"font-medium",children:"Update failed"}),t("p",{className:"text-sm",children:O})]}),D&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:D})]}),C&&o?.subscription&&t("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e("div",{className:"flex items-start gap-3",children:[t("div",{className:"flex-shrink-0",children:t(Vo,{className:"h-5 w-5 text-amber-600"})}),e("div",{className:"flex-1",children:[t("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),t("p",{className:"text-sm text-amber-700 mb-2",children:"A new version of the pricing plans is now available. Please upgrade to one of the new plans below to continue receiving updates and support."}),e("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e("span",{children:["Current: Version ",E?.version||"N/A"]}),t("span",{children:"•"}),e("span",{children:["Latest: Version ",A?.version||"N/A"]})]}),_&&(_.newPlans.length>0||_.updatedPlans.length>0)&&e("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",A?.version,":"]}),e("div",{className:"space-y-1.5 text-xs text-amber-700",children:[_.newPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"New Plans: "}),t("span",{children:_.newPlans.map(e=>e.plan.name).join(", ")})]}),_.updatedPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"Updated Plans: "}),t("span",{children:_.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold",children:"Subscription"}),t("p",{className:"text-sm text-gray-600",children:"Manage your workspace subscription plan"})]}),e("div",{className:"flex items-center gap-2",children:[o?.subscription?t(hl,{variant:"outline",size:"sm",onClick:()=>z(!0),children:"Change Plan"}):T&&T.length>0?t(hl,{size:"sm",onClick:()=>z(!0),children:"View Pricing Plans"}):null,e(hl,{variant:"ghost",size:"sm",onClick:F,disabled:S,children:[t(Uo,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]}),o?.subscription?e("div",{className:"border rounded-lg p-4 space-y-3 "+(C?"border-amber-300 bg-amber-50/50":""),children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex-1",children:[e("div",{className:"flex items-center gap-2 mb-1",children:[t("div",{className:"font-medium",children:o.plan?.name||"No plan assigned"}),C&&e("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-800 border border-amber-200",children:[t(Vo,{className:"h-3 w-3"}),"Deprecated"]})]}),e("div",{className:"text-sm text-gray-600",children:["Status:"," ",t("span",{className:"font-medium "+("active"===o.subscription.subscriptionStatus?"text-green-600":"trialing"===o.subscription.subscriptionStatus?"text-blue-600":"text-red-600"),children:o.subscription.subscriptionStatus}),C&&e("span",{className:"ml-2 text-xs text-amber-600",children:["(Version ",E?.version||"N/A",")"]})]})]}),t("div",{className:"flex items-center gap-2",children:t(To,{className:"h-5 w-5 text-gray-400"})})]}),o.planVersion&&(()=>{const r=(e=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const t=[],r=[],n=[];return e.subscriptionItems.forEach(a=>{const o=a.slug;if("feature"===a.type){const r=e.features?.[o]??!1;t.push({item:a,enabled:r})}else if("limit"===a.type){const t=e.limits?.[o]??0;r.push({item:a,value:t})}else if("quota"===a.type){const t=e.quotas?.[o]??null;null!=t&&n.push({item:a,value:t})}}),{features:t,limits:r,quotas:n}})(o.planVersion);return e("div",{className:"mt-4 pt-4 border-t",children:[t("div",{className:"text-sm font-medium mb-3",children:"Current Plan Details"}),e("div",{className:"space-y-4 text-sm",children:[e("div",{children:[t("span",{className:"text-gray-600",children:"Plan:"})," ",t("span",{className:"font-medium",children:o.plan?.name||"N/A"})]}),r.features.length>0&&e("div",{children:[t("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Features:"}),t("ul",{className:"space-y-1.5",children:r.features.map(({item:r,enabled:n})=>e("li",{className:"flex items-start gap-2",children:[t("span",{className:n?"text-green-500 mt-0.5":"text-gray-300 mt-0.5",children:n?"✓":"○"}),e("div",{className:"flex-1",children:[t("div",{className:"font-medium",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500",children:r.description})]})]},r._id))})]}),r.limits.length>0&&e("div",{children:[t("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Limits:"}),t("ul",{className:"space-y-1.5",children:r.limits.map(({item:r,value:n})=>e("li",{className:"flex items-start gap-2",children:[t("span",{className:"text-gray-400 mt-0.5",children:"•"}),e("div",{className:"flex-1",children:[e("div",{children:[e("span",{className:"font-medium",children:[r.name,":"]})," ",t("span",{className:"text-gray-700",children:n})]}),r.description&&t("div",{className:"text-xs text-gray-500",children:r.description})]})]},r._id))})]}),r.quotas.length>0&&e("div",{children:[t("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Quotas:"}),t("ul",{className:"space-y-1.5",children:r.quotas.map(({item:r,value:n})=>{const a="object"==typeof n&&null!==n&&"included"in n?`${n.included} included${n.overage?`, ${n.overage} overage`:""}`:String(n);return e("li",{className:"flex items-start gap-2",children:[t("span",{className:"text-gray-400 mt-0.5",children:"•"}),e("div",{className:"flex-1",children:[e("div",{children:[e("span",{className:"font-medium",children:[r.name,":"]})," ",t("span",{className:"text-gray-700",children:a})]}),r.description&&t("div",{className:"text-xs text-gray-500",children:r.description})]})]},r._id)})})]})]})]})})()]}):t("div",{className:"border rounded-lg p-6 text-center",children:e("div",{className:"mb-4",children:[t(To,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),t("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]})})]}),o?.subscription&&(()=>{const n=y.filter(e=>e.invoice_pdf);return e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold",children:"Invoices"}),t("p",{className:"text-sm text-gray-600",children:"View and download your subscription invoices"})]}),e(hl,{variant:"ghost",size:"sm",onClick:x,disabled:b,children:[t(Uo,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),w&&e("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg",children:[t("p",{className:"font-medium",children:"Error loading invoices"}),t("p",{className:"text-sm",children:w})]}),b&&0===n.length?t("div",{className:"border rounded-lg p-6",children:t(qm,{})}):0===n.length?e("div",{className:"border rounded-lg p-6 text-center",children:[t(Po,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-sm text-gray-500",children:"No invoices with download option found"})]}):t("div",{className:"space-y-2",children:n.map(n=>{const a=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(n);return t("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e("div",{className:"flex items-center justify-between gap-4",children:[e("div",{className:"flex-1 min-w-0",children:[e("div",{className:"flex items-center gap-2 mb-1.5",children:[t("span",{className:"text-sm font-medium text-gray-900",children:n.description||`Invoice ${n.id.slice(-8)}`}),t("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${vb(n.status)}`,children:n.status.charAt(0).toUpperCase()+n.status.slice(1)})]}),e("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[t("span",{className:"font-medium text-gray-900",children:hb(n.amount_due,n.currency)}),n.created&&e(r,{children:[t("span",{className:"text-gray-300",children:"•"}),e("span",{children:["Created: ",gb(n.created)]})]}),n.due_date&&e(r,{children:[t("span",{className:"text-gray-300",children:"•"}),e("span",{children:["Due: ",gb(n.due_date)]})]}),n.amount_paid>0&&n.amount_due>0&&e(r,{children:[t("span",{className:"text-gray-300",children:"•"}),e("span",{className:"text-xs text-gray-500",children:["Paid: ",hb(n.amount_paid,n.currency)]})]})]})]}),t("div",{className:"flex items-center gap-2 flex-shrink-0",children:e(hl,{size:"sm",onClick:()=>window.open(n.hosted_invoice_url,"_blank"),className:a.color,children:[a.text,t(Ro,{className:"h-3 w-3 ml-1.5"})]})})]})},n.id)})})]})})(),T&&T.length>0&&t(g,{fallback:null,children:t(mb,{open:M,onOpenChange:z,planVersions:T,currentPlanVersionId:L||null,onSelectPlan:async e=>{if(a&&o?.planVersion?._id!==e){P(!0),I(null),U(null);try{let t,r,n;try{const e=new URL(window.location.href);t=e.toString(),r=e.toString()}catch{const e=window.location.protocol||"https:",n=window.location.host||window.location.hostname||"",a=`${e}//${n}${window.location.pathname||"/"}`;t=a,r=a}if(n=o?.subscription?await l(e,{billingInterval:"monthly",successUrl:t,cancelUrl:r}):await f({planVersionId:e,billingInterval:"monthly",successUrl:t,cancelUrl:r}),n&&"checkoutUrl"in n&&n.checkoutUrl)return void(window.location.href=n.checkoutUrl);U("Subscription updated successfully!"),await F()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";I(t)}finally{P(!1),setTimeout(()=>{I(null),U(null)},5e3)}}},loading:R||S})}),!p&&!S&&e("div",{className:"border rounded-lg p-4 text-center",children:[e("div",{className:"text-gray-500 mb-2",children:[t("p",{className:"font-medium",children:"Unable to load plan information"}),k&&e("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",k]}),!k&&t("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e(hl,{variant:"outline",size:"sm",onClick:F,disabled:S,className:"mt-4",children:[t(Uo,{className:"h-4 w-4 mr-2"}),"Retry"]})]})]}):t("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:t("p",{children:"Invalid workspace ID"})})};function bb(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ds(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wb=Symbol("radix.slottable");function xb(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===wb}var Sb=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"});n.forwardRef((e,r)=>t(Cl.span,{...e,ref:r,style:{...Sb,...e.style}})).displayName="VisuallyHidden";var kb=[" ","Enter","ArrowUp","ArrowDown"],Eb=[" ","Enter"],Ab="Select",[Nb,Cb,_b]=wf(Ab),[Tb]=vl(Ab,[_b,Xv]),Rb=Xv(),[Pb,Ob]=Tb(Ab),[Ib,Db]=Tb(Ab),Ub=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:v}=r,y=Rb(a),[b,w]=n.useState(null),[x,S]=n.useState(null),[k,E]=n.useState(!1),A=Sf(f),[N,C]=kl({prop:i,defaultProp:s??!1,onChange:c,caller:Ab}),[_,T]=kl({prop:l,defaultProp:d,onChange:u,caller:Ab}),R=n.useRef(null),P=!b||(v||!!b.closest("form")),[O,I]=n.useState(new Set),D=Array.from(O).map(e=>e.props.value).join(";");return t(my,{...y,children:e(Pb,{required:g,scope:a,trigger:b,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:E,contentId:xl(),value:_,onValueChange:T,open:N,onOpenChange:C,dir:A,triggerPointerDownPosRef:R,disabled:h,children:[t(Nb.Provider,{scope:a,children:t(Ib,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{I(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{I(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),P?e(bw,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:_,onChange:e=>T(e.target.value),disabled:h,form:v,children:[void 0===_?t("option",{value:""}):null,Array.from(O)]},D):null]})})};Ub.displayName=Ab;var Mb="SelectTrigger",zb=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=Rb(a),c=Ob(Mb,a),l=c.disabled||o,d=us(r,c.onTriggerChange),u=Cb(a),f=n.useRef("touch"),[p,m,h]=xw(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=Sw(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t(hy,{asChild:!0,...s,children:t(Cl.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":ww(c.value)?"":void 0,...i,ref:d,onClick:gl(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:gl(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:gl(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||kb.includes(e.key)&&(g(),e.preventDefault())})})})});zb.displayName=Mb;var Fb="SelectValue",Lb=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:c="",...l}=e,d=Ob(Fb,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=us(n,d.onValueNodeChange);return cs(()=>{u(f)},[u,f]),t(Cl.span,{...l,ref:p,style:{pointerEvents:"none"},children:ww(d.value)?t(r,{children:c}):s})});Lb.displayName=Fb;var jb=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(Cl.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});jb.displayName="SelectIcon";var $b=e=>t(Hl,{asChild:!0,...e});$b.displayName="SelectPortal";var Vb="SelectContent",Bb=n.forwardRef((e,r)=>{const a=Ob(Vb,e.__scopeSelect),[o,i]=n.useState();if(cs(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?b.createPortal(t(Gb,{scope:e.__scopeSelect,children:t(Nb.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(Zb,{...e,ref:r})});Bb.displayName=Vb;var Wb=10,[Gb,Hb]=Tb(Vb),Kb=function(e){const r=bb(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(xb);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("SelectContent.RemoveScroll"),Zb=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,w=Ob(Vb,a),[x,S]=n.useState(null),[k,E]=n.useState(null),A=us(r,e=>S(e)),[N,C]=n.useState(null),[_,T]=n.useState(null),R=Cb(a),[P,O]=n.useState(!1),I=n.useRef(!1);n.useEffect(()=>{if(x)return Gd(x)},[x]),ql();const D=n.useCallback(e=>{const[t,...r]=R().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[R,k]),U=n.useCallback(()=>D([N,x]),[D,N,x]);n.useEffect(()=>{P&&U()},[P,U]);const{onOpenChange:M,triggerPointerDownPosRef:z}=w;n.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():x.contains(r.target)||M(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[x,M,z]),n.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[F,L]=xw(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Sw(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&(C(e),n&&(I.current=!0))},[w.value]),$=n.useCallback(()=>x?.focus(),[x]),V=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&T(e)},[w.value]),B="popper"===o?qb:Jb,W=B===qb?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t(Gb,{scope:a,content:x,viewport:k,onViewportChange:E,itemRefCallback:j,selectedItem:N,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:U,selectedItemText:_,position:o,isPositioned:P,searchRef:F,children:t(Fd,{as:Kb,allowPinchZoom:!0,children:t(Ll,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:gl(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(Il,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(B,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...W,onPlaced:()=>O(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:gl(b.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||L(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});Zb.displayName="SelectContentImpl";var Jb=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=Ob(Vb,a),c=Hb(Vb,a),[l,d]=n.useState(null),[u,f]=n.useState(null),p=us(r,e=>f(e)),m=Cb(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=c,x=n.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=b.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-Wb,u=hp(o,[Wb,Math.max(Wb,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-Wb,u=hp(o,[Wb,Math.max(Wb,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const a=m(),i=window.innerHeight-2*Wb,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),E=parseInt(S.paddingBottom,10),A=e.top+e.height/2-Wb,N=i-A,C=y.offsetHeight/2,_=f+p+(y.offsetTop+C),T=w-_;if(_<=A){const e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=_+Math.max(N,C+(e?E:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;l.style.top="0px";const t=Math.max(A,f+v.offsetTop+(e?k:0)+C)+T;l.style.height=t+"px",v.scrollTop=_-A+v.offsetTop}l.style.margin=`${Wb}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,v,y,b,s.dir,o]);cs(()=>x(),[x]);const[S,k]=n.useState();cs(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const E=n.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t(Yb,{scope:a,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:E,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:t(Cl.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Jb.displayName="SelectItemAlignedPosition";var qb=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=Wb,...i}=e,s=Rb(n);return t(gy,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}})});qb.displayName="SelectPopperPosition";var[Yb,Xb]=Tb(Vb,{}),Qb="SelectViewport",ew=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...c}=a,l=Hb(Qb,i),d=Xb(Qb,i),u=us(o,l.onViewportChange),f=n.useRef(0);return e(r,{children:[t("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}),t(Nb.Slot,{scope:i,children:t(Cl.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:gl(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Wb,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});ew.displayName=Qb;var tw="SelectGroup",[rw,nw]=Tb(tw);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=xl();return t(rw,{scope:n,id:o,children:t(Cl.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=tw;var aw="SelectLabel",ow=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=nw(aw,n);return t(Cl.div,{id:o.id,...a,ref:r})});ow.displayName=aw;var iw="SelectItem",[sw,cw]=Tb(iw),lw=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...c}=e,l=Ob(iw,a),d=Hb(iw,a),u=l.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=us(r,e=>d.itemRefCallback?.(e,o,i)),v=xl(),y=n.useRef("touch"),b=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t(sw,{scope:a,value:o,disabled:i,textId:v,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(Nb.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(Cl.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:g,onFocus:gl(c.onFocus,()=>h(!0)),onBlur:gl(c.onBlur,()=>h(!1)),onClick:gl(c.onClick,()=>{"mouse"!==y.current&&b()}),onPointerUp:gl(c.onPointerUp,()=>{"mouse"===y.current&&b()}),onPointerDown:gl(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:gl(c.onPointerMove,e=>{y.current=e.pointerType,i?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:gl(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:gl(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Eb.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});lw.displayName=iw;var dw="SelectItemText",uw=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:c,...l}=a,d=Ob(dw,i),u=Hb(dw,i),f=cw(dw,i),p=Db(dw,i),[m,h]=n.useState(null),g=us(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),v=m?.textContent,y=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:v},f.value),[f.disabled,f.value,v]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return cs(()=>(w(y),()=>x(y)),[w,x,y]),e(r,{children:[t(Cl.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?b.createPortal(l.children,d.valueNode):null]})});uw.displayName=dw;var fw="SelectItemIndicator",pw=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return cw(fw,n).isSelected?t(Cl.span,{"aria-hidden":!0,...a,ref:r}):null});pw.displayName=fw;var mw="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=Hb(mw,e.__scopeSelect),o=Xb(mw,e.__scopeSelect),[i,s]=n.useState(!1),c=us(r,o.onScrollButtonChange);return cs(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(gw,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=mw;var hw="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=Hb(hw,e.__scopeSelect),o=Xb(hw,e.__scopeSelect),[i,s]=n.useState(!1),c=us(r,o.onScrollButtonChange);return cs(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(gw,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=hw;var gw=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=Hb("SelectScrollButton",a),c=n.useRef(null),l=Cb(a),d=n.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),cs(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t(Cl.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:gl(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:gl(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:gl(i.onPointerLeave,()=>{d()})})}),vw=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(Cl.div,{"aria-hidden":!0,...a,ref:r})});vw.displayName="SelectSeparator";var yw="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Rb(n),i=Ob(yw,n),s=Hb(yw,n);return i.open&&"popper"===s.position?t(vy,{...o,...a,ref:r}):null}).displayName=yw;var bw=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=us(o,i),c=Vf(r);return n.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),t(Cl.select,{...a,style:{...Sb,...a.style},ref:s,defaultValue:r})});function ww(e){return""===e||void 0===e}function xw(e){const t=ss(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function Sw(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}bw.displayName="SelectBubbleInput";var kw=zb,Ew=jb,Aw=$b,Nw=Bb,Cw=ew,_w=ow,Tw=lw,Rw=uw,Pw=pw,Ow=vw;const Iw=Ub,Dw=n.forwardRef(({className:r,children:n,...a},o)=>e(kw,{ref:o,className:sl("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),...a,children:[n,t(Ew,{asChild:!0,children:t(Fu,{className:"h-4 w-4 opacity-50"})})]}));Dw.displayName=kw.displayName;const Uw=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(Ie);return t(Aw,{container:s,children:t(Nw,{ref:i,className:sl("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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","popper"===a&&"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:a,...o,children:t(Cw,{className:sl("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Uw.displayName=Nw.displayName;n.forwardRef(({className:e,...r},n)=>t(_w,{ref:n,className:sl("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=_w.displayName;const Mw=n.forwardRef(({className:r,children:n,...a},o)=>e(Tw,{ref:o,className:sl("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(Pw,{children:t(ju,{className:"h-4 w-4"})})}),t(Rw,{children:n})]}));Mw.displayName=Tw.displayName;n.forwardRef(({className:e,...r},n)=>t(Ow,{ref:n,className:sl("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=Ow.displayName;const zw=({workspace:r})=>{const n=ke(e=>e.auth.session?.user||null),[a,o]=u(0),[i,s]=u(!1),[c,l]=u([]),[f,p]=u(null),{getUsers:m,removeUser:h,updateUser:g}=Kw(),{settings:v}=im();d(()=>{r&&(s(!0),m(r._id).then(e=>{l(e)}).catch(e=>{console.error(e)}).finally(()=>{s(!1)}))},[r,a]);const y=()=>{o(e=>e+1)};if(i||!r)return t(qm,{});const b=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},w=c.map(e=>({...e,...b(e.user)})),x=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,S="admin"===x,k=(v?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e("div",{children:[!S&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),S&&e("div",{className:"mb-4",children:[k&&t(Fw,{onInvite:y,workspaceId:r._id}),!k&&t("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),t("div",{children:t(hl,{variant:"ghost",size:"sm",onClick:y,progress:i,startIcon:t(Uo,{}),children:"Refresh"})})]}),t("ul",{className:"space-y-2",children:w.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[e("div",{className:"relative",children:[e(Iw,{disabled:i||!S||s||f===a.id,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(Zm(r,n)?E(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):(p(n),g(t,n,{role:o}).then(()=>{y()}).catch(e=>{E(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}).finally(()=>{p(null)})));var t,n,o},children:[t(Dw,{children:t(Lb,{placeholder:"Select a role"})}),t(Uw,{children:r?.roles.map(e=>t(Mw,{value:e,children:e},e))})]}),f===a.id&&t("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:t(Io,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&S&&t(hl,{variant:"destructive",size:"sm",startIcon:t($o,{}),onClick:()=>{var e;e=a.id,Zm(r,e)?E(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):h(r._id,e).then(()=>{y()}).catch(t=>{E(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===c.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function Fw({onInvite:r,workspaceId:n}){const[a,o]=u(""),[i,s]=u("admin"),[c,l]=u(!1),[f,p]=u(null),[m,h]=u(null),{addUser:g,getWorkspace:v}=Kw(),[y,b]=u(null),{settings:w}=im(),x=w?.workspace.roles??y?.roles??[];d(()=>{n&&v(n).then(b)},[n]);const S=()=>{p(null),h(null),o(""),s("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[f&&t("div",{className:"text-red-500 capitalize",children:f}),m&&t("div",{className:"text-green-500 capitalize",children:m}),e("div",{children:[t(nf,{children:"Invite member by email"}),t(hf,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(nf,{children:"Role"}),e(Iw,{value:i,onValueChange:s,children:[t(Dw,{children:t(Lb,{placeholder:"Select a role"})}),t(Uw,{children:x.map(e=>t(Mw,{value:e,children:e},e))})]})]}),t("div",{children:t(hl,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void p("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await g(n,e,i).then(()=>{h("User invited successfully"),r?.()}).catch(e=>{console.error(e),p(e.message||"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{S()},6e3)})):p("Invalid email address format")},disabled:c||!a||!i,children:c?"Inviting...":`Invite as ${i}`})})]})}const Lw=({workspace:r,section:n,setSection:a})=>{const o=ke(e=>e.auth.session?.user||null),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id;return e("div",{className:"w-56 h-full flex flex-col space-y-6",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:sl("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(jw,{title:"Account",children:t($w,{activeSection:n,icon:t(Bo,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(jw,{title:"Workspace",children:[t($w,{activeSection:n,icon:t(zo,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t($w,{activeSection:n,icon:t(Wo,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t($w,{activeSection:n,icon:t(To,{className:"h-3.5 w-3.5"}),label:"Subscription",section:"subscription",onClick:()=>a("subscription")}),t($w,{activeSection:n,icon:t(Lo,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),i&&t($w,{activeSection:n,icon:t(Vo,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function jw({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function $w({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:sl("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===o?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const Vw=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[f,p]=u(!1),[m,h]=u(i),g=void 0!==a?a:f,v=o||p,y=void 0!==s?s:m,b=c||h;if(!r)return null;const w=t(hl,{variant:"outline",size:"icon",children:t(zo,{className:"h-4 w-4"})});return e(Gu,{open:g,onOpenChange:e=>{v(e),!e&&n&&n()},children:[l&&t(Hu,{asChild:!0,children:d||w}),e(Ju,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[t(Xu,{className:"sr-only",children:"Workspace settings dialog"}),t(Lw,{workspace:r,section:y,setSection:b}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(Yu,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===y&&"Account","general"===y&&"Workspace Settings","users"===y&&"Workspace Members","subscription"===y&&"Subscription","features"===y&&"Workspace Features","danger"===y&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===y&&t(ob,{workspace:r}),"general"===y&&t(ph,{workspace:r}),"users"===y&&t(zw,{workspace:r}),"subscription"===y&&t(yb,{workspace:r}),"features"===y&&t(dh,{workspaceId:r._id?.toString()}),"danger"===y&&t(Ym,{workspace:r})]})]})]})]})};var Bw=Object.freeze({__proto__:null,WorkspaceSettingsDialog:Vw,default:Vw});function Ww(n){const{workspaces:a,currentWorkspace:o,loading:i,refreshing:s}=ke(e=>e.workspaces),c=ke(e=>e.auth.session?.user),{settings:l}=im(),[f,p]=u(!1),[m,h]=u(0),[g,v]=u(""),{fetchWorkspaces:y,getFeatures:b,refreshWorkspaces:w,setCurrentWorkspace:x,workspaces:S}=Kw(),k=i||s;d(()=>{0===S.length?(y(),b()):b()},[]),d(()=>{m>0&&w()},[m]);const E=S.length>0?S:a,A=E.filter(e=>e._id!==o?._id).filter(e=>e.name.toLowerCase().includes(g.toLowerCase())),N=l?.workspace.maxWorkspaces??Number.MAX_VALUE,C=E?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===c?.id?.toString()).length,_=N>(C??0);return e(Gu,{open:f,onOpenChange:p,children:[t(Hu,{children:n.trigger?.(k,o)}),e(Ju,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(qu,{children:[e(Yu,{className:"flex items-center gap-2",children:[t(No,{className:"h-5 w-5"}),"Switch Workspace"]}),t(Xu,{children:"Select a workspace to switch to or create a new one."})]}),!c&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&e("div",{className:"flex flex-col gap-4",children:[o&&t(Gw,{workspace:o,isCurrentWorkspace:!0,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:x,setOpen:p,workspacesToUse:E}),t(om,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",A.length,")"]}),t("div",{children:t(hl,{progress:s,disabled:s,variant:"ghost",onClick:function(){h(e=>e+1)},startIcon:t(Uo,{}),children:s?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(Mo,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(hf,{placeholder:"Search workspaces...",value:g,onChange:e=>v(e.target.value),className:"pl-10"})]}),i?e("div",{className:"flex items-center justify-center py-8",children:[t(Io,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===A.length?e("div",{className:"text-center py-8",children:[t(No,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:g?"No workspaces found":"No workspaces available"})]}):t(Xp,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:A.map(e=>{const r=e._id===o?._id;return t(Gw,{workspace:e,isCurrentWorkspace:r,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:x,setOpen:p,workspacesToUse:E},e._id)})})})]}),_&&e(r,{children:[t(om,{}),t(Hw,{onCreated:()=>{y()}})]})]})]})]})}function Gw(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i}=r,s=r.isCurrentWorkspace??!1,[c,l]=u(!1);return e("div",{className:sl("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":s}),children:[e(cl,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(ll,{src:n.image&&n.image.trim()?n.image:void 0})}),t(dl,{children:(d=n.name,d.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(Wo,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]})]}),e("div",{className:"flex items-center gap-2",children:[s?null:t(hl,{size:"sm",disabled:c,progress:c,onClick:()=>{l(!0),r.onWorkspaceChange(n).then(()=>{a(n),o(!1)}).catch(e=>{E(e,{component:"WorkspaceItem",action:"onWorkspaceChange",metadata:{workspaceId:n._id}})}).finally(()=>{l(!1)})},children:"Switch to"}),t(Vw,{workspace:n,onClose:()=>{if(s){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var d}function Hw(n){const[a,o]=u(!1),[i,s]=u("emoji"),[c,l]=u("🏢"),[d,f]=u(!1),{createWorkspace:p}=Kw(),m=cr({resolver:yo(Vi({name:hi().min(2,{message:"Workspace name must be at least 2 characters."}),image:hi().optional()})),defaultValues:{name:"",image:""}});return e(Gu,{open:a,onOpenChange:o,children:[t(Hu,{asChild:!0,children:e(hl,{className:"w-full rounded-none",children:[t(Do,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(Ju,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(qu,{children:[t(Yu,{children:"Create New Workspace"}),t(Xu,{children:"Create a new workspace to get started."})]}),t(af,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){let t="";if("emoji"===i)t=uh(c);else if("url"===i&&e.image)try{new URL(e.image),t=e.image}catch{return void m.setError("image",{message:"Please enter a valid URL"})}f(!0);try{await p(e.name,t),o(!1),m.reset(),l("🏢"),s("emoji"),n?.onCreated?.()}catch(e){console.error("Failed to create workspace:",e)}finally{f(!1)}}),children:[t(sf,{control:m.control,name:"name",render:({field:r})=>e(df,{children:[t(uf,{children:"Workspace Name"}),t(ff,{children:t(hf,{placeholder:"My Awesome Workspace",...r})}),t(mf,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(nf,{className:"text-sm font-medium",children:"Workspace Icon"}),t(pf,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(pp,{value:i,onValueChange:e=>s(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(mp,{value:"emoji",id:"emoji"}),e(nf,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Fo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(mp,{value:"url",id:"url"}),e(nf,{htmlFor:"url",className:"flex items-center gap-2",children:[t(Oo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===i&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),t(Xp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:fh.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",uh(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===i&&e("div",{className:"flex flex-col gap-y-2",children:[t(sf,{control:m.control,name:"image",render:({field:r})=>e(df,{children:[t(uf,{children:"Image URL"}),t(ff,{children:t(hf,{placeholder:"https://example.com/image.png",...r})}),t(pf,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(mf,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(hl,{type:"button",variant:"outline",onClick:()=>{o(!1),m.reset(),l("🏢"),s("emoji")},disabled:d,children:"Cancel"}),t(hl,{type:"submit",disabled:d,children:d?e(r,{children:[t(Io,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const Kw=()=>{const e=Ee(),t=ke(e=>e.os),r=c(()=>new ze(t),[t.serverUrl,t.version,t.orgId]),n=ke(e=>e.workspaces),o=ke(e=>e.auth.session?.user),i=l(t=>{if(t._id!==n.currentWorkspace?._id&&t){const r=n.currentWorkspace;e.workspaces(le(t)),Oe.emitWorkspaceChanged(t,r).catch(e=>{E(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]);d(()=>{if(!n.isInitialized){const t=Hm();if(e.workspaces(ue(!0)),t){const e=n.workspaces.find(e=>e._id===t);if(e){if(e._id===n.currentWorkspace?._id)return;i(e)}}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,i]);const s=l(()=>{e.workspaces(de())},[e]),u=a.useRef(!1),f=a.useRef(!1),p=l(async()=>{if(!n.loading&&!u.current){u.current=!0,e.workspaces(fe(!0)),e.workspaces(pe(null));try{const t=await r.getWorkspaces();if(e.workspaces(se(t)),t.length>0){const e=Hm();if(e&&Km(e,t)){const r=t.find(t=>t._id===e);r&&i(r)}else t.length>0&&(n.currentWorkspace||i(t[0]))}}catch(t){e.workspaces(pe(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(fe(!1)),u.current=!1}}},[r,n.loading,n.currentWorkspace?._id,e,i]),m=l(async()=>{if(!n.refreshing&&!u.current){u.current=!0,e.workspaces(me(!0));try{const t=await r.getWorkspaces();e.workspaces(se(t))}catch(e){}finally{e.workspaces(me(!1)),u.current=!1}}},[r,n.refreshing,e]),h=l(async(t,a)=>{const o=await r.createWorkspace({name:t,image:a});e.workspaces(se([...n.workspaces,o])),Oe.emitWorkspaceCreated(o).catch(e=>{E(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),g=l(async(t,a)=>{const o=await r.updateWorkspace(t._id,a);e.workspaces(se(n.workspaces.map(e=>e._id===t._id?o:e))),Oe.emitWorkspaceUpdated(o).catch(e=>{E(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),v=l(async()=>{if(f.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;f.current=!0;try{const t=await r.getFeatures();return e.workspaces(ce(t)),t}catch(e){return E(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{f.current=!1}},[r,e,n.allFeatures]),y=l(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const e=n.currentWorkspace._id,t=n.workspaces.find(t=>t._id===e);if(t)t!==n.currentWorkspace&&i(t);else if(n.workspaces.length>0){const t=n.workspaces[0];t._id!==e&&i(t)}},[n.workspaces,n.currentWorkspace,i]);const b=l(async e=>await r.getWorkspaceUsers(e),[r]),w=l(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&Oe.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{E(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),o},[r,n.workspaces]),x=l(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&Zm(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;Oe.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{E(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return i},[r,n.workspaces]),S=l(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&Zm(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&Oe.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{E(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),k=l(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return Oe.emitUserUpdated(n,t||void 0).catch(e=>{E(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),A=l(async()=>await r.getProfile(),[r]),N=l(async e=>await r.getWorkspace(e),[r]),C=l(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!Zm(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(se(n.workspaces.filter(e=>e._id!==t))),n.currentWorkspace?._id===t&&e.workspaces(de()),a&&Oe.emitWorkspaceDeleted(a).catch(e=>{E(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:p,refreshWorkspaces:m,refreshing:n.refreshing,WorkspaceSwitcher:Ww,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,resetCurrentWorkspace:s,createWorkspace:h,allFeatures:n.allFeatures,getFeatures:v,updateFeature:y,getWorkspace:N,switching:n.switching,updateWorkspace:g,getUsers:b,addUser:w,removeUser:x,updateUser:S,getProfile:A,updateUserProfile:k,deleteWorkspace:C}};const Zw=new class{constructor(){this.listeners=new Set,this.currentState={open:!1,section:"profile"}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getState(){return{...this.currentState}}openWorkspaceSettings(e){this.currentState={open:!0,section:e||"profile"},this.notifyListeners()}closeSettings(){this.currentState={...this.currentState,open:!1},this.notifyListeners()}setSection(e){this.currentState={...this.currentState,section:e},this.notifyListeners()}notifyListeners(){this.listeners.forEach(e=>{e(this.currentState.open,this.currentState.section)})}},Jw=v(()=>Promise.resolve().then(function(){return Bw}).then(e=>({default:e.default}))),qw=({children:n})=>{const{currentWorkspace:a}=Kw(),[o,i]=u(!1),[s,c]=u("profile");return d(()=>{const e=Zw.getState();i(e.open),c(e.section);return Zw.subscribe((e,t)=>{i(e),c(t)})},[]),e(r,{children:[n,a&&o&&t(g,{fallback:null,children:t(Jw,{workspace:a,open:o,onOpenChange:e=>{e||Zw.closeSettings()},section:s,onSectionChange:e=>{Zw.setSection(e)},showTrigger:!1})})]})},Yw=(e,t,r)=>{if(t!==x.V1)throw new Error(`Invalid version: "${t}". Only "${x.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},Xw=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{Yw(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),c=a.useMemo(()=>o?.callbacks,[o?.callbacks]),l=a.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return d(()=>(Oe.setCallbacks(l?{handleEvent:l}:null),()=>{Oe.setCallbacks(null)}),[l]),t(N,{children:t(Se,{children:t(Re,{callbacks:c,children:t(De,{children:t(Pe,{config:s,auth:o,children:t(Me,{children:t(qw,{children:i})})})})})})})});Xw.displayName="SaaSOSProvider";let Qw=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await Ce(`${this.serverUrl}/api/${this.version}/beta/config?orgId=${this.orgId}`);if(!e.ok)throw new Error(`Failed to fetch beta form configuration: ${e.statusText}`);return e.json()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),o=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0),i=await Ce(`${this.serverUrl}/api/${this.version}/beta/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:o}})});if(!i.ok)throw new Error(`Failed to submit beta user request: ${i.statusText}`);return i.json()}};const ex=Vi({name:hi().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[a-zA-Z\s]*$/,"Name can only contain letters and spaces"),email:hi().min(1,"Please enter your email address").email("Please enter a valid email address").max(100,"Email must be less than 100 characters").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"Please enter a valid email format (e.g., name@domain.com)")}),tx={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}},rx=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:c={},autoFocus:f=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,v]=u("en"),[y,b]=u(!1),[w,x]=u(!1),{submitBetaForm:S,isLoading:k,isSubmitting:E,error:A,config:N,success:C,message:_}=(()=>{const e=ke(e=>e.os),[t,r]=u(null),[n,a]=u(!0),[o,i]=u(!1),[s,c]=u(null),[f,p]=u(!1),[m,h]=u(null);return d(()=>{(async()=>{a(!0);const t=new Qw(e),n=await t.fetchConfig();r(n),a(!1)})()},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:f,message:m,submitBetaForm:l(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),p(!1),h(null);const r=new Qw(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{v((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(tx).indexOf(e)?e:"en"})())},[]),d(()=>{C&&p&&(b(!0),x(!0)),A&&x(!0)},[C,p,A]);const T={...tx[s||g],...c},R=cr({resolver:yo(ex),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{f&&R.setFocus("name")},[f,R]);const P=R.formState.isValid&&!E;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{className:sl("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",o),children:[t(Jm,{className:"h-24 w-24 rounded-lg"}),t(Jm,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(Jm,{className:"h-4 w-16"}),t(Jm,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(Jm,{className:"h-4 w-16"}),t(Jm,{className:"h-10 w-full"})]}),t(Jm,{className:"h-10 w-full"})]})]}:{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[N?.logo&&t(ax,{logo:N?.logo}),N?.name&&t("div",{children:N?.name})]}),t(yt,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await S(e);t.success?(n?.(),R.reset(),p&&b(!0),x(!0)):(a?.(t.message),x(!0))}catch(e){a?.(e instanceof Error?e.message:T.errorMessage),x(!0)}}),className:o,noValidate:!0,"aria-busy":E,children:[!w&&e(r,{children:[!h&&N?.screen?.register&&t(nx,{screen:N?.screen?.register}),t(sf,{control:R.control,name:"name",render:({field:r})=>e(df,{className:i,children:[t(uf,{children:T.nameLabel}),t(ff,{children:t(hf,{...r})}),t(pf,{}),t(mf,{})]})}),t(sf,{control:R.control,name:"email",render:({field:r})=>e(df,{className:i,children:[t(uf,{children:T.emailLabel}),t(ff,{children:t(hf,{...r})}),t(pf,{}),t(mf,{})]})}),t(hl,{type:"submit",disabled:!P,className:i,children:E?T.submittingText:T.submitText})]}),w&&A&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),A]}),t("div",{className:"mt-4 flex justify-center",children:t(hl,{type:"button",onClick:()=>{x(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&y&&_&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:N?.screen?.thankYou&&t(nx,{screen:N?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:N?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:N?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function nx({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function ax({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function ox(e,t){return function(){return e.apply(t,arguments)}}const{toString:ix}=Object.prototype,{getPrototypeOf:sx}=Object,{iterator:cx,toStringTag:lx}=Symbol,dx=(ux=Object.create(null),e=>{const t=ix.call(e);return ux[t]||(ux[t]=t.slice(8,-1).toLowerCase())});var ux;const fx=e=>(e=e.toLowerCase(),t=>dx(t)===e),px=e=>t=>typeof t===e,{isArray:mx}=Array,hx=px("undefined");function gx(e){return null!==e&&!hx(e)&&null!==e.constructor&&!hx(e.constructor)&&bx(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vx=fx("ArrayBuffer");const yx=px("string"),bx=px("function"),wx=px("number"),xx=e=>null!==e&&"object"==typeof e,Sx=e=>{if("object"!==dx(e))return!1;const t=sx(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||lx in e||cx in e)},kx=fx("Date"),Ex=fx("File"),Ax=fx("Blob"),Nx=fx("FileList"),Cx=fx("URLSearchParams"),[_x,Tx,Rx,Px]=["ReadableStream","Request","Response","Headers"].map(fx);function Ox(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),mx(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(gx(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function Ix(e,t){if(gx(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const Dx="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ux=e=>!hx(e)&&e!==Dx;const Mx=(zx="undefined"!=typeof Uint8Array&&sx(Uint8Array),e=>zx&&e instanceof zx);var zx;const Fx=fx("HTMLFormElement"),Lx=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),jx=fx("RegExp"),$x=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ox(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Vx=fx("AsyncFunction"),Bx=(Wx="function"==typeof setImmediate,Gx=bx(Dx.postMessage),Wx?setImmediate:Gx?(Hx=`axios@${Math.random()}`,Kx=[],Dx.addEventListener("message",({source:e,data:t})=>{e===Dx&&t===Hx&&Kx.length&&Kx.shift()()},!1),e=>{Kx.push(e),Dx.postMessage(Hx,"*")}):e=>setTimeout(e));var Wx,Gx,Hx,Kx;const Zx="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Dx):"undefined"!=typeof process&&process.nextTick||Bx;var Jx={isArray:mx,isArrayBuffer:vx,isBuffer:gx,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||bx(e.append)&&("formdata"===(t=dx(e))||"object"===t&&bx(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&vx(e.buffer),t},isString:yx,isNumber:wx,isBoolean:e=>!0===e||!1===e,isObject:xx,isPlainObject:Sx,isEmptyObject:e=>{if(!xx(e)||gx(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:_x,isRequest:Tx,isResponse:Rx,isHeaders:Px,isUndefined:hx,isDate:kx,isFile:Ex,isBlob:Ax,isRegExp:jx,isFunction:bx,isStream:e=>xx(e)&&bx(e.pipe),isURLSearchParams:Cx,isTypedArray:Mx,isFileList:Nx,forEach:Ox,merge:function e(){const{caseless:t,skipUndefined:r}=Ux(this)&&this||{},n={},a=(a,o)=>{const i=t&&Ix(n,o)||o;Sx(n[i])&&Sx(a)?n[i]=e(n[i],a):Sx(a)?n[i]=e({},a):mx(a)?n[i]=a.slice():r&&hx(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Ox(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Ox(t,(t,n)=>{r&&bx(t)?Object.defineProperty(e,n,{value:ox(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&sx(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:dx,kindOfTest:fx,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(mx(e))return e;let t=e.length;if(!wx(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[cx]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Fx,hasOwnProperty:Lx,hasOwnProp:Lx,reduceDescriptors:$x,freezeMethods:e=>{$x(e,(t,r)=>{if(bx(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];bx(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return mx(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ix,global:Dx,isContextDefined:Ux,isSpecCompliantForm:function(e){return!!(e&&bx(e.append)&&"FormData"===e[lx]&&e[cx])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(xx(e)){if(t.indexOf(e)>=0)return;if(gx(e))return e;if(!("toJSON"in e)){t[n]=e;const a=mx(e)?[]:{};return Ox(e,(e,t)=>{const o=r(e,n+1);!hx(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Vx,isThenable:e=>e&&(xx(e)||bx(e))&&bx(e.then)&&bx(e.catch),setImmediate:Bx,asap:Zx,isIterable:e=>null!=e&&bx(e[cx])};let qx=class e extends Error{static from(t,r,n,a,o,i){const s=new e(t.message,r||t.code,n,a,o);return s.cause=t,s.name=t.name,i&&Object.assign(s,i),s}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Jx.toJSONObject(this.config),code:this.code,status:this.status}}};qx.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",qx.ERR_BAD_OPTION="ERR_BAD_OPTION",qx.ECONNABORTED="ECONNABORTED",qx.ETIMEDOUT="ETIMEDOUT",qx.ERR_NETWORK="ERR_NETWORK",qx.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",qx.ERR_DEPRECATED="ERR_DEPRECATED",qx.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",qx.ERR_BAD_REQUEST="ERR_BAD_REQUEST",qx.ERR_CANCELED="ERR_CANCELED",qx.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",qx.ERR_INVALID_URL="ERR_INVALID_URL";function Yx(e){return Jx.isPlainObject(e)||Jx.isArray(e)}function Xx(e){return Jx.endsWith(e,"[]")?e.slice(0,-2):e}function Qx(e,t,r){return e?e.concat(t).map(function(e,t){return e=Xx(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const eS=Jx.toFlatObject(Jx,{},null,function(e){return/^is[A-Z]/.test(e)});function tS(e,t,r){if(!Jx.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Jx.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Jx.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Jx.isSpecCompliantForm(t);if(!Jx.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Jx.isDate(e))return e.toISOString();if(Jx.isBoolean(e))return e.toString();if(!s&&Jx.isBlob(e))throw new qx("Blob is not supported. Use a Buffer instead.");return Jx.isArrayBuffer(e)||Jx.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(Jx.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Jx.isArray(e)&&function(e){return Jx.isArray(e)&&!e.some(Yx)}(e)||(Jx.isFileList(e)||Jx.endsWith(r,"[]"))&&(s=Jx.toArray(e)))return r=Xx(r),s.forEach(function(e,n){!Jx.isUndefined(e)&&null!==e&&t.append(!0===i?Qx([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!Yx(e)||(t.append(Qx(a,r,o),c(e)),!1)}const d=[],u=Object.assign(eS,{defaultVisitor:l,convertValue:c,isVisitable:Yx});if(!Jx.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Jx.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),Jx.forEach(r,function(r,o){!0===(!(Jx.isUndefined(r)||null===r)&&a.call(t,r,Jx.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function rS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function nS(e,t){this._pairs=[],e&&tS(e,this,t)}const aS=nS.prototype;function oS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function iS(e,t,r){if(!t)return e;const n=r&&r.encode||oS,a=Jx.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let i;if(i=o?o(t,a):Jx.isURLSearchParams(t)?t.toString():new nS(t,a).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}aS.append=function(e,t){this._pairs.push([e,t])},aS.toString=function(e){const t=e?function(t){return e.call(this,t,rS)}:rS;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class sS{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Jx.forEach(this.handlers,function(t){null!==t&&e(t)})}}var cS={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},lS={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:nS,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const dS="undefined"!=typeof window&&"undefined"!=typeof document,uS="object"==typeof navigator&&navigator||void 0,fS=dS&&(!uS||["ReactNative","NativeScript","NS"].indexOf(uS.product)<0),pS="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,mS=dS&&window.location.href||"http://localhost";var hS={...Object.freeze({__proto__:null,hasBrowserEnv:dS,hasStandardBrowserEnv:fS,hasStandardBrowserWebWorkerEnv:pS,navigator:uS,origin:mS}),...lS};function gS(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&Jx.isArray(n)?n.length:o,s)return Jx.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&Jx.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&Jx.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(Jx.isFormData(e)&&Jx.isFunction(e.entries)){const r={};return Jx.forEachEntry(e,(e,n)=>{t(function(e){return Jx.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const vS={transitional:cS,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=Jx.isObject(e);a&&Jx.isHTMLForm(e)&&(e=new FormData(e));if(Jx.isFormData(e))return n?JSON.stringify(gS(e)):e;if(Jx.isArrayBuffer(e)||Jx.isBuffer(e)||Jx.isStream(e)||Jx.isFile(e)||Jx.isBlob(e)||Jx.isReadableStream(e))return e;if(Jx.isArrayBufferView(e))return e.buffer;if(Jx.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return tS(e,new hS.classes.URLSearchParams,{visitor:function(e,t,r,n){return hS.isNode&&Jx.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Jx.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return tS(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(Jx.isString(e))try{return(t||JSON.parse)(e),Jx.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||vS.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Jx.isResponse(e)||Jx.isReadableStream(e))return e;if(e&&Jx.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw qx.from(e,qx.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:hS.classes.FormData,Blob:hS.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Jx.forEach(["delete","get","head","post","put","patch"],e=>{vS.headers[e]={}});const yS=Jx.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const bS=Symbol("internals");function wS(e){return e&&String(e).trim().toLowerCase()}function xS(e){return!1===e||null==e?e:Jx.isArray(e)?e.map(xS):String(e)}function SS(e,t,r,n,a){return Jx.isFunction(n)?n.call(this,t,r):(a&&(t=r),Jx.isString(t)?Jx.isString(n)?-1!==t.indexOf(n):Jx.isRegExp(n)?n.test(t):void 0:void 0)}let kS=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=wS(t);if(!a)throw new Error("header name must be a non-empty string");const o=Jx.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=xS(e))}const o=(e,t)=>Jx.forEach(e,(e,r)=>a(e,r,t));if(Jx.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Jx.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&yS[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(Jx.isObject(e)&&Jx.isIterable(e)){let r,n,a={};for(const t of e){if(!Jx.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?Jx.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=wS(e)){const r=Jx.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(Jx.isFunction(t))return t.call(this,e,r);if(Jx.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=wS(e)){const r=Jx.findKey(this,e);return!(!r||void 0===this[r]||t&&!SS(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=wS(e)){const a=Jx.findKey(r,e);!a||t&&!SS(0,r[a],a,t)||(delete r[a],n=!0)}}return Jx.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!SS(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return Jx.forEach(this,(n,a)=>{const o=Jx.findKey(r,a);if(o)return t[o]=xS(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=xS(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Jx.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Jx.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[bS]=this[bS]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=wS(e);t[n]||(!function(e,t){const r=Jx.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return Jx.isArray(e)?e.forEach(n):n(e),this}};function ES(e,t){const r=this||vS,n=t||r,a=kS.from(n.headers);let o=n.data;return Jx.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function AS(e){return!(!e||!e.__CANCEL__)}kS.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Jx.reduceDescriptors(kS.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Jx.freezeMethods(kS);let NS=class extends qx{constructor(e,t,r){super(null==e?"canceled":e,qx.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function CS(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new qx("Request failed with status code "+r.status,[qx.ERR_BAD_REQUEST,qx.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const _S=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=n[i];a||(a=c),r[o]=s,n[o]=c;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,c=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},TS=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},RS=e=>(...t)=>Jx.asap(()=>e(...t));var PS=hS.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,hS.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(hS.origin),hS.navigator&&/(msie|trident)/i.test(hS.navigator.userAgent)):()=>!0,OS=hS.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];Jx.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),Jx.isString(n)&&s.push(`path=${n}`),Jx.isString(a)&&s.push(`domain=${a}`),!0===o&&s.push("secure"),Jx.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function IS(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const DS=e=>e instanceof kS?{...e}:e;function US(e,t){t=t||{};const r={};function n(e,t,r,n){return Jx.isPlainObject(e)&&Jx.isPlainObject(t)?Jx.merge.call({caseless:n},e,t):Jx.isPlainObject(t)?Jx.merge({},t):Jx.isArray(t)?t.slice():t}function a(e,t,r,a){return Jx.isUndefined(t)?Jx.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!Jx.isUndefined(t))return n(void 0,t)}function i(e,t){return Jx.isUndefined(t)?Jx.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(DS(e),DS(t),0,!0)};return Jx.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,i=o(e[n],t[n],n);Jx.isUndefined(i)&&o!==s||(r[n]=i)}),r}var MS=e=>{const t=US({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=kS.from(i),t.url=iS(IS(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Jx.isFormData(r))if(hS.hasStandardBrowserEnv||hS.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Jx.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(hS.hasStandardBrowserEnv&&(n&&Jx.isFunction(n)&&(n=n(t)),n||!1!==n&&PS(t.url))){const e=a&&o&&OS.read(o);e&&i.set(a,e)}return t};var zS="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=MS(e);let a=n.data;const o=kS.from(n.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=kS.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());CS(function(e){t(e),m()},function(e){r(e),m()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new qx("Request aborted",qx.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new qx(n,qx.ERR_NETWORK,e,h);a.event=t||null,r(a),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||cS;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new qx(t,a.clarifyTimeoutError?qx.ETIMEDOUT:qx.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&Jx.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),Jx.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=_S(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([s,l]=_S(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new NS(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===hS.protocols.indexOf(v)?r(new qx("Unsupported protocol "+v+":",qx.ERR_BAD_REQUEST,e)):h.send(a||null)})};const FS=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof qx?t:new NS(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new qx(`timeout of ${t}ms exceeded`,qx.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>Jx.asap(i),s}},LS=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},jS=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},$S=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of jS(e))yield*LS(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:VS}=Jx,BS=(({Request:e,Response:t})=>({Request:e,Response:t}))(Jx.global),{ReadableStream:WS,TextEncoder:GS}=Jx.global,HS=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},KS=e=>{e=Jx.merge.call({skipUndefined:!0},BS,e);const{fetch:t,Request:r,Response:n}=e,a=t?VS(t):"function"==typeof fetch,o=VS(r),i=VS(n);if(!a)return!1;const s=a&&VS(WS),c=a&&("function"==typeof GS?(l=new GS,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&s&&HS(()=>{let e=!1;const t=new r(hS.origin,{body:new WS,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&HS(()=>Jx.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new qx(`Response type '${e}' is not supported`,qx.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=Jx.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Jx.isBlob(e))return e.size;if(Jx.isSpecCompliantForm(e)){const t=new r(hS.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Jx.isArrayBufferView(e)||Jx.isArrayBuffer(e)?e.byteLength:(Jx.isURLSearchParams(e)&&(e+=""),Jx.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:y,withCredentials:b="same-origin",fetchOptions:w}=MS(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let S=FS([c,l&&l.toAbortSignal()],m),k=null;const E=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let A;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(A=await p(y,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(Jx.isFormData(s)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=TS(A,_S(RS(g)));s=$S(t.body,65536,e,r)}}Jx.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:S,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};k=o&&new r(a,c);let l=await(o?x(k,w):x(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Jx.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&TS(t,_S(RS(h),!0))||[];l=new n($S(l.body,65536,r,()=>{a&&a(),E&&E()}),e)}v=v||"text";let N=await f[Jx.findKey(f,v)||"text"](l,e);return!m&&E&&E(),await new Promise((t,r)=>{CS(t,r,{data:N,headers:kS.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new qx("Network Error",qx.ERR_NETWORK,e,k),{cause:t.cause||t});throw qx.from(t,t&&t.code,e,k)}}},ZS=new Map,JS=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,c=o.length,l=ZS;for(;c--;)i=o[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:KS(t)),l=s;return s};JS();const qS={http:null,xhr:zS,fetch:{get:JS}};Jx.forEach(qS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const YS=e=>`- ${e}`,XS=e=>Jx.isFunction(e)||null===e||!1===e;var QS={getAdapter:function(e,t){e=Jx.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!XS(n)&&(a=qS[(r=String(n)).toLowerCase()],void 0===a))throw new qx(`Unknown adapter '${r}'`);if(a&&(Jx.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(YS).join("\n"):" "+YS(e[0]):"as no adapter specified";throw new qx("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:qS};function ek(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new NS(null,e)}function tk(e){ek(e),e.headers=kS.from(e.headers),e.data=ES.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return QS.getAdapter(e.adapter||vS.adapter,e)(e).then(function(t){return ek(e),t.data=ES.call(e,e.transformResponse,t),t.headers=kS.from(t.headers),t},function(t){return AS(t)||(ek(e),t&&t.response&&(t.response.data=ES.call(e,e.transformResponse,t.response),t.response.headers=kS.from(t.response.headers))),Promise.reject(t)})}const rk="1.13.4",nk={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{nk[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ak={};nk.transitional=function(e,t,r){function n(e,t){return"[Axios v"+rk+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new qx(n(a," has been removed"+(t?" in "+t:"")),qx.ERR_DEPRECATED);return t&&!ak[a]&&(ak[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},nk.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var ok={assertOptions:function(e,t,r){if("object"!=typeof e)throw new qx("options must be an object",qx.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new qx("option "+o+" must be "+r,qx.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new qx("Unknown option "+o,qx.ERR_BAD_OPTION)}},validators:nk};const ik=ok.validators;let sk=class{constructor(e){this.defaults=e||{},this.interceptors={request:new sS,response:new sS}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=US(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&ok.assertOptions(r,{silentJSONParsing:ik.transitional(ik.boolean),forcedJSONParsing:ik.transitional(ik.boolean),clarifyTimeoutError:ik.transitional(ik.boolean)},!1),null!=n&&(Jx.isFunction(n)?t.paramsSerializer={serialize:n}:ok.assertOptions(n,{encode:ik.function,serialize:ik.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ok.assertOptions(t,{baseUrl:ik.spelling("baseURL"),withXsrfToken:ik.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&Jx.merge(a.common,a[t.method]);a&&Jx.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=kS.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[tk.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=tk.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return iS(IS((e=US(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Jx.forEach(["delete","get","head","options"],function(e){sk.prototype[e]=function(t,r){return this.request(US(r||{},{method:e,url:t,data:(r||{}).data}))}}),Jx.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(US(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}sk.prototype[e]=t(),sk.prototype[e+"Form"]=t(!0)});const ck={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ck).forEach(([e,t])=>{ck[t]=e});const lk=function e(t){const r=new sk(t),n=ox(sk.prototype.request,r);return Jx.extend(n,sk.prototype,r,{allOwnKeys:!0}),Jx.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(US(t,r))},n}(vS);lk.Axios=sk,lk.CanceledError=NS,lk.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new NS(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},lk.isCancel=AS,lk.VERSION=rk,lk.toFormData=tS,lk.AxiosError=qx,lk.Cancel=lk.CanceledError,lk.all=function(e){return Promise.all(e)},lk.spread=function(e){return function(t){return e.apply(null,t)}},lk.isAxiosError=function(e){return Jx.isObject(e)&&!0===e.isAxiosError},lk.mergeConfig=US,lk.AxiosHeaders=kS,lk.formToJSON=e=>gS(Jx.isHTMLForm(e)?new FormData(e):e),lk.getAdapter=QS.getAdapter,lk.HttpStatusCode=ck,lk.default=lk;const{Axios:dk,AxiosError:uk,CanceledError:fk,isCancel:pk,CancelToken:mk,VERSION:hk,all:gk,Cancel:vk,isAxiosError:yk,spread:bk,toFormData:wk,AxiosHeaders:xk,HttpStatusCode:Sk,formToJSON:kk,getAdapter:Ek,mergeConfig:Ak}=lk;const Nk=new class{constructor(e={}){this.client=lk.create({baseURL:e.baseURL||"https://api.example.com",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=$();return t&&(e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const r=await this.client.get(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async post(e,t,r){const n=await this.client.post(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async put(e,t,r){const n=await this.client.put(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async delete(e,t){const r=await this.client.delete(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async patch(e,t,r){const n=await this.client.patch(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}setBaseURL(e){this.client.defaults.baseURL=e}setHeader(e,t){this.client.defaults.headers.common[e]=t}removeHeader(e){delete this.client.defaults.headers.common[e]}};function Ck(){const e=Ee(),t=ke(e=>e.auth),r=ke(e=>e.os),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:s}=Kw(),d=l(async()=>{e.auth(C());try{const t=await Nk.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(T()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(T()),E(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),u=l(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth(P()),i(),j()}catch(e){E(e,{component:"useSaaSAuth",action:"signOut"}),j()}},[e,i,o?.callbacks?.onSignOut]),f=l(e=>{s?Zw.openWorkspaceSettings(e):E(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[s]),p=c(()=>D(t.status),[t.status]);return c(()=>({user:t.session?.user,session:t.session,status:t.status,...p,signIn:d,signOut:u,openWorkspaceSettings:f}),[t.session,t.status,p,d,u,f])}const _k=e=>{const{children:t}=e,{status:r}=Ck();return r!==I.authenticated?null:t},Tk=e=>{const{children:t}=e,{status:r}=Ck();return r===I.authenticated?null:t},Rk=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Ck();return n.includes(a?.role??"")?t:r||null},Pk=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Ck(),{currentWorkspace:o}=Kw(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function Ok(){const e=y(Ue);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function Ik(){const e=y(Ue);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}const Dk=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=Kw(),a=n?.features?.[r];return a?t:null},Uk=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=Kw(),a=n?.features?.[r];return a?null:t},Mk=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Ik();return n(r)?t:null},zk=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Ik();return n(r)?null:t};var Fk=Object.freeze({__proto__:null,default:({open:n,onOpenChange:a,planVersions:o,currentPlanVersionId:i,onSelectPlan:s,loading:l=!1})=>{const[d,f]=u(!1),p=c(()=>[...o].sort((e,t)=>e.version-t.version),[o]),m=(e=>{const t=new Map;return e.forEach(e=>{e.subscriptionItems?.forEach(e=>{t.has(e._id)||t.set(e._id,e)})}),Array.from(t.values())})(p);c(()=>{const e=new Map;return m.forEach(t=>{const r=t.category||"other";e.has(r)||e.set(r,[]),e.get(r).push(t)}),e},[m]);const h=m.filter(e=>"feature"===e.type),g=m.filter(e=>"limit"===e.type),v=m.filter(e=>"quota"===e.type),y=l||d,b=(e,t)=>"feature"===t.type?e.features?.[t.slug]??!1:"limit"===t.type?e.limits?.[t.slug]??null:"quota"===t.type?e.quotas?.[t.slug]??null:null,w=(e,t)=>"feature"===t.type?!0===e?"✓":"—":"limit"===t.type?null!=e?String(e):"—":"quota"===t.type?"object"==typeof e&&null!==e&&"included"in e?`${e.included}${e.overage?` (+${e.overage})`:""}`:null!=e?String(e):"—":"—";return t(Gu,{open:n,onOpenChange:a,children:e(Ju,{className:"max-w-7xl w-full h-[90vh] p-0 flex flex-col",children:[t("div",{className:"flex items-center justify-between p-6 border-b",children:e("div",{children:[t(Yu,{className:"text-2xl font-bold",children:"Choose Your Plan"}),t(Xu,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]})}),t("div",{className:"flex-1 overflow-auto p-6",children:0===p.length?t("div",{className:"text-center py-12 text-gray-500",children:t("p",{children:"No plans available"})}):e("div",{className:"space-y-6",children:[t("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map(r=>{const n=r._id===i,o=(e=>{if(e._id===i)return{label:"Current Plan",variant:"outline",disabled:!0};if(!i)return{label:"Subscribe",variant:"default",disabled:!1};const t=p.findIndex(e=>e._id===i),r=p.findIndex(t=>t._id===e._id);return-1===t||-1===r?{label:"Select",variant:"default",disabled:!1}:r<t?{label:"Downgrade",variant:"outline",disabled:!1}:r>t?{label:"Upgrade",variant:"default",disabled:!1}:{label:"Select",variant:"default",disabled:!1}})(r),c=y&&r._id===i;return e("div",{className:"border rounded-lg p-4 "+(n?"border-blue-500 bg-blue-50":"hover:border-gray-300"),children:[e("div",{className:"flex items-center justify-between mb-2",children:[t("h3",{className:"text-lg font-semibold",children:r.plan.name}),n&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"Current"})]}),r.plan.description&&t("p",{className:"text-sm text-gray-600 mb-4",children:r.plan.description}),t(hl,{className:"w-full",variant:o.variant,disabled:o.disabled||y,onClick:()=>(async e=>{if(e!==i&&!l&&!d){f(!0);try{await s(e),a(!1)}catch(e){}finally{f(!1)}}})(r._id),children:c?"Updating...":o.label})]},r._id)})}),e("div",{className:"border rounded-lg overflow-hidden bg-white",children:[t("div",{className:"bg-gray-50 p-4 border-b",children:t("h3",{className:"font-semibold text-lg",children:"Compare all features"})}),t("div",{className:"overflow-x-auto",children:e("table",{className:"w-full",children:[t("thead",{children:e("tr",{className:"border-b bg-gray-50",children:[t("th",{className:"text-left p-4 font-semibold text-sm sticky left-0 bg-gray-50 z-10 min-w-[250px]",children:"Feature"}),p.map(r=>e("th",{className:"text-center p-4 font-semibold text-sm min-w-[150px] "+(r._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:[t("div",{className:"font-semibold",children:r.plan.name}),r._id===i&&t("div",{className:"text-xs text-blue-600 font-normal mt-1",children:"Current Plan"})]},r._id))]})}),e("tbody",{children:[h.length>0&&e(r,{children:[t("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:t("td",{colSpan:p.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Features"})}),h.map(r=>e("tr",{className:"border-b hover:bg-gray-50",children:[e("td",{className:"p-4 sticky left-0 bg-white z-10",children:[t("div",{className:"font-medium text-sm text-gray-900",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500 mt-1",children:r.description})]}),p.map(e=>{const n=b(e,r),a=w(n,r),o="feature"===r.type&&!0===n;return t("td",{className:"text-center p-4 align-middle "+(e._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:t("span",{className:"text-sm "+(o?"text-green-600 font-semibold":"—"===a?"text-gray-400":"text-gray-700"),children:a})},e._id)})]},r._id))]}),g.length>0&&e(r,{children:[t("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:t("td",{colSpan:p.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Limits"})}),g.map(r=>e("tr",{className:"border-b hover:bg-gray-50",children:[e("td",{className:"p-4 sticky left-0 bg-white z-10",children:[t("div",{className:"font-medium text-sm text-gray-900",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500 mt-1",children:r.description})]}),p.map(e=>{const n=b(e,r),a=w(n,r);return t("td",{className:"text-center p-4 align-middle "+(e._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:t("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},e._id)})]},r._id))]}),v.length>0&&e(r,{children:[t("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:t("td",{colSpan:p.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Quotas"})}),v.map(r=>e("tr",{className:"border-b hover:bg-gray-50",children:[e("td",{className:"p-4 sticky left-0 bg-white z-10",children:[t("div",{className:"font-medium text-sm text-gray-900",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500 mt-1",children:r.description})]}),p.map(e=>{const n=b(e,r),a=w(n,r);return t("td",{className:"text-center p-4 align-middle "+(e._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:t("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},e._id)})]},r._id))]})]})]})})]})]})})]})})}});export{x as ApiVersion,I as AuthStatus,rx as BetaForm,N as ErrorBoundary,S as SDKError,N as SDKErrorBoundary,Xw as SaaSOSProvider,_k as WhenAuthenticated,Rk as WhenRoles,Tk as WhenUnauthenticated,zk as WhenUserFeatureDisabled,Mk as WhenUserFeatureEnabled,Uk as WhenWorkspaceFeatureDisabled,Dk as WhenWorkspaceFeatureEnabled,Pk as WhenWorkspaceRoles,Ww as WorkspaceSwitcher,A as createSDKError,k as errorHandler,Oe as eventEmitter,E as handleError,lb as useCreateCheckoutSession,pb as useInvoice,fb as useInvoices,sb as usePlanGroup,cb as usePlanGroupVersions,Ck as useSaaSAuth,im as useSaaSSettings,Kw as useSaaSWorkspaces,ib as useSubscription,ub as useSubscriptionManagement,db as useUpdateSubscription,Ok as useUserAttributes,Ik as useUserFeatures};
|
|
29
|
+
*/function Sf(){return bf||(bf=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){c||void 0===t.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};xf.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),xf}function kf(){return wf||(wf=1,"production"===process.env.NODE_ENV?gf.exports=yf():gf.exports=Sf()),gf.exports}var Ef=kf();function Af(){return()=>{}}var Nf="Avatar",[Cf]=function(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o);i.displayName=r+"Context";const s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},uf(o,...r)]}(Nf),[_f,Tf]=Cf(Nf),Rf=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(_f,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(hf.span,{...o,ref:r})})});Rf.displayName=Nf;var Pf="AvatarImage",Of=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,c=Tf(Pf,a),l=function(e,{referrerPolicy:t,crossOrigin:r}){const a=Ef.useSyncExternalStore(Af,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,c]=n.useState(()=>Uf(i,e));return mf(()=>{c(Uf(i,e))},[i,e]),mf(()=>{const e=e=>()=>{c(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=ff(e=>{i(e),c.onImageLoadingStatusChange(e)});return mf(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?t(hf.img,{...s,ref:r,src:o}):null});Of.displayName=Pf;var If="AvatarFallback",Df=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=Tf(If,a),[c,l]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==s.imageLoadingStatus?t(hf.span,{...i,ref:r}):null});function Uf(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}Df.displayName=If;var Mf=Rf,zf=Of,Ff=Df;const Lf=n.forwardRef(({className:e,...r},n)=>t(Mf,{ref:n,className:Le("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));Lf.displayName=Mf.displayName;const jf=n.forwardRef(({className:e,...r},n)=>t(zf,{ref:n,className:Le("aspect-square h-full w-full",e),...r}));jf.displayName=zf.displayName;const $f=n.forwardRef(({className:e,...r},n)=>t(Ff,{ref:n,className:Le("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));function Vf(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Wf(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},Bf(o,...r)]}function Bf(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}$f.displayName=Ff.displayName;var Gf=n[" useId ".trim().toString()]||(()=>{}),Hf=0;function Kf(e){const[t,r]=n.useState(Gf());return mf(()=>{r(e=>e??String(Hf++))},[e]),e||(t?`radix-${t}`:"")}var Zf=n[" useInsertionEffect ".trim().toString()]||mf;function Jf({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return Zf(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${a} is changing from ${t} to ${r}. 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.`)}t.current=c},[c,a])}const d=n.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[c,e,i,s]);return[l,d]}function qf(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?os(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yf=Symbol("radix.slottable");function Xf(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Yf}var Qf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=function(e){const r=qf(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Xf);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var ep,tp="dismissableLayer.update",rp="dismissableLayer.pointerDownOutside",np="dismissableLayer.focusOutside",ap=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),op=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=e,u=n.useContext(ap),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=is(r,e=>p(e)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=b,k=function(e,t=globalThis?.document){const r=ff(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){sp(rp,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},m),E=function(e,t=globalThis?.document){const r=ff(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){sp(np,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=ff(e);n.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(ep=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),ip(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=ep)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),ip())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(tp,e),()=>document.removeEventListener(tp,e)},[]),t(Qf.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:Vf(e.onFocusCapture,E.onFocusCapture),onBlurCapture:Vf(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Vf(e.onPointerDownCapture,k.onPointerDownCapture)})});op.displayName="DismissableLayer";function ip(){const e=new CustomEvent(tp);document.dispatchEvent(e)}function sp(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&b.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(ap),o=n.useRef(null),i=is(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(Qf.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var cp="focusScope.autoFocusOnMount",lp="focusScope.autoFocusOnUnmount",dp={bubbles:!1,cancelable:!0},up=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=e,[l,d]=n.useState(null),u=ff(i),f=ff(s),p=n.useRef(null),m=is(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:hp(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||hp(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&hp(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[o,l,h.paused]),n.useEffect(()=>{if(l){gp.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(cp,dp);l.addEventListener(cp,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(hp(n,{select:t}),document.activeElement!==r)return}((e=fp(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&hp(l))}return()=>{l.removeEventListener(cp,u),setTimeout(()=>{const e=new CustomEvent(lp,dp);l.addEventListener(lp,f),l.dispatchEvent(e),e.defaultPrevented||hp(t??document.body,{select:!0}),l.removeEventListener(lp,f),gp.remove(h)},0)}}var e},[l,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[n,o]=function(e){const t=fp(e),r=pp(t,e),n=pp(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&hp(o,{select:!0})):(e.preventDefault(),a&&hp(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(Qf.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function fp(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function pp(e,t){for(const r of e)if(!mp(r,{upTo:t}))return r}function mp(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function hp(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}up.displayName="FocusScope";var gp=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=vp(e,t),e.unshift(t)},remove(t){e=vp(e,t),e[0]?.resume()}}}();function vp(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var yp=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);mf(()=>s(!0),[]);const c=a||i&&globalThis?.document?.body;return c?w.createPortal(t(Qf.div,{...o,ref:r}),c):null});yp.displayName="Portal";var bp=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=wp(a.current);i.current="mounted"===c?e:"none"},[c]),mf(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=wp(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),mf(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=wp(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(l("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=wp(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=is(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function wp(e){return e?.animationName||"none"}bp.displayName="Presence";var xp=0;function Sp(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kp()),document.body.insertAdjacentElement("beforeend",e[1]??kp()),xp++,()=>{1===xp&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),xp--}},[])}function kp(){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 Ep=function(){return Ep=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ep.apply(this,arguments)};function Ap(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var Np="right-scroll-bar-position",Cp="width-before-scroll-bar";function _p(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Tp="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,Rp=new WeakMap;function Pp(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return _p(e,t)})},(a=f(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return Tp(function(){var t=Rp.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||_p(e,null)}),n.forEach(function(e){r.has(e)||_p(e,a)})}Rp.set(o,e)},[e]),o}function Op(e){return e}var Ip=function(e){var t=e.sideCar,r=Ap(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,Ep({},r))};Ip.isSideCarExport=!0;var Dp=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Op);var r=[],n=!1;return{read:function(){if(n)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(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Ep({async:!0,ssr:!1},e),t}(),Up=function(){},Mp=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:Up,onWheelCapture:Up,onTouchMoveCapture:Up}),o=a[0],i=a[1],s=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,v=e.allowPinchZoom,y=e.as,b=void 0===y?"div":y,w=e.gapMode,x=Ap(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Pp([r,t]),E=Ep(Ep({},x),o);return n.createElement(n.Fragment,null,u&&n.createElement(S,{sideCar:Dp,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(c),Ep(Ep({},E),{ref:k})):n.createElement(b,Ep({},E,{className:l,ref:k}),c))});Mp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Mp.classNames={fullWidth:Cp,zeroRight:Np};function zp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Fp=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=zp())&&(a=r,(n=t).styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Lp=function(){var e,t=(e=Fp(),function(t,r){n.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},jp={left:0,top:0,right:0,gap:0},$p=function(e){return parseInt(e||"",10)||0},Vp=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return jp;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[$p(r),$p(n),$p(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Wp=Lp(),Bp="data-scroll-locked",Gp=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(Bp,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Np," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(Cp," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(Np," .").concat(Np," {\n right: 0 ").concat(n,";\n }\n \n .").concat(Cp," .").concat(Cp," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Bp,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Hp=function(){var e=parseInt(document.body.getAttribute(Bp)||"0",10);return isFinite(e)?e:0},Kp=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(Bp,(Hp()+1).toString()),function(){var e=Hp()-1;e<=0?document.body.removeAttribute(Bp):document.body.setAttribute(Bp,e.toString())}},[]);var i=n.useMemo(function(){return Vp(o)},[o]);return n.createElement(Wp,{styles:Gp(i,!t,o,r?"":"!important")})},Zp=!1;if("undefined"!=typeof window)try{var Jp=Object.defineProperty({},"passive",{get:function(){return Zp=!0,!0}});window.addEventListener("test",Jp,Jp),window.removeEventListener("test",Jp,Jp)}catch(e){Zp=!1}var qp=!!Zp&&{passive:!1},Yp=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},Xp=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Qp(e,n)){var a=em(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Qp=function(e,t){return"v"===e?function(e){return Yp(e,"overflowY")}(t):function(e){return Yp(e,"overflowX")}(t)},em=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},tm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rm=function(e){return[e.deltaX,e.deltaY]},nm=function(e){return e&&"current"in e?e.current:e},am=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},om=0,im=[];function sm(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var cm,lm=(cm=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(om++)[0],i=n.useState(Lp)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(nm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=tm(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],l="deltaY"in e?e.deltaY:i[1]-o[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=Xp(u,d);if(!m)return!0;if(m?n=u:(n="v"===u?"h":"v",m=Xp(u,d)),!m)return!1;if(!a.current&&"changedTouches"in e&&(c||l)&&(a.current=n),!n)return!0;var h=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),c=!1,l=o>0,d=0,u=0;do{if(!i)break;var f=em(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Qp(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=n.useCallback(function(e){var r=e;if(im.length&&im[im.length-1]===i){var n="deltaY"in r?rm(r):tm(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var o=(s.current.shards||[]).map(nm).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:sm(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=tm(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,rm(t),t.target,c(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,tm(t),t.target,c(t,e.lockRef.current))},[]);n.useEffect(function(){return im.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,qp),document.addEventListener("touchmove",l,qp),document.addEventListener("touchstart",u,qp),function(){im=im.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,qp),document.removeEventListener("touchmove",l,qp),document.removeEventListener("touchstart",u,qp)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:am(o)}):null,m?n.createElement(Kp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Dp.useMedium(cm),Ip),dm=n.forwardRef(function(e,t){return n.createElement(Mp,Ep({},e,{ref:t,sideCar:lm}))});dm.classNames=Mp.classNames;var um=new WeakMap,fm=new WeakMap,pm={},mm=0,hm=function(e){return e&&(e.host||hm(e.parentNode))},gm=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=hm(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);pm[r]||(pm[r]=new WeakMap);var o=pm[r],i=[],s=new Set,c=new Set(a),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(um.get(e)||0)+1,l=(o.get(e)||0)+1;um.set(e,c),o.set(e,l),i.push(e),1===c&&a&&fm.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),mm++,function(){i.forEach(function(e){var t=um.get(e)-1,a=o.get(e)-1;um.set(e,t),o.set(e,a),t||(fm.has(e)||e.removeAttribute(n),fm.delete(e)),a||e.removeAttribute(r)}),--mm||(um=new WeakMap,um=new WeakMap,fm=new WeakMap,pm={})}},vm=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),gm(n,a,r,"aria-hidden")):function(){return null}};function ym(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?os(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bm=Symbol("radix.slottable");function wm(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===bm}var xm="Dialog",[Sm,km]=Wf(xm),[Em,Am]=Sm(xm),Nm=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,l=n.useRef(null),d=n.useRef(null),[u,f]=Jf({prop:o,defaultProp:i??!1,onChange:s,caller:xm});return t(Em,{scope:r,triggerRef:l,contentRef:d,contentId:Kf(),titleId:Kf(),descriptionId:Kf(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:c,children:a})};Nm.displayName=xm;var Cm="DialogTrigger",_m=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Am(Cm,n),i=is(r,o.triggerRef);return t(Qf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Zm(o.open),...a,ref:i,onClick:Vf(e.onClick,o.onOpenToggle)})});_m.displayName=Cm;var Tm="DialogPortal",[Rm,Pm]=Sm(Tm,{forceMount:void 0}),Om=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=Am(Tm,r);return t(Rm,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(bp,{present:a||s.open,children:t(yp,{asChild:!0,container:i,children:e})}))})};Om.displayName=Tm;var Im="DialogOverlay",Dm=n.forwardRef((e,r)=>{const n=Pm(Im,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=Am(Im,e.__scopeDialog);return i.modal?t(bp,{present:a||i.open,children:t(Mm,{...o,ref:r})}):null});Dm.displayName=Im;var Um=function(e){const r=ym(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(wm);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("DialogOverlay.RemoveScroll"),Mm=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Am(Im,n);return t(dm,{as:Um,allowPinchZoom:!0,shards:[o.contentRef],children:t(Qf.div,{"data-state":Zm(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),zm="DialogContent",Fm=n.forwardRef((e,r)=>{const n=Pm(zm,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=Am(zm,e.__scopeDialog);return t(bp,{present:a||i.open,children:i.modal?t(Lm,{...o,ref:r}):t(jm,{...o,ref:r})})});Fm.displayName=zm;var Lm=n.forwardRef((e,r)=>{const a=Am(zm,e.__scopeDialog),o=n.useRef(null),i=is(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return vm(e)},[]),t($m,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vf(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:Vf(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Vf(e.onFocusOutside,e=>e.preventDefault())})}),jm=n.forwardRef((e,r)=>{const a=Am(zm,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t($m,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),$m=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=a,u=Am(zm,i),f=n.useRef(null),p=is(o,f);return Sp(),e(r,{children:[t(up,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:t(op,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Zm(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(Xm,{titleId:u.titleId}),t(Qm,{contentRef:f,descriptionId:u.descriptionId})]})]})}),Vm="DialogTitle",Wm=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Am(Vm,n);return t(Qf.h2,{id:o.titleId,...a,ref:r})});Wm.displayName=Vm;var Bm="DialogDescription",Gm=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Am(Bm,n);return t(Qf.p,{id:o.descriptionId,...a,ref:r})});Gm.displayName=Bm;var Hm="DialogClose",Km=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=Am(Hm,n);return t(Qf.button,{type:"button",...a,ref:r,onClick:Vf(e.onClick,()=>o.onOpenChange(!1))})});function Zm(e){return e?"open":"closed"}Km.displayName=Hm;var Jm="DialogTitleWarning",[qm,Ym]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Jm,{contentName:zm,titleName:Vm,docsSlug:"dialog"}),Xm=({titleId:e})=>{const t=Ym(Jm),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Qm=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ym("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},eh=Nm,th=_m,rh=Om,nh=Dm,ah=Fm,oh=Wm,ih=Gm,sh=Km;function ch(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var lh=["color"],dh=h(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ch(e,lh);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),g("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),uh=["color"],fh=h(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ch(e,uh);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),g("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),ph=["color"],mh=h(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ch(e,ph);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),g("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),hh=["color"],gh=h(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ch(e,hh);return g("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),g("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))});const vh=eh,yh=th,bh=rh,wh=n.forwardRef(({className:e,...r},n)=>t(nh,{ref:n,className:Le("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));wh.displayName=nh.displayName;const xh=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(fr);return e(bh,{container:s,children:[t(wh,{}),e(ah,{ref:i,className:Le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...o,children:[a,e(sh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t(mh,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});xh.displayName=ah.displayName;const Sh=({className:e,...r})=>t("div",{className:Le("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});Sh.displayName="DialogHeader";const kh=n.forwardRef(({className:e,...r},n)=>t(oh,{ref:n,className:Le("text-lg font-semibold leading-none tracking-tight",e),...r}));kh.displayName=oh.displayName;const Eh=n.forwardRef(({className:e,...r},n)=>t(ih,{ref:n,className:Le("text-sm text-muted-foreground",e),...r}));function Ah(e){const r=Nh(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(_h);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}function Nh(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?os(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Eh.displayName=ih.displayName;var Ch=Symbol("radix.slottable");function _h(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ch}function Th(e){const r=e+"CollectionProvider",[n,o]=Wf(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};c.displayName=r;const l=e+"CollectionSlot",d=Ah(l),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=is(r,s(l,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Ah(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,c=a.useRef(null),l=is(r,c),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),t(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}var Rh=n.createContext(void 0);function Ph(e){const t=n.useContext(Rh);return e||t||"ltr"}var Oh="rovingFocusGroup.onEntryFocus",Ih={bubbles:!1,cancelable:!0},Dh="RovingFocusGroup",[Uh,Mh,zh]=Th(Dh),[Fh,Lh]=Wf(Dh,[zh]),[jh,$h]=Fh(Dh),Vh=n.forwardRef((e,r)=>t(Uh.Provider,{scope:e.__scopeRovingFocusGroup,children:t(Uh.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Wh,{...e,ref:r})})}));Vh.displayName=Dh;var Wh=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=is(r,m),g=Ph(s),[v,y]=Jf({prop:c,defaultProp:l??null,onChange:d,caller:Dh}),[b,w]=n.useState(!1),x=ff(u),S=Mh(a),k=n.useRef(!1),[E,A]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Oh,x),()=>e.removeEventListener(Oh,x)},[x]),t(jh,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:v,onItemFocus:n.useCallback(e=>y(e),[y]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>A(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>A(e=>e-1),[]),children:t(Qf.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:Vf(e.onMouseDown,()=>{k.current=!0}),onFocus:Vf(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!b){const t=new CustomEvent(Oh,Ih);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Kh([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:Vf(e.onBlur,()=>w(!1))})})}),Bh="RovingFocusGroupItem",Gh=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:c,...l}=e,d=Kf(),u=s||d,f=$h(Bh,a),p=f.currentTabStopId===u,m=Mh(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(Uh.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(Qf.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:Vf(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:Vf(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:Vf(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Hh[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const n=r.indexOf(e.currentTarget);r=f.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>Kh(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});Gh.displayName=Bh;var Hh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Kh(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Zh=Vh,Jh=Gh;function qh(e){const[t,r]=n.useState(void 0);return mf(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Yh(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xh="Radio",[Qh,eg]=Wf(Xh),[tg,rg]=Qh(Xh),ng=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=is(a,e=>h(e)),v=n.useRef(!1),y=!m||(f||!!m.closest("form"));return e(tg,{scope:o,checked:s,disabled:l,children:[t(Qf.button,{type:"button",role:"radio","aria-checked":s,"data-state":sg(s),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:Vf(r.onClick,e=>{s||u?.(),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),y&&t(ig,{control:m,bubbles:!v.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});ng.displayName=Xh;var ag="RadioIndicator",og=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=rg(ag,n);return t(bp,{present:a||i.checked,children:t(Qf.span,{"data-state":sg(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});og.displayName=ag;var ig=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=is(c,s),d=Yh(a),u=qh(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(Qf.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function sg(e){return e?"checked":"unchecked"}ig.displayName="RadioBubbleInput";var cg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lg="RadioGroup",[dg]=Wf(lg,[Lh,eg]),ug=Lh(),fg=eg(),[pg,mg]=dg(lg),hg=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=ug(n),h=Ph(d),[g,v]=Jf({prop:i,defaultProp:o??null,onChange:f,caller:lg});return t(pg,{scope:n,name:a,required:s,disabled:c,value:g,onValueChange:v,children:t(Zh,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:t(Qf.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});hg.displayName=lg;var gg="RadioGroupItem",vg=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=mg(gg,a),c=s.disabled||o,l=ug(a),d=fg(a),u=n.useRef(null),f=is(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{cg.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),t(Jh,{asChild:!0,...l,focusable:!c,active:p,children:t(ng,{disabled:c,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:Vf(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Vf(i.onFocus,()=>{m.current&&u.current?.click()})})})});vg.displayName=gg;var yg=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=fg(n);return t(og,{...o,...a,ref:r})});yg.displayName="RadioGroupIndicator";var bg=hg,wg=vg,xg=yg;const Sg=n.forwardRef(({className:e,...r},n)=>t(bg,{className:Le("grid gap-2",e),...r,ref:n}));Sg.displayName=bg.displayName;const kg=n.forwardRef(({className:e,...r},n)=>t(wg,{ref:n,className:Le("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:t(xg,{className:"flex items-center justify-center",children:t(fh,{className:"h-3.5 w-3.5 fill-primary"})})}));function Eg(e,[t,r]){return Math.min(r,Math.max(t,e))}kg.displayName=wg.displayName;var Ag="ScrollArea",[Ng]=Wf(Ag),[Cg,_g]=Ng(Ag),Tg=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...c}=e,[l,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[v,y]=n.useState(null),[b,w]=n.useState(0),[x,S]=n.useState(0),[k,E]=n.useState(!1),[A,N]=n.useState(!1),C=is(r,e=>d(e)),_=Ph(i);return t(Cg,{scope:a,type:o,dir:_,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:E,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:N,onCornerWidthChange:w,onCornerHeightChange:S,children:t(Qf.div,{dir:_,...c,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});Tg.displayName=Ag;var Rg="ScrollAreaViewport",Pg=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:c,...l}=a,d=_g(Rg,i),u=is(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),t(Qf.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Pg.displayName=Rg;var Og="ScrollAreaScrollbar",Ig=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=_g(Og,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===e.orientation;return n.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?t(Dg,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(Ug,{...o,ref:r,forceMount:a}):"auto"===i.type?t(Mg,{...o,ref:r,forceMount:a}):"always"===i.type?t(zg,{...o,ref:r}):null});Ig.displayName=Og;var Dg=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=_g(Og,e.__scopeScrollArea),[s,c]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(bp,{present:a||s,children:t(Mg,{"data-state":s?"visible":"hidden",...o,ref:r})})}),Ug=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=_g(Og,e.__scopeScrollArea),s="horizontal"===e.orientation,c=rv(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,s,d,c]),t(bp,{present:a||"hidden"!==l,children:t(zg,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:Vf(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Vf(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Mg=n.forwardRef((e,r)=>{const a=_g(Og,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=n.useState(!1),l="horizontal"===e.orientation,d=rv(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;c(l?e:t)}},10);return nv(a.viewport,d),nv(a.content,d),t(bp,{present:o||s,children:t(zg,{"data-state":s?"visible":"hidden",...i,ref:r})})}),zg=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=_g(Og,e.__scopeScrollArea),s=n.useRef(null),c=n.useRef(0),[l,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=qg(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Yg(r),o=a/2,i=t||o,s=a-i,c=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Qg([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===a?t(Fg,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Xg(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(Lg,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Xg(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),Fg=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=_g(Og,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=is(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(Vg,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Yg(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),ev(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Jg(c.paddingLeft),paddingEnd:Jg(c.paddingRight)}})}})}),Lg=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=_g(Og,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=is(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(Vg,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Yg(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),ev(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Jg(c.paddingTop),paddingEnd:Jg(c.paddingBottom)}})}})}),[jg,$g]=Ng(Og),Vg=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=_g(Og,a),[g,v]=n.useState(null),y=is(r,e=>v(e)),b=n.useRef(null),w=n.useRef(""),x=h.viewport,S=o.content-o.viewport,k=ff(f),E=ff(d),A=rv(p,10);function N(e){if(b.current){const t=e.clientX-b.current.left,r=e.clientY-b.current.top;u({x:t,y:r})}}return n.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,g,S,k]),n.useEffect(E,[o,E]),nv(g,A),nv(h.content,A),t(jg,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:ff(s),onThumbPointerUp:ff(c),onThumbPositionChange:E,onThumbPointerDown:ff(l),children:t(Qf.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:Vf(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),N(e)}}),onPointerMove:Vf(e.onPointerMove,N),onPointerUp:Vf(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),Wg="ScrollAreaThumb",Bg=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=$g(Wg,e.__scopeScrollArea);return t(bp,{present:n||o.hasThumb,children:t(Gg,{ref:r,...a})})}),Gg=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=_g(Wg,a),c=$g(Wg,a),{onThumbPositionChange:l}=c,d=is(r,e=>c.onThumbChange(e)),u=n.useRef(void 0),f=rv(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=tv(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),t(Qf.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Vf(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:Vf(e.onPointerUp,c.onThumbPointerUp)})});Bg.displayName=Wg;var Hg="ScrollAreaCorner",Kg=n.forwardRef((e,r)=>{const n=_g(Hg,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Zg,{...e,ref:r}):null});Kg.displayName=Hg;var Zg=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=_g(Hg,a),[s,c]=n.useState(0),[l,d]=n.useState(0),u=Boolean(s&&l);return nv(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),nv(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?t(Qf.div,{...o,ref:r,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Jg(e){return e?parseInt(e,10):0}function qg(e,t){const r=e/t;return isNaN(r)?0:r}function Yg(e){const t=qg(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Xg(e,t,r="ltr"){const n=Yg(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,c=Eg(e,"ltr"===r?[0,i]:[-1*i,0]);return Qg([0,i],[0,s])(c)}function Qg(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function ev(e,t){return e>0&&e<t}var tv=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function rv(e,t){const r=ff(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function nv(e,t){const r=ff(t);mf(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var av=Tg,ov=Pg,iv=Kg;const sv=n.forwardRef(({className:r,children:n,...a},o)=>e(av,{ref:o,className:Le("relative overflow-hidden",r),...a,children:[t(ov,{className:"h-full w-full rounded-[inherit]",children:n}),t(cv,{}),t(iv,{})]}));sv.displayName=av.displayName;const cv=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(Ig,{ref:a,orientation:r,className:Le("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",e),...n,children:t(Bg,{className:Le("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));cv.displayName=Ig.displayName;var lv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=ds(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),dv="horizontal",uv=["horizontal","vertical"],fv=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=dv,...o}=e,i=function(e){return uv.includes(e)}(a)?a:dv,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t(lv.div,{"data-orientation":i,...s,...o,ref:r})});fv.displayName="Separator";var pv=fv;const mv=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(pv,{ref:o,decorative:n,orientation:r,className:Le("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));mv.displayName=pv.displayName;var hv=Symbol("radix.slottable");var gv="AlertDialog",[vv]=Wf(gv,[km]),yv=km(),bv=e=>{const{__scopeAlertDialog:r,...n}=e,a=yv(r);return t(eh,{...a,...n,modal:!0})};bv.displayName=gv;var wv=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=yv(n);return t(th,{...o,...a,ref:r})});wv.displayName="AlertDialogTrigger";var xv=e=>{const{__scopeAlertDialog:r,...n}=e,a=yv(r);return t(rh,{...a,...n})};xv.displayName="AlertDialogPortal";var Sv=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=yv(n);return t(nh,{...o,...a,ref:r})});Sv.displayName="AlertDialogOverlay";var kv="AlertDialogContent",[Ev,Av]=vv(kv),Nv=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=hv,n}("AlertDialogContent"),Cv=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,c=yv(o),l=n.useRef(null),d=is(a,l),u=n.useRef(null);return t(qm,{contentName:kv,titleName:_v,docsSlug:"alert-dialog",children:t(Ev,{scope:o,cancelRef:u,children:e(ah,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:Vf(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(Nv,{children:i}),t(Uv,{contentRef:l})]})})})});Cv.displayName=kv;var _v="AlertDialogTitle",Tv=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=yv(n);return t(oh,{...o,...a,ref:r})});Tv.displayName=_v;var Rv="AlertDialogDescription",Pv=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=yv(n);return t(ih,{...o,...a,ref:r})});Pv.displayName=Rv;var Ov=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=yv(n);return t(sh,{...o,...a,ref:r})});Ov.displayName="AlertDialogAction";var Iv="AlertDialogCancel",Dv=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=Av(Iv,n),i=yv(n),s=is(r,o);return t(sh,{...i,...a,ref:s})});Dv.displayName=Iv;var Uv=({contentRef:e})=>{const t=`\`${kv}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${kv}\` by passing a \`${Rv}\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${kv}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Mv=Sv,zv=Cv,Fv=Ov,Lv=Dv,jv=Tv,$v=Pv;const Vv=bv,Wv=wv,Bv=xv,Gv=n.forwardRef(({className:e,...r},n)=>t(Mv,{className:Le("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r,ref:n}));Gv.displayName=Mv.displayName;const Hv=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(fr);return e(Bv,{container:i,children:[t(Gv,{}),t(zv,{ref:o,className:Le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...a})]})});Hv.displayName=zv.displayName;const Kv=({className:e,...r})=>t("div",{className:Le("flex flex-col space-y-2 text-center sm:text-left",e),...r});Kv.displayName="AlertDialogHeader";const Zv=({className:e,...r})=>t("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Zv.displayName="AlertDialogFooter";const Jv=n.forwardRef(({className:e,...r},n)=>t(jv,{ref:n,className:Le("text-lg font-semibold",e),...r}));Jv.displayName=jv.displayName;const qv=n.forwardRef(({className:e,...r},n)=>t($v,{ref:n,className:Le("text-sm text-muted-foreground",e),...r}));qv.displayName=$v.displayName;const Yv=n.forwardRef(({className:e,...r},n)=>t(Fv,{ref:n,className:Le(Bs(),e),...r}));Yv.displayName=Fv.displayName;const Xv=n.forwardRef(({className:e,...r},n)=>t(Lv,{ref:n,className:Le(Bs({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));function Qv(){return e("div",{className:"space-y-3.5",children:[t(cc,{className:"h-10 w-full"}),t(cc,{className:"h-10 w-full"}),t(cc,{className:"h-10 w-full"})]})}Xv.displayName=Lv.displayName;const ey=({workspace:n})=>{const[a,o]=f(!1),{deleteWorkspace:i}=vr(),s=ir(e=>e.auth.session?.user||null);if(!n)return t(Qv,{});const c=Xt(n,s?.id??null);return"admin"===c?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e(Vv,{children:[t(Wv,{asChild:!0,children:e(Gs,{variant:"destructive",disabled:a,progress:a,children:[t(Ls,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e(Hv,{children:[e(Kv,{children:[t(Jv,{children:"Are you absolutely sure?"}),e(qv,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(Zv,{children:[t(Xv,{disabled:a,children:"Cancel"}),t(Yv,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){qe(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t(Os,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var ty="Switch",[ry]=Wf(ty),[ny,ay]=ry(ty),oy=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),v=is(a,e=>g(e)),y=n.useRef(!1),b=!h||(p||!!h.closest("form")),[w,x]=Jf({prop:s,defaultProp:c??!1,onChange:f,caller:ty});return e(ny,{scope:o,checked:w,disabled:d,children:[t(Qf.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":ly(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:v,onClick:Vf(r.onClick,e=>{x(e=>!e),b&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),b&&t(cy,{control:h,bubbles:!y.current,name:i,value:u,checked:w,required:l,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});oy.displayName=ty;var iy="SwitchThumb",sy=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=ay(iy,n);return t(Qf.span,{"data-state":ly(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});sy.displayName=iy;var cy=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=is(c,s),d=Yh(a),u=qh(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ly(e){return e?"checked":"unchecked"}cy.displayName="SwitchBubbleInput";var dy=oy,uy=sy;const fy=n.forwardRef(({className:e,...r},n)=>t(dy,{className:Le("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:t(uy,{className:Le("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));fy.displayName=dy.displayName;const py=({workspaceId:r})=>{const[n,a]=f({}),[o,i]=f(null),{allFeatures:s,updateFeature:c,getWorkspace:l}=vr(),[u,p]=f(null),m=ir(e=>e.auth.session?.user||null);if(d(()=>{l(r).then(p)},[r]),!u)return t(Qv,{});const h=Yt(u,m?.id??null);return e("div",{children:[o&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:o})]}),e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!h&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!s.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),s.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:s.map(r=>{const o=u?.features?.[r.slug],l=null!==n[r.slug]&&void 0!==n[r.slug],d=n[r.slug],f=!0===d?"Enabling":!1===d?"Disabling":"";return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),l?e("div",{className:"flex items-center gap-x-1",children:[t(Os,{className:"h-4 w-4 animate-spin text-gray-500"}),e("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):t(fy,{disabled:!h,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(u){a(r=>({...r,[e]:t})),i(null);try{const r=await c(u._id,e,t);p(r);const n=s.find(t=>t.slug===e);i(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{i(null)},5e3)}catch(t){qe(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:u._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(r.slug,e)})]},r._id)})})]})]})};function my(e){return`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50%" y="50%" dominant-baseline="middle" alignment-baseline="middle" text-anchor="middle" font-size="50" font-family="sans-serif">${e}</text></svg>`}const hy=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑💻","👨💻","👩💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨💼","👩💼","👨🏫","👩🏫","👨🔬","👩🔬","👨🎨","👩🎨","👨🔧","👩🔧","👨🚀","👩🚀","👨⚖️","👩⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️🌈","🎟️","🎫"],gy=({workspace:r})=>{const[n,a]=f(!1),[o,i]=f("emoji"),[s,c]=f(),[l,d]=f(null),{updateWorkspace:u}=vr(),p=ir(e=>e.auth.session?.user||null),m=Zn({resolver:ns(sl({name:Dc().min(2,{message:"Workspace name must be at least 2 characters."}),image:Dc().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(Qv,{});const h=Yt(r,p?.id??null);return e("div",{children:[l&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:l})]}),!h&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(Ys,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await u(r,e),d("Workspace settings saved successfully"),setTimeout(()=>{d(null)},5e3)}catch(e){qe(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[t(Qs,{control:m.control,name:"name",render:({field:r})=>e(rc,{children:[t(nc,{children:"Name"}),t(ac,{children:t(sc,{placeholder:"My Awesome Workspace",...r,disabled:!h})}),t(ic,{})]})}),e("div",{className:"space-y-4",children:[e("div",{children:[t(qs,{className:"text-sm font-medium",children:"Icon"}),t(oc,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(Sg,{value:o,disabled:!h,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(kg,{value:"emoji",id:"emoji"}),e(qs,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(zs,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(kg,{value:"url",id:"url"}),e(qs,{htmlFor:"url",className:"flex items-center gap-2",children:[t(Ps,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&t("span",{className:"text-2xl",children:s}),!s&&m.watch("image")?.trim()&&t("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&t(sv,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:hy.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),m.setValue("image",my(e))})(e),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(Qs,{control:m.control,name:"image",render:({field:r})=>e(rc,{children:[t(nc,{children:"Image URL"}),t(ac,{children:t(sc,{placeholder:"https://example.com/image.png",...r,disabled:!h})}),t(oc,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(ic,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:h&&t(Gs,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var vy=.999,yy=/[\\\/_+.#"@\[\(\{&]/,by=/[\\\/_+.#"@\[\(\{&]/g,wy=/[\s-]/,xy=/[\s-]/g;function Sy(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=Sy(e,t,r,n,p+1,o+1,i))>m&&(p===a?c*=1:yy.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(by))&&a>0&&(c*=Math.pow(vy,d.length))):wy.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(xy))&&a>0&&(c*=Math.pow(vy,u.length))):(c*=.17,a>0&&(c*=Math.pow(vy,p-a))),e.charAt(p)!==t.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(p-1)!==n.charAt(o))&&(.1*(l=Sy(e,t,r,n,p+1,o+2,i))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return i[s]=m,m}function ky(e){return e.toLowerCase().replace(xy," ")}function Ey(e,t,r){return Sy(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,ky(e),ky(t),0,0,{})}var Ay='[cmdk-group=""]',Ny='[cmdk-group-items=""]',Cy='[cmdk-item=""]',_y=`${Cy}:not([aria-disabled="true"])`,Ty="cmdk-item-select",Ry="data-value",Py=(e,t,r)=>Ey(e,t,r),Oy=n.createContext(void 0),Iy=()=>n.useContext(Oy),Dy=n.createContext(void 0),Uy=()=>n.useContext(Dy),My=n.createContext(void 0),zy=n.forwardRef((e,t)=>{let r=Yy(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Yy(()=>new Set),o=Yy(()=>new Map),i=Yy(()=>new Map),s=Yy(()=>new Set),c=Jy(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=Kf(),w=Kf(),x=Kf(),S=n.useRef(null),k=eb();qy(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,E.emit()}},[u]),qy(()=>{k(6,R)},[]);let E=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),C(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,E.emit()}),n||k(5,R),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}E.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),A=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,N(t,n)),k(2,()=>{C(),E.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{T(),C(),r.current.value||_(),E.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),E.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:b,inputId:x,labelId:w,listInnerRef:S}),[]);function N(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:Py;return e?o(e,r.current.search,t):0}function C(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(Ny);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ny} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${Ny} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Ay}[${Ry}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Ry);E.setState("value",t||void 0)}function T(){var e,t,n,s;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of a.current){let a=N(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&l++}for(let[e,t]of o.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function R(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Ay))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Cy}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(_y))||[])}function I(e){let t=O()[e];t&&E.setState("value",t.getAttribute(Ry))}function D(e){var t;let r=P(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&E.setState("value",o.getAttribute(Ry))}function U(e){let t,r=P(),n=null==r?void 0:r.closest(Ay);for(;n&&!t;)n=e>0?Ky(n,Ay):Zy(n,Ay),t=null==n?void 0:n.querySelector(_y);t?E.setState("value",t.getAttribute(Ry)):D(e)}let M=()=>I(O().length-1),z=e=>{e.preventDefault(),e.metaKey?M():e.altKey?U(1):D(1)},F=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?U(-1):D(-1)};return n.createElement(Qf.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),M();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(Ty);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:rb},l),tb(e,e=>n.createElement(Dy.Provider,{value:E},n.createElement(Oy.Provider,{value:A},e))))}),Fy=n.forwardRef((e,t)=>{var r,a;let o=Kf(),i=n.useRef(null),s=n.useContext(My),c=Iy(),l=Jy(e),d=null!=(a=null==(r=l.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;qy(()=>{if(!d)return c.item(o,null==s?void 0:s.id)},[d]);let u=Qy(o,i,[e.value,e.children,i],e.keywords),f=Uy(),p=Xy(e=>e.value&&e.value===u.current),m=Xy(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Ty,h),()=>t.removeEventListener(Ty,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:x,...S}=e;return n.createElement(Qf.div,{ref:os(i,t),...S,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||c.getDisablePointerSelection()?void 0:g,onClick:v?void 0:h},e.children)}),Ly=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=Kf(),c=n.useRef(null),l=n.useRef(null),d=Kf(),u=Iy(),f=Xy(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));qy(()=>u.group(s),[]),Qy(s,c,[e.value,e.heading,l]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(Qf.div,{ref:os(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),tb(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement(My.Provider,{value:p},e))))}),jy=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=Xy(e=>!e.search);return r||i?n.createElement(Qf.div,{ref:os(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),$y=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=Uy(),s=Xy(e=>e.search),c=Xy(e=>e.selectedItemId),l=Iy();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(Qf.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),Vy=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),c=Xy(e=>e.selectedItemId),l=Iy();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),n.createElement(Qf.div,{ref:os(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":a,id:l.listId},tb(e,e=>n.createElement("div",{ref:os(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Wy=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...c}=e;return n.createElement(eh,{open:r,onOpenChange:a},n.createElement(rh,{container:s},n.createElement(nh,{"cmdk-overlay":"",className:o}),n.createElement(ah,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(zy,{ref:t,...c}))))}),By=n.forwardRef((e,t)=>Xy(e=>0===e.filtered.count)?n.createElement(Qf.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Gy=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(Qf.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},tb(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),Hy=Object.assign(zy,{List:Vy,Item:Fy,Input:$y,Group:Ly,Separator:jy,Dialog:Wy,Empty:By,Loading:Gy});function Ky(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Zy(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Jy(e){let t=n.useRef(e);return qy(()=>{t.current=e}),t}var qy="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function Yy(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function Xy(e){let t=Uy(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function Qy(e,t,r,a=[]){let o=n.useRef(),i=Iy();return qy(()=>{var n;let s=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),c=a.map(e=>e.trim());i.value(e,s,c),null==(n=t.current)||n.setAttribute(Ry,s),o.current=s}),o}var eb=()=>{let[e,t]=n.useState(),r=Yy(()=>new Map);return qy(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function tb({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var rb={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const nb=n.forwardRef(({className:e,...r},n)=>t(Hy,{ref:n,className:Le("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));nb.displayName=Hy.displayName;const ab=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(gh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(Hy.Input,{ref:a,className:Le("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...n})]}));ab.displayName=Hy.Input.displayName;const ob=n.forwardRef(({className:e,...r},n)=>t(Hy.List,{ref:n,className:Le("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));ob.displayName=Hy.List.displayName;n.forwardRef((e,r)=>t(Hy.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=Hy.Empty.displayName;const ib=n.forwardRef(({className:e,...r},n)=>t(Hy.Group,{ref:n,className:Le("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));ib.displayName=Hy.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(Hy.Separator,{ref:n,className:Le("-mx-1 h-px bg-border",e),...r})).displayName=Hy.Separator.displayName;const sb=n.forwardRef(({className:e,...r},n)=>t(Hy.Item,{ref:n,className:Le("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r}));sb.displayName=Hy.Item.displayName;const cb=["top","right","bottom","left"],lb=Math.min,db=Math.max,ub=Math.round,fb=Math.floor,pb=e=>({x:e,y:e}),mb={left:"right",right:"left",bottom:"top",top:"bottom"},hb={start:"end",end:"start"};function gb(e,t,r){return db(e,lb(t,r))}function vb(e,t){return"function"==typeof e?e(t):e}function yb(e){return e.split("-")[0]}function bb(e){return e.split("-")[1]}function wb(e){return"x"===e?"y":"x"}function xb(e){return"y"===e?"height":"width"}const Sb=new Set(["top","bottom"]);function kb(e){return Sb.has(yb(e))?"y":"x"}function Eb(e){return wb(kb(e))}function Ab(e){return e.replace(/start|end/g,e=>hb[e])}const Nb=["left","right"],Cb=["right","left"],_b=["top","bottom"],Tb=["bottom","top"];function Rb(e,t,r,n){const a=bb(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Cb:Nb:t?Nb:Cb;case"left":case"right":return t?_b:Tb;default:return[]}}(yb(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Ab)))),o}function Pb(e){return e.replace(/left|right|bottom|top/g,e=>mb[e])}function Ob(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ib(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function Db(e,t,r){let{reference:n,floating:a}=e;const o=kb(t),i=Eb(t),s=xb(i),c=yb(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(bb(t)){case"start":p[i]-=f*(r&&l?-1:1);break;case"end":p[i]+=f*(r&&l?-1:1)}return p}async function Ub(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=vb(t,e),m=Ob(p),h=s[f?"floating"===u?"reference":"floating":u],g=Ib(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),b=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=Ib(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(g.top-w.top+m.top)/b.y,bottom:(w.bottom-g.bottom+m.bottom)/b.y,left:(g.left-w.left+m.left)/b.x,right:(w.right-g.right+m.right)/b.x}}function Mb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zb(e){return cb.some(t=>e[t]>=0)}const Fb=new Set(["left","top"]);function Lb(){return"undefined"!=typeof window}function jb(e){return Wb(e)?(e.nodeName||"").toLowerCase():"#document"}function $b(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Vb(e){var t;return null==(t=(Wb(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Wb(e){return!!Lb()&&(e instanceof Node||e instanceof $b(e).Node)}function Bb(e){return!!Lb()&&(e instanceof Element||e instanceof $b(e).Element)}function Gb(e){return!!Lb()&&(e instanceof HTMLElement||e instanceof $b(e).HTMLElement)}function Hb(e){return!(!Lb()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof $b(e).ShadowRoot)}const Kb=new Set(["inline","contents"]);function Zb(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=iw(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Kb.has(a)}const Jb=new Set(["table","td","th"]);function qb(e){return Jb.has(jb(e))}const Yb=[":popover-open",":modal"];function Xb(e){return Yb.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Qb=["transform","translate","scale","rotate","perspective"],ew=["transform","translate","scale","rotate","perspective","filter"],tw=["paint","layout","strict","content"];function rw(e){const t=nw(),r=Bb(e)?iw(e):e;return Qb.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||ew.some(e=>(r.willChange||"").includes(e))||tw.some(e=>(r.contain||"").includes(e))}function nw(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const aw=new Set(["html","body","#document"]);function ow(e){return aw.has(jb(e))}function iw(e){return $b(e).getComputedStyle(e)}function sw(e){return Bb(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cw(e){if("html"===jb(e))return e;const t=e.assignedSlot||e.parentNode||Hb(e)&&e.host||Vb(e);return Hb(t)?t.host:t}function lw(e){const t=cw(e);return ow(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gb(t)&&Zb(t)?t:lw(t)}function dw(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=lw(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=$b(a);if(o){const e=uw(i);return t.concat(i,i.visualViewport||[],Zb(a)?a:[],e&&r?dw(e):[])}return t.concat(a,dw(a,[],r))}function uw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fw(e){const t=iw(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Gb(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=ub(r)!==o||ub(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function pw(e){return Bb(e)?e:e.contextElement}function mw(e){const t=pw(e);if(!Gb(t))return pb(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=fw(t);let i=(o?ub(r.width):r.width)/n,s=(o?ub(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const hw=pb(0);function gw(e){const t=$b(e);return nw()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:hw}function vw(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=pw(e);let i=pb(1);t&&(n?Bb(n)&&(i=mw(n)):i=mw(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==$b(e))&&t}(o,r,n)?gw(o):pb(0);let c=(a.left+s.x)/i.x,l=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=$b(o),t=n&&Bb(n)?$b(n):n;let r=e,a=uw(r);for(;a&&n&&t!==r;){const e=mw(a),t=a.getBoundingClientRect(),n=iw(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=i,r=$b(a),a=uw(r)}}return Ib({width:d,height:u,x:c,y:l})}function yw(e,t){const r=sw(e).scrollLeft;return t?t.left+r:vw(Vb(e)).left+r}function bw(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-yw(e,r),y:r.top+t.scrollTop}}const ww=new Set(["absolute","fixed"]);function xw(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=$b(e),n=Vb(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;const e=nw();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,c=a.offsetTop)}const l=yw(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else l<=25&&(o+=l);return{width:o,height:i,x:s,y:c}}(e,r);else if("document"===t)n=function(e){const t=Vb(e),r=sw(e),n=e.ownerDocument.body,a=db(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=db(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+yw(e);const s=-r.scrollTop;return"rtl"===iw(n).direction&&(i+=db(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Vb(e));else if(Bb(t))n=function(e,t){const r=vw(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Gb(e)?mw(e):pb(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{const r=gw(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ib(n)}function Sw(e,t){const r=cw(e);return!(r===t||!Bb(r)||ow(r))&&("fixed"===iw(r).position||Sw(r,t))}function kw(e,t,r){const n=Gb(t),a=Vb(t),o="fixed"===r,i=vw(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=pb(0);function l(){c.x=yw(a)}if(n||!n&&!o)if(("body"!==jb(t)||Zb(a))&&(s=sw(t)),n){const e=vw(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();o&&!n&&a&&l();const d=!a||n||o?pb(0):bw(a,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function Ew(e){return"static"===iw(e).position}function Aw(e,t){if(!Gb(e)||"fixed"===iw(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Vb(e)===r&&(r=r.ownerDocument.body),r}function Nw(e,t){const r=$b(e);if(Xb(e))return r;if(!Gb(e)){let t=cw(e);for(;t&&!ow(t);){if(Bb(t)&&!Ew(t))return t;t=cw(t)}return r}let n=Aw(e,t);for(;n&&qb(n)&&Ew(n);)n=Aw(n,t);return n&&ow(n)&&Ew(n)&&!rw(n)?r:n||function(e){let t=cw(e);for(;Gb(t)&&!ow(t);){if(rw(t))return t;if(Xb(t))return null;t=cw(t)}return null}(e)||r}const Cw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=Vb(n),s=!!t&&Xb(t.floating);if(n===i||s&&o)return r;let c={scrollLeft:0,scrollTop:0},l=pb(1);const d=pb(0),u=Gb(n);if((u||!u&&!o)&&(("body"!==jb(n)||Zb(i))&&(c=sw(n)),Gb(n))){const e=vw(n);l=mw(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?pb(0):bw(i,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Vb,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o="clippingAncestors"===r?Xb(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=dw(e,[],!1).filter(e=>Bb(e)&&"body"!==jb(e)),a=null;const o="fixed"===iw(e).position;let i=o?cw(e):e;for(;Bb(i)&&!ow(i);){const t=iw(i),r=rw(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&ww.has(a.position)||Zb(i)&&!r&&Sw(e,i))?n=n.filter(e=>e!==i):a=t,i=cw(i)}return t.set(e,n),n}(t,this._c):[].concat(r),i=[...o,n],s=i[0],c=i.reduce((e,r)=>{const n=xw(t,r,a);return e.top=db(n.top,e.top),e.right=lb(n.right,e.right),e.bottom=lb(n.bottom,e.bottom),e.left=db(n.left,e.left),e},xw(t,s,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:Nw,getElementRects:async function(e){const t=this.getOffsetParent||Nw,r=this.getDimensions,n=await r(e.floating);return{reference:kw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=fw(e);return{width:t,height:r}},getScale:mw,isElement:Bb,isRTL:function(e){return"rtl"===iw(e).direction}};function _w(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tw(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=pw(e),d=a||o?[...l?dw(l):[],...dw(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&s?function(e,t){let r,n=null;const a=Vb(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(s||t(),!f||!p)return;const m={rootMargin:-fb(u)+"px "+-fb(a.clientWidth-(d+f))+"px "+-fb(a.clientHeight-(u+p))+"px "+-fb(d)+"px",threshold:db(0,lb(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||_w(l,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(l,r):null;let f,p=-1,m=null;i&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?vw(e):null;return c&&function t(){const n=vw(e);h&&!_w(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const Rw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=yb(r),s=bb(r),c="y"===kb(r),l=Fb.has(i)?-1:1,d=o&&c?-1:1,u=vb(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},Pw=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=vb(e,t),l={x:r,y:n},d=await Ub(t,c),u=kb(yb(a)),f=wb(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=gb(p+d["y"===f?"top":"left"],p,p-d[e])}if(i){const e="y"===u?"bottom":"right";m=gb(m+d["y"===u?"top":"left"],m,m-d[e])}const h=s.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:i}}}}}},Ow=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=vb(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=yb(a),y=kb(s),b=yb(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(b||!h?[Pb(s)]:function(e){const t=Pb(e);return[Ab(e),t,Ab(t)]}(s)),S="none"!==m;!f&&S&&x.push(...Rb(s,h,m,w));const k=[s,...x],E=await Ub(t,g),A=[];let N=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&A.push(E[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=bb(e),a=Eb(e),o=xb(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Pb(i)),[i,Pb(i)]}(a,i,w);A.push(E[e[0]],E[e[1]])}if(N=[...N,{placement:a,overflows:A}],!A.every(e=>e<=0)){var C,_;const e=((null==(C=o.flip)?void 0:C.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==kb(t))||N.every(e=>kb(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:N},reset:{placement:t}}}let r=null==(_=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!r)switch(p){case"bestFit":{var T;const e=null==(T=N.filter(e=>{if(S){const t=kb(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:T[0];e&&(r=e);break}case"initialPlacement":r=s}if(a!==r)return{reset:{placement:r}}}return{}}}},Iw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...l}=vb(e,t),d=await Ub(t,l),u=yb(a),f=bb(a),p="y"===kb(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,b=m-d.left-d.right,w=lb(h-d[g],y),x=lb(m-d[v],b),S=!t.middlewareData.shift;let k=w,E=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(E=b),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=db(d.left,0),t=db(d.right,0),r=db(d.top,0),n=db(d.bottom,0);p?E=m-2*(0!==e||0!==t?e+t:db(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:db(d.top,d.bottom))}await c({...t,availableWidth:E,availableHeight:k});const A=await i.getDimensions(s.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},Dw=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=vb(e,t);switch(n){case"referenceHidden":{const e=Mb(await Ub(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:zb(e)}}}case"escaped":{const e=Mb(await Ub(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:zb(e)}}}default:return{}}}}},Uw=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=vb(e,t)||{};if(null==l)return{};const u=Ob(d),f={x:r,y:n},p=Eb(a),m=xb(p),h=await i.getDimensions(l),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=f[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let k=S?S[b]:0;k&&await(null==i.isElement?void 0:i.isElement(S))||(k=s.floating[b]||o.floating[m]);const E=w/2-x/2,A=k/2-h[m]/2-1,N=lb(u[v],A),C=lb(u[y],A),_=N,T=k-h[m]-C,R=k/2-h[m]/2+E,P=gb(_,R,T),O=!c.arrow&&null!=bb(a)&&R!==P&&o.reference[m]/2-(R<_?N:C)-h[m]/2<0,I=O?R<_?R-_:R-T:0;return{[p]:f[p]+I,data:{[p]:P,centerOffset:R-P-I,...O&&{alignmentOffset:I}},reset:O}}}),Mw=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=vb(e,t),d={x:r,y:n},u=kb(a),f=wb(u);let p=d[f],m=d[u];const h=vb(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var v,y;const e="y"===f?"width":"height",t=Fb.has(yb(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=i.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},zw=(e,t,r)=>{const n=new Map,a={platform:Cw,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Db(l,n,c),f=n,p={},m=0;for(let r=0;r<s.length;r++){const{name:o,fn:h}=s[r],{x:g,y:v,data:y,reset:b}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...y}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):b.rects),({x:d,y:u}=Db(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Fw="undefined"!=typeof document?y:function(){};function Lw(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Lw(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){const r=a[n];if(("_owner"!==r||!e.$$typeof)&&!Lw(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function jw(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $w(e,t){const r=jw(e);return Math.round(t*r)/r}function Vw(e){const t=n.useRef(e);return Fw(()=>{t.current=e}),t}const Ww=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(a=r,{}.hasOwnProperty.call(a,"current"))?null!=r.current?Uw({element:r.current,padding:n}).fn(t):{}:r?Uw({element:r,padding:n}).fn(t):{};var a}}),Bw=(e,t)=>({...Rw(e),options:[e,t]}),Gw=(e,t)=>({...Pw(e),options:[e,t]}),Hw=(e,t)=>({...Mw(e),options:[e,t]}),Kw=(e,t)=>({...Ow(e),options:[e,t]}),Zw=(e,t)=>({...Iw(e),options:[e,t]}),Jw=(e,t)=>({...Dw(e),options:[e,t]}),qw=(e,t)=>({...Ww(e),options:[e,t]});var Yw=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(Qf.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});Yw.displayName="Arrow";var Xw=Yw,Qw="Popper",[ex,tx]=Wf(Qw),[rx,nx]=ex(Qw),ax=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(rx,{scope:r,anchor:o,onAnchorChange:i,children:a})};ax.displayName=Qw;var ox="PopperAnchor",ix=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=nx(ox,a),c=n.useRef(null),l=is(r,c),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(Qf.div,{...i,ref:l})});ix.displayName=ox;var sx="PopperContent",[cx,lx]=ex(sx),dx=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,y=nx(sx,a),[w,x]=n.useState(null),S=is(r,e=>x(e)),[k,E]=n.useState(null),A=qh(k),N=A?.width??0,C=A?.height??0,_=o+("center"!==s?"-"+s:""),T="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],P=R.length>0,O={padding:T,boundary:R.filter(mx),altBoundary:P},{refs:I,floatingStyles:D,placement:U,isPositioned:M,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);Lw(p,a)||m(a);const[h,g]=n.useState(null),[v,y]=n.useState(null),w=n.useCallback(e=>{e!==E.current&&(E.current=e,g(e))},[]),x=n.useCallback(e=>{e!==A.current&&(A.current=e,y(e))},[]),S=i||h,k=s||v,E=n.useRef(null),A=n.useRef(null),N=n.useRef(u),C=null!=l,_=Vw(l),T=Vw(o),R=Vw(d),P=n.useCallback(()=>{if(!E.current||!A.current)return;const e={placement:t,strategy:r,middleware:p};T.current&&(e.platform=T.current),zw(E.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};O.current&&!Lw(N.current,t)&&(N.current=t,b.flushSync(()=>{f(t)}))})},[p,t,r,T,R]);Fw(()=>{!1===d&&N.current.isPositioned&&(N.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const O=n.useRef(!1);Fw(()=>(O.current=!0,()=>{O.current=!1}),[]),Fw(()=>{if(S&&(E.current=S),k&&(A.current=k),S&&k){if(_.current)return _.current(S,k,P);P()}},[S,k,P,_,C]);const I=n.useMemo(()=>({reference:E,floating:A,setReference:w,setFloating:x}),[w,x]),D=n.useMemo(()=>({reference:S,floating:k}),[S,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=$w(D.floating,u.x),n=$w(D.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...jw(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,D.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:P,refs:I,elements:D,floatingStyles:U}),[u,P,I,D,U])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Tw(...e,{animationFrame:"always"===h}),elements:{reference:y.anchor},middleware:[Bw({mainAxis:i+C,alignmentAxis:c}),d&&Gw({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?Hw():void 0,...O}),d&&Kw({...O}),Zw({...O,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&qw({element:k,padding:l}),hx({arrowWidth:N,arrowHeight:C}),m&&Jw({strategy:"referenceHidden",...O})]}),[F,L]=gx(U),j=ff(g);mf(()=>{M&&j?.()},[M,j]);const $=z.arrow?.x,V=z.arrow?.y,W=0!==z.arrow?.centerOffset,[B,G]=n.useState();return mf(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:M?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t(cx,{scope:a,placedSide:F,onArrowChange:E,arrowX:$,arrowY:V,shouldHideArrow:W,children:t(Qf.div,{"data-side":F,"data-align":L,...v,ref:S,style:{...v.style,animation:M?void 0:"none"}})})})});dx.displayName=sx;var ux="PopperArrow",fx={top:"bottom",right:"left",bottom:"top",left:"right"},px=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=lx(ux,n),i=fx[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(Xw,{...a,ref:r,style:{...a.style,display:"block"}})})});function mx(e){return null!==e}px.displayName=ux;var hx=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[c,l]=gx(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-s+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===c?(p=-s+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function gx(e){const[t,r="center"]=e.split("-");return[t,r]}var vx=ax,yx=ix,bx=dx,wx=px;function xx(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?os(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sx=Symbol("radix.slottable");function kx(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Sx}var Ex="Popover",[Ax]=Wf(Ex,[tx]),Nx=tx(),[Cx,_x]=Ax(Ex),Tx=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!1}=e,l=Nx(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=Jf({prop:o,defaultProp:i??!1,onChange:s,caller:Ex});return t(vx,{...l,children:t(Cx,{scope:r,contentId:Kf(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:c,children:a})})};Tx.displayName=Ex;var Rx="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=_x(Rx,a),s=Nx(a),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return n.useEffect(()=>(c(),()=>l()),[c,l]),t(yx,{...s,...o,ref:r})}).displayName=Rx;var Px="PopoverTrigger",Ox=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=_x(Px,n),i=Nx(n),s=is(r,o.triggerRef),c=t(Qf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Bx(o.open),...a,ref:s,onClick:Vf(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:t(yx,{asChild:!0,...i,children:c})});Ox.displayName=Px;var Ix="PopoverPortal",[Dx,Ux]=Ax(Ix,{forceMount:void 0}),Mx=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=_x(Ix,r);return t(Dx,{scope:r,forceMount:n,children:t(bp,{present:n||i.open,children:t(yp,{asChild:!0,container:o,children:a})})})};Mx.displayName=Ix;var zx="PopoverContent",Fx=n.forwardRef((e,r)=>{const n=Ux(zx,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=_x(zx,e.__scopePopover);return t(bp,{present:a||i.open,children:i.modal?t(jx,{...o,ref:r}):t($x,{...o,ref:r})})});Fx.displayName=zx;var Lx=function(e){const r=xx(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(kx);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("PopoverContent.RemoveScroll"),jx=n.forwardRef((e,r)=>{const a=_x(zx,e.__scopePopover),o=n.useRef(null),i=is(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return vm(e)},[]),t(dm,{as:Lx,allowPinchZoom:!0,children:t(Vx,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vf(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:Vf(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:Vf(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),$x=n.forwardRef((e,r)=>{const a=_x(zx,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(Vx,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Vx=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=e,p=_x(zx,n),m=Nx(n);return Sp(),t(up,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(op,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(bx,{"data-state":Bx(p.open),role:"dialog",id:p.contentId,...m,...f,ref:r,style:{...f.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)"}})})})}),Wx="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=_x(Wx,n);return t(Qf.button,{type:"button",...a,ref:r,onClick:Vf(e.onClick,()=>o.onOpenChange(!1))})}).displayName=Wx;function Bx(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Nx(n);return t(wx,{...o,...a,ref:r})}).displayName="PopoverArrow";var Gx=Mx,Hx=Fx;const Kx=Tx,Zx=Ox,Jx=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(fr);return t(Gx,{container:s,children:t(Hx,{ref:i,align:r,sideOffset:a,className:Le("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...o})})});function qx({options:r,value:n,onChange:a,placeholder:o="Search...",emptyLabel:i="Choose option"}){const[s,c]=f(n??""),[l,u]=f(!1);d(()=>{void 0!==n&&c(n)},[n]);const p=r.find(e=>e.value===s);return e(Kx,{open:l,onOpenChange:u,children:[t(Zx,{asChild:!0,children:e(Gs,{variant:"outline",role:"combobox","aria-expanded":l,className:"justify-between overflow-hidden text-ellipsis",children:[p?e("div",{children:[String(p.label).trim(),p.icon&&t("span",{className:"ml-2 text-xs text-muted-foreground",children:p.icon})]}):t("span",{className:"text-muted-foreground",children:i}),t(Cs,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(Jx,{className:"p-0 overflow-hidden text-ellipsis",children:e(nb,{children:[t(ab,{placeholder:o}),t(ob,{children:t(ib,{children:r.map(r=>e(sb,{className:Le("whitespace-nowrap text-left",{"text-green-500":s===r.value}),value:r.value,defaultValue:r.value,onSelect:()=>{return e=r.value,c(e),a?.(e),void u(!1);var e},children:[s===r.value&&t(Ns,{className:Le("mr-2 h-4 w-4 text-green-400",s===r.value?"opacity-100":"opacity-0")}),String(r.label).trim(),r.icon&&t("span",{className:"ml-2 text-xs text-muted-foreground",children:r.icon})]},r.value))})})]})})]})}Jx.displayName=Hx.displayName;const Yx={USD:"$",EUR:"€",JPY:"¥",GBP:"£",AUD:"A$",CAD:"C$",CHF:"CHF",CNY:"¥",SEK:"kr",NZD:"NZ$",INR:"₹",RUB:"₽",KRW:"₩",BRL:"R$",ZAR:"R",HKD:"HK$",SGD:"S$",MXN:"Mex$",NOK:"kr",TRY:"₺",IDR:"Rp",PLN:"zł",THB:"฿",ILS:"₪",PHP:"₱",MYR:"RM",CZK:"Kč",HUF:"Ft",DKK:"kr",PKR:"₨",EGP:"£",NGN:"₦",BDT:"৳",UAH:"₴",KZT:"₸",VND:"₫",ARS:"$",BGN:"лв",COP:"COL$",HRK:"kn",ISK:"kr",KES:"KSh",LKR:"Rs",MAD:"د.م.",MNT:"₮",NPR:"रू",RSD:"дин.",SAR:"ر.س",TWD:"NT$",UYU:"$U",YER:"﷼",FJD:"FJ$",JMD:"J$",HTG:"G",BHD:"ب.د",KWD:"د.ك",OMR:"ر.ع.",BND:"B$",KPW:"₩",GHS:"₵",SYP:"ل.س",SLL:"Le",SSP:"£",AFN:"؋",MGA:"Ar",MDL:"lei",FOK:"kr",GMD:"D",LTL:"Lt",LVL:"Ls",HNL:"L",GEL:"₾",BMD:"$",AWG:"Afl",BTN:"Nu",GTQ:"Q",TZS:"TSh",BBD:"Bds$",NAD:"N$",BZD:"$",JEP:"£",WST:"T",PGK:"K",KGS:"лв",AZN:"₼",QAR:"ر.ق",XOF:"CFA",XPF:"CFP"},Xx={AF:"AFN",AX:"EUR",AL:"ALL",DZ:"DZD",AS:"USD",AD:"EUR",AO:"AOA",AI:"XCD",AQ:"USD",AG:"XCD",AR:"ARS",AM:"AMD",AW:"AWG",AU:"AUD",AT:"EUR",AZ:"AZN",BS:"BSD",BH:"BHD",BD:"BDT",BB:"BBD",BY:"BYN",BE:"EUR",BZ:"BZD",BJ:"XOF",BM:"BMD",BT:"BTN",BO:"BOB",BA:"BAM",BW:"BWP",BV:"NOK",BR:"BRL",IO:"USD",BN:"BND",BG:"BGN",BF:"XOF",BI:"BIF",KH:"KHR",CM:"XAF",CA:"CAD",CV:"CVE",KY:"KYD",CF:"XAF",TD:"XAF",CL:"CLP",CN:"CNY",CX:"AUD",CC:"AUD",CO:"COP",KM:"KMF",CG:"XAF",CD:"CDF",CK:"NZD",CR:"CRC",CI:"XOF",HR:"HRK",CU:"CUP",CY:"EUR",CZ:"CZK",DK:"DKK",DJ:"DJF",DM:"XCD",DO:"DOP",EC:"USD",EG:"EGP",SV:"USD",GQ:"XAF",ER:"ERN",EE:"EUR",ET:"ETB",FK:"FKP",FO:"DKK",FJ:"FJD",FI:"EUR",FR:"EUR",GF:"EUR",PF:"XPF",TF:"EUR",GA:"XAF",GM:"GMD",GE:"GEL",DE:"EUR",GH:"GHS",GI:"GIP",GR:"EUR",GL:"DKK",GD:"XCD",GP:"EUR",GU:"USD",GT:"GTQ",GG:"GBP",GN:"GNF",GW:"XOF",GY:"GYD",HT:"HTG",HM:"AUD",VA:"EUR",HN:"HNL",HK:"HKD",HU:"HUF",IS:"ISK",IN:"INR",ID:"IDR",IR:"IRR",IQ:"IQD",IE:"EUR",IM:"GBP",IL:"ILS",IT:"EUR",JM:"JMD",JP:"JPY",JE:"GBP",JO:"JOD",KZ:"KZT",KE:"KES",KI:"AUD",KP:"KPW",KR:"KRW",KW:"KWD",KG:"KGS",LA:"LAK",LV:"EUR",LB:"LBP",LS:"LSL",LR:"LRD",LY:"LYD",LI:"CHF",LT:"EUR",LU:"EUR",MO:"MOP",MK:"MKD",MG:"MGA",MW:"MWK",MY:"MYR",MV:"MVR",ML:"XOF",MT:"EUR",MH:"USD",MQ:"EUR",MR:"MRU",MU:"MUR",YT:"EUR",MX:"MXN",FM:"USD",MD:"MDL",MC:"EUR",MN:"MNT",ME:"EUR",MS:"XCD",MA:"MAD",MZ:"MZN",MM:"MMK",NA:"NAD",NR:"AUD",NP:"NPR",NL:"EUR",AN:"ANG",NC:"XPF",NZ:"NZD",NI:"NIO",NE:"XOF",NG:"NGN",NU:"NZD",NF:"AUD",MP:"USD",NO:"NOK",OM:"OMR",PK:"PKR",PW:"USD",PS:"ILS",PA:"PAB",PG:"PGK",PY:"PYG",PE:"PEN",PH:"PHP",PN:"NZD",PL:"PLN",PT:"EUR",PR:"USD",QA:"QAR",RE:"EUR",RO:"RON",RU:"RUB",RW:"RWF",SH:"SHP",KN:"XCD",LC:"XCD",PM:"EUR",VC:"XCD",WS:"WST",SM:"EUR",ST:"STN",SA:"SAR",SN:"XOF",RS:"RSD",SC:"SCR",SL:"SLL",SG:"SGD",SK:"EUR",SI:"EUR",SB:"SBD",SO:"SOS",ZA:"ZAR",GS:"GBP",ES:"EUR",LK:"LKR",SD:"SDG",SR:"SRD",SJ:"NOK",SZ:"SZL",SE:"SEK",CH:"CHF",SY:"SYP",TW:"TWD",TJ:"TJS",TZ:"TZS",TH:"THB"},Qx=[{name:"Afghanistan",code:"AF"},{name:"land Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:'Korea, Democratic People"S Republic of',code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:'Lao People"S Democratic Republic',code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}].map(e=>{const t=Xx[e.code]||"USD",r=Yx[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function eS({value:e,onChange:r}){const n=Qx.map(e=>({value:e.value,label:e.text,icon:e.flag}));return t(qx,{options:n,value:e,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const tS=Qx.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),rS=Array.from(new Set(tS.map(e=>e.value))).map(e=>tS.find(t=>t.value===e)).filter(e=>void 0!==e);function nS({value:e,onChange:r}){const n=rS.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return t(qx,{options:n,value:e,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let aS=[{code:"en",label:"English",flag:"🇬🇧"},{code:"en-GB",label:"English (United Kingdom)",flag:"🇬🇧"},{code:"en-US",label:"English (United States)",flag:"🇺🇸"},{code:"en-AU",label:"English (Australia)",flag:"🇦🇺"},{code:"en-CA",label:"English (Canada)",flag:"🇨🇦"},{code:"en-NZ",label:"English (New Zealand)",flag:"🇳🇿"},{code:"es",label:"Spanish",flag:"🇪🇸"},{code:"es-ES",label:"Spanish (Spain)",flag:"🇪🇸"},{code:"es-MX",label:"Spanish (Mexico)",flag:"🇲🇽"},{code:"fr",label:"French",flag:"🇫🇷"},{code:"fr-FR",label:"French (France)",flag:"🇫🇷"},{code:"de",label:"German",flag:"🇩🇪"},{code:"de-DE",label:"German (Germany)",flag:"🇩🇪"},{code:"it",label:"Italian",flag:"🇮🇹"},{code:"it-IT",label:"Italian (Italy)",flag:"🇮🇹"},{code:"pt",label:"Portuguese",flag:"🇵🇹"},{code:"pt-PT",label:"Portuguese (Portugal)",flag:"🇵🇹"},{code:"pt-BR",label:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"ru",label:"Russian",flag:"🇷🇺"},{code:"ru-RU",label:"Russian (Russia)",flag:"🇷🇺"},{code:"zh",label:"Chinese",flag:"🇨🇳"},{code:"zh-CN",label:"Chinese (Simplified)",flag:"🇨🇳"},{code:"zh-TW",label:"Chinese (Traditional)",flag:"🇹🇼"},{code:"ja",label:"Japanese",flag:"🇯🇵"},{code:"ja-JP",label:"Japanese (Japan)",flag:"🇯🇵"},{code:"ko",label:"Korean",flag:"🇰🇷"},{code:"ko-KR",label:"Korean (South Korea)",flag:"🇰🇷"},{code:"ar",label:"Arabic",flag:"🇸🇦"},{code:"ar-SA",label:"Arabic (Saudi Arabia)",flag:"🇸🇦"},{code:"hi",label:"Hindi",flag:"🇮🇳"},{code:"hi-IN",label:"Hindi (India)",flag:"🇮🇳"},{code:"bn",label:"Bengali",flag:"🇮🇳"},{code:"bn-IN",label:"Bengali (India)",flag:"🇮🇳"},{code:"gu",label:"Gujarati",flag:"🇮🇳"},{code:"gu-IN",label:"Gujarati (India)",flag:"🇮🇳"},{code:"ta",label:"Tamil",flag:"🇮🇳"},{code:"ta-IN",label:"Tamil (India)",flag:"🇮🇳"},{code:"te",label:"Telugu",flag:"🇮🇳"},{code:"te-IN",label:"Telugu (India)",flag:"🇮🇳"},{code:"ml",label:"Malayalam",flag:"🇮🇳"},{code:"ml-IN",label:"Malayalam (India)",flag:"🇮🇳"},{code:"kn",label:"Kannada",flag:"🇮🇳"},{code:"kn-IN",label:"Kannada (India)",flag:"🇮🇳"},{code:"mr",label:"Marathi",flag:"🇮🇳"},{code:"mr-IN",label:"Marathi (India)",flag:"🇮🇳"},{code:"pa",label:"Punjabi",flag:"🇮🇳"},{code:"pa-IN",label:"Punjabi (India)",flag:"🇮🇳"},{code:"ur",label:"Urdu",flag:"🇮🇳"},{code:"ur-IN",label:"Urdu (India)",flag:"🇮🇳"},{code:"or",label:"Odia",flag:"🇮🇳"},{code:"or-IN",label:"Odia (India)",flag:"🇮🇳"},{code:"as",label:"Assamese",flag:"🇮🇳"},{code:"as-IN",label:"Assamese (India)",flag:"🇮🇳"},{code:"zh-HK",label:"Chinese (Hong Kong)",flag:"🇭🇰"},{code:"nl",label:"Dutch",flag:"🇳🇱"},{code:"nl-NL",label:"Dutch (Netherlands)",flag:"🇳🇱"},{code:"pl",label:"Polish",flag:"🇵🇱"},{code:"pl-PL",label:"Polish (Poland)",flag:"🇵🇱"},{code:"sv",label:"Swedish",flag:"🇸🇪"},{code:"sv-SE",label:"Swedish (Sweden)",flag:"🇸🇪"},{code:"da",label:"Danish",flag:"🇩🇰"},{code:"da-DK",label:"Danish (Denmark)",flag:"🇩🇰"},{code:"no",label:"Norwegian",flag:"🇳🇴"},{code:"no-NO",label:"Norwegian (Norway)",flag:"🇳🇴"},{code:"fi",label:"Finnish",flag:"🇫🇮"},{code:"fi-FI",label:"Finnish (Finland)",flag:"🇫🇮"},{code:"tr",label:"Turkish",flag:"🇹🇷"},{code:"tr-TR",label:"Turkish (Turkey)",flag:"🇹🇷"},{code:"cs",label:"Czech",flag:"🇨🇿"},{code:"cs-CZ",label:"Czech (Czech Republic)",flag:"🇨🇿"},{code:"sk",label:"Slovak",flag:"🇸🇰"},{code:"sk-SK",label:"Slovak (Slovakia)",flag:"🇸🇰"},{code:"hu",label:"Hungarian",flag:"🇭🇺"},{code:"hu-HU",label:"Hungarian (Hungary)",flag:"🇭🇺"},{code:"ro",label:"Romanian",flag:"🇷🇴"},{code:"ro-RO",label:"Romanian (Romania)",flag:"🇷🇴"},{code:"el",label:"Greek",flag:"🇬🇷"},{code:"el-GR",label:"Greek (Greece)",flag:"🇬🇷"},{code:"th",label:"Thai",flag:"🇹🇭"},{code:"th-TH",label:"Thai (Thailand)",flag:"🇹🇭"},{code:"id",label:"Indonesian",flag:"🇮🇩"},{code:"id-ID",label:"Indonesian (Indonesia)",flag:"🇮🇩"},{code:"ms",label:"Malay",flag:"🇲🇾"},{code:"ms-MY",label:"Malay (Malaysia)",flag:"🇲🇾"},{code:"vi",label:"Vietnamese",flag:"🇻🇳"},{code:"vi-VN",label:"Vietnamese (Vietnam)",flag:"🇻🇳"},{code:"he",label:"Hebrew",flag:"🇮🇱"},{code:"he-IL",label:"Hebrew (Israel)",flag:"🇮🇱"}];aS=aS.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),aS.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const oS=aS.filter(e=>function(e){try{const t=new Intl.DateTimeFormat(e);return t.resolvedOptions().locale===e||t.resolvedOptions().locale.startsWith(e)}catch{return!1}}(e.code)).filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function iS({value:e,onChange:r}){const n=oS.map(e=>({value:e.value,label:e.label,icon:e.flag}));return t(qx,{options:n,value:e,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const sS=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function cS({value:e,onChange:r}){const n=sS.map(e=>({value:e.value,label:e.text}));return t(qx,{options:n,value:e,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const lS=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=vr(),[o,i]=f(!1),[s,c]=f(),[l,u]=f(0),[p,m]=f(null),h=Zn({resolver:ns(sl({name:Dc().min(2,{message:"Name must be at least 2 characters."}),country:Dc().optional(),timezone:Dc().optional(),language:Dc().optional(),currency:Dc().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return d(()=>{a().then(e=>{c(e),h.setValue("name",e.name),h.setValue("country",e.country),h.setValue("timezone",e.timezone),h.setValue("language",e.language),h.setValue("currency",e.currency)})},[l]),s?e("div",{children:[p&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:p})]}),t("div",{className:"space-y-4",children:t(Ys,{...h,children:e("form",{onSubmit:h.handleSubmit(async function(e){i(!0),m(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),m("Profile saved successfully"),setTimeout(()=>{m(null)},5e3)}catch(e){qe(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{i(!1)}}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(sc,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),t(Qs,{disabled:o,control:h.control,name:"name",render:({field:r})=>e(rc,{children:[t(nc,{children:"Name"}),t(ac,{children:t(sc,{...r})}),t(ic,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(iS,{value:h.getValues("language"),onChange:e=>{h.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(eS,{value:h.getValues("country"),onChange:e=>{h.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(nS,{value:h.getValues("currency"),onChange:e=>{h.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(cS,{value:h.getValues("timezone"),onChange:e=>{h.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(Gs,{type:"submit",progress:o,disabled:o,children:"Save"}),t(Gs,{type:"button",variant:"outline",onClick:()=>{u(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),s?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):t(Qv,{})},dS=e=>{const t=ir(e=>e.os),r=s(()=>new gr(t),[t.serverUrl,t.version,t.orgId]),[n,a]=f(null),[o,i]=f(!1),[c,l]=f(null),p=u(async()=>{if(e){i(!0),l(null);try{const t=await r.getCurrentSubscription(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";l(r),qe(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{i(!1)}}else a(null)},[r,e]);return d(()=>{p()},[p]),{subscription:n,loading:o,error:c,refetch:p}},uS=(e,t)=>{const r=ir(e=>e.os),n=s(()=>new gr(r),[r.serverUrl,r.version,r.orgId]),[a,o]=f(null),[i,c]=f(!1),[l,p]=f(null),m=u(async()=>{if(e){c(!0),p(null);try{const r=t?await n.getPlanGroupByVersion(e,t):await n.getPlanGroup(e);o(r)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch plan group";p(n),qe(r,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:t}})}finally{c(!1)}}else o(null)},[n,e,t]);return d(()=>{m()},[m]),{planGroup:a,loading:i,error:l,refetch:m}},fS=e=>{const t=ir(e=>e.os),r=s(()=>new gr(t),[t.serverUrl,t.version,t.orgId]),[n,a]=f(null),[o,i]=f(!1),[c,l]=f(null),p=u(async()=>{if(e){i(!0),l(null);try{const t=await r.getPlanGroupVersions(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";l(r),qe(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{i(!1)}}else a(null)},[r,e]);return d(()=>{p()},[p]),{versions:n,loading:o,error:c,refetch:p}},pS=e=>{const t=ir(e=>e.os),r=s(()=>new gr(t),[t.serverUrl,t.version,t.orgId]),[n,a]=f(!1),[o,i]=f(null);return{createCheckoutSession:u(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),i(null);try{return await r.createCheckoutSession(e,t)}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw i(n),qe(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:o}},mS=e=>{const t=ir(e=>e.os),r=s(()=>new gr(t),[t.serverUrl,t.version,t.orgId]),[n,a]=f(!1),[o,i]=f(null),c=u(async(t,n)=>{if(!e)throw new Error("Workspace ID is required");a(!0),i(null);try{const a={planVersionId:t,...n?.billingInterval&&{billingInterval:n.billingInterval},...n?.successUrl&&{successUrl:n.successUrl},...n?.cancelUrl&&{cancelUrl:n.cancelUrl}};return await r.updateSubscription(e,a)}catch(r){const a=r instanceof Error?r.message:"Failed to update subscription";throw i(a),qe(r,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:n}}),r}finally{a(!1)}},[r,e]);return{updateSubscription:c,loading:n,error:o}},hS=(e,t)=>{const r=dS(e),n=uS(e,t),a=mS(e),o=u(async()=>{await Promise.all([r.refetch(),n.refetch()])},[r,n]);return{subscription:r.subscription,planGroup:n.planGroup,loading:r.loading||n.loading||a.loading,error:r.error||n.error||a.error,updateSubscription:a.updateSubscription,refetch:o}},gS=(e,t=10,r)=>{const n=ir(e=>e.os),a=s(()=>new gr(n),[n.serverUrl,n.version,n.orgId]),[o,i]=f([]),[c,l]=f(!1),[p,m]=f(!1),[h,g]=f(null),v=u(async()=>{if(!e)return i([]),void l(!1);m(!0),g(null);try{const n=await a.listInvoices(e,t,r);i(n.invoices||[]),l(n.has_more||!1)}catch(n){const a=n instanceof Error?n.message:"Failed to fetch invoices";g(a),qe(n,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:t,startingAfter:r}})}finally{m(!1)}},[a,e,t,r]);return d(()=>{v()},[v]),{invoices:o,hasMore:c,loading:p,error:h,refetch:v}},vS=(e,t)=>{const r=ir(e=>e.os),n=s(()=>new gr(r),[r.serverUrl,r.version,r.orgId]),[a,o]=f(null),[i,c]=f(!1),[l,p]=f(null),m=u(async()=>{if(e&&t){c(!0),p(null);try{const r=await n.getInvoice(e,t);o(r.invoice)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch invoice";p(n),qe(r,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:t}})}finally{c(!1)}}else o(null)},[n,e,t]);return d(()=>{m()},[m]),{invoice:a,loading:i,error:l,refetch:m}},yS=m(()=>Promise.resolve().then(function(){return Yk}).then(e=>({default:e.default}))),bS=(e,t="usd")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e/100),wS=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",xS=e=>{switch(e){case"paid":return"bg-green-100 text-green-800";case"open":return"bg-yellow-100 text-yellow-800";case"draft":case"void":default:return"bg-gray-100 text-gray-800";case"uncollectible":return"bg-red-100 text-red-800"}},SS=({workspace:n})=>{const a=n._id?.toString(),{subscription:o,loading:i,error:c,updateSubscription:l,refetch:d}=hS(a),{createCheckoutSession:u}=pS(a),{versions:m,loading:h,error:g,refetch:v}=fS(a),{invoices:y,loading:b,error:w,refetch:x}=gS(a,20),S=i||h,k=c||g,{currentVersion:E,latestVersion:A,hasNewerVersion:N,isDeprecated:C,whatsNew:_,plansToShow:T}=s(()=>{const e=m?.currentVersion,t=m?.availableVersions||[],r=null!==o?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const a=!!(r&&n&&e)&&n.version>e.version,i=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:a,isDeprecated:a&&r,whatsNew:n?.whatsNew,plansToShow:i}},[m,o?.subscription]),[R,P]=f(!1),[O,I]=f(null),[D,U]=f(null),[M,z]=f(!1),F=async()=>{await Promise.all([d(),v()])};if(S&&!o&&!m)return t(Qv,{});const L=o?.planVersion?._id||null;return a?e("div",{className:"space-y-6",children:[k&&e("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[t("p",{className:"font-medium",children:"Error loading subscription data"}),t("p",{className:"text-sm",children:k}),t("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try refreshing the page."})]}),O&&e("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[t("p",{className:"font-medium",children:"Update failed"}),t("p",{className:"text-sm",children:O})]}),D&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:D})]}),C&&o?.subscription&&t("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e("div",{className:"flex items-start gap-3",children:[t("div",{className:"flex-shrink-0",children:t($s,{className:"h-5 w-5 text-amber-600"})}),e("div",{className:"flex-1",children:[t("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),t("p",{className:"text-sm text-amber-700 mb-2",children:"A new version of the pricing plans is now available. Please upgrade to one of the new plans below to continue receiving updates and support."}),e("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e("span",{children:["Current: Version ",E?.version||"N/A"]}),t("span",{children:"•"}),e("span",{children:["Latest: Version ",A?.version||"N/A"]})]}),_&&(_.newPlans.length>0||_.updatedPlans.length>0)&&e("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",A?.version,":"]}),e("div",{className:"space-y-1.5 text-xs text-amber-700",children:[_.newPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"New Plans: "}),t("span",{children:_.newPlans.map(e=>e.plan.name).join(", ")})]}),_.updatedPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"Updated Plans: "}),t("span",{children:_.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold",children:"Subscription"}),t("p",{className:"text-sm text-gray-600",children:"Manage your workspace subscription plan"})]}),e("div",{className:"flex items-center gap-2",children:[o?.subscription?t(Gs,{variant:"outline",size:"sm",onClick:()=>z(!0),children:"Change Plan"}):T&&T.length>0?t(Gs,{size:"sm",onClick:()=>z(!0),children:"View Pricing Plans"}):null,e(Gs,{variant:"ghost",size:"sm",onClick:F,disabled:S,children:[t(Ds,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]}),o?.subscription?e("div",{className:"border rounded-lg p-4 space-y-3 "+(C?"border-amber-300 bg-amber-50/50":""),children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"flex-1",children:[e("div",{className:"flex items-center gap-2 mb-1",children:[t("div",{className:"font-medium",children:o.plan?.name||"No plan assigned"}),C&&e("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-800 border border-amber-200",children:[t($s,{className:"h-3 w-3"}),"Deprecated"]})]}),e("div",{className:"text-sm text-gray-600",children:["Status:"," ",t("span",{className:"font-medium "+("active"===o.subscription.subscriptionStatus?"text-green-600":"trialing"===o.subscription.subscriptionStatus?"text-blue-600":"text-red-600"),children:o.subscription.subscriptionStatus}),C&&e("span",{className:"ml-2 text-xs text-amber-600",children:["(Version ",E?.version||"N/A",")"]})]})]}),t("div",{className:"flex items-center gap-2",children:t(_s,{className:"h-5 w-5 text-gray-400"})})]}),o.planVersion&&(()=>{const r=(e=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const t=[],r=[],n=[];return e.subscriptionItems.forEach(a=>{const o=a.slug;if("feature"===a.type){const r=e.features?.[o]??!1;t.push({item:a,enabled:r})}else if("limit"===a.type){const t=e.limits?.[o]??0;r.push({item:a,value:t})}else if("quota"===a.type){const t=e.quotas?.[o]??null;null!=t&&n.push({item:a,value:t})}}),{features:t,limits:r,quotas:n}})(o.planVersion);return e("div",{className:"mt-4 pt-4 border-t",children:[t("div",{className:"text-sm font-medium mb-3",children:"Current Plan Details"}),e("div",{className:"space-y-4 text-sm",children:[e("div",{children:[t("span",{className:"text-gray-600",children:"Plan:"})," ",t("span",{className:"font-medium",children:o.plan?.name||"N/A"})]}),r.features.length>0&&e("div",{children:[t("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Features:"}),t("ul",{className:"space-y-1.5",children:r.features.map(({item:r,enabled:n})=>e("li",{className:"flex items-start gap-2",children:[t("span",{className:n?"text-green-500 mt-0.5":"text-gray-300 mt-0.5",children:n?"✓":"○"}),e("div",{className:"flex-1",children:[t("div",{className:"font-medium",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500",children:r.description})]})]},r._id))})]}),r.limits.length>0&&e("div",{children:[t("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Limits:"}),t("ul",{className:"space-y-1.5",children:r.limits.map(({item:r,value:n})=>e("li",{className:"flex items-start gap-2",children:[t("span",{className:"text-gray-400 mt-0.5",children:"•"}),e("div",{className:"flex-1",children:[e("div",{children:[e("span",{className:"font-medium",children:[r.name,":"]})," ",t("span",{className:"text-gray-700",children:n})]}),r.description&&t("div",{className:"text-xs text-gray-500",children:r.description})]})]},r._id))})]}),r.quotas.length>0&&e("div",{children:[t("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Quotas:"}),t("ul",{className:"space-y-1.5",children:r.quotas.map(({item:r,value:n})=>{const a="object"==typeof n&&null!==n&&"included"in n?`${n.included} included${n.overage?`, ${n.overage} overage`:""}`:String(n);return e("li",{className:"flex items-start gap-2",children:[t("span",{className:"text-gray-400 mt-0.5",children:"•"}),e("div",{className:"flex-1",children:[e("div",{children:[e("span",{className:"font-medium",children:[r.name,":"]})," ",t("span",{className:"text-gray-700",children:a})]}),r.description&&t("div",{className:"text-xs text-gray-500",children:r.description})]})]},r._id)})})]})]})]})})()]}):t("div",{className:"border rounded-lg p-6 text-center",children:e("div",{className:"mb-4",children:[t(_s,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),t("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]})})]}),o?.subscription&&(()=>{const n=y.filter(e=>e.invoice_pdf);return e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold",children:"Invoices"}),t("p",{className:"text-sm text-gray-600",children:"View and download your subscription invoices"})]}),e(Gs,{variant:"ghost",size:"sm",onClick:x,disabled:b,children:[t(Ds,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),w&&e("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg",children:[t("p",{className:"font-medium",children:"Error loading invoices"}),t("p",{className:"text-sm",children:w})]}),b&&0===n.length?t("div",{className:"border rounded-lg p-6",children:t(Qv,{})}):0===n.length?e("div",{className:"border rounded-lg p-6 text-center",children:[t(Rs,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-sm text-gray-500",children:"No invoices with download option found"})]}):t("div",{className:"space-y-2",children:n.map(n=>{const a=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(n);return t("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e("div",{className:"flex items-center justify-between gap-4",children:[e("div",{className:"flex-1 min-w-0",children:[e("div",{className:"flex items-center gap-2 mb-1.5",children:[t("span",{className:"text-sm font-medium text-gray-900",children:n.description||`Invoice ${n.id.slice(-8)}`}),t("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${xS(n.status)}`,children:n.status.charAt(0).toUpperCase()+n.status.slice(1)})]}),e("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[t("span",{className:"font-medium text-gray-900",children:bS(n.amount_due,n.currency)}),n.created&&e(r,{children:[t("span",{className:"text-gray-300",children:"•"}),e("span",{children:["Created: ",wS(n.created)]})]}),n.due_date&&e(r,{children:[t("span",{className:"text-gray-300",children:"•"}),e("span",{children:["Due: ",wS(n.due_date)]})]}),n.amount_paid>0&&n.amount_due>0&&e(r,{children:[t("span",{className:"text-gray-300",children:"•"}),e("span",{className:"text-xs text-gray-500",children:["Paid: ",bS(n.amount_paid,n.currency)]})]})]})]}),t("div",{className:"flex items-center gap-2 flex-shrink-0",children:e(Gs,{size:"sm",onClick:()=>window.open(n.hosted_invoice_url,"_blank"),className:a.color,children:[a.text,t(Ts,{className:"h-3 w-3 ml-1.5"})]})})]})},n.id)})})]})})(),T&&T.length>0&&t(p,{fallback:null,children:t(yS,{open:M,onOpenChange:z,planVersions:T,currentPlanVersionId:L||null,onSelectPlan:async e=>{if(a&&o?.planVersion?._id!==e){P(!0),I(null),U(null);try{let t,r,n;try{const e=new URL(window.location.href);t=e.toString(),r=e.toString()}catch{const e=window.location.protocol||"https:",n=window.location.host||window.location.hostname||"",a=`${e}//${n}${window.location.pathname||"/"}`;t=a,r=a}if(n=o?.subscription?await l(e,{billingInterval:"monthly",successUrl:t,cancelUrl:r}):await u({planVersionId:e,billingInterval:"monthly",successUrl:t,cancelUrl:r}),n&&"checkoutUrl"in n&&n.checkoutUrl)return void(window.location.href=n.checkoutUrl);U("Subscription updated successfully!"),await F()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";I(t)}finally{P(!1),setTimeout(()=>{I(null),U(null)},5e3)}}},loading:R||S})}),!m&&!S&&e("div",{className:"border rounded-lg p-4 text-center",children:[e("div",{className:"text-gray-500 mb-2",children:[t("p",{className:"font-medium",children:"Unable to load plan information"}),k&&e("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",k]}),!k&&t("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e(Gs,{variant:"outline",size:"sm",onClick:F,disabled:S,className:"mt-4",children:[t(Ds,{className:"h-4 w-4 mr-2"}),"Retry"]})]})]}):t("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:t("p",{children:"Invalid workspace ID"})})};function kS(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?os(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ES=Symbol("radix.slottable");function AS(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ES}var NS=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"});n.forwardRef((e,r)=>t(Qf.span,{...e,ref:r,style:{...NS,...e.style}})).displayName="VisuallyHidden";var CS=[" ","Enter","ArrowUp","ArrowDown"],_S=[" ","Enter"],TS="Select",[RS,PS,OS]=Th(TS),[IS]=Wf(TS,[OS,tx]),DS=tx(),[US,MS]=IS(TS),[zS,FS]=IS(TS),LS=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:v}=r,y=DS(a),[b,w]=n.useState(null),[x,S]=n.useState(null),[k,E]=n.useState(!1),A=Ph(f),[N,C]=Jf({prop:i,defaultProp:s??!1,onChange:c,caller:TS}),[_,T]=Jf({prop:l,defaultProp:d,onChange:u,caller:TS}),R=n.useRef(null),P=!b||(v||!!b.closest("form")),[O,I]=n.useState(new Set),D=Array.from(O).map(e=>e.props.value).join(";");return t(vx,{...y,children:e(US,{required:g,scope:a,trigger:b,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:E,contentId:Kf(),value:_,onValueChange:T,open:N,onOpenChange:C,dir:A,triggerPointerDownPosRef:R,disabled:h,children:[t(RS.Provider,{scope:a,children:t(zS,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{I(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{I(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),P?e(kk,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:_,onChange:e=>T(e.target.value),disabled:h,form:v,children:[void 0===_?t("option",{value:""}):null,Array.from(O)]},D):null]})})};LS.displayName=TS;var jS="SelectTrigger",$S=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=DS(a),c=MS(jS,a),l=c.disabled||o,d=is(r,c.onTriggerChange),u=PS(a),f=n.useRef("touch"),[p,m,h]=Ak(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=Nk(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t(yx,{asChild:!0,...s,children:t(Qf.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Ek(c.value)?"":void 0,...i,ref:d,onClick:Vf(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Vf(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:Vf(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||CS.includes(e.key)&&(g(),e.preventDefault())})})})});$S.displayName=jS;var VS="SelectValue",WS=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:c="",...l}=e,d=MS(VS,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=is(n,d.onValueNodeChange);return mf(()=>{u(f)},[u,f]),t(Qf.span,{...l,ref:p,style:{pointerEvents:"none"},children:Ek(d.value)?t(r,{children:c}):s})});WS.displayName=VS;var BS=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(Qf.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});BS.displayName="SelectIcon";var GS=e=>t(yp,{asChild:!0,...e});GS.displayName="SelectPortal";var HS="SelectContent",KS=n.forwardRef((e,r)=>{const a=MS(HS,e.__scopeSelect),[o,i]=n.useState();if(mf(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?b.createPortal(t(JS,{scope:e.__scopeSelect,children:t(RS.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(XS,{...e,ref:r})});KS.displayName=HS;var ZS=10,[JS,qS]=IS(HS),YS=function(e){const r=kS(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(AS);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("SelectContent.RemoveScroll"),XS=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,w=MS(HS,a),[x,S]=n.useState(null),[k,E]=n.useState(null),A=is(r,e=>S(e)),[N,C]=n.useState(null),[_,T]=n.useState(null),R=PS(a),[P,O]=n.useState(!1),I=n.useRef(!1);n.useEffect(()=>{if(x)return vm(x)},[x]),Sp();const D=n.useCallback(e=>{const[t,...r]=R().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[R,k]),U=n.useCallback(()=>D([N,x]),[D,N,x]);n.useEffect(()=>{P&&U()},[P,U]);const{onOpenChange:M,triggerPointerDownPosRef:z}=w;n.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():x.contains(r.target)||M(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[x,M,z]),n.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[F,L]=Ak(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Nk(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&(C(e),n&&(I.current=!0))},[w.value]),$=n.useCallback(()=>x?.focus(),[x]),V=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&T(e)},[w.value]),W="popper"===o?ek:QS,B=W===ek?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t(JS,{scope:a,content:x,viewport:k,onViewportChange:E,itemRefCallback:j,selectedItem:N,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:U,selectedItemText:_,position:o,isPositioned:P,searchRef:F,children:t(dm,{as:YS,allowPinchZoom:!0,children:t(up,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Vf(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(op,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...B,onPlaced:()=>O(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Vf(b.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||L(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});XS.displayName="SelectContentImpl";var QS=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=MS(HS,a),c=qS(HS,a),[l,d]=n.useState(null),[u,f]=n.useState(null),p=is(r,e=>f(e)),m=PS(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=c,x=n.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=b.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-ZS,u=Eg(o,[ZS,Math.max(ZS,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-ZS,u=Eg(o,[ZS,Math.max(ZS,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const a=m(),i=window.innerHeight-2*ZS,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),E=parseInt(S.paddingBottom,10),A=e.top+e.height/2-ZS,N=i-A,C=y.offsetHeight/2,_=f+p+(y.offsetTop+C),T=w-_;if(_<=A){const e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=_+Math.max(N,C+(e?E:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;l.style.top="0px";const t=Math.max(A,f+v.offsetTop+(e?k:0)+C)+T;l.style.height=t+"px",v.scrollTop=_-A+v.offsetTop}l.style.margin=`${ZS}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,v,y,b,s.dir,o]);mf(()=>x(),[x]);const[S,k]=n.useState();mf(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const E=n.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t(tk,{scope:a,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:E,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:t(Qf.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});QS.displayName="SelectItemAlignedPosition";var ek=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=ZS,...i}=e,s=DS(n);return t(bx,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}})});ek.displayName="SelectPopperPosition";var[tk,rk]=IS(HS,{}),nk="SelectViewport",ak=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...c}=a,l=qS(nk,i),d=rk(nk,i),u=is(o,l.onViewportChange),f=n.useRef(0);return e(r,{children:[t("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}),t(RS.Slot,{scope:i,children:t(Qf.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Vf(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*ZS,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});ak.displayName=nk;var ok="SelectGroup",[ik,sk]=IS(ok);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Kf();return t(ik,{scope:n,id:o,children:t(Qf.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=ok;var ck="SelectLabel",lk=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=sk(ck,n);return t(Qf.div,{id:o.id,...a,ref:r})});lk.displayName=ck;var dk="SelectItem",[uk,fk]=IS(dk),pk=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...c}=e,l=MS(dk,a),d=qS(dk,a),u=l.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=is(r,e=>d.itemRefCallback?.(e,o,i)),v=Kf(),y=n.useRef("touch"),b=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t(uk,{scope:a,value:o,disabled:i,textId:v,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(RS.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(Qf.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:g,onFocus:Vf(c.onFocus,()=>h(!0)),onBlur:Vf(c.onBlur,()=>h(!1)),onClick:Vf(c.onClick,()=>{"mouse"!==y.current&&b()}),onPointerUp:Vf(c.onPointerUp,()=>{"mouse"===y.current&&b()}),onPointerDown:Vf(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:Vf(c.onPointerMove,e=>{y.current=e.pointerType,i?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Vf(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Vf(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(_S.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});pk.displayName=dk;var mk="SelectItemText",hk=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:c,...l}=a,d=MS(mk,i),u=qS(mk,i),f=fk(mk,i),p=FS(mk,i),[m,h]=n.useState(null),g=is(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),v=m?.textContent,y=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:v},f.value),[f.disabled,f.value,v]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return mf(()=>(w(y),()=>x(y)),[w,x,y]),e(r,{children:[t(Qf.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?b.createPortal(l.children,d.valueNode):null]})});hk.displayName=mk;var gk="SelectItemIndicator",vk=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return fk(gk,n).isSelected?t(Qf.span,{"aria-hidden":!0,...a,ref:r}):null});vk.displayName=gk;var yk="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=qS(yk,e.__scopeSelect),o=rk(yk,e.__scopeSelect),[i,s]=n.useState(!1),c=is(r,o.onScrollButtonChange);return mf(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(wk,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=yk;var bk="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=qS(bk,e.__scopeSelect),o=rk(bk,e.__scopeSelect),[i,s]=n.useState(!1),c=is(r,o.onScrollButtonChange);return mf(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(wk,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=bk;var wk=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=qS("SelectScrollButton",a),c=n.useRef(null),l=PS(a),d=n.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),mf(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t(Qf.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:Vf(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:Vf(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:Vf(i.onPointerLeave,()=>{d()})})}),xk=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(Qf.div,{"aria-hidden":!0,...a,ref:r})});xk.displayName="SelectSeparator";var Sk="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=DS(n),i=MS(Sk,n),s=qS(Sk,n);return i.open&&"popper"===s.position?t(wx,{...o,...a,ref:r}):null}).displayName=Sk;var kk=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=is(o,i),c=Yh(r);return n.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),t(Qf.select,{...a,style:{...NS,...a.style},ref:s,defaultValue:r})});function Ek(e){return""===e||void 0===e}function Ak(e){const t=ff(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function Nk(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}kk.displayName="SelectBubbleInput";var Ck=$S,_k=BS,Tk=GS,Rk=KS,Pk=ak,Ok=lk,Ik=pk,Dk=hk,Uk=vk,Mk=xk;const zk=LS,Fk=n.forwardRef(({className:r,children:n,...a},o)=>e(Ck,{ref:o,className:Le("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),...a,children:[n,t(_k,{asChild:!0,children:t(dh,{className:"h-4 w-4 opacity-50"})})]}));Fk.displayName=Ck.displayName;const Lk=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(fr);return t(Tk,{container:s,children:t(Rk,{ref:i,className:Le("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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","popper"===a&&"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:a,...o,children:t(Pk,{className:Le("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Lk.displayName=Rk.displayName;n.forwardRef(({className:e,...r},n)=>t(Ok,{ref:n,className:Le("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=Ok.displayName;const jk=n.forwardRef(({className:r,children:n,...a},o)=>e(Ik,{ref:o,className:Le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(Uk,{children:t(fh,{className:"h-4 w-4"})})}),t(Dk,{children:n})]}));jk.displayName=Ik.displayName;n.forwardRef(({className:e,...r},n)=>t(Mk,{ref:n,className:Le("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=Mk.displayName;const $k=({workspace:r})=>{const n=ir(e=>e.auth.session?.user||null),[a,o]=f(0),[i,s]=f(!1),[c,l]=f([]),[u,p]=f(null),{getUsers:m,removeUser:h,updateUser:g}=vr(),{settings:v}=df();d(()=>{r&&(s(!0),m(r._id).then(e=>{l(e)}).catch(e=>{qe(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{s(!1)}))},[r,a]);const y=()=>{o(e=>e+1)};if(i||!r)return t(Qv,{});const b=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},w=c.map(e=>({...e,...b(e.user)})),x=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,S="admin"===x,k=(v?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e("div",{children:[!S&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),S&&e("div",{className:"mb-4",children:[k&&t(Vk,{onInvite:y,workspaceId:r._id}),!k&&t("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),t("div",{children:t(Gs,{variant:"ghost",size:"sm",onClick:y,progress:i,startIcon:t(Ds,{}),children:"Refresh"})})]}),t("ul",{className:"space-y-2",children:w.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[e("div",{className:"relative",children:[e(zk,{disabled:i||!S||s||u===a.id,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(Yt(r,n)?qe(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):(p(n),g(t,n,{role:o}).then(()=>{y()}).catch(e=>{qe(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}).finally(()=>{p(null)})));var t,n,o},children:[t(Fk,{children:t(WS,{placeholder:"Select a role"})}),t(Lk,{children:r?.roles.map(e=>t(jk,{value:e,children:e},e))})]}),u===a.id&&t("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:t(Os,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&S&&t(Gs,{variant:"destructive",size:"sm",startIcon:t(js,{}),onClick:()=>{var e;e=a.id,Yt(r,e)?qe(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):h(r._id,e).then(()=>{y()}).catch(t=>{qe(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===c.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function Vk({onInvite:r,workspaceId:n}){const[a,o]=f(""),[i,s]=f("admin"),[c,l]=f(!1),[u,p]=f(null),[m,h]=f(null),{addUser:g,getWorkspace:v}=vr(),[y,b]=f(null),{settings:w}=df(),x=w?.workspace.roles??y?.roles??[];d(()=>{n&&v(n).then(b)},[n]);const S=()=>{p(null),h(null),o(""),s("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[u&&t("div",{className:"text-red-500 capitalize",children:u}),m&&t("div",{className:"text-green-500 capitalize",children:m}),e("div",{children:[t(qs,{children:"Invite member by email"}),t(sc,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(qs,{children:"Role"}),e(zk,{value:i,onValueChange:s,children:[t(Fk,{children:t(WS,{placeholder:"Select a role"})}),t(Lk,{children:x.map(e=>t(jk,{value:e,children:e},e))})]})]}),t("div",{children:t(Gs,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void p("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await g(n,e,i).then(()=>{h("User invited successfully"),r?.()}).catch(t=>{qe(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:i}}),p(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{S()},6e3)})):p("Invalid email address format")},disabled:c||!a||!i,children:c?"Inviting...":`Invite as ${i}`})})]})}const Wk=({workspace:r,section:n,setSection:a})=>{const o=ir(e=>e.auth.session?.user||null),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id;return e("div",{className:"w-56 h-full flex flex-col space-y-6",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:Le("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(Bk,{title:"Account",children:t(Gk,{activeSection:n,icon:t(Vs,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(Bk,{title:"Workspace",children:[t(Gk,{activeSection:n,icon:t(Ms,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t(Gk,{activeSection:n,icon:t(Ws,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t(Gk,{activeSection:n,icon:t(_s,{className:"h-3.5 w-3.5"}),label:"Subscription",section:"subscription",onClick:()=>a("subscription")}),t(Gk,{activeSection:n,icon:t(Fs,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),i&&t(Gk,{activeSection:n,icon:t($s,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function Bk({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function Gk({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:Le("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===o?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const Hk=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[u,p]=f(!1),[m,h]=f(i),g=void 0!==a?a:u,v=o||p,y=void 0!==s?s:m,b=c||h;if(!r)return null;const w=t(Gs,{variant:"outline",size:"icon",children:t(Ms,{className:"h-4 w-4"})});return e(vh,{open:g,onOpenChange:e=>{v(e),!e&&n&&n()},children:[l&&t(yh,{asChild:!0,children:d||w}),e(xh,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[t(Eh,{className:"sr-only",children:"Workspace settings dialog"}),t(Wk,{workspace:r,section:y,setSection:b}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(kh,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===y&&"Account","general"===y&&"Workspace Settings","users"===y&&"Workspace Members","subscription"===y&&"Subscription","features"===y&&"Workspace Features","danger"===y&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===y&&t(lS,{workspace:r}),"general"===y&&t(gy,{workspace:r}),"users"===y&&t($k,{workspace:r}),"subscription"===y&&t(SS,{workspace:r}),"features"===y&&t(py,{workspaceId:r._id?.toString()}),"danger"===y&&t(ey,{workspace:r})]})]})]})]})};var Kk=Object.freeze({__proto__:null,WorkspaceSettingsDialog:Hk,default:Hk});function Zk(n){const{workspaces:a,currentWorkspace:o,loading:i,refreshing:s,switchingToId:c}=ir(e=>e.workspaces),l=ir(e=>e.auth.session?.user),{settings:u}=df(),[p,m]=f(!1),[h,g]=f(0),[v,y]=f(""),{fetchWorkspaces:b,getFeatures:w,refreshWorkspaces:x,setCurrentWorkspace:S,switchToWorkspace:k,workspaces:E}=vr(),A=i||s;d(()=>{0===E.length?(b(),w()):w()},[]),d(()=>{h>0&&x()},[h]);const N=E.length>0?E:a,C=N.filter(e=>e._id!==o?._id).filter(e=>e.name.toLowerCase().includes(v.toLowerCase())),_=u?.workspace.maxWorkspaces??Number.MAX_VALUE,T=N?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===l?.id?.toString()).length,R=_>(T??0);return e(vh,{open:p,onOpenChange:m,children:[t(yh,{children:n.trigger?.(A,o)}),e(xh,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(Sh,{children:[e(kh,{className:"flex items-center gap-2",children:[t(As,{className:"h-5 w-5"}),"Switch Workspace"]}),t(Eh,{children:"Select a workspace to switch to or create a new one."})]}),!l&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),l&&e("div",{className:"flex flex-col gap-4",children:[o&&t(Jk,{workspace:o,isCurrentWorkspace:!0,switchToWorkspace:k,switchingToId:c,onClose:()=>m(!1),setCurrentWorkspace:S,setOpen:m,workspacesToUse:N}),t(mv,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",C.length,")"]}),t("div",{children:t(Gs,{progress:s,disabled:s,variant:"ghost",onClick:function(){g(e=>e+1)},startIcon:t(Ds,{}),children:s?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(Us,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(sc,{placeholder:"Search workspaces...",value:v,onChange:e=>y(e.target.value),className:"pl-10"})]}),i?e("div",{className:"flex items-center justify-center py-8",children:[t(Os,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===C.length?e("div",{className:"text-center py-8",children:[t(As,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:v?"No workspaces found":"No workspaces available"})]}):t(sv,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:C.map(e=>{const r=e._id===o?._id;return t(Jk,{workspace:e,isCurrentWorkspace:r,switchToWorkspace:k,switchingToId:c,onClose:()=>m(!1),setCurrentWorkspace:S,setOpen:m,workspacesToUse:N},e._id)})})})]}),R&&e(r,{children:[t(mv,{}),t(qk,{onCreated:()=>{b()}})]})]})]})]})}function Jk(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i,switchingToId:s}=r,c=r.isCurrentWorkspace??!1,l=s===n._id;return e("div",{className:Le("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":c}),children:[e(Lf,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(jf,{src:n.image&&n.image.trim()?n.image:void 0})}),t($f,{children:(d=n.name,d.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(Ws,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]})]}),e("div",{className:"flex items-center gap-2",children:[c?null:t(Gs,{size:"sm",disabled:null!==s||l,progress:l,onClick:()=>{r.switchToWorkspace(n).then(()=>o(!1)).catch(e=>{qe(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:n._id}})})},children:"Switch to"}),t(Hk,{workspace:n,onClose:()=>{if(c){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var d}function qk(n){const{switching:a}=vr(),[o,i]=f(!1),[s,c]=f("emoji"),[l,d]=f("🏢"),[u,p]=f(!1),{createWorkspace:m}=vr(),h=Zn({resolver:ns(sl({name:Dc().min(2,{message:"Workspace name must be at least 2 characters."}),image:Dc().optional()})),defaultValues:{name:"",image:""}});return e(vh,{open:o,onOpenChange:i,children:[t(yh,{asChild:!0,children:e(Gs,{className:"w-full rounded-none",disabled:a,children:[t(Is,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(xh,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(Sh,{children:[t(kh,{children:"Create New Workspace"}),t(Eh,{children:"Create a new workspace to get started."})]}),t(Ys,{...h,children:e("form",{onSubmit:h.handleSubmit(async function(e){let t="";if("emoji"===s)t=my(l);else if("url"===s&&e.image)try{new URL(e.image),t=e.image}catch{return void h.setError("image",{message:"Please enter a valid URL"})}p(!0);try{await m(e.name,t),i(!1),h.reset(),d("🏢"),c("emoji"),n?.onCreated?.()}catch(t){qe(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{p(!1)}}),children:[t(Qs,{control:h.control,name:"name",render:({field:r})=>e(rc,{children:[t(nc,{children:"Workspace Name"}),t(ac,{children:t(sc,{placeholder:"My Awesome Workspace",...r})}),t(ic,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(qs,{className:"text-sm font-medium",children:"Workspace Icon"}),t(oc,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(Sg,{value:s,onValueChange:e=>c(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(kg,{value:"emoji",id:"emoji"}),e(qs,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(zs,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(kg,{value:"url",id:"url"}),e(qs,{htmlFor:"url",className:"flex items-center gap-2",children:[t(Ps,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:l})]}),t(sv,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:hy.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{d(e),h.setValue("image",my(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===s&&e("div",{className:"flex flex-col gap-y-2",children:[t(Qs,{control:h.control,name:"image",render:({field:r})=>e(rc,{children:[t(nc,{children:"Image URL"}),t(ac,{children:t(sc,{placeholder:"https://example.com/image.png",...r})}),t(oc,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(ic,{})]})}),h.watch("image")&&h.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:h.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(Gs,{type:"button",variant:"outline",onClick:()=>{i(!1),h.reset(),d("🏢"),c("emoji")},disabled:u,children:"Cancel"}),t(Gs,{type:"submit",disabled:u,children:u?e(r,{children:[t(Os,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}var Yk=Object.freeze({__proto__:null,default:({open:n,onOpenChange:a,planVersions:o,currentPlanVersionId:i,onSelectPlan:c,loading:l=!1})=>{const[d,u]=f(!1),p=s(()=>[...o].sort((e,t)=>e.version-t.version),[o]),m=(e=>{const t=new Map;return e.forEach(e=>{e.subscriptionItems?.forEach(e=>{t.has(e._id)||t.set(e._id,e)})}),Array.from(t.values())})(p);s(()=>{const e=new Map;return m.forEach(t=>{const r=t.category||"other";e.has(r)||e.set(r,[]),e.get(r).push(t)}),e},[m]);const h=m.filter(e=>"feature"===e.type),g=m.filter(e=>"limit"===e.type),v=m.filter(e=>"quota"===e.type),y=l||d,b=(e,t)=>"feature"===t.type?e.features?.[t.slug]??!1:"limit"===t.type?e.limits?.[t.slug]??null:"quota"===t.type?e.quotas?.[t.slug]??null:null,w=(e,t)=>"feature"===t.type?!0===e?"✓":"—":"limit"===t.type?null!=e?String(e):"—":"quota"===t.type?"object"==typeof e&&null!==e&&"included"in e?`${e.included}${e.overage?` (+${e.overage})`:""}`:null!=e?String(e):"—":"—";return t(vh,{open:n,onOpenChange:a,children:e(xh,{className:"max-w-7xl w-full h-[90vh] p-0 flex flex-col",children:[t("div",{className:"flex items-center justify-between p-6 border-b",children:e("div",{children:[t(kh,{className:"text-2xl font-bold",children:"Choose Your Plan"}),t(Eh,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]})}),t("div",{className:"flex-1 overflow-auto p-6",children:0===p.length?t("div",{className:"text-center py-12 text-gray-500",children:t("p",{children:"No plans available"})}):e("div",{className:"space-y-6",children:[t("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map(r=>{const n=r._id===i,o=(e=>{if(e._id===i)return{label:"Current Plan",variant:"outline",disabled:!0};if(!i)return{label:"Subscribe",variant:"default",disabled:!1};const t=p.findIndex(e=>e._id===i),r=p.findIndex(t=>t._id===e._id);return-1===t||-1===r?{label:"Select",variant:"default",disabled:!1}:r<t?{label:"Downgrade",variant:"outline",disabled:!1}:r>t?{label:"Upgrade",variant:"default",disabled:!1}:{label:"Select",variant:"default",disabled:!1}})(r),s=y&&r._id===i;return e("div",{className:"border rounded-lg p-4 "+(n?"border-blue-500 bg-blue-50":"hover:border-gray-300"),children:[e("div",{className:"flex items-center justify-between mb-2",children:[t("h3",{className:"text-lg font-semibold",children:r.plan.name}),n&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"Current"})]}),r.plan.description&&t("p",{className:"text-sm text-gray-600 mb-4",children:r.plan.description}),t(Gs,{className:"w-full",variant:o.variant,disabled:o.disabled||y,onClick:()=>(async e=>{if(e!==i&&!l&&!d){u(!0);try{await c(e),a(!1)}catch(e){}finally{u(!1)}}})(r._id),children:s?"Updating...":o.label})]},r._id)})}),e("div",{className:"border rounded-lg overflow-hidden bg-white",children:[t("div",{className:"bg-gray-50 p-4 border-b",children:t("h3",{className:"font-semibold text-lg",children:"Compare all features"})}),t("div",{className:"overflow-x-auto",children:e("table",{className:"w-full",children:[t("thead",{children:e("tr",{className:"border-b bg-gray-50",children:[t("th",{className:"text-left p-4 font-semibold text-sm sticky left-0 bg-gray-50 z-10 min-w-[250px]",children:"Feature"}),p.map(r=>e("th",{className:"text-center p-4 font-semibold text-sm min-w-[150px] "+(r._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:[t("div",{className:"font-semibold",children:r.plan.name}),r._id===i&&t("div",{className:"text-xs text-blue-600 font-normal mt-1",children:"Current Plan"})]},r._id))]})}),e("tbody",{children:[h.length>0&&e(r,{children:[t("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:t("td",{colSpan:p.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Features"})}),h.map(r=>e("tr",{className:"border-b hover:bg-gray-50",children:[e("td",{className:"p-4 sticky left-0 bg-white z-10",children:[t("div",{className:"font-medium text-sm text-gray-900",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500 mt-1",children:r.description})]}),p.map(e=>{const n=b(e,r),a=w(n,r),o="feature"===r.type&&!0===n;return t("td",{className:"text-center p-4 align-middle "+(e._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:t("span",{className:"text-sm "+(o?"text-green-600 font-semibold":"—"===a?"text-gray-400":"text-gray-700"),children:a})},e._id)})]},r._id))]}),g.length>0&&e(r,{children:[t("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:t("td",{colSpan:p.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Limits"})}),g.map(r=>e("tr",{className:"border-b hover:bg-gray-50",children:[e("td",{className:"p-4 sticky left-0 bg-white z-10",children:[t("div",{className:"font-medium text-sm text-gray-900",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500 mt-1",children:r.description})]}),p.map(e=>{const n=b(e,r),a=w(n,r);return t("td",{className:"text-center p-4 align-middle "+(e._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:t("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},e._id)})]},r._id))]}),v.length>0&&e(r,{children:[t("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:t("td",{colSpan:p.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Quotas"})}),v.map(r=>e("tr",{className:"border-b hover:bg-gray-50",children:[e("td",{className:"p-4 sticky left-0 bg-white z-10",children:[t("div",{className:"font-medium text-sm text-gray-900",children:r.name}),r.description&&t("div",{className:"text-xs text-gray-500 mt-1",children:r.description})]}),p.map(e=>{const n=b(e,r),a=w(n,r);return t("td",{className:"text-center p-4 align-middle "+(e._id===i?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:t("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},e._id)})]},r._id))]})]})]})})]})]})})]})})}});export{x as ApiVersion,ct as AuthStatus,Cl as BetaForm,Sr as SaaSOSProvider,Qu as WhenAuthenticated,tf as WhenRoles,ef as WhenUnauthenticated,lf as WhenUserFeatureDisabled,cf as WhenUserFeatureEnabled,sf as WhenWorkspaceFeatureDisabled,of as WhenWorkspaceFeatureEnabled,rf as WhenWorkspaceRoles,Zk as WorkspaceSwitcher,ur as eventEmitter,pS as useCreateCheckoutSession,vS as useInvoice,gS as useInvoices,uS as usePlanGroup,fS as usePlanGroupVersions,Xu as useSaaSAuth,df as useSaaSSettings,vr as useSaaSWorkspaces,dS as useSubscription,hS as useSubscriptionManagement,mS as useUpdateSubscription,nf as useUserAttributes,af as useUserFeatures};
|
|
36
30
|
//# sourceMappingURL=index.esm.js.map
|