@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.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var a=n(t),o=n(r);exports.ApiVersion=void 0,(exports.ApiVersion||(exports.ApiVersion={})).V1="v1";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 i=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 c(e,t={}){i.handleError(e,t)}class l extends t.Component{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(c(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.jsxs("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),e.jsx("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),e.jsx("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 d=()=>({type:"AUTHENTICATION_STARTED"}),u=()=>({type:"AUTHENTICATION_PROCESSING"}),f=()=>({type:"AUTHENTICATION_FAILED"}),p=e=>({type:"SET_SESSION",payload:e}),m=()=>({type:"REMOVE_SESSION"});function h({name:r,initialState:n,reducer:a,initializer:o}){const s=t.createContext(null),i=t.createContext(null),c=t.createContext(null),l=t.memo(({children:r})=>{const[l,d]=t.useReducer(a,n,o||(e=>e)),u=t.useMemo(()=>({state:l,dispatch:d}),[l,d]);return e.jsx(c.Provider,{value:u,children:e.jsx(s.Provider,{value:l,children:e.jsx(i.Provider,{value:d,children:r})})})});l.displayName=`${r}Provider`;const d=()=>{const e=t.useContext(s);if(null===e)throw new Error(`use${r}State must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e};return{Provider:l,useContext:()=>{const e=t.useContext(c);if(!e)throw new Error(`use${r}Context must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useState:d,useDispatch:()=>{const e=t.useContext(i);if(null===e)throw new Error(`use${r}Dispatch must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useSelector:(e,r)=>{const n=d(),a=e||(e=>e),o=t.useRef(a),s=t.useRef(r),i=t.useRef(void 0),c=t.useRef(n);e&&(o.current=a),r&&(s.current=r);return t.useMemo(()=>{const e=o.current(n);if(void 0!==i.current){if((s.current?s.current(i.current,e):Object.is(i.current,e))&&c.current===n)return i.current}return i.current=e,c.current=n,e},[n])}}}var g;function v(e){return{isAuthenticated:e===exports.AuthStatus.authenticated,isLoading:e===exports.AuthStatus.loading||e===exports.AuthStatus.redirecting||e===exports.AuthStatus.authenticating,isRedirecting:e===exports.AuthStatus.redirecting}}function b(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 y(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function x(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){console.warn(`Failed to remove ${e} from localStorage:`,t)}}exports.AuthStatus=void 0,(g=exports.AuthStatus||(exports.AuthStatus={})).loading="loading",g.redirecting="redirecting",g.authenticated="authenticated",g.unauthenticated="unauthenticated",g.authenticating="authenticating";const w="code",S="saas-session-id";function k(){x(S)}function j(){if("undefined"==typeof window)return null;try{return b(S)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function E(){const e=j(),t={};return e&&(t["x-session-id"]=e),t}function A(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(w)}catch(e){return console.error("Error getting token from URL:",e),null}}function N(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const C=()=>({session:null,status:exports.AuthStatus.loading}),{Provider:_,useState:T,useDispatch:R}=h({name:"Auth",initialState:C(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,status:exports.AuthStatus.redirecting};case"AUTHENTICATION_PROCESSING":return{...e,status:exports.AuthStatus.authenticating};case"AUTHENTICATION_FAILED":return{...e,session:null,status:exports.AuthStatus.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,y(S,r),{...e,session:n,status:exports.AuthStatus.authenticated}}case"REMOVE_SESSION":return k(),{...e,session:null,status:exports.AuthStatus.unauthenticated};default:return e}var r},initializer:C}),P=_,O=T,I=R,D=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),U=e=>({type:"SET_SETTINGS",payload:e}),M=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:F,useState:z,useDispatch:L}=h({name:"OS",initialState:M(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return M();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),$=F,V=z,W=L,B=e=>({type:"SET_WORKSPACES",payload:e}),G=e=>({type:"SET_ALL_FEATURES",payload:e}),H=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),K=()=>({type:"RESET_CURRENT_WORKSPACE"}),Z=e=>({type:"SET_IS_INITIALIZED",payload:e}),J=e=>({type:"SET_LOADING",payload:e}),q=e=>({type:"SET_ERROR",payload:e}),Y=e=>({type:"SET_REFRESHING",payload:e}),X="saas-workspace-current";const{Provider:Q,useState:ee,useDispatch:te}=h({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)?y(X,r):x(X),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return x(X),{...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}}),re=Q,ne=ee,ae=te,oe=t.memo(({children:t})=>e.jsx($,{children:e.jsx(P,{children:e.jsx(re,{children:t})})}));function se(e,r){const n=V(),a=O(),o=ne(),s=t.useMemo(()=>({os:n,auth:a,workspaces:o}),[n,a,o]),i=e||(e=>e),c=t.useRef(i),l=t.useRef(r),d=t.useRef(void 0),u=t.useRef(s);e&&(c.current=i);return t.useMemo(()=>{const e=c.current(s);if(void 0!==d.current){if((l.current?l.current(d.current,e):Object.is(d.current,e))&&u.current===s)return d.current}return d.current=e,u.current=s,e},[s])}function ie(){const e=I(),r=W(),n=ae();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}function ce(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(ce);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":ce(a);return r}function le(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function de(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 s;try{const e=await o.text();if(e)try{s=JSON.parse(e)}catch{s=e.substring(0,200)+(e.length>200?"...":"")}}catch{s="(read failed)"}console.log("[SDK API]",n,e,{request:ce(a),response:ce(s),status:r.status})}return r}catch(e){if(le(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 ue(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 fe(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await ue(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 ue(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}oe.displayName="SDKContextProvider";const pe=t.memo(({children:r,callbacks:n})=>{const a=ie(),o=se(e=>e.auth),s=se(e=>e.os),i=v(o.status).isAuthenticated,l=t.useRef(!1),d=t.useRef(null),m=t.useRef(!1),h=t.useMemo(()=>n,[n]),g=t.useCallback(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:o,orgId:i}=r;if(!n||!o||!i)throw new Error("OS configuration is not available");const c=await de(`${n}/api/${o}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}}),l=await fe(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=N({id:d,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);a.auth(p(u)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(w),window.history.replaceState({},"",e.toString())}catch(e){console.error("Error removing token from URL:",e)}}()}}catch(t){throw c(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),a.auth(f()),t}},[a,h,s]);return t.useEffect(()=>{if("undefined"==typeof window)return;if(i)return;if(m.current)return;if(A())return;const e=j();if(!e)return void a.auth(f());const t=new AbortController;return(async()=>{m.current=!0;try{const{serverUrl:r,version:n,orgId:o}=s;if(!r||!n||!o)return m.current=!1,void c(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});let i;try{const a=await de(`${r}/api/${n}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"},signal:t.signal});i=await fe(a,"Failed to fetch user profile")}catch(e){if(le(e))return;return m.current=!1,c(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}),k(),void a.auth(f())}const l=i._id||i.id;if(!l||"string"!=typeof l)return m.current=!1,c(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),k(),void a.auth(f());if(!i.email||"string"!=typeof i.email)return m.current=!1,c(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),k(),void a.auth(f());const d=N({id:l,name:i.name||"",org:o,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);a.auth(p(d))}catch(e){if(le(e))return;c(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),k(),a.auth(f())}finally{m.current=!1}})(),()=>{t.abort()}},[i,a,s]),t.useEffect(()=>{const e=A();if(!e)return;if(l.current||d.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(l.current=!0,d.current=e,a.auth(u()),g(e).then(()=>{d.current=null}).catch(t=>{c(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),d.current=null}).finally(()=>{l.current=!1}))},[g,s.serverUrl,s.version,s.orgId]),e.jsx(e.Fragment,{children:r})});pe.displayName="AuthProviderWrapper";const me=t.memo(({config:r,auth:n,children:a})=>{const o=ie(),s=se(e=>e.os),i=t.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return t.useEffect(()=>{o.os(D({...r,auth:i}))},[r,i,o]),t.useEffect(()=>{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=E(),s=await de(`${e}/api/${t}/public/${r}/settings`,{headers:n,signal:a.signal});if(s.ok){const e=await s.json();o.os(U(e))}}catch(n){if(le(n))return;c(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})(),()=>{a.abort()}},[s.serverUrl,s.version,s.orgId,s.settings,o]),e.jsx(e.Fragment,{children:a})});me.displayName="ContextConfigProvider";const he=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){c(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})}},ge=t.createContext({container:null,setContainer:()=>{}}),ve=t.memo(({children:r})=>{const[n,a]=t.useState(null),o=t.useMemo(()=>({container:n,setContainer:a}),[n]),s=t.useMemo(()=>r,[r]);return e.jsxs(ge.Provider,{value:o,children:[s,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});ve.displayName="PortalProvider";const be=t.createContext(void 0),ye=t.memo(({children:r})=>{const n=se(e=>e.os),a=se(e=>e.auth),{serverUrl:o,version:s}=n,i=v(a.status).isAuthenticated,[l,d]=t.useState({}),[u,f]=t.useState({}),[p,m]=t.useState(!1),[h,g]=t.useState(null),b=t.useCallback(async()=>{if(o&&s&&i)try{const e=await de(`${o}/api/${s}/public/users/attributes`,{headers:E()});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)?d(t):d({})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user attributes");g(t),c(e,{component:"UserProvider",action:"fetchAttributes"})}else d({})},[o,s,i]),y=t.useCallback(async()=>{if(o&&s&&i){m(!0),g(null);try{await b()}finally{m(!1)}}},[o,s,i,b]),x=t.useCallback(async e=>{if(!o||!s)throw new Error("Server URL or version is missing");m(!0),g(null);try{const t=await de(`${o}/api/${s}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...E()},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 g(r),c(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{m(!1)}},[o,s,b]),w=t.useCallback(async(e,t)=>{if(!o||!s)throw new Error("Server URL or version is missing");m(!0),g(null);try{const r=await de(`${o}/api/${s}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...E()},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 g(n),c(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{m(!1)}},[o,s,b]),S=t.useCallback(async()=>{if(o&&s&&i)try{const e=await de(`${o}/api/${s}/public/users/features`,{headers:E()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user features")}const t=await e.json();f("object"==typeof t?t:{})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user features");g(t),c(e,{component:"UserProvider",action:"fetchFeatures"})}else f({})},[o,s,i]),k=t.useCallback(async()=>{if(o&&s&&i){m(!0),g(null);try{await S()}finally{m(!1)}}},[o,s,i,S]);t.useEffect(()=>{i&&o&&s?(m(!0),g(null),Promise.all([b(),S()]).finally(()=>{m(!1)})):(d({}),f({}))},[i,o,s,b,S]);const j=t.useMemo(()=>({attributes:l,features:u,isLoading:p,error:h,updateAttributes:x,updateAttribute:w,refreshAttributes:y,refreshFeatures:k}),[l,u,p,h,x,w,y,k]);return e.jsx(be.Provider,{value:j,children:r})});ye.displayName="UserProvider";class xe{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return E()}async getWorkspaces(){return fe(await de(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()}),"Failed to fetch workspaces")}async createWorkspace(e){return fe(await de(`${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 fe(await de(`${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 fe(await de(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to delete workspace")}async getWorkspaceUsers(e){return fe(await de(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()}),"Failed to fetch workspace users")}async addUser(e,t){return fe(await de(`${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 fe(await de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 de(`${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 we=e=>"checkbox"===e.type,Se=e=>e instanceof Date,ke=e=>null==e;const je=e=>"object"==typeof e;var Ee=e=>!ke(e)&&!Array.isArray(e)&&je(e)&&!Se(e),Ae=e=>Ee(e)&&e.target?we(e.target)?e.target.checked:e.target.value:e,Ne=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Ce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function _e(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(Ce&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||Ee(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Ee(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]=_e(e[t]));return n}var Te=e=>/^\w*$/.test(e),Re=e=>void 0===e,Pe=e=>Array.isArray(e)?e.filter(Boolean):[],Oe=e=>Pe(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ie=(e,t,r)=>{if(!t||!Ee(e))return r;const n=(Te(t)?[t]:Oe(t)).reduce((e,t)=>ke(e)?e:e[t],e);return Re(n)||n===e?Re(e[t])?r:e[t]:n},De=e=>"boolean"==typeof e,Ue=e=>"function"==typeof e,Me=(e,t,r)=>{let n=-1;const a=Te(t)?[t]:Oe(t),o=a.length,s=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==s){const r=e[t];o=Ee(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Fe="blur",ze="focusout",Le="change",$e="onBlur",Ve="onChange",We="onSubmit",Be="onTouched",Ge="all",He="max",Ke="min",Ze="maxLength",Je="minLength",qe="pattern",Ye="required",Xe="validate",Qe=t.createContext(null);Qe.displayName="HookFormContext";const et=()=>t.useContext(Qe),tt=e=>{const{children:r,...n}=e;return t.createElement(Qe.Provider,{value:n},r)};var rt=(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]!==Ge&&(t._proxyFormState[a]=!n||Ge),r&&(r[a]=!0),e[a]}});return a};const nt="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var at=e=>"string"==typeof e,ot=(e,t,r,n,a)=>at(e)?(n&&t.watch.add(e),Ie(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Ie(r,e))):(n&&(t.watchAll=!0),r),st=e=>ke(e)||!je(e);function it(e,t,r=new WeakSet){if(st(e)||st(t))return Object.is(e,t);if(Se(e)&&Se(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(Se(n)&&Se(e)||Ee(n)&&Ee(e)||Array.isArray(n)&&Array.isArray(e)?!it(n,e,r):!Object.is(n,e))return!1}}return!0}function ct(e){const r=et(),{name:n,disabled:a,control:o=r.control,shouldUnregister:s,defaultValue:i,exact:c=!0}=e,l=Ne(o._names.array,n),d=t.useMemo(()=>Ie(o._formValues,n,Ie(o._defaultValues,n,i)),[o,n,i]),u=function(e){const r=et(),{control:n=r.control,name:a,defaultValue:o,disabled:s,exact:i,compute:c}=e||{},l=t.useRef(o),d=t.useRef(c),u=t.useRef(void 0),f=t.useRef(n),p=t.useRef(a);d.current=c;const[m,h]=t.useState(()=>{const e=n._getWatch(a,l.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=ot(a,n._names,e||n._formValues,!1,l.current);return d.current?d.current(t):t},[n._formValues,n._names,a]),v=t.useCallback(e=>{if(!s){const t=ot(a,n._names,e||n._formValues,!1,l.current);if(d.current){const e=d.current(t);it(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,s,a]);nt(()=>(f.current===n&&it(p.current,a)||(f.current=n,p.current=a,v()),n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{v(e.values)}})),[n,i,a,v]),t.useEffect(()=>n._removeUnmounted());const b=f.current!==n,y=p.current,x=t.useMemo(()=>{if(s)return null;const e=!b&&!it(y,a);return b||e?g():null},[s,b,a,y,g]);return null!==x?x:m}({control:o,name:n,defaultValue:d,exact:c}),f=function(e){const r=et(),{control:n=r.control,disabled:a,name:o,exact:s}=e||{},[i,c]=t.useState(n._formState),l=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return nt(()=>n._subscribe({name:o,formState:l.current,exact:s,callback:e=>{!a&&c({...n._formState,...e})}}),[o,a,s]),t.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),t.useMemo(()=>rt(i,n,l.current,!1),[i,n])}({control:o,name:n,exact:c}),p=t.useRef(e),m=t.useRef(void 0),h=t.useRef(o.register(n,{...e.rules,value:u,...De(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ie(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ie(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ie(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ie(f.validatingFields,n)},error:{enumerable:!0,get:()=>Ie(f.errors,n)}}),[f,n]),v=t.useCallback(e=>h.current.onChange({target:{value:Ae(e),name:n},type:Le}),[n]),b=t.useCallback(()=>h.current.onBlur({target:{value:Ie(o._formValues,n),name:n},type:Fe}),[n,o._formValues]),y=t.useCallback(e=>{const t=Ie(o._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>Ue(e.focus)&&e.focus(),select:()=>Ue(e.select)&&e.select(),setCustomValidity:t=>Ue(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Ue(e.reportValidity)&&e.reportValidity()})},[o._fields,n]),x=t.useMemo(()=>({name:n,value:u,...De(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:v,onBlur:b,ref:y}),[n,a,f.disabled,v,b,y,u]);return t.useEffect(()=>{const e=o._options.shouldUnregister||s,t=m.current;t&&t!==n&&!l&&o.unregister(t),o.register(n,{...p.current.rules,...De(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=Ie(o._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=_e(Ie(o._options.defaultValues,n,p.current.defaultValue));Me(o._defaultValues,n,e),Re(Ie(o._formValues,n))&&Me(o._formValues,n,e)}return!l&&o.register(n),m.current=n,()=>{(l?e&&!o._state.action:e)?o.unregister(n):r(n,!1)}},[n,o,l,s]),t.useEffect(()=>{o._setDisabledField({disabled:a,name:n})},[a,n,o]),t.useMemo(()=>({field:x,formState:f,fieldState:g}),[x,f,g])}const lt=e=>e.render(ct(e));var dt=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},ut=e=>Array.isArray(e)?e:[e],ft=()=>{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 pt(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&Ee(a)&&o){const e=pt(a,o);Ee(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var mt=e=>Ee(e)&&!Object.keys(e).length,ht=e=>"file"===e.type,gt=e=>{if(!Ce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},vt=e=>"select-multiple"===e.type,bt=e=>"radio"===e.type,yt=e=>gt(e)&&e.isConnected;function xt(e,t){const r=Array.isArray(t)?t:Te(t)?[t]:Oe(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Re(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Ee(n)&&mt(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Re(e[t]))return!1;return!0}(n))&&xt(e,r.slice(0,-1)),e}function wt(e){return Array.isArray(e)||Ee(e)&&!(e=>{for(const t in e)if(Ue(e[t]))return!0;return!1})(e)}function St(e,t={}){for(const r in e){const n=e[r];wt(n)?(t[r]=Array.isArray(n)?[]:{},St(n,t[r])):Re(n)||(t[r]=!0)}return t}function kt(e,t,r){r||(r=St(t));for(const n in e){const a=e[n];if(wt(a))Re(t)||st(r[n])?r[n]=St(a,Array.isArray(a)?[]:{}):kt(a,ke(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!it(a,e)}}return r}const jt={value:!1,isValid:!1},Et={value:!0,isValid:!0};var At=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&&!Re(e[0].attributes.value)?Re(e[0].value)||""===e[0].value?Et:{value:e[0].value,isValid:!0}:Et:jt}return jt},Nt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Re(e)?e:t?""===e?NaN:e?+e:e:r&&at(e)?new Date(e):n?n(e):e;const Ct={isValid:!1,value:null};var _t=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ct):Ct;function Tt(e){const t=e.ref;return ht(t)?t.files:bt(t)?_t(e.refs).value:vt(t)?[...t.selectedOptions].map(({value:e})=>e):we(t)?At(e.refs).value:Nt(Re(t.value)?e.ref.value:t.value,e)}var Rt=e=>e instanceof RegExp,Pt=e=>Re(e)?e:Rt(e)?e.source:Ee(e)?Rt(e.value)?e.value.source:e.value:e,Ot=e=>({isOnSubmit:!e||e===We,isOnBlur:e===$e,isOnChange:e===Ve,isOnAll:e===Ge,isOnTouch:e===Be});const It="AsyncFunction";var Dt=e=>!!e&&!!e.validate&&!!(Ue(e.validate)&&e.validate.constructor.name===It||Ee(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===It)),Ut=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Mt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Ie(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(Mt(o,t))break}else if(Ee(o)&&Mt(o,t))break}}};function Ft(e,t,r){const n=Ie(e,r);if(n||Te(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Ie(t,n),s=Ie(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(s&&s.type)return{name:n,error:s};if(s&&s.root&&s.root.type)return{name:`${n}.root`,error:s.root};a.pop()}return{name:r}}var zt=(e,t,r)=>{const n=ut(Ie(e,r));return Me(n,"root",t[r]),Me(e,r,n),e};function Lt(e,t,r="validate"){if(at(e)||Array.isArray(e)&&e.every(at)||De(e)&&!e)return{type:r,message:at(e)?e:"",ref:t}}var $t=e=>Ee(e)&&!Rt(e)?e:{value:e,message:""},Vt=async(e,t,r,n,a,o)=>{const{ref:s,refs:i,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,b=Ie(r,h);if(!v||t.has(h))return{};const y=i?i[0]:s,x=e=>{a&&y.reportValidity&&(y.setCustomValidity(De(e)?"":e||""),y.reportValidity())},w={},S=bt(s),k=we(s),j=S||k,E=(g||ht(s))&&Re(s.value)&&Re(b)||gt(s)&&""===s.value||""===b||Array.isArray(b)&&!b.length,A=dt.bind(null,h,n,w),N=(e,t,r,n=Ze,a=Je)=>{const o=e?t:r;w[h]={type:e?n:a,message:o,ref:s,...A(e?n:a,o)}};if(o?!Array.isArray(b)||!b.length:c&&(!j&&(E||ke(b))||De(b)&&!b||k&&!At(i).isValid||S&&!_t(i).isValid)){const{value:e,message:t}=at(c)?{value:!!c,message:c}:$t(c);if(e&&(w[h]={type:Ye,message:t,ref:y,...A(Ye,t)},!n))return x(t),w}if(!(E||ke(u)&&ke(f))){let e,t;const r=$t(f),a=$t(u);if(ke(b)||isNaN(b)){const n=s.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),i="time"==s.type,c="week"==s.type;at(r.value)&&b&&(e=i?o(b)>o(r.value):c?b>r.value:n>new Date(r.value)),at(a.value)&&b&&(t=i?o(b)<o(a.value):c?b<a.value:n<new Date(a.value))}else{const n=s.valueAsNumber||(b?+b:b);ke(r.value)||(e=n>r.value),ke(a.value)||(t=n<a.value)}if((e||t)&&(N(!!e,r.message,a.message,He,Ke),!n))return x(w[h].message),w}if((l||d)&&!E&&(at(b)||o&&Array.isArray(b))){const e=$t(l),t=$t(d),r=!ke(e.value)&&b.length>+e.value,a=!ke(t.value)&&b.length<+t.value;if((r||a)&&(N(r,e.message,t.message),!n))return x(w[h].message),w}if(p&&!E&&at(b)){const{value:e,message:t}=$t(p);if(Rt(e)&&!b.match(e)&&(w[h]={type:qe,message:t,ref:s,...A(qe,t)},!n))return x(t),w}if(m)if(Ue(m)){const e=Lt(await m(b,r),y);if(e&&(w[h]={...e,...A(Xe,e.message)},!n))return x(e.message),w}else if(Ee(m)){let e={};for(const t in m){if(!mt(e)&&!n)break;const a=Lt(await m[t](b,r),y,t);a&&(e={...a,...A(t,a.message)},x(a.message),n&&(w[h]=e))}if(!mt(e)&&(w[h]={ref:y,...e},!n))return w}return x(!0),w};const Wt={mode:We,reValidateMode:Ve,shouldFocusError:!0};function Bt(e={}){let t,r={...Wt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ue(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Ee(r.defaultValues)||Ee(r.values))&&_e(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:_e(o),i={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:ft(),state:ft()},m=r.criteriaMode===Ge,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=mt((await x()).errors),g()):e=await w(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?Me(n.validatingFields,e,t):xt(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!mt(n.validatingFields)}))},v=(e,t,r,n)=>{const c=Ie(a,e);if(c){const a=Ie(s,e,Re(r)?Ie(o,e):r);Re(a)||n&&n.defaultChecked||t?Me(s,e,t?a:Tt(c._f)):j(e,a),i.mount&&!i.action&&h()}},b=(e,t,a,s,i)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||s){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=it(Ie(o,e),t);l=!!Ie(n.dirtyFields,e),r?xt(n.dirtyFields,e):Me(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=Ie(n.touchedFields,e);t||(Me(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&i&&p.state.next(d)}return c?d:{}},y=(e,a,o,s)=>{const i=Ie(n.errors,e),c=(u.isValid||f.isValid)&&De(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{Me(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?Me(n.errors,e,o):xt(n.errors,e)),(o?!it(i,o):i)||!mt(s)||c){const t={...s,...c&&De(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},x=async e=>{g(e,!0);const t=await r.resolver(s,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Ie(t,r);e&&Me(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},w=async(t,a,o={valid:!0})=>{for(const i in t){const l=t[i];if(l){const{_f:t,...i}=l;if(t){const i=c.array.has(t.name),d=l._f&&Dt(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await Vt(l,c.disabled,s,m,r.shouldUseNativeValidation&&!a,i);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Ie(f,t.name)?i?zt(n.errors,f,t.name):Me(n.errors,t.name,f[t.name]):xt(n.errors,t.name))}!mt(i)&&await w(i,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&Me(s,e,t),!it(T(),o)),k=(e,t,r)=>ot(e,c,{...i.mount?s:Re(t)?o:at(e)?{[e]:t}:t},r,t),j=(e,t,r={})=>{const n=Ie(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Me(s,e,Nt(t,r)),o=gt(r.ref)&&ke(t)?"":t,vt(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?we(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):ht(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:_e(s)})))}(r.shouldDirty||r.shouldTouch)&&b(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},E=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],s=e+"."+n,i=Ie(a,s);(c.array.has(e)||Ee(o)||i&&!i._f)&&!Se(o)?E(s,o,r):j(s,o,r)}},A=(e,t,r={})=>{const l=Ie(a,e),d=c.array.has(e),m=_e(t);Me(s,e,m),d?(p.array.next({name:e,values:_e(s)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:kt(o,s),isDirty:S(e,m)})):!l||l._f||ke(m)?j(e,m,r):E(e,m,r),Ut(e,c)?p.state.next({...n,name:e,values:_e(s)}):p.state.next({name:i.mount?e:void 0,values:_e(s)})},N=async e=>{i.mount=!0;const o=e.target;let l=o.name,d=!0;const v=Ie(a,l),S=e=>{d=Number.isNaN(e)||Se(e)&&isNaN(e.getTime())||it(e,Ie(s,l,e))},k=Ot(r.mode),j=Ot(r.reValidateMode);if(v){let i,E;const A=o.type?Tt(v._f):Ae(e),N=e.type===Fe||e.type===ze,C=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(v._f)&&!r.resolver&&!Ie(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))(N,Ie(n.touchedFields,l),n.isSubmitted,j,k),T=Ut(l,c,N);Me(s,l,A),N?o&&o.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);const R=b(l,A,N),P=!mt(R)||T;if(!N&&p.state.next({name:l,type:e.type,values:_e(s)}),C)return(u.isValid||f.isValid)&&("onBlur"===r.mode?N&&h():N||h()),P&&p.state.next({name:l,...T?{}:R});if(!N&&T&&p.state.next({...n}),r.resolver){const{errors:e}=await x([l]);if(g([l]),S(A),d){const t=Ft(n.errors,a,l),r=Ft(e,a,t.name||l);i=r.error,l=r.name,E=mt(e)}}else g([l],!0),i=(await Vt(v,c.disabled,s,m,r.shouldUseNativeValidation))[l],g([l]),S(A),d&&(i?E=!1:(u.isValid||f.isValid)&&(E=await w(a,!0)));d&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&_(v._f.deps),y(l,E,i,R))}},C=(e,t)=>{if(Ie(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let o,s;const i=ut(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(g(e),e)for(const r of e){const e=Ie(t,r);e?Me(n.errors,r,e):xt(n.errors,r)}else n.errors=t;return t})(Re(e)?e:i);o=mt(t),s=e?!i.some(e=>Ie(t,e)):o}else e?(s=(await Promise.all(i.map(async e=>{const t=Ie(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||n.isValid)&&h()):s=o=await w(a);return p.state.next({...!at(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!s&&Mt(a,C,e?i:c.mount),s},T=(e,t)=>{let r={...i.mount?s:o};return t&&(r=pt(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Re(e)?r:at(e)?Ie(r,e):e.map(e=>Ie(r,e))},R=(e,t)=>({invalid:!!Ie((t||n).errors,e),isDirty:!!Ie((t||n).dirtyFields,e),error:Ie((t||n).errors,e),isValidating:!!Ie(n.validatingFields,e),isTouched:!!Ie((t||n).touchedFields,e)}),P=(e,t,r)=>{const o=(Ie(a,e,{_f:{}})._f||{}).ref,s=Ie(n.errors,e)||{},{ref:i,message:c,type:l,...d}=s;Me(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()},O=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!ut(r).some(e=>e&&(i?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return mt(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Ge))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...s},...n,...t,defaultValues:o})}}).unsubscribe,I=(e,t={})=>{for(const i of e?ut(e):c.mount)c.mount.delete(i),c.array.delete(i),t.keepValue||(xt(a,i),xt(s,i)),!t.keepError&&xt(n.errors,i),!t.keepDirty&&xt(n.dirtyFields,i),!t.keepTouched&&xt(n.touchedFields,i),!t.keepIsValidating&&xt(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&xt(o,i);p.state.next({values:_e(s)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},D=({disabled:e,name:t})=>{(De(e)&&i.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},U=(e,t={})=>{let n=Ie(a,e);const s=De(t.disabled)||De(r.disabled);return Me(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?D({disabled:De(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...s?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Pt(t.min),max:Pt(t.max),minLength:Pt(t.minLength),maxLength:Pt(t.maxLength),pattern:Pt(t.pattern)}:{},name:e,onChange:N,onBlur:N,ref:s=>{if(s){U(e,t),n=Ie(a,e);const r=Re(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=(e=>bt(e)||we(e))(r),c=n._f.refs||[];if(i?c.find(e=>e===r):r===n._f.ref)return;Me(a,e,{_f:{...n._f,...i?{refs:[...c.filter(yt),r,...Array.isArray(Ie(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=Ie(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Ne(c.array,e)||!i.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&Mt(a,C,c.mount),F=(e,t)=>async o=>{let i;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=_e(s);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();g(),n.errors=e,l=_e(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)xt(l,e);if(xt(n.errors,"root"),mt(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){i=e}}else t&&await t({...n.errors},o),M(),setTimeout(M);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:mt(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},z=(e,t={})=>{const l=e?_e(e):o,d=_e(l),f=mt(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(kt(o,s))]);for(const t of Array.from(e)){const e=Ie(n.dirtyFields,t),r=Ie(s,t),a=Ie(m,t);e&&!Re(r)?Me(m,t,r):e||Re(a)||A(t,a)}}else{if(Ce&&Re(e))for(const e of c.mount){const t=Ie(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(gt(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)A(e,Ie(m,e));else a={}}s=r.shouldUnregister?t.keepDefaultValues?_e(o):{}:_e(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:""},i.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!mt(m),i.watch=!!r.shouldUnregister,i.keepIsValid=!!t.keepIsValid,i.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||it(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&s?kt(o,s):n.dirtyFields:t.keepDefaultValues&&e?kt(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})},L=(e,t)=>z(Ue(e)?e(s):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:U,unregister:I,getFieldState:R,handleSubmit:F,setError:P,_subscribe:O,_runSchema:x,_updateIsValidating:g,_focusError:M,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(i.action=!0,m&&Array.isArray(Ie(a,e))){const t=c(Ie(a,e),l.argA,l.argB);d&&Me(a,e,t)}if(m&&Array.isArray(Ie(n.errors,e))){const t=c(Ie(n.errors,e),l.argA,l.argB);d&&Me(n.errors,e,t),((e,t)=>{!Pe(Ie(e,t)).length&&xt(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Ie(n.touchedFields,e))){const t=c(Ie(n.touchedFields,e),l.argA,l.argB);d&&Me(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=kt(o,s)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Me(s,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Pe(Ie(i.mount?s:o,e,r.shouldUnregister?Ie(o,e,[]):[])),_reset:z,_resetDefaultValues:()=>Ue(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Ie(a,e);t&&(t._f.refs?t._f.refs.every(e=>!yt(e)):!yt(t._f.ref))&&I(e)}c.unMount=new Set},_disableForm:e=>{De(e)&&(p.state.next({disabled:e}),Mt(a,(t,r)=>{const n=Ie(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 s},get _state(){return i},set _state(e){i=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=>(i.mount=!0,f={...f,...e.formState},O({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:F,watch:(e,t)=>Ue(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:A,getValues:T,reset:L,resetField:(e,t={})=>{Ie(a,e)&&(Re(t.defaultValue)?A(e,_e(Ie(o,e))):(A(e,t.defaultValue),Me(o,e,_e(t.defaultValue))),t.keepTouched||xt(n.touchedFields,e),t.keepDirty||(xt(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,_e(Ie(o,e))):S()),t.keepError||(xt(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&ut(e).forEach(e=>xt(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=Ie(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Ue(e.select)&&e.select()})}},getFieldState:R};return{...V,formControl:V}}function Gt(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,o]=t.useState({isDirty:!1,isValidating:!1,isLoading:Ue(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:Ue(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!Ue(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Bt(e);r.current={...n,formState:a}}const s=r.current.control;return s._options=e,nt(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),t.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),t.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),t.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),t.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==a.isDirty&&s._subjects.state.next({isDirty:e})}},[s,a.isDirty]),t.useEffect(()=>{var t;e.values&&!it(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null===(t=s._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||s._setValid(),n.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),t.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),r.current.formState=rt(a,s),r.current}const Ht=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Ie(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Kt=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Ht(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>Ht(t,r,e))}},Zt=(e,t)=>{t.shouldUseNativeValidation&&Kt(e,t);const r={};for(const n in e){const a=Ie(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(Jt(t.names||Object.keys(e),n)){const e=Object.assign({},Ie(r,n));Me(e,"root",o),Me(r,n,e)}else Me(r,n,o)}return r},Jt=(e,t)=>{const r=qt(t);return e.some(e=>qt(e).match(`^${r}\\.\\d+`))};function qt(e){return e.replace(/\]|\[/g,"")}function Yt(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:s,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=s.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 s(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(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Xt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Qt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const er={};function tr(e){return er}function rr(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 nr(e,t){return"bigint"==typeof t?t.toString():t}function ar(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function or(e){return null==e}function sr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const ir=Symbol("evaluating");function cr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ir)return void 0===n&&(n=ir,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function lr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function dr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function ur(e){return JSON.stringify(e)}const fr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function pr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const mr=ar(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function hr(e){if(!1===pr(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!==pr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function gr(e){return hr(e)?{...e}:Array.isArray(e)?[...e]:e}const vr=new Set(["string","number","symbol"]);function br(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function xr(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 wr(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 Sr(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function kr(e){return"string"==typeof e?e:e?.message}function jr(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=kr(e.inst?._zod.def?.error?.(e))??kr(t?.error?.(e))??kr(r.customError?.(e))??kr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Er(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Ar(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Nr=(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,nr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Cr=Yt("$ZodError",Nr),_r=Yt("$ZodError",Nr,{Parent:Error});const Tr=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Xt;if(s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>jr(e,o,tr())));throw fr(t,a?.callee),t}return s.value},Rr=Tr(_r),Pr=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>jr(e,o,tr())));throw fr(t,a?.callee),t}return s.value},Or=Pr(_r),Ir=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 Xt;return o.issues.length?{success:!1,error:new(e??Cr)(o.issues.map(e=>jr(e,a,tr())))}:{success:!0,data:o.value}},Dr=Ir(_r),Ur=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=>jr(e,a,tr())))}:{success:!0,data:o.value}},Mr=Ur(_r),Fr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tr(e)(t,r,a)},zr=e=>(t,r,n)=>Tr(e)(t,r,n),Lr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pr(e)(t,r,a)},$r=e=>async(t,r,n)=>Pr(e)(t,r,n),Vr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ir(e)(t,r,a)},Wr=e=>(t,r,n)=>Ir(e)(t,r,n),Br=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ur(e)(t,r,a)},Gr=e=>async(t,r,n)=>Ur(e)(t,r,n),Hr=/^[cC][^\s-]{8,}$/,Kr=/^[0-9a-z]+$/,Zr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Jr=/^[0-9a-vA-V]{20}$/,qr=/^[A-Za-z0-9]{27}$/,Yr=/^[a-zA-Z0-9_-]{21}$/,Xr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qr=/^([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})$/,en=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)$/,tn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const rn=/^(?:(?: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])$/,nn=/^(([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}|:))$/,an=/^((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])$/,on=/^(([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])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^[A-Za-z0-9_-]*$/,ln=/^\+[1-9]\d{6,14}$/,dn="(?:(?:\\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])))",un=new RegExp(`^${dn}$`);function fn(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 pn=/^[^A-Z]*$/,mn=/^[^a-z]*$/,hn=Yt("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gn=Yt("$ZodCheckMaxLength",(e,t)=>{var r;hn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!or(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=Er(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),vn=Yt("$ZodCheckMinLength",(e,t)=>{var r;hn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!or(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=Er(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),bn=Yt("$ZodCheckLengthEquals",(e,t)=>{var r;hn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!or(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=Er(n),s=a>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),yn=Yt("$ZodCheckStringFormat",(e,t)=>{var r,n;hn.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=()=>{})}),xn=Yt("$ZodCheckRegex",(e,t)=>{yn.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})}}),wn=Yt("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pn),yn.init(e,t)}),Sn=Yt("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mn),yn.init(e,t)}),kn=Yt("$ZodCheckIncludes",(e,t)=>{hn.init(e,t);const r=br(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})}}),jn=Yt("$ZodCheckStartsWith",(e,t)=>{hn.init(e,t);const r=new RegExp(`^${br(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})}}),En=Yt("$ZodCheckEndsWith",(e,t)=>{hn.init(e,t);const r=new RegExp(`.*${br(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})}}),An=Yt("$ZodCheckOverwrite",(e,t)=>{hn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Nn{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 Cn={major:4,minor:3,patch:6},_n=Yt("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cn;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=wr(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,s=o._zod.check(e);if(s instanceof Promise&&!1===r?.async)throw new Xt;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(a||(a=wr(e,t)))});else{if(e.issues.length===t)continue;a||(a=wr(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(wr(r))return r.aborted=!0,r;const s=t(a,n,o);if(s instanceof Promise){if(!1===o.async)throw new Xt;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,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 s=e._zod.parse(a,o);if(s instanceof Promise){if(!1===o.async)throw new Xt;return s.then(e=>t(e,n,o))}return t(s,n,o)}}cr(e,"~standard",()=>({validate:t=>{try{const r=Dr(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Mr(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Tn=Yt("$ZodString",(e,t)=>{var r;_n.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}}),Rn=Yt("$ZodStringFormat",(e,t)=>{yn.init(e,t),Tn.init(e,t)}),Pn=Yt("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Qr),Rn.init(e,t)}),On=Yt("$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=en(e))}else t.pattern??(t.pattern=en());Rn.init(e,t)}),In=Yt("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tn),Rn.init(e,t)}),Dn=Yt("$ZodURL",(e,t)=>{Rn.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})}}}),Un=Yt("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Rn.init(e,t)}),Mn=Yt("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Yr),Rn.init(e,t)}),Fn=Yt("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Hr),Rn.init(e,t)}),zn=Yt("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Kr),Rn.init(e,t)}),Ln=Yt("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zr),Rn.init(e,t)}),$n=Yt("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Jr),Rn.init(e,t)}),Vn=Yt("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qr),Rn.init(e,t)}),Wn=Yt("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=fn({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(`^${dn}T(?:${n})$`)}(t)),Rn.init(e,t)}),Bn=Yt("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=un),Rn.init(e,t)}),Gn=Yt("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${fn(t)}$`)),Rn.init(e,t)}),Hn=Yt("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xr),Rn.init(e,t)}),Kn=Yt("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rn),Rn.init(e,t),e._zod.bag.format="ipv4"}),Zn=Yt("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=nn),Rn.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})}}}),Jn=Yt("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=an),Rn.init(e,t)}),qn=Yt("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=on),Rn.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 Yn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xn=Yt("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=sn),Rn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Yn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Qn=Yt("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=cn),Rn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!cn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Yn(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})}}),ea=Yt("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ln),Rn.init(e,t)});const ta=Yt("$ZodJWT",(e,t)=>{Rn.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})}}),ra=Yt("$ZodUnknown",(e,t)=>{_n.init(e,t),e._zod.parse=e=>e}),na=Yt("$ZodNever",(e,t)=>{_n.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function aa(e,t,r){e.issues.length&&t.issues.push(...Sr(r,e.issues)),t.value[r]=e.value}const oa=Yt("$ZodArray",(e,t)=>{_n.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 s=a[e],i=t.element._zod.run({value:s,issues:[]},n);i instanceof Promise?o.push(i.then(t=>aa(t,r,e))):aa(i,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function sa(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Sr(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ia(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 ca(e,t,r,n,a,o){const s=[],i=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(i.has(a))continue;if("never"===l){s.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>sa(e,r,a,t,d))):sa(o,r,a,t,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const la=Yt("$ZodObject",(e,t)=>{_n.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=ar(()=>ia(t));cr(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=pr,o=t.catchall;let s;e._zod.parse=(t,r)=>{s??(s=n.value);const i=t.value;if(!a(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],l=s.shape;for(const e of s.keys){const n=l[e],a="optional"===n._zod.optout,o=n._zod.run({value:i[e],issues:[]},r);o instanceof Promise?c.push(o.then(r=>sa(r,t,e,i,a))):sa(o,t,e,i,a)}return o?ca(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),da=Yt("$ZodObjectJIT",(e,t)=>{la.init(e,t);const r=e._zod.parse,n=ar(()=>ia(t));let a;const o=pr,s=!er.jitless,i=s&&mr.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?s&&i&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new Nn(["shape","payload","ctx"]),r=n.value,a=e=>{const t=ur(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const e of r.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],s=ur(n),i=e[n],c="optional"===i?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${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 ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=a(d,u),c?ca([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function ua(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=>!wr(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=>jr(e,n,tr())))}),t)}const fa=Yt("$ZodUnion",(e,t)=>{_n.init(e,t),cr(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),cr(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),cr(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),cr(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=>sr(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 s=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)i.push(t),s=!0;else{if(0===t.issues.length)return t;i.push(t)}}return s?Promise.all(i).then(t=>ua(t,a,e,o)):ua(i,a,e,o)}}),pa=Yt("$ZodIntersection",(e,t)=>{_n.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])=>ha(e,t,r)):ha(e,a,o)}});function ma(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(hr(e)&&hr(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=ma(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=ma(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 ha(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}),wr(e))return e;const s=ma(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const ga=Yt("$ZodEnum",(e,t)=>{_n.init(e,t);const r=rr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>vr.has(typeof e)).map(e=>"string"==typeof e?br(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}}),va=Yt("$ZodTransform",(e,t)=>{_n.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Qt(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 Xt;return r.value=a,r}});function ba(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const ya=Yt("$ZodOptional",(e,t)=>{_n.init(e,t),e._zod.optin="optional",e._zod.optout="optional",cr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),cr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${sr(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=>ba(t,e.value)):ba(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),xa=Yt("$ZodExactOptional",(e,t)=>{ya.init(e,t),cr(e._zod,"values",()=>t.innerType._zod.values),cr(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),wa=Yt("$ZodNullable",(e,t)=>{_n.init(e,t),cr(e._zod,"optin",()=>t.innerType._zod.optin),cr(e._zod,"optout",()=>t.innerType._zod.optout),cr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${sr(e.source)}|null)$`):void 0}),cr(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)}),Sa=Yt("$ZodDefault",(e,t)=>{_n.init(e,t),e._zod.optin="optional",cr(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=>ka(e,t)):ka(n,t)}});function ka(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const ja=Yt("$ZodPrefault",(e,t)=>{_n.init(e,t),e._zod.optin="optional",cr(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))}),Ea=Yt("$ZodNonOptional",(e,t)=>{_n.init(e,t),cr(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=>Aa(t,e)):Aa(a,e)}});function Aa(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 Na=Yt("$ZodCatch",(e,t)=>{_n.init(e,t),cr(e._zod,"optin",()=>t.innerType._zod.optin),cr(e._zod,"optout",()=>t.innerType._zod.optout),cr(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=>jr(e,r,tr()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>jr(e,r,tr()))},input:e.value}),e.issues=[]),e)}}),Ca=Yt("$ZodPipe",(e,t)=>{_n.init(e,t),cr(e._zod,"values",()=>t.in._zod.values),cr(e._zod,"optin",()=>t.in._zod.optin),cr(e._zod,"optout",()=>t.out._zod.optout),cr(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=>_a(e,t.in,r)):_a(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>_a(e,t.out,r)):_a(n,t.out,r)}});function _a(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ta=Yt("$ZodReadonly",(e,t)=>{_n.init(e,t),cr(e._zod,"propValues",()=>t.innerType._zod.propValues),cr(e._zod,"values",()=>t.innerType._zod.values),cr(e._zod,"optin",()=>t.innerType?._zod?.optin),cr(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(Ra):Ra(n)}});function Ra(e){return e.value=Object.freeze(e.value),e}const Pa=Yt("$ZodCustom",(e,t)=>{hn.init(e,t),_n.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=>Oa(t,r,n,e));Oa(a,r,n,e)}});function Oa(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(Ar(e))}}var Ia;class Da{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)}}(Ia=globalThis).__zod_globalRegistry??(Ia.__zod_globalRegistry=new Da);const Ua=globalThis.__zod_globalRegistry;function Ma(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...xr(t)})}function Fa(e,t){return new gn({check:"max_length",...xr(t),maximum:e})}function za(e,t){return new vn({check:"min_length",...xr(t),minimum:e})}function La(e,t){return new bn({check:"length_equals",...xr(t),length:e})}function $a(e){return new An({check:"overwrite",tx:e})}function Va(e){const t=function(e,t){const r=new hn({check:"custom",...xr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Ar(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(Ar(n))}},e(r.value,r)));return t}function Wa(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??Ua,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 Ba(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 s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const i=e._zod.toJSONSchema?.();if(i)s.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,n);else{const r=s.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&&(s.ref||(s.ref=o),Ba(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&Ka(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function Ga(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 s=n.schema;for(const e in s)delete s[e];s.$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 Ha(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},s=r.ref;if(r.ref=null,s){n(s);const r=e.seen.get(s),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,i):(a.allOf=a.allOf??[],a.allOf.push(i)),Object.assign(a,o);if(t._zod.parent===s)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(i.$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 i=t._zod.parent;if(i&&i!==s){n(i);const t=e.seen.get(i);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:Za(t,"input",e.processors),output:Za(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Ka(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 Ka(n.element,r);if("set"===n.type)return Ka(n.valueType,r);if("lazy"===n.type)return Ka(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 Ka(n.innerType,r);if("intersection"===n.type)return Ka(n.left,r)||Ka(n.right,r);if("record"===n.type||"map"===n.type)return Ka(n.keyType,r)||Ka(n.valueType,r);if("pipe"===n.type)return Ka(n.in,r)||Ka(n.out,r);if("object"===n.type){for(const e in n.shape)if(Ka(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Ka(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Ka(e,r))return!0;return!(!n.rest||!Ka(n.rest,r))}return!1}const Za=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},s=Wa({...a??{},target:o,io:t,processors:r});return Ba(e,s),Ga(s,e),Ha(s,e)},Ja={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qa=(e,t,r,n)=>{const a=e._zod.def;Ba(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Ya(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Xa(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[s]={message:i.message,type:i.code}}else r[s]={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[s].types,l=c&&c[n.code];r[s]=dt(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Qa(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,s=n.path.join(".");if(!r[s])if("invalid_union"===n.code&&n.errors.length>0){var i=n.errors[0][0];r[s]={message:i.message,type:i.code}}else r[s]={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[s].types,l=c&&c[n.code];r[s]=dt(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function eo(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(Ya(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&Kt({},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:Zt(Xa(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(Ya(function(){return Promise.resolve(("sync"===r.mode?Rr:Or)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&Kt({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Cr}(e))return{values:{},errors:Zt(Qa(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 to=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ro=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)},no=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),ao=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var a=n(t),o=n(r);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 i(){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}exports.ApiVersion=void 0,(exports.ApiVersion||(exports.ApiVersion={})).V1="v1";const c=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),l="-",d=[],u=e=>{const t=m(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return p(e);const r=e.split(l),n=""===r[0]&&r.length>1?1:0;return f(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||d}return r[e]||d}}},f=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=f(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const s=0===t?e.join(l):e.slice(t).join(l),i=o.length;for(let e=0;e<i;e++){const t=o[e];if(t.validator(s))return t.classGroupId}},p=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})(),m=e=>{const{theme:t,classGroups:r}=e;return h(r,t)},h=(e,t)=>{const r=c();for(const n in e){const a=e[n];g(a,r,n,t)}return r},g=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];v(a,t,r,n)}},v=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?x(e,t,r,n):y(e,t,r,n):b(e,t,r)},b=(e,t,r)=>{(""===e?t:w(t,e)).classGroupId=r},y=(e,t,r,n)=>{S(e)?g(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},x=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,s]=a[e];g(s,w(t,o),r,n)}},w=(e,t)=>{let r=e;const n=t.split(l),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=c(),r.nextPart.set(t,a)),r=a}return r},S=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,k=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)}}},E=[],j=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),A=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const s=e.length;for(let i=0;i<s;i++){const s=e[i];if(0===n&&0===a){if(":"===s){t.push(e.slice(o,i)),o=i+1;continue}if("/"===s){r=i;continue}}"["===s?n++:"]"===s?n--:"("===s?a++:")"===s&&a--}const i=0===t.length?e:e.slice(o);let c=i,l=!1;i.endsWith("!")?(c=i.slice(0,-1),l=!0):i.startsWith("!")&&(c=i.slice(1),l=!0);return j(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(E,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},N=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],s="["===o[0],i=t.has(o);s||i?(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}},C=/\s+/,_=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=_(e[n]))&&(r&&(r+=" "),r+=t);return r},T=(e,...t)=>{let r,n,a,o;const s=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,s=[],i=e.trim().split(C);let c="";for(let e=i.length-1;e>=0;e-=1){const t=i[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,b=v+h;if(s.indexOf(b)>-1)continue;s.push(b);const y=a(h,m);for(let e=0;e<y.length;++e){const t=y[e];s.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=i=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:k(e.cacheSize),parseClassName:A(e),sortModifiers:N(e),...u(e)}))(c),n=r.cache.get,a=r.cache.set,o=s,s(i)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=_(t))&&(a&&(a+=" "),a+=r);return a})(...e))},R=[],P=e=>{const t=t=>t[e]||R;return t.isThemeGetter=!0,t},O=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,I=/^\((?:(\w[\w-]*):)?(.+)\)$/i,D=/^\d+\/\d+$/,U=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M=/\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$/,F=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,z=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,L=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$=e=>D.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),W=e=>!!e&&Number.isInteger(Number(e)),B=e=>e.endsWith("%")&&V(e.slice(0,-1)),G=e=>U.test(e),H=()=>!0,K=e=>M.test(e)&&!F.test(e),Z=()=>!1,J=e=>z.test(e),q=e=>L.test(e),Y=e=>!Q(e)&&!oe(e),X=e=>fe(e,ge,Z),Q=e=>O.test(e),ee=e=>fe(e,ve,K),te=e=>fe(e,be,V),re=e=>fe(e,me,Z),ne=e=>fe(e,he,q),ae=e=>fe(e,xe,J),oe=e=>I.test(e),se=e=>pe(e,ve),ie=e=>pe(e,ye),ce=e=>pe(e,me),le=e=>pe(e,ge),de=e=>pe(e,he),ue=e=>pe(e,xe,!0),fe=(e,t,r)=>{const n=O.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},pe=(e,t,r=!1)=>{const n=I.exec(e);return!!n&&(n[1]?t(n[1]):r)},me=e=>"position"===e||"percentage"===e,he=e=>"image"===e||"url"===e,ge=e=>"length"===e||"size"===e||"bg-size"===e,ve=e=>"length"===e,be=e=>"number"===e,ye=e=>"family-name"===e,xe=e=>"shadow"===e,we=T(()=>{const e=P("color"),t=P("font"),r=P("text"),n=P("font-weight"),a=P("tracking"),o=P("leading"),s=P("breakpoint"),i=P("container"),c=P("spacing"),l=P("radius"),d=P("shadow"),u=P("inset-shadow"),f=P("text-shadow"),p=P("drop-shadow"),m=P("blur"),h=P("perspective"),g=P("aspect"),v=P("ease"),b=P("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",oe,Q],x=()=>[oe,Q,c],w=()=>[$,"full","auto",...x()],S=()=>[W,"none","subgrid",oe,Q],k=()=>["auto",{span:["full",W,oe,Q]},W,oe,Q],E=()=>[W,"auto",oe,Q],j=()=>["auto","min","max","fr",oe,Q],A=()=>["auto",...x()],N=()=>[$,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],C=()=>[e,oe,Q],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ce,re,{position:[oe,Q]}],T=()=>["auto","cover","contain",le,X,{size:[oe,Q]}],R=()=>[B,se,ee],O=()=>["","none","full",l,oe,Q],I=()=>["",V,se,ee],D=()=>[V,B,ce,re],U=()=>["","none",m,oe,Q],M=()=>["none",V,oe,Q],F=()=>["none",V,oe,Q],z=()=>[V,oe,Q],L=()=>[$,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[G],breakpoint:[G],color:[H],container:[G],"drop-shadow":[G],ease:["in","out","in-out"],font:[Y],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[G],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[G],shadow:[G],spacing:["px",V],text:[G],"text-shadow":[G],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$,Q,oe,g]}],container:["container"],columns:[{columns:[V,Q,oe,i]}],"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:y()}],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:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[W,"auto",oe,Q]}],basis:[{basis:[$,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[V,$,"auto","initial","none",Q]}],grow:[{grow:["",V,oe,Q]}],shrink:[{shrink:["",V,oe,Q]}],order:[{order:[W,"first","last","none",oe,Q]}],"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":j()}],"auto-rows":[{"auto-rows":j()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"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:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],w:[{w:[i,"screen",...N()]}],"min-w":[{"min-w":[i,"screen","none",...N()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",r,se,ee]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,oe,te]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",B,Q]}],"font-family":[{font:[ie,Q,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,oe,Q]}],"line-clamp":[{"line-clamp":[V,"none",oe,te]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",oe,Q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,Q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[V,"from-font","auto",oe,ee]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[V,"auto",oe,Q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,Q]}],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",oe,Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},W,oe,Q],radial:["",oe,Q],conic:[W,oe,Q]},de,ne]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],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:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[V,oe,Q]}],"outline-w":[{outline:["",V,se,ee]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",d,ue,ae]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",u,ue,ae]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[V,ee]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",f,ue,ae]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[V,oe,Q]}],"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":[V]}],"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":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"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":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"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":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"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":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"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":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"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":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"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":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[oe,Q]}],"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":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"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":[V]}],"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":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,Q]}],filter:[{filter:["","none",oe,Q]}],blur:[{blur:U()}],brightness:[{brightness:[V,oe,Q]}],contrast:[{contrast:[V,oe,Q]}],"drop-shadow":[{"drop-shadow":["","none",p,ue,ae]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",V,oe,Q]}],"hue-rotate":[{"hue-rotate":[V,oe,Q]}],invert:[{invert:["",V,oe,Q]}],saturate:[{saturate:[V,oe,Q]}],sepia:[{sepia:["",V,oe,Q]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,Q]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[V,oe,Q]}],"backdrop-contrast":[{"backdrop-contrast":[V,oe,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",V,oe,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,oe,Q]}],"backdrop-invert":[{"backdrop-invert":["",V,oe,Q]}],"backdrop-opacity":[{"backdrop-opacity":[V,oe,Q]}],"backdrop-saturate":[{"backdrop-saturate":[V,oe,Q]}],"backdrop-sepia":[{"backdrop-sepia":["",V,oe,Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,Q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[V,"initial",oe,Q]}],ease:[{ease:["linear","initial",v,oe,Q]}],delay:[{delay:[V,oe,Q]}],animate:[{animate:["none",b,oe,Q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,oe,Q]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:M()}],"rotate-x":[{"rotate-x":M()}],"rotate-y":[{"rotate-y":M()}],"rotate-z":[{"rotate-z":M()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:z()}],"skew-x":[{"skew-x":z()}],"skew-y":[{"skew-y":z()}],transform:[{transform:[oe,Q,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"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:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"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",oe,Q]}],"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":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"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",oe,Q]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[V,se,ee,te]}],stroke:[{stroke:["none",...C()]}],"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 Se(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function ke(...e){return we(i(e))}let Ee=!0;function je(e,...t){console.error(e,...t)}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(Se()){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 s;try{const e=await o.text();if(e)try{s=JSON.parse(e)}catch{s=e.substring(0,200)+(e.length>200?"...":"")}}catch{s="(read failed)"}!function(e,...t){Ee&&Se()&&console.log(e,...t)}("[SDK API]",n,e,{request:Ae(a),response:Ae(s),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,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function Te(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 Re(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await Te(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 Te(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class Pe 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,Pe)}}const Oe=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&&(Ee=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Ne(e))return;const r=e instanceof Error?e:new Pe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof Pe?r:new Pe(r.message,r.name,t,r);if(this.config.enableConsoleLogging&&function(e,...t){Ee&&Se()&&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){je("[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 Ie(e,t={}){Oe.handleError(e,t)}function De(e,t={}){return!Ne(e)&&(Oe.handleError(e,t),!0)}class Ue extends t.Component{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(Ie(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){je("[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.jsxs("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),e.jsx("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),e.jsx("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 Me=()=>({type:"AUTHENTICATION_STARTED"}),Fe=()=>({type:"AUTHENTICATION_PROCESSING"}),ze=()=>({type:"AUTHENTICATION_FAILED"}),Le=e=>({type:"SET_SESSION",payload:e}),$e=()=>({type:"REMOVE_SESSION"});function Ve(e,r,n){const a=t.useRef(r),o=t.useRef(n),s=t.useRef(void 0),i=t.useRef(e);return a.current=r,o.current=n,t.useMemo(()=>{const t=a.current(e);if(void 0!==s.current){if((o.current?o.current(s.current,t):Object.is(s.current,t))&&i.current===e)return s.current}return s.current=t,i.current=e,t},[e])}function We({name:r,initialState:n,reducer:a,initializer:o}){const s=t.createContext(null),i=t.createContext(null),c=t.createContext(null),l=t.memo(({children:r})=>{const[l,d]=t.useReducer(a,n,o||(e=>e)),u=t.useMemo(()=>({state:l,dispatch:d}),[l,d]);return e.jsx(c.Provider,{value:u,children:e.jsx(s.Provider,{value:l,children:e.jsx(i.Provider,{value:d,children:r})})})});l.displayName=`${r}Provider`;const d=()=>{const e=t.useContext(s);if(null===e)throw new Error(`use${r}State must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e};return{Provider:l,useContext:()=>{const e=t.useContext(c);if(!e)throw new Error(`use${r}Context must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useState:d,useDispatch:()=>{const e=t.useContext(i);if(null===e)throw new Error(`use${r}Dispatch must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useSelector:(e,t)=>{const r=e||(e=>e);return Ve(d(),r,t)}}}function Be(e,t,r){return{...e,[t]:r}}function Ge(e,t){return{...e,...t}}var He;function Ke(e){return{isAuthenticated:e===exports.AuthStatus.authenticated,isLoading:e===exports.AuthStatus.loading||e===exports.AuthStatus.redirecting||e===exports.AuthStatus.authenticating,isRedirecting:e===exports.AuthStatus.redirecting}}function Ze(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return Ie(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function Je(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){Ie(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function qe(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){Ie(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}exports.AuthStatus=void 0,(He=exports.AuthStatus||(exports.AuthStatus={})).loading="loading",He.redirecting="redirecting",He.authenticated="authenticated",He.unauthenticated="unauthenticated",He.authenticating="authenticating";const Ye="code",Xe="saas-session-id",Qe="saas-workspace-current";function et(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 tt(){qe(Xe)}function rt(){if("undefined"==typeof window)return null;try{return Ze(Xe)}catch(e){return Ie(e,{component:"auth/utils",action:"getSessionId",metadata:{key:Xe}}),null}}function nt(){const e=rt(),t={};return e&&(t["x-session-id"]=e),t}function at(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(Ye)}catch(e){return Ie(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:Ye}}),null}}function ot(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const st=()=>({session:null,status:exports.AuthStatus.loading}),{Provider:it,useState:ct,useDispatch:lt}=We({name:"Auth",initialState:st(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return Be(e,"status",exports.AuthStatus.redirecting);case"AUTHENTICATION_PROCESSING":return Be(e,"status",exports.AuthStatus.authenticating);case"AUTHENTICATION_FAILED":return Ge(e,{session:null,status:exports.AuthStatus.unauthenticated});case"SET_SESSION":{const n=t.payload;return r=n.sessionId,Je(Xe,r),Ge(e,{session:n,status:exports.AuthStatus.authenticated})}case"REMOVE_SESSION":return tt(),Ge(e,{session:null,status:exports.AuthStatus.unauthenticated});default:return e}var r},initializer:st}),dt=it,ut=ct,ft=lt,pt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),mt=e=>({type:"SET_SETTINGS",payload:e}),ht=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:gt,useState:vt,useDispatch:bt}=We({name:"OS",initialState:ht(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return Ge(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return ht();case"SET_SETTINGS":return Be(e,"settings",t.payload);default:return e}}}),yt=gt,xt=vt,wt=bt,St=e=>({type:"SET_WORKSPACES",payload:e}),kt=e=>({type:"SET_ALL_FEATURES",payload:e}),Et=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),jt=()=>({type:"RESET_CURRENT_WORKSPACE"}),At=e=>({type:"SET_IS_INITIALIZED",payload:e}),Nt=e=>({type:"SET_LOADING",payload:e}),Ct=e=>({type:"SET_ERROR",payload:e}),_t=e=>({type:"SET_REFRESHING",payload:e}),Tt=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),Rt=e=>{e?Je(Qe,e._id):qe(Qe)},Pt=()=>Ze(Qe),Ot=()=>{qe(Qe)},It=(e,t)=>!!e&&t.some(t=>t._id===e);function Dt(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 Ut(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:Mt,useState:Ft,useDispatch:zt}=We({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 Be(e,"workspaces",t.payload);case"SET_ALL_FEATURES":return Be(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return Rt(t.payload),Be(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return Ot(),Be(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return Be(e,"isInitialized",t.payload);case"SET_LOADING":return Be(e,"loading",t.payload);case"SET_ERROR":return Be(e,"error",t.payload);case"SET_REFRESHING":return Be(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return Be(e,"switchingToId",t.payload);default:return e}}}),Lt=Mt,$t=Ft,Vt=zt,Wt=t.memo(({children:t})=>e.jsx(yt,{children:e.jsx(dt,{children:e.jsx(Lt,{children:t})})}));function Bt(e,r){const n=xt(),a=ut(),o=$t(),s=e||(e=>e);return Ve(t.useMemo(()=>({os:n,auth:a,workspaces:o}),[n,a,o]),s,r)}function Gt(){const e=ft(),r=wt(),n=Vt();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}function Ht(e,r,n){t.useEffect(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Ne(e)||(n?.onError?n.onError(e):Ie(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},r)}Wt.displayName="SDKContextProvider";const Kt=t.memo(({children:r,callbacks:n})=>{const a=Gt(),o=Bt(e=>e.auth),s=Bt(e=>e.os),i=Ke(o.status).isAuthenticated,c=t.useRef(!1),l=t.useRef(null),d=t.useRef(!1),u=t.useMemo(()=>n,[n]),f=t.useCallback(async e=>{try{if(u?.handleAuthentication){const{sessionId:t}=await u.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=s,{serverUrl:n,version:o,orgId:i}=r;if(!n||!o||!i)throw new Error("OS configuration is not available");const c=await Ce(`${n}/api/${o}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}}),l=await Re(c,"Failed to fetch user profile"),d=ot(et(l,i,r.auth?.clientId||""),t);a.auth(Le(d)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(Ye),window.history.replaceState({},"",e.toString())}catch(e){Ie(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:Ye}})}}()}}catch(t){throw Ie(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),a.auth(ze()),t}},[a,u,s]);return Ht(async e=>{if("undefined"==typeof window)return;if(i)return;if(d.current)return;if(at())return;const t=rt();if(t){d.current=!0;try{const{serverUrl:r,version:n,orgId:o}=s;if(!r||!n||!o)return d.current=!1,void Ie(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":t,"Content-Type":"application/json"},signal:e});i=await Re(a,"Failed to fetch user profile")}catch(e){if(!De(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return d.current=!1,tt(),void a.auth(ze())}const c=ot(et(i,o,s.auth?.clientId||""),t);a.auth(Le(c))}catch(e){if(!De(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;tt(),a.auth(ze())}finally{d.current=!1}}else a.auth(ze())},[i,a,s]),t.useEffect(()=>{const e=at();if(!e)return;if(c.current||l.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(c.current=!0,l.current=e,a.auth(Fe()),f(e).then(()=>{l.current=null}).catch(t=>{Ie(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),l.current=null}).finally(()=>{c.current=!1}))},[f,s.serverUrl,s.version,s.orgId]),e.jsx(e.Fragment,{children:r})});Kt.displayName="AuthProviderWrapper";const Zt=t.memo(({config:r,auth:n,children:a})=>{const o=Gt(),s=Bt(e=>e.os),i=t.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return t.useEffect(()=>{o.os(pt({...r,auth:i}))},[r,i,o]),Ht(async e=>{const{serverUrl:t,version:r,orgId:n,settings:a}=s;if(!t||!r||!n||a)return;const i=nt(),c=await Ce(`${t}/api/${r}/public/${n}/settings`,{headers:i,signal:e});if(c.ok){const e=await c.json();o.os(mt(e))}},[s.serverUrl,s.version,s.orgId,s.settings,o],{onError:e=>Ie(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:s.serverUrl,version:s.version,orgId:s.orgId}})}),e.jsx(e.Fragment,{children:a})});Zt.displayName="ContextConfigProvider";const Jt=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){Ie(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})}},qt=t.createContext({container:null,setContainer:()=>{}}),Yt=t.memo(({children:r})=>{const[n,a]=t.useState(null),o=t.useMemo(()=>({container:n,setContainer:a}),[n]),s=t.useMemo(()=>r,[r]);return e.jsxs(qt.Provider,{value:o,children:[s,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Yt.displayName="PortalProvider";const Xt=t.createContext(void 0),Qt=t.memo(({children:r})=>{const n=Bt(e=>e.os),a=Bt(e=>e.auth),{serverUrl:o,version:s}=n,i=Ke(a.status).isAuthenticated,[c,l]=t.useState({}),[d,u]=t.useState({}),[f,p]=t.useState(!1),[m,h]=t.useState(null),g=t.useCallback(async e=>{if(o&&s&&i)try{const t=await Ce(`${o}/api/${s}/public/users/attributes`,{headers:nt(),signal:e});if(!t.ok)throw new Error(await _e(t,"Failed to fetch user attributes"));const r=await t.json();r&&"object"==typeof r&&!Array.isArray(r)?l(r):l({})}catch(e){if(Ne(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");h(t),Ie(e,{component:"UserProvider",action:"fetchAttributes"})}else l({})},[o,s,i]),v=t.useCallback(async()=>{if(o&&s&&i){p(!0),h(null);try{await g()}finally{p(!1)}}},[o,s,i,g]),b=t.useCallback(async e=>{if(!o||!s)throw new Error("Server URL or version is missing");p(!0),h(null);try{const t=await Ce(`${o}/api/${s}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...nt()},body:JSON.stringify({attributes:e})});if(!t.ok)throw new Error(await _e(t,"Failed to update user attributes"));const r=await t.json();return await g(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw h(r),Ie(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{p(!1)}},[o,s,g]),y=t.useCallback(async(e,t)=>{if(!o||!s)throw new Error("Server URL or version is missing");p(!0),h(null);try{const r=await Ce(`${o}/api/${s}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...nt()},body:JSON.stringify({value:t})});if(!r.ok)throw new Error(await _e(r,"Failed to update user attribute"));const n=await r.json();return await g(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw h(n),Ie(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{p(!1)}},[o,s,g]),x=t.useCallback(async e=>{if(o&&s&&i)try{const t=await Ce(`${o}/api/${s}/public/users/features`,{headers:nt(),signal:e});if(!t.ok)throw new Error(await _e(t,"Failed to fetch user features"));const r=await t.json();u("object"==typeof r?r:{})}catch(e){if(Ne(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");h(t),Ie(e,{component:"UserProvider",action:"fetchFeatures"})}else u({})},[o,s,i]),w=t.useCallback(async()=>{if(o&&s&&i){p(!0),h(null);try{await x()}finally{p(!1)}}},[o,s,i,x]);Ht(async e=>{if(!i||!o||!s)return l({}),void u({});p(!0),h(null);try{await Promise.all([g(e),x(e)])}finally{p(!1)}},[i,o,s,g,x],{onError:e=>Ie(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const S=t.useMemo(()=>({attributes:c,features:d,isLoading:f,error:m,updateAttributes:b,updateAttribute:y,refreshAttributes:v,refreshFeatures:w}),[c,d,f,m,b,y,v,w]);return e.jsx(Xt.Provider,{value:S,children:r})});Qt.displayName="UserProvider";class er{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return nt()}async getWorkspaces(){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()}),"Failed to fetch workspaces")}async createWorkspace(e){return Re(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 Re(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 Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to delete workspace")}async getWorkspaceUsers(e){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()}),"Failed to fetch workspace users")}async addUser(e,t){return Re(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 Re(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}}const tr=()=>{const e=Gt(),r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),a=Bt(e=>e.workspaces),o=Bt(e=>e.auth.session?.user),s=t.useCallback((t,r)=>{if((!(t._id===a.currentWorkspace?._id)||r?.forceEmit)&&t){const r=a.currentWorkspace;e.workspaces(Et(t)),Jt.emitWorkspaceChanged(t,r).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[a.currentWorkspace,e]),i=t.useCallback(async(t,n)=>{const a=++u.current;e.workspaces(Tt(t._id));try{const e=r.auth?.callbacks?.onWorkspaceChange;if(e){const r=Ut(t,o?.id);try{await e({workspace:t,user:o??null,role:r})}catch(e){throw Ie(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:t._id}}),e}if(a!==u.current)return}s(t,n)}finally{a===u.current&&e.workspaces(Tt(null))}},[e,r.auth?.callbacks?.onWorkspaceChange,s,o]);t.useEffect(()=>{if(!a.isInitialized){const t=Pt();if(e.workspaces(At(!0)),t){const e=a.workspaces.find(e=>e._id===t);e&&i(e,{forceEmit:!0}).catch(()=>{})}}},[a.isInitialized,a.workspaces,a.currentWorkspace,e,i]);const c=t.useCallback(()=>{e.workspaces(jt())},[e]),l=t.useRef(!1),d=t.useRef(!1),u=t.useRef(0),f=t.useCallback(async()=>{if(!a.loading&&!l.current){l.current=!0,e.workspaces(Nt(!0)),e.workspaces(Ct(null));try{const t=await n.getWorkspaces();if(e.workspaces(St(t)),t.length>0){const e=Pt();if(e&&It(e,t)){const r=t.find(t=>t._id===e);if(r)try{await i(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await i(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(Ct(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(Nt(!1)),l.current=!1}}},[n,a.loading,a.currentWorkspace?._id,e,i]),p=t.useCallback(async()=>{if(!a.refreshing&&!l.current){l.current=!0,e.workspaces(_t(!0));try{const t=await n.getWorkspaces();e.workspaces(St(t))}catch(e){}finally{e.workspaces(_t(!1)),l.current=!1}}},[n,a.refreshing,e]),m=t.useCallback(async(t,r)=>{const o=await n.createWorkspace({name:t,image:r});e.workspaces(St([...a.workspaces,o])),Jt.emitWorkspaceCreated(o).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[n,a.workspaces,e]),h=t.useCallback(async(t,r)=>{const o=await n.updateWorkspace(t._id,r);e.workspaces(St(a.workspaces.map(e=>e._id===t._id?o:e))),Jt.emitWorkspaceUpdated(o).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[n,a.workspaces,e]),g=t.useCallback(async()=>{if(d.current)return a.allFeatures.length>0?a.allFeatures:null;if(a.allFeatures.length>0)return a.allFeatures;d.current=!0;try{const t=await n.getFeatures();return e.workspaces(kt(t)),t}catch(e){return Ie(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{d.current=!1}},[n,e,a.allFeatures]),v=t.useCallback(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);t.useEffect(()=>{if(!a.currentWorkspace?._id||0===a.workspaces.length)return;const e=a.currentWorkspace._id,t=a.workspaces.find(t=>t._id===e);if(t)t!==a.currentWorkspace&&s(t);else if(a.workspaces.length>0){const t=a.workspaces[0];t._id!==e&&i(t).catch(()=>{})}},[a.workspaces,a.currentWorkspace,s,i]);const b=t.useCallback(async e=>await n.getWorkspaceUsers(e),[n]),y=t.useCallback(async(e,t,r)=>{const o=await n.addUser(e,{email:t,role:r}),s=a.workspaces.find(t=>t._id===e);return s&&Jt.emitWorkspaceUserAdded(o.userId,s,r).catch(t=>{Ie(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:r}})}),o},[n,a.workspaces]),x=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&Dt(r,t))throw new Error("Cannot remove the workspace owner");const o=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),s=await n.removeUser(e,t);if(r&&o){const t=o.role;Jt.emitWorkspaceUserRemoved(s.userId,r,t).catch(r=>{Ie(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:s.userId,role:t}})})}return s},[n,a.workspaces]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&Dt(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(r.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=r?.role}const s=await n.updateUser(e,t,r);return r.role&&o&&o!==r.role&&Jt.emitWorkspaceUserRoleChanged(s.userId,s.workspace,o,r.role).catch(n=>{Ie(n,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:r.role}})}),s},[n,a.workspaces]),S=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return Jt.emitUserUpdated(r,t||void 0).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:r._id}})}),r},[n]),k=t.useCallback(async()=>await n.getProfile(),[n]),E=t.useCallback(async e=>await n.getWorkspace(e),[n]),j=t.useCallback(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const r=a.workspaces.find(e=>e._id===t);if(!r)throw new Error("Workspace not found");if(!Dt(r,o.id))throw new Error("Only the workspace creator can delete the workspace");const s=await n.deleteWorkspace(t);return e.workspaces(St(a.workspaces.filter(e=>e._id!==t))),a.currentWorkspace?._id===t&&e.workspaces(jt()),r&&Jt.emitWorkspaceDeleted(r).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),s},[n,a.workspaces,a.currentWorkspace,e,o]);return{workspaces:a.workspaces,loading:a.loading,error:a.error,fetchWorkspaces:f,refreshWorkspaces:p,refreshing:a.refreshing,currentWorkspace:a.currentWorkspace,setCurrentWorkspace:s,switchToWorkspace:i,resetCurrentWorkspace:c,createWorkspace:m,allFeatures:a.allFeatures,getFeatures:g,updateFeature:v,getWorkspace:E,updateWorkspace:h,getUsers:b,addUser:y,removeUser:x,updateUser:w,getProfile:k,updateUserProfile:S,deleteWorkspace:j,switching:null!==a.switchingToId}};const rr=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)})}},nr=t.lazy(()=>Promise.resolve().then(function(){return xk}).then(e=>({default:e.default}))),ar=({children:r})=>{const{currentWorkspace:n}=tr(),[a,o]=t.useState(!1),[s,i]=t.useState("profile");return t.useEffect(()=>{const e=rr.getState();o(e.open),i(e.section);return rr.subscribe((e,t)=>{o(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&a&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(nr,{workspace:n,open:a,onOpenChange:e=>{e||rr.closeSettings()},section:s,onSectionChange:e=>{rr.setSection(e)},showTrigger:!1})})]})},or=(e,t,r)=>{if(t!==exports.ApiVersion.V1)throw new Error(`Invalid version: "${t}". Only "${exports.ApiVersion.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=t.memo(({serverUrl:r,version:n,orgId:a,auth:o,children:s})=>{or(r,n,a);const i=t.useMemo(()=>({serverUrl:r,version:n,orgId:a}),[r,n,a]),c=t.useMemo(()=>o?.callbacks,[o?.callbacks]),l=t.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return t.useEffect(()=>(Jt.setCallbacks(l?{handleEvent:l}:null),()=>{Jt.setCallbacks(null)}),[l]),e.jsx(Ue,{children:e.jsx(Wt,{children:e.jsx(Kt,{callbacks:c,children:e.jsx(Yt,{children:e.jsx(Zt,{config:i,auth:o,children:e.jsx(Qt,{children:e.jsx(ar,{children:s})})})})})})})});sr.displayName="SaaSOSProvider";var ir=e=>"checkbox"===e.type,cr=e=>e instanceof Date,lr=e=>null==e;const dr=e=>"object"==typeof e;var ur=e=>!lr(e)&&!Array.isArray(e)&&dr(e)&&!cr(e),fr=e=>ur(e)&&e.target?ir(e.target)?e.target.checked:e.target.value:e,pr=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),mr="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function hr(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(mr&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||ur(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return ur(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]=hr(e[t]));return n}var gr=e=>/^\w*$/.test(e),vr=e=>void 0===e,br=e=>Array.isArray(e)?e.filter(Boolean):[],yr=e=>br(e.replace(/["|']|\]/g,"").split(/\.|\[/)),xr=(e,t,r)=>{if(!t||!ur(e))return r;const n=(gr(t)?[t]:yr(t)).reduce((e,t)=>lr(e)?e:e[t],e);return vr(n)||n===e?vr(e[t])?r:e[t]:n},wr=e=>"boolean"==typeof e,Sr=e=>"function"==typeof e,kr=(e,t,r)=>{let n=-1;const a=gr(t)?[t]:yr(t),o=a.length,s=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==s){const r=e[t];o=ur(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Er="blur",jr="focusout",Ar="change",Nr="onBlur",Cr="onChange",_r="onSubmit",Tr="onTouched",Rr="all",Pr="max",Or="min",Ir="maxLength",Dr="minLength",Ur="pattern",Mr="required",Fr="validate",zr=t.createContext(null);zr.displayName="HookFormContext";const Lr=()=>t.useContext(zr),$r=e=>{const{children:r,...n}=e;return t.createElement(zr.Provider,{value:n},r)};var Vr=(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]!==Rr&&(t._proxyFormState[a]=!n||Rr),r&&(r[a]=!0),e[a]}});return a};const Wr="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var Br=e=>"string"==typeof e,Gr=(e,t,r,n,a)=>Br(e)?(n&&t.watch.add(e),xr(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),xr(r,e))):(n&&(t.watchAll=!0),r),Hr=e=>lr(e)||!dr(e);function Kr(e,t,r=new WeakSet){if(Hr(e)||Hr(t))return Object.is(e,t);if(cr(e)&&cr(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(cr(n)&&cr(e)||ur(n)&&ur(e)||Array.isArray(n)&&Array.isArray(e)?!Kr(n,e,r):!Object.is(n,e))return!1}}return!0}function Zr(e){const r=Lr(),{name:n,disabled:a,control:o=r.control,shouldUnregister:s,defaultValue:i,exact:c=!0}=e,l=pr(o._names.array,n),d=t.useMemo(()=>xr(o._formValues,n,xr(o._defaultValues,n,i)),[o,n,i]),u=function(e){const r=Lr(),{control:n=r.control,name:a,defaultValue:o,disabled:s,exact:i,compute:c}=e||{},l=t.useRef(o),d=t.useRef(c),u=t.useRef(void 0),f=t.useRef(n),p=t.useRef(a);d.current=c;const[m,h]=t.useState(()=>{const e=n._getWatch(a,l.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=Gr(a,n._names,e||n._formValues,!1,l.current);return d.current?d.current(t):t},[n._formValues,n._names,a]),v=t.useCallback(e=>{if(!s){const t=Gr(a,n._names,e||n._formValues,!1,l.current);if(d.current){const e=d.current(t);Kr(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,s,a]);Wr(()=>(f.current===n&&Kr(p.current,a)||(f.current=n,p.current=a,v()),n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{v(e.values)}})),[n,i,a,v]),t.useEffect(()=>n._removeUnmounted());const b=f.current!==n,y=p.current,x=t.useMemo(()=>{if(s)return null;const e=!b&&!Kr(y,a);return b||e?g():null},[s,b,a,y,g]);return null!==x?x:m}({control:o,name:n,defaultValue:d,exact:c}),f=function(e){const r=Lr(),{control:n=r.control,disabled:a,name:o,exact:s}=e||{},[i,c]=t.useState(n._formState),l=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Wr(()=>n._subscribe({name:o,formState:l.current,exact:s,callback:e=>{!a&&c({...n._formState,...e})}}),[o,a,s]),t.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),t.useMemo(()=>Vr(i,n,l.current,!1),[i,n])}({control:o,name:n,exact:c}),p=t.useRef(e),m=t.useRef(void 0),h=t.useRef(o.register(n,{...e.rules,value:u,...wr(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!xr(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!xr(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!xr(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!xr(f.validatingFields,n)},error:{enumerable:!0,get:()=>xr(f.errors,n)}}),[f,n]),v=t.useCallback(e=>h.current.onChange({target:{value:fr(e),name:n},type:Ar}),[n]),b=t.useCallback(()=>h.current.onBlur({target:{value:xr(o._formValues,n),name:n},type:Er}),[n,o._formValues]),y=t.useCallback(e=>{const t=xr(o._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>Sr(e.focus)&&e.focus(),select:()=>Sr(e.select)&&e.select(),setCustomValidity:t=>Sr(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Sr(e.reportValidity)&&e.reportValidity()})},[o._fields,n]),x=t.useMemo(()=>({name:n,value:u,...wr(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:v,onBlur:b,ref:y}),[n,a,f.disabled,v,b,y,u]);return t.useEffect(()=>{const e=o._options.shouldUnregister||s,t=m.current;t&&t!==n&&!l&&o.unregister(t),o.register(n,{...p.current.rules,...wr(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=xr(o._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=hr(xr(o._options.defaultValues,n,p.current.defaultValue));kr(o._defaultValues,n,e),vr(xr(o._formValues,n))&&kr(o._formValues,n,e)}return!l&&o.register(n),m.current=n,()=>{(l?e&&!o._state.action:e)?o.unregister(n):r(n,!1)}},[n,o,l,s]),t.useEffect(()=>{o._setDisabledField({disabled:a,name:n})},[a,n,o]),t.useMemo(()=>({field:x,formState:f,fieldState:g}),[x,f,g])}const Jr=e=>e.render(Zr(e));var qr=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},Yr=e=>Array.isArray(e)?e:[e],Xr=()=>{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 Qr(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&ur(a)&&o){const e=Qr(a,o);ur(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var en=e=>ur(e)&&!Object.keys(e).length,tn=e=>"file"===e.type,rn=e=>{if(!mr)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},nn=e=>"select-multiple"===e.type,an=e=>"radio"===e.type,on=e=>rn(e)&&e.isConnected;function sn(e,t){const r=Array.isArray(t)?t:gr(t)?[t]:yr(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=vr(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(ur(n)&&en(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!vr(e[t]))return!1;return!0}(n))&&sn(e,r.slice(0,-1)),e}function cn(e){return Array.isArray(e)||ur(e)&&!(e=>{for(const t in e)if(Sr(e[t]))return!0;return!1})(e)}function ln(e,t={}){for(const r in e){const n=e[r];cn(n)?(t[r]=Array.isArray(n)?[]:{},ln(n,t[r])):vr(n)||(t[r]=!0)}return t}function dn(e,t,r){r||(r=ln(t));for(const n in e){const a=e[n];if(cn(a))vr(t)||Hr(r[n])?r[n]=ln(a,Array.isArray(a)?[]:{}):dn(a,lr(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Kr(a,e)}}return r}const un={value:!1,isValid:!1},fn={value:!0,isValid:!0};var pn=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&&!vr(e[0].attributes.value)?vr(e[0].value)||""===e[0].value?fn:{value:e[0].value,isValid:!0}:fn:un}return un},mn=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>vr(e)?e:t?""===e?NaN:e?+e:e:r&&Br(e)?new Date(e):n?n(e):e;const hn={isValid:!1,value:null};var gn=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,hn):hn;function vn(e){const t=e.ref;return tn(t)?t.files:an(t)?gn(e.refs).value:nn(t)?[...t.selectedOptions].map(({value:e})=>e):ir(t)?pn(e.refs).value:mn(vr(t.value)?e.ref.value:t.value,e)}var bn=e=>e instanceof RegExp,yn=e=>vr(e)?e:bn(e)?e.source:ur(e)?bn(e.value)?e.value.source:e.value:e,xn=e=>({isOnSubmit:!e||e===_r,isOnBlur:e===Nr,isOnChange:e===Cr,isOnAll:e===Rr,isOnTouch:e===Tr});const wn="AsyncFunction";var Sn=e=>!!e&&!!e.validate&&!!(Sr(e.validate)&&e.validate.constructor.name===wn||ur(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===wn)),kn=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const En=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=xr(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(En(o,t))break}else if(ur(o)&&En(o,t))break}}};function jn(e,t,r){const n=xr(e,r);if(n||gr(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=xr(t,n),s=xr(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(s&&s.type)return{name:n,error:s};if(s&&s.root&&s.root.type)return{name:`${n}.root`,error:s.root};a.pop()}return{name:r}}var An=(e,t,r)=>{const n=Yr(xr(e,r));return kr(n,"root",t[r]),kr(e,r,n),e};function Nn(e,t,r="validate"){if(Br(e)||Array.isArray(e)&&e.every(Br)||wr(e)&&!e)return{type:r,message:Br(e)?e:"",ref:t}}var Cn=e=>ur(e)&&!bn(e)?e:{value:e,message:""},_n=async(e,t,r,n,a,o)=>{const{ref:s,refs:i,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,b=xr(r,h);if(!v||t.has(h))return{};const y=i?i[0]:s,x=e=>{a&&y.reportValidity&&(y.setCustomValidity(wr(e)?"":e||""),y.reportValidity())},w={},S=an(s),k=ir(s),E=S||k,j=(g||tn(s))&&vr(s.value)&&vr(b)||rn(s)&&""===s.value||""===b||Array.isArray(b)&&!b.length,A=qr.bind(null,h,n,w),N=(e,t,r,n=Ir,a=Dr)=>{const o=e?t:r;w[h]={type:e?n:a,message:o,ref:s,...A(e?n:a,o)}};if(o?!Array.isArray(b)||!b.length:c&&(!E&&(j||lr(b))||wr(b)&&!b||k&&!pn(i).isValid||S&&!gn(i).isValid)){const{value:e,message:t}=Br(c)?{value:!!c,message:c}:Cn(c);if(e&&(w[h]={type:Mr,message:t,ref:y,...A(Mr,t)},!n))return x(t),w}if(!(j||lr(u)&&lr(f))){let e,t;const r=Cn(f),a=Cn(u);if(lr(b)||isNaN(b)){const n=s.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),i="time"==s.type,c="week"==s.type;Br(r.value)&&b&&(e=i?o(b)>o(r.value):c?b>r.value:n>new Date(r.value)),Br(a.value)&&b&&(t=i?o(b)<o(a.value):c?b<a.value:n<new Date(a.value))}else{const n=s.valueAsNumber||(b?+b:b);lr(r.value)||(e=n>r.value),lr(a.value)||(t=n<a.value)}if((e||t)&&(N(!!e,r.message,a.message,Pr,Or),!n))return x(w[h].message),w}if((l||d)&&!j&&(Br(b)||o&&Array.isArray(b))){const e=Cn(l),t=Cn(d),r=!lr(e.value)&&b.length>+e.value,a=!lr(t.value)&&b.length<+t.value;if((r||a)&&(N(r,e.message,t.message),!n))return x(w[h].message),w}if(p&&!j&&Br(b)){const{value:e,message:t}=Cn(p);if(bn(e)&&!b.match(e)&&(w[h]={type:Ur,message:t,ref:s,...A(Ur,t)},!n))return x(t),w}if(m)if(Sr(m)){const e=Nn(await m(b,r),y);if(e&&(w[h]={...e,...A(Fr,e.message)},!n))return x(e.message),w}else if(ur(m)){let e={};for(const t in m){if(!en(e)&&!n)break;const a=Nn(await m[t](b,r),y,t);a&&(e={...a,...A(t,a.message)},x(a.message),n&&(w[h]=e))}if(!en(e)&&(w[h]={ref:y,...e},!n))return w}return x(!0),w};const Tn={mode:_r,reValidateMode:Cr,shouldFocusError:!0};function Rn(e={}){let t,r={...Tn,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Sr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(ur(r.defaultValues)||ur(r.values))&&hr(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:hr(o),i={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:Xr(),state:Xr()},m=r.criteriaMode===Rr,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=en((await x()).errors),g()):e=await w(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?kr(n.validatingFields,e,t):sn(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!en(n.validatingFields)}))},v=(e,t,r,n)=>{const c=xr(a,e);if(c){const a=xr(s,e,vr(r)?xr(o,e):r);vr(a)||n&&n.defaultChecked||t?kr(s,e,t?a:vn(c._f)):E(e,a),i.mount&&!i.action&&h()}},b=(e,t,a,s,i)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||s){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=Kr(xr(o,e),t);l=!!xr(n.dirtyFields,e),r?sn(n.dirtyFields,e):kr(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=xr(n.touchedFields,e);t||(kr(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&i&&p.state.next(d)}return c?d:{}},y=(e,a,o,s)=>{const i=xr(n.errors,e),c=(u.isValid||f.isValid)&&wr(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{kr(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?kr(n.errors,e,o):sn(n.errors,e)),(o?!Kr(i,o):i)||!en(s)||c){const t={...s,...c&&wr(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},x=async e=>{g(e,!0);const t=await r.resolver(s,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=xr(t,r);e&&kr(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},w=async(t,a,o={valid:!0})=>{for(const i in t){const l=t[i];if(l){const{_f:t,...i}=l;if(t){const i=c.array.has(t.name),d=l._f&&Sn(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await _n(l,c.disabled,s,m,r.shouldUseNativeValidation&&!a,i);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(xr(f,t.name)?i?An(n.errors,f,t.name):kr(n.errors,t.name,f[t.name]):sn(n.errors,t.name))}!en(i)&&await w(i,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&kr(s,e,t),!Kr(T(),o)),k=(e,t,r)=>Gr(e,c,{...i.mount?s:vr(t)?o:Br(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=xr(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&kr(s,e,mn(t,r)),o=rn(r.ref)&&lr(t)?"":t,nn(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?ir(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):tn(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:hr(s)})))}(r.shouldDirty||r.shouldTouch)&&b(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},j=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],s=e+"."+n,i=xr(a,s);(c.array.has(e)||ur(o)||i&&!i._f)&&!cr(o)?j(s,o,r):E(s,o,r)}},A=(e,t,r={})=>{const l=xr(a,e),d=c.array.has(e),m=hr(t);kr(s,e,m),d?(p.array.next({name:e,values:hr(s)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:dn(o,s),isDirty:S(e,m)})):!l||l._f||lr(m)?E(e,m,r):j(e,m,r),kn(e,c)?p.state.next({...n,name:e,values:hr(s)}):p.state.next({name:i.mount?e:void 0,values:hr(s)})},N=async e=>{i.mount=!0;const o=e.target;let l=o.name,d=!0;const v=xr(a,l),S=e=>{d=Number.isNaN(e)||cr(e)&&isNaN(e.getTime())||Kr(e,xr(s,l,e))},k=xn(r.mode),E=xn(r.reValidateMode);if(v){let i,j;const A=o.type?vn(v._f):fr(e),N=e.type===Er||e.type===jr,C=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(v._f)&&!r.resolver&&!xr(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))(N,xr(n.touchedFields,l),n.isSubmitted,E,k),T=kn(l,c,N);kr(s,l,A),N?o&&o.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);const R=b(l,A,N),P=!en(R)||T;if(!N&&p.state.next({name:l,type:e.type,values:hr(s)}),C)return(u.isValid||f.isValid)&&("onBlur"===r.mode?N&&h():N||h()),P&&p.state.next({name:l,...T?{}:R});if(!N&&T&&p.state.next({...n}),r.resolver){const{errors:e}=await x([l]);if(g([l]),S(A),d){const t=jn(n.errors,a,l),r=jn(e,a,t.name||l);i=r.error,l=r.name,j=en(e)}}else g([l],!0),i=(await _n(v,c.disabled,s,m,r.shouldUseNativeValidation))[l],g([l]),S(A),d&&(i?j=!1:(u.isValid||f.isValid)&&(j=await w(a,!0)));d&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&_(v._f.deps),y(l,j,i,R))}},C=(e,t)=>{if(xr(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let o,s;const i=Yr(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(g(e),e)for(const r of e){const e=xr(t,r);e?kr(n.errors,r,e):sn(n.errors,r)}else n.errors=t;return t})(vr(e)?e:i);o=en(t),s=e?!i.some(e=>xr(t,e)):o}else e?(s=(await Promise.all(i.map(async e=>{const t=xr(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||n.isValid)&&h()):s=o=await w(a);return p.state.next({...!Br(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!s&&En(a,C,e?i:c.mount),s},T=(e,t)=>{let r={...i.mount?s:o};return t&&(r=Qr(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),vr(e)?r:Br(e)?xr(r,e):e.map(e=>xr(r,e))},R=(e,t)=>({invalid:!!xr((t||n).errors,e),isDirty:!!xr((t||n).dirtyFields,e),error:xr((t||n).errors,e),isValidating:!!xr(n.validatingFields,e),isTouched:!!xr((t||n).touchedFields,e)}),P=(e,t,r)=>{const o=(xr(a,e,{_f:{}})._f||{}).ref,s=xr(n.errors,e)||{},{ref:i,message:c,type:l,...d}=s;kr(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()},O=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!Yr(r).some(e=>e&&(i?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return en(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Rr))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...s},...n,...t,defaultValues:o})}}).unsubscribe,I=(e,t={})=>{for(const i of e?Yr(e):c.mount)c.mount.delete(i),c.array.delete(i),t.keepValue||(sn(a,i),sn(s,i)),!t.keepError&&sn(n.errors,i),!t.keepDirty&&sn(n.dirtyFields,i),!t.keepTouched&&sn(n.touchedFields,i),!t.keepIsValidating&&sn(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&sn(o,i);p.state.next({values:hr(s)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},D=({disabled:e,name:t})=>{(wr(e)&&i.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},U=(e,t={})=>{let n=xr(a,e);const s=wr(t.disabled)||wr(r.disabled);return kr(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?D({disabled:wr(t.disabled)?t.disabled:r.disabled,name:e}):v(e,!0,t.value),{...s?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:yn(t.min),max:yn(t.max),minLength:yn(t.minLength),maxLength:yn(t.maxLength),pattern:yn(t.pattern)}:{},name:e,onChange:N,onBlur:N,ref:s=>{if(s){U(e,t),n=xr(a,e);const r=vr(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=(e=>an(e)||ir(e))(r),c=n._f.refs||[];if(i?c.find(e=>e===r):r===n._f.ref)return;kr(a,e,{_f:{...n._f,...i?{refs:[...c.filter(on),r,...Array.isArray(xr(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=xr(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!pr(c.array,e)||!i.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&En(a,C,c.mount),F=(e,t)=>async o=>{let i;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=hr(s);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();g(),n.errors=e,l=hr(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)sn(l,e);if(sn(n.errors,"root"),en(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){i=e}}else t&&await t({...n.errors},o),M(),setTimeout(M);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:en(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},z=(e,t={})=>{const l=e?hr(e):o,d=hr(l),f=en(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(dn(o,s))]);for(const t of Array.from(e)){const e=xr(n.dirtyFields,t),r=xr(s,t),a=xr(m,t);e&&!vr(r)?kr(m,t,r):e||vr(a)||A(t,a)}}else{if(mr&&vr(e))for(const e of c.mount){const t=xr(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(rn(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)A(e,xr(m,e));else a={}}s=r.shouldUnregister?t.keepDefaultValues?hr(o):{}:hr(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:""},i.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!en(m),i.watch=!!r.shouldUnregister,i.keepIsValid=!!t.keepIsValid,i.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Kr(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&s?dn(o,s):n.dirtyFields:t.keepDefaultValues&&e?dn(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})},L=(e,t)=>z(Sr(e)?e(s):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:U,unregister:I,getFieldState:R,handleSubmit:F,setError:P,_subscribe:O,_runSchema:x,_updateIsValidating:g,_focusError:M,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(i.action=!0,m&&Array.isArray(xr(a,e))){const t=c(xr(a,e),l.argA,l.argB);d&&kr(a,e,t)}if(m&&Array.isArray(xr(n.errors,e))){const t=c(xr(n.errors,e),l.argA,l.argB);d&&kr(n.errors,e,t),((e,t)=>{!br(xr(e,t)).length&&sn(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(xr(n.touchedFields,e))){const t=c(xr(n.touchedFields,e),l.argA,l.argB);d&&kr(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=dn(o,s)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else kr(s,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>br(xr(i.mount?s:o,e,r.shouldUnregister?xr(o,e,[]):[])),_reset:z,_resetDefaultValues:()=>Sr(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=xr(a,e);t&&(t._f.refs?t._f.refs.every(e=>!on(e)):!on(t._f.ref))&&I(e)}c.unMount=new Set},_disableForm:e=>{wr(e)&&(p.state.next({disabled:e}),En(a,(t,r)=>{const n=xr(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 s},get _state(){return i},set _state(e){i=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=>(i.mount=!0,f={...f,...e.formState},O({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:F,watch:(e,t)=>Sr(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:A,getValues:T,reset:L,resetField:(e,t={})=>{xr(a,e)&&(vr(t.defaultValue)?A(e,hr(xr(o,e))):(A(e,t.defaultValue),kr(o,e,hr(t.defaultValue))),t.keepTouched||sn(n.touchedFields,e),t.keepDirty||(sn(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,hr(xr(o,e))):S()),t.keepError||(sn(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&Yr(e).forEach(e=>sn(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=xr(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Sr(e.select)&&e.select()})}},getFieldState:R};return{...V,formControl:V}}function Pn(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,o]=t.useState({isDirty:!1,isValidating:!1,isLoading:Sr(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:Sr(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!Sr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Rn(e);r.current={...n,formState:a}}const s=r.current.control;return s._options=e,Wr(()=>{const e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),t.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),t.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),t.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),t.useEffect(()=>{if(s._proxyFormState.isDirty){const e=s._getDirty();e!==a.isDirty&&s._subjects.state.next({isDirty:e})}},[s,a.isDirty]),t.useEffect(()=>{var t;e.values&&!Kr(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null===(t=s._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||s._setValid(),n.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),t.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),r.current.formState=Vr(a,s),r.current}const On=(e,t,r)=>{if(e&&"reportValidity"in e){const n=xr(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},In=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?On(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>On(t,r,e))}},Dn=(e,t)=>{t.shouldUseNativeValidation&&In(e,t);const r={};for(const n in e){const a=xr(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(Un(t.names||Object.keys(e),n)){const e=Object.assign({},xr(r,n));kr(e,"root",o),kr(r,n,e)}else kr(r,n,o)}return r},Un=(e,t)=>{const r=Mn(t);return e.some(e=>Mn(e).match(`^${r}\\.\\d+`))};function Mn(e){return e.replace(/\]|\[/g,"")}function Fn(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:s,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=s.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 s(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(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class zn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ln extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const $n={};function Vn(e){return $n}function Wn(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 Bn(e,t){return"bigint"==typeof t?t.toString():t}function Gn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hn(e){return null==e}function Kn(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Zn=Symbol("evaluating");function Jn(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Zn)return void 0===n&&(n=Zn,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function qn(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Yn(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Xn(e){return JSON.stringify(e)}const Qn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ea(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const ta=Gn(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ra(e){if(!1===ea(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!==ea(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function na(e){return ra(e)?{...e}:Array.isArray(e)?[...e]:e}const aa=new Set(["string","number","symbol"]);function oa(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 ia(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 ca(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 la(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function da(e){return"string"==typeof e?e:e?.message}function ua(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=da(e.inst?._zod.def?.error?.(e))??da(t?.error?.(e))??da(r.customError?.(e))??da(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function fa(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function pa(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const ma=(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,Bn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ha=Fn("$ZodError",ma),ga=Fn("$ZodError",ma,{Parent:Error});const va=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new zn;if(s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>ua(e,o,Vn())));throw Qn(t,a?.callee),t}return s.value},ba=va(ga),ya=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>ua(e,o,Vn())));throw Qn(t,a?.callee),t}return s.value},xa=ya(ga),wa=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 zn;return o.issues.length?{success:!1,error:new(e??ha)(o.issues.map(e=>ua(e,a,Vn())))}:{success:!0,data:o.value}},Sa=wa(ga),ka=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=>ua(e,a,Vn())))}:{success:!0,data:o.value}},Ea=ka(ga),ja=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return va(e)(t,r,a)},Aa=e=>(t,r,n)=>va(e)(t,r,n),Na=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ya(e)(t,r,a)},Ca=e=>async(t,r,n)=>ya(e)(t,r,n),_a=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wa(e)(t,r,a)},Ta=e=>(t,r,n)=>wa(e)(t,r,n),Ra=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ka(e)(t,r,a)},Pa=e=>async(t,r,n)=>ka(e)(t,r,n),Oa=/^[cC][^\s-]{8,}$/,Ia=/^[0-9a-z]+$/,Da=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ua=/^[0-9a-vA-V]{20}$/,Ma=/^[A-Za-z0-9]{27}$/,Fa=/^[a-zA-Z0-9_-]{21}$/,za=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,La=/^([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})$/,$a=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)$/,Va=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Wa=/^(?:(?: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])$/,Ba=/^(([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}|:))$/,Ga=/^((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])$/,Ha=/^(([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])$/,Ka=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Za=/^[A-Za-z0-9_-]*$/,Ja=/^\+[1-9]\d{6,14}$/,qa="(?:(?:\\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])))",Ya=new RegExp(`^${qa}$`);function Xa(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 Qa=/^[^A-Z]*$/,eo=/^[^a-z]*$/,to=Fn("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ro=Fn("$ZodCheckMaxLength",(e,t)=>{var r;to.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Hn(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=fa(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),no=Fn("$ZodCheckMinLength",(e,t)=>{var r;to.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Hn(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=fa(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ao=Fn("$ZodCheckLengthEquals",(e,t)=>{var r;to.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Hn(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=fa(n),s=a>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),oo=Fn("$ZodCheckStringFormat",(e,t)=>{var r,n;to.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=()=>{})}),so=Fn("$ZodCheckRegex",(e,t)=>{oo.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})}}),io=Fn("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Qa),oo.init(e,t)}),co=Fn("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=eo),oo.init(e,t)}),lo=Fn("$ZodCheckIncludes",(e,t)=>{to.init(e,t);const r=oa(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})}}),uo=Fn("$ZodCheckStartsWith",(e,t)=>{to.init(e,t);const r=new RegExp(`^${oa(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})}}),fo=Fn("$ZodCheckEndsWith",(e,t)=>{to.init(e,t);const r=new RegExp(`.*${oa(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})}}),po=Fn("$ZodCheckOverwrite",(e,t)=>{to.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class mo{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 ho={major:4,minor:3,patch:6},go=Fn("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ho;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=ca(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,s=o._zod.check(e);if(s instanceof Promise&&!1===r?.async)throw new zn;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(a||(a=ca(e,t)))});else{if(e.issues.length===t)continue;a||(a=ca(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(ca(r))return r.aborted=!0,r;const s=t(a,n,o);if(s instanceof Promise){if(!1===o.async)throw new zn;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,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 s=e._zod.parse(a,o);if(s instanceof Promise){if(!1===o.async)throw new zn;return s.then(e=>t(e,n,o))}return t(s,n,o)}}Jn(e,"~standard",()=>({validate:t=>{try{const r=Sa(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Ea(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),vo=Fn("$ZodString",(e,t)=>{var r;go.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}}),bo=Fn("$ZodStringFormat",(e,t)=>{oo.init(e,t),vo.init(e,t)}),yo=Fn("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=La),bo.init(e,t)}),xo=Fn("$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=$a(e))}else t.pattern??(t.pattern=$a());bo.init(e,t)}),wo=Fn("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Va),bo.init(e,t)}),So=Fn("$ZodURL",(e,t)=>{bo.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})}}}),ko=Fn("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),bo.init(e,t)}),Eo=Fn("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fa),bo.init(e,t)}),jo=Fn("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Oa),bo.init(e,t)}),Ao=Fn("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ia),bo.init(e,t)}),No=Fn("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Da),bo.init(e,t)}),Co=Fn("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ua),bo.init(e,t)}),_o=Fn("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ma),bo.init(e,t)}),To=Fn("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Xa({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(`^${qa}T(?:${n})$`)}(t)),bo.init(e,t)}),Ro=Fn("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ya),bo.init(e,t)}),Po=Fn("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Xa(t)}$`)),bo.init(e,t)}),Oo=Fn("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=za),bo.init(e,t)}),Io=Fn("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wa),bo.init(e,t),e._zod.bag.format="ipv4"}),Do=Fn("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ba),bo.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})}}}),Uo=Fn("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ga),bo.init(e,t)}),Mo=Fn("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ha),bo.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 Fo(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const zo=Fn("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ka),bo.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Fo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Lo=Fn("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Za),bo.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!Za.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Fo(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})}}),$o=Fn("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ja),bo.init(e,t)});const Vo=Fn("$ZodJWT",(e,t)=>{bo.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})}}),Wo=Fn("$ZodUnknown",(e,t)=>{go.init(e,t),e._zod.parse=e=>e}),Bo=Fn("$ZodNever",(e,t)=>{go.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Go(e,t,r){e.issues.length&&t.issues.push(...la(r,e.issues)),t.value[r]=e.value}const Ho=Fn("$ZodArray",(e,t)=>{go.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 s=a[e],i=t.element._zod.run({value:s,issues:[]},n);i instanceof Promise?o.push(i.then(t=>Go(t,r,e))):Go(i,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Ko(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...la(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Zo(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 Jo(e,t,r,n,a,o){const s=[],i=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(i.has(a))continue;if("never"===l){s.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>Ko(e,r,a,t,d))):Ko(o,r,a,t,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const qo=Fn("$ZodObject",(e,t)=>{go.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=Gn(()=>Zo(t));Jn(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=ea,o=t.catchall;let s;e._zod.parse=(t,r)=>{s??(s=n.value);const i=t.value;if(!a(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],l=s.shape;for(const e of s.keys){const n=l[e],a="optional"===n._zod.optout,o=n._zod.run({value:i[e],issues:[]},r);o instanceof Promise?c.push(o.then(r=>Ko(r,t,e,i,a))):Ko(o,t,e,i,a)}return o?Jo(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Yo=Fn("$ZodObjectJIT",(e,t)=>{qo.init(e,t);const r=e._zod.parse,n=Gn(()=>Zo(t));let a;const o=ea,s=!$n.jitless,i=s&&ta.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?s&&i&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new mo(["shape","payload","ctx"]),r=n.value,a=e=>{const t=Xn(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const e of r.keys)o[e]="key_"+s++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],s=Xn(n),i=e[n],c="optional"===i?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${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 ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=a(d,u),c?Jo([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function Xo(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=>!ca(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=>ua(e,n,Vn())))}),t)}const Qo=Fn("$ZodUnion",(e,t)=>{go.init(e,t),Jn(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Jn(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Jn(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Jn(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=>Kn(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 s=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)i.push(t),s=!0;else{if(0===t.issues.length)return t;i.push(t)}}return s?Promise.all(i).then(t=>Xo(t,a,e,o)):Xo(i,a,e,o)}}),es=Fn("$ZodIntersection",(e,t)=>{go.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])=>rs(e,t,r)):rs(e,a,o)}});function ts(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(ra(e)&&ra(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=ts(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=ts(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 rs(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}),ca(e))return e;const s=ts(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const ns=Fn("$ZodEnum",(e,t)=>{go.init(e,t);const r=Wn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>aa.has(typeof e)).map(e=>"string"==typeof e?oa(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}}),as=Fn("$ZodTransform",(e,t)=>{go.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Ln(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 zn;return r.value=a,r}});function os(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const ss=Fn("$ZodOptional",(e,t)=>{go.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Jn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Jn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Kn(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=>os(t,e.value)):os(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),is=Fn("$ZodExactOptional",(e,t)=>{ss.init(e,t),Jn(e._zod,"values",()=>t.innerType._zod.values),Jn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),cs=Fn("$ZodNullable",(e,t)=>{go.init(e,t),Jn(e._zod,"optin",()=>t.innerType._zod.optin),Jn(e._zod,"optout",()=>t.innerType._zod.optout),Jn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Kn(e.source)}|null)$`):void 0}),Jn(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)}),ls=Fn("$ZodDefault",(e,t)=>{go.init(e,t),e._zod.optin="optional",Jn(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=>ds(e,t)):ds(n,t)}});function ds(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const us=Fn("$ZodPrefault",(e,t)=>{go.init(e,t),e._zod.optin="optional",Jn(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))}),fs=Fn("$ZodNonOptional",(e,t)=>{go.init(e,t),Jn(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=>ps(t,e)):ps(a,e)}});function ps(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 ms=Fn("$ZodCatch",(e,t)=>{go.init(e,t),Jn(e._zod,"optin",()=>t.innerType._zod.optin),Jn(e._zod,"optout",()=>t.innerType._zod.optout),Jn(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=>ua(e,r,Vn()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>ua(e,r,Vn()))},input:e.value}),e.issues=[]),e)}}),hs=Fn("$ZodPipe",(e,t)=>{go.init(e,t),Jn(e._zod,"values",()=>t.in._zod.values),Jn(e._zod,"optin",()=>t.in._zod.optin),Jn(e._zod,"optout",()=>t.out._zod.optout),Jn(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=>gs(e,t.in,r)):gs(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>gs(e,t.out,r)):gs(n,t.out,r)}});function gs(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const vs=Fn("$ZodReadonly",(e,t)=>{go.init(e,t),Jn(e._zod,"propValues",()=>t.innerType._zod.propValues),Jn(e._zod,"values",()=>t.innerType._zod.values),Jn(e._zod,"optin",()=>t.innerType?._zod?.optin),Jn(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(bs):bs(n)}});function bs(e){return e.value=Object.freeze(e.value),e}const ys=Fn("$ZodCustom",(e,t)=>{to.init(e,t),go.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=>xs(t,r,n,e));xs(a,r,n,e)}});function xs(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(pa(e))}}var ws;class Ss{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)}}(ws=globalThis).__zod_globalRegistry??(ws.__zod_globalRegistry=new Ss);const ks=globalThis.__zod_globalRegistry;function Es(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ia(t)})}function js(e,t){return new ro({check:"max_length",...ia(t),maximum:e})}function As(e,t){return new no({check:"min_length",...ia(t),minimum:e})}function Ns(e,t){return new ao({check:"length_equals",...ia(t),length:e})}function Cs(e){return new po({check:"overwrite",tx:e})}function _s(e){const t=function(e,t){const r=new to({check:"custom",...ia(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(pa(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(pa(n))}},e(r.value,r)));return t}function Ts(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??ks,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 Rs(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 s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const i=e._zod.toJSONSchema?.();if(i)s.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,n);else{const r=s.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&&(s.ref||(s.ref=o),Rs(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&Is(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault;return t.seen.get(e).schema}function Ps(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 s=n.schema;for(const e in s)delete s[e];s.$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 Os(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},s=r.ref;if(r.ref=null,s){n(s);const r=e.seen.get(s),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,i):(a.allOf=a.allOf??[],a.allOf.push(i)),Object.assign(a,o);if(t._zod.parent===s)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(i.$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 i=t._zod.parent;if(i&&i!==s){n(i);const t=e.seen.get(i);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:Ds(t,"input",e.processors),output:Ds(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Is(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 Is(n.element,r);if("set"===n.type)return Is(n.valueType,r);if("lazy"===n.type)return Is(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 Is(n.innerType,r);if("intersection"===n.type)return Is(n.left,r)||Is(n.right,r);if("record"===n.type||"map"===n.type)return Is(n.keyType,r)||Is(n.valueType,r);if("pipe"===n.type)return Is(n.in,r)||Is(n.out,r);if("object"===n.type){for(const e in n.shape)if(Is(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Is(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Is(e,r))return!0;return!(!n.rest||!Is(n.rest,r))}return!1}const Ds=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},s=Ts({...a??{},target:o,io:t,processors:r});return Rs(e,s),Ps(s,e),Os(s,e)},Us={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ms=(e,t,r,n)=>{const a=e._zod.def;Rs(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Fs(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function zs(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[s]={message:i.message,type:i.code}}else r[s]={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[s].types,l=c&&c[n.code];r[s]=qr(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Ls(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,s=n.path.join(".");if(!r[s])if("invalid_union"===n.code&&n.errors.length>0){var i=n.errors[0][0];r[s]={message:i.message,type:i.code}}else r[s]={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[s].types,l=c&&c[n.code];r[s]=qr(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function $s(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(Fs(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&In({},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:Dn(zs(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(Fs(function(){return Promise.resolve(("sync"===r.mode?ba:xa)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&In({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof ha}(e))return{values:{},errors:Dn(Ls(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 Vs(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ws(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Vs(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():Vs(e[t],null)}}}}function Bs(...e){return a.useCallback(Ws(...e),e)}var Gs=Symbol.for("react.lazy"),Hs=a[" use ".trim().toString()];function Ks(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Gs&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function Zs(t){const r=qs(t),n=a.forwardRef((t,n)=>{let{children:o,...s}=t;Ks(o)&&"function"==typeof Hs&&(o=Hs(o._payload));const i=a.Children.toArray(o),c=i.find(Xs);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}var Js=Zs("Slot");function qs(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(Ks(r)&&"function"==typeof Hs&&(r=Hs(r._payload)),a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ws(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ys=Symbol("radix.slottable");function Xs(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Ys}const Qs=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,ei=i,ti=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return ei(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,s=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 s=Qs(t)||Qs(n);return a[e][s]}),i=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,...i}[t]):{...o,...i}[t]===r})?[...e,r,n]:e},[]);return ei(e,s,c,null==r?void 0:r.class,null==r?void 0:r.className)},ri=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ni=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)},ai=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),oi=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 si={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 ii=t.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:s,iconNode:i,...c},l)=>t.createElement("svg",{ref:l,...si,width:r,height:r,stroke:e,strokeWidth:a?24*Number(n)/Number(r):n,className:ai("lucide",o),...!s&&!oi(c)&&{"aria-hidden":"true"},...c},[...i.map(([e,r])=>t.createElement(e,r)),...Array.isArray(s)?s:[s]])),ci=(e,r)=>{const n=t.forwardRef(({className:n,...a},o)=>t.createElement(ii,{ref:o,iconNode:r,className:ai(`lucide-${ri(ni(e))}`,`lucide-${e}`,n),...a}));return n.displayName=ni(e),n},li=ci("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"}]]),di=ci("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),ui=ci("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),fi=ci("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"}]]),pi=ci("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"}]]),mi=ci("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"}]]),hi=ci("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"}]]),gi=ci("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),vi=ci("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),bi=ci("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"}]]),yi=ci("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),xi=ci("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"}]]),wi=ci("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"}]]),Si=ci("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),ki=ci("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"}]]),Ei=ci("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"}]]),ji=ci("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"}]]),Ai=ci("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"}]]),Ni=ci("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"}]]),Ci=ti("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"}}),_i=a.forwardRef(({className:t,variant:r,progress:n,size:o,startIcon:s,endIcon:i,asChild:c=!1,...l},d)=>{const u=c?Js:"button",f=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(o);return e.jsxs(u,{disabled:n||l.disabled,className:ke(Ci({variant:r,size:o,withIcon:null!=n||null!=s||null!=i,className:t})),ref:d,...l,children:[n&&e.jsx(gi,{size:f,className:"animate-spin"}),s&&a.cloneElement(s,{size:f}),l.children,i&&a.cloneElement(i,{size:f})]})});
|
|
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 _o(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...xr(t)})}(Co,e)}const To=Yt("ZodISODate",(e,t)=>{Bn.init(e,t),Qo.init(e,t)});function Ro(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...xr(t)})}(To,e)}const Po=Yt("ZodISOTime",(e,t)=>{Gn.init(e,t),Qo.init(e,t)});function Oo(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...xr(t)})}(Po,e)}const Io=Yt("ZodISODuration",(e,t)=>{Hn.init(e,t),Qo.init(e,t)});function Do(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...xr(t)})}(Io,e)}const Uo=Yt("ZodError",(e,t)=>{Cr.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,nr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,nr,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Mo=Tr(Uo),Fo=Pr(Uo),zo=Ir(Uo),Lo=Ur(Uo),$o=Fr(Uo),Vo=zr(Uo),Wo=Lr(Uo),Bo=$r(Uo),Go=Vr(Uo),Ho=Wr(Uo),Ko=Br(Uo),Zo=Gr(Uo),Jo=Yt("ZodType",(e,t)=>(_n.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Za(e,"input"),output:Za(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Wa({...r,processors:t});return Ba(e,n),Ga(n,e),Ha(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(dr(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)=>yr(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Mo(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>zo(e,t,r),e.parseAsync=async(t,r)=>Fo(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Lo(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>$o(e,t,r),e.decode=(t,r)=>Vo(e,t,r),e.encodeAsync=async(t,r)=>Wo(e,t,r),e.decodeAsync=async(t,r)=>Bo(e,t,r),e.safeEncode=(t,r)=>Go(e,t,r),e.safeDecode=(t,r)=>Ho(e,t,r),e.safeEncodeAsync=async(t,r)=>Ko(e,t,r),e.safeDecodeAsync=async(t,r)=>Zo(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,...xr(r)})}(Vs,e,t)}(t,r)),e.superRefine=t=>e.check(Va(t)),e.overwrite=t=>e.check($a(t)),e.optional=()=>Rs(e),e.exactOptional=()=>new Ps({type:"optional",innerType:e}),e.nullable=()=>Is(e),e.nullish=()=>Rs(Is(e)),e.nonoptional=t=>function(e,t){return new Ms({type:"nonoptional",innerType:e,...xr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...xr(r)})}(ks,e,t);var t},e.or=t=>function(e,t){return new As({type:"union",options:e,...xr(t)})}([e,t]),e.and=t=>new Ns({type:"intersection",left:e,right:t}),e.transform=t=>Ls(e,new _s({type:"transform",transform:t})),e.default=t=>{return r=t,new Ds({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():gr(r)}});var r},e.prefault=t=>{return r=t,new Us({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():gr(r)}});var r},e.catch=t=>{return new Fs({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Ls(e,t),e.readonly=()=>new $s({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Ua.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Ua.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Ua.get(e);const r=e.clone();return Ua.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),qo=Yt("_ZodString",(e,t)=>{Tn.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:s,patterns:i,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),s&&(n.format=Ja[s]??s,""===n.format&&delete n.format,"time"===s&&delete n.format),c&&(n.contentEncoding=c),i&&i.size>0){const e=[...i];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 xn({check:"string_format",format:"regex",...xr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new kn({check:"string_format",format:"includes",...xr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new jn({check:"string_format",format:"starts_with",...xr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new En({check:"string_format",format:"ends_with",...xr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(za(...t)),e.max=(...t)=>e.check(Fa(...t)),e.length=(...t)=>e.check(La(...t)),e.nonempty=(...t)=>e.check(za(1,...t)),e.lowercase=t=>e.check(function(e){return new wn({check:"string_format",format:"lowercase",...xr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Sn({check:"string_format",format:"uppercase",...xr(e)})}(t)),e.trim=()=>e.check($a(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return $a(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check($a(e=>e.toLowerCase())),e.toUpperCase=()=>e.check($a(e=>e.toUpperCase())),e.slugify=()=>e.check($a(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Yo=Yt("ZodString",(e,t)=>{Tn.init(e,t),qo.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...xr(t)})}(es,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...xr(t)})}(ns,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...xr(t)})}(bs,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...xr(t)})}(as,t)),e.guid=t=>e.check(Ma(ts,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...xr(t)})}(rs,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...xr(t)})}(rs,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...xr(t)})}(rs,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...xr(t)})}(rs,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...xr(t)})}(os,t)),e.guid=t=>e.check(Ma(ts,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...xr(t)})}(ss,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...xr(t)})}(is,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...xr(t)})}(cs,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...xr(t)})}(hs,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...xr(t)})}(gs,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...xr(t)})}(ls,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...xr(t)})}(ds,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...xr(t)})}(us,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...xr(t)})}(fs,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...xr(t)})}(ps,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...xr(t)})}(ms,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...xr(t)})}(vs,t)),e.datetime=t=>e.check(_o(t)),e.date=t=>e.check(Ro(t)),e.time=t=>e.check(Oo(t)),e.duration=t=>e.check(Do(t))});function Xo(e){return function(e,t){return new e({type:"string",...xr(t)})}(Yo,e)}const Qo=Yt("ZodStringFormat",(e,t)=>{Rn.init(e,t),qo.init(e,t)}),es=Yt("ZodEmail",(e,t)=>{In.init(e,t),Qo.init(e,t)}),ts=Yt("ZodGUID",(e,t)=>{Pn.init(e,t),Qo.init(e,t)}),rs=Yt("ZodUUID",(e,t)=>{On.init(e,t),Qo.init(e,t)}),ns=Yt("ZodURL",(e,t)=>{Dn.init(e,t),Qo.init(e,t)}),as=Yt("ZodEmoji",(e,t)=>{Un.init(e,t),Qo.init(e,t)}),os=Yt("ZodNanoID",(e,t)=>{Mn.init(e,t),Qo.init(e,t)}),ss=Yt("ZodCUID",(e,t)=>{Fn.init(e,t),Qo.init(e,t)}),is=Yt("ZodCUID2",(e,t)=>{zn.init(e,t),Qo.init(e,t)}),cs=Yt("ZodULID",(e,t)=>{Ln.init(e,t),Qo.init(e,t)}),ls=Yt("ZodXID",(e,t)=>{$n.init(e,t),Qo.init(e,t)}),ds=Yt("ZodKSUID",(e,t)=>{Vn.init(e,t),Qo.init(e,t)}),us=Yt("ZodIPv4",(e,t)=>{Kn.init(e,t),Qo.init(e,t)}),fs=Yt("ZodIPv6",(e,t)=>{Zn.init(e,t),Qo.init(e,t)}),ps=Yt("ZodCIDRv4",(e,t)=>{Jn.init(e,t),Qo.init(e,t)}),ms=Yt("ZodCIDRv6",(e,t)=>{qn.init(e,t),Qo.init(e,t)}),hs=Yt("ZodBase64",(e,t)=>{Xn.init(e,t),Qo.init(e,t)}),gs=Yt("ZodBase64URL",(e,t)=>{Qn.init(e,t),Qo.init(e,t)}),vs=Yt("ZodE164",(e,t)=>{ea.init(e,t),Qo.init(e,t)}),bs=Yt("ZodJWT",(e,t)=>{ta.init(e,t),Qo.init(e,t)}),ys=Yt("ZodUnknown",(e,t)=>{ra.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function xs(){return new ys({type:"unknown"})}const ws=Yt("ZodNever",(e,t)=>{na.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function Ss(e){return function(e,t){return new e({type:"never",...xr(t)})}(ws,e)}const ks=Yt("ZodArray",(e,t)=>{oa.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:s,maximum:i}=e._zod.bag;"number"==typeof s&&(a.minItems=s),"number"==typeof i&&(a.maxItems=i),a.type="array",a.items=Ba(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(za(t,r)),e.nonempty=t=>e.check(za(1,t)),e.max=(t,r)=>e.check(Fa(t,r)),e.length=(t,r)=>e.check(La(t,r)),e.unwrap=()=>e.element});const js=Yt("ZodObject",(e,t)=>{da.init(e,t),Jo.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 s=o.shape;for(const e in s)a.properties[e]=Ba(s[e],t,{...n,path:[...n.path,"properties",e]});const i=new Set(Object.keys(s)),c=new Set([...i].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=Ba(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),cr(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Cs({type:"enum",entries:r,...xr(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:xs()}),e.loose=()=>e.clone({...e._zod.def,catchall:xs()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ss()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!hr(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=dr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return lr(this,"shape",r),r}});return yr(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!hr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=dr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return lr(this,"shape",r),r}});return yr(e,r)}(e,t),e.merge=t=>function(e,t){const r=dr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return lr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return yr(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 yr(e,dr(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 lr(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=dr(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 lr(this,"shape",n),n},checks:[]});return yr(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=dr(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 lr(this,"shape",a),a},checks:[]});return yr(t,a)}(Ts,e,t[0]),e.required=(...t)=>function(e,t,r){const n=dr(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 lr(this,"shape",a),a}});return yr(t,n)}(Ms,e,t[0])});function Es(e,t){const r={type:"object",shape:e??{},...xr(t)};return new js(r)}const As=Yt("ZodUnion",(e,t)=>{fa.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,s=a.options.map((e,r)=>Ba(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=s:r.anyOf=s})(e,t,r,n),e.options=t.options});const Ns=Yt("ZodIntersection",(e,t)=>{pa.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ba(a.left,t,{...n,path:[...n.path,"allOf",0]}),s=Ba(a.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,c=[...i(o)?o.allOf:[o],...i(s)?s.allOf:[s]];r.allOf=c})(e,t,r,n)});const Cs=Yt("ZodEnum",(e,t)=>{ga.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=rr(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 Cs({...t,checks:[],...xr(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 Cs({...t,checks:[],...xr(n),entries:a})}});const _s=Yt("ZodTransform",(e,t)=>{va.init(e,t),Jo.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 Qt(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Ar(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(Ar(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Ts=Yt("ZodOptional",(e,t)=>{ya.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>qa(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Rs(e){return new Ts({type:"optional",innerType:e})}const Ps=Yt("ZodExactOptional",(e,t)=>{xa.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>qa(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Os=Yt("ZodNullable",(e,t)=>{wa.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ba(a.innerType,t,n),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function Is(e){return new Os({type:"nullable",innerType:e})}const Ds=Yt("ZodDefault",(e,t)=>{Sa.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ba(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 Us=Yt("ZodPrefault",(e,t)=>{ja.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ba(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 Ms=Yt("ZodNonOptional",(e,t)=>{Ea.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ba(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Fs=Yt("ZodCatch",(e,t)=>{Na.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;Ba(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 zs=Yt("ZodPipe",(e,t)=>{Ca.init(e,t),Jo.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;Ba(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function Ls(e,t){return new zs({type:"pipe",in:e,out:t})}const $s=Yt("ZodReadonly",(e,t)=>{Ta.init(e,t),Jo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ba(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 Vs=Yt("ZodCustom",(e,t)=>{Pa.init(e,t),Jo.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 Ws(...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 n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}function Bs(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var Gs=globalThis?.document?a.useLayoutEffect:()=>{};function Hs(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ks(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Hs(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():Hs(e[t],null)}}}}function Zs(...e){return a.useCallback(Ks(...e),e)}var Js=Symbol.for("react.lazy"),qs=a[" use ".trim().toString()];function Ys(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Js&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function Xs(t){const r=ei(t),n=a.forwardRef((t,n)=>{let{children:o,...s}=t;Ys(o)&&"function"==typeof qs&&(o=qs(o._payload));const i=a.Children.toArray(o),c=i.find(ri);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}var Qs=Xs("Slot");function ei(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(Ys(r)&&"function"==typeof qs&&(r=qs(r._payload)),a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ks(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ti=Symbol("radix.slottable");function ri(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ti}var ni,ai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Xs(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),oi={exports:{}},si={};function ii(){if(ni)return si;ni=1;var e=t;var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,a=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(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 r=t(),c=n({inst:{value:r,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=r,l.getSnapshot=t,i(l)&&d({inst:l})},[e,r,t]),a(function(){return i(l)&&d({inst:l}),e(function(){i(l)&&d({inst:l})})},[e]),s(r),r};return si.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,si}var ci,li,di={};
|
|
20
|
+
*/_i.displayName="Button";var Ti=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Zs(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Ri=a.forwardRef((t,r)=>e.jsx(Ti.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Ri.displayName="Label";var Pi=Ri;const Oi=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ii=a.forwardRef(({className:t,...r},n)=>e.jsx(Pi,{ref:n,className:ke(Oi(),t),...r}));Ii.displayName=Pi.displayName;const Di=$r,Ui=a.createContext({}),Mi=({...t})=>e.jsx(Ui.Provider,{value:{name:t.name},children:e.jsx(Jr,{...t})}),Fi=()=>{const e=a.useContext(Ui),t=a.useContext(zi),{getFieldState:r,formState:n}=Lr(),o=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},zi=a.createContext({}),Li=a.forwardRef(({className:t,...r},n)=>{const o=a.useId();return e.jsx(zi.Provider,{value:{id:o},children:e.jsx("div",{ref:n,className:ke("space-y-2",t),...r})})});Li.displayName="FormItem";const $i=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:o}=Fi();return e.jsx(Ii,{ref:n,className:ke(a&&"text-destructive",t),htmlFor:o,...r})});$i.displayName="FormLabel";const Vi=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:s}=Fi();return e.jsx(Js,{ref:r,id:a,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...t})});Vi.displayName="FormControl";const Wi=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=Fi();return e.jsx("p",{ref:n,id:a,className:ke("text-sm text-muted-foreground",t),...r})});Wi.displayName="FormDescription";const Bi=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:o,formMessageId:s}=Fi(),i=o?String(o?.message):r;return i?e.jsx("p",{ref:a,id:s,className:ke("text-sm font-medium text-destructive",t),...n,children:i}):null});Bi.displayName="FormMessage";const Gi=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:ke("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",t),ref:a,...n}));function Hi({className:t,...r}){return e.jsx("div",{className:ke("animate-pulse rounded-md bg-primary/10",t),...r})}Gi.displayName="Input";let Ki=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(await _e(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),s=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(!s.ok)throw new Error(await _e(s,"Failed to submit beta user request"));return s.json()}};const Zi=Fn("ZodISODateTime",(e,t)=>{To.init(e,t),yc.init(e,t)});function Ji(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ia(t)})}(Zi,e)}const qi=Fn("ZodISODate",(e,t)=>{Ro.init(e,t),yc.init(e,t)});function Yi(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...ia(t)})}(qi,e)}const Xi=Fn("ZodISOTime",(e,t)=>{Po.init(e,t),yc.init(e,t)});function Qi(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ia(t)})}(Xi,e)}const ec=Fn("ZodISODuration",(e,t)=>{Oo.init(e,t),yc.init(e,t)});function tc(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...ia(t)})}(ec,e)}const rc=Fn("ZodError",(e,t)=>{ha.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,Bn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Bn,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),nc=va(rc),ac=ya(rc),oc=wa(rc),sc=ka(rc),ic=ja(rc),cc=Aa(rc),lc=Na(rc),dc=Ca(rc),uc=_a(rc),fc=Ta(rc),pc=Ra(rc),mc=Pa(rc),hc=Fn("ZodType",(e,t)=>(go.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ds(e,"input"),output:Ds(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Ts({...r,processors:t});return Rs(e,n),Ps(n,e),Os(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Yn(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)=>nc(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>oc(e,t,r),e.parseAsync=async(t,r)=>ac(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>sc(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>ic(e,t,r),e.decode=(t,r)=>cc(e,t,r),e.encodeAsync=async(t,r)=>lc(e,t,r),e.decodeAsync=async(t,r)=>dc(e,t,r),e.safeEncode=(t,r)=>uc(e,t,r),e.safeDecode=(t,r)=>fc(e,t,r),e.safeEncodeAsync=async(t,r)=>pc(e,t,r),e.safeDecodeAsync=async(t,r)=>mc(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,...ia(r)})}(cl,e,t)}(t,r)),e.superRefine=t=>e.check(_s(t)),e.overwrite=t=>e.check(Cs(t)),e.optional=()=>Yc(e),e.exactOptional=()=>new Xc({type:"optional",innerType:e}),e.nullable=()=>el(e),e.nullish=()=>Yc(el(e)),e.nonoptional=t=>function(e,t){return new nl({type:"nonoptional",innerType:e,...ia(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...ia(r)})}(Wc,e,t);var t},e.or=t=>function(e,t){return new Hc({type:"union",options:e,...ia(t)})}([e,t]),e.and=t=>new Kc({type:"intersection",left:e,right:t}),e.transform=t=>sl(e,new Jc({type:"transform",transform:t})),e.default=t=>{return r=t,new tl({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():na(r)}});var r},e.prefault=t=>{return r=t,new rl({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():na(r)}});var r},e.catch=t=>{return new al({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>sl(e,t),e.readonly=()=>new il({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return ks.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>ks.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return ks.get(e);const r=e.clone();return ks.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),gc=Fn("_ZodString",(e,t)=>{vo.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:s,patterns:i,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),s&&(n.format=Us[s]??s,""===n.format&&delete n.format,"time"===s&&delete n.format),c&&(n.contentEncoding=c),i&&i.size>0){const e=[...i];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 so({check:"string_format",format:"regex",...ia(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new lo({check:"string_format",format:"includes",...ia(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new uo({check:"string_format",format:"starts_with",...ia(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new fo({check:"string_format",format:"ends_with",...ia(t),suffix:e})}(...t)),e.min=(...t)=>e.check(As(...t)),e.max=(...t)=>e.check(js(...t)),e.length=(...t)=>e.check(Ns(...t)),e.nonempty=(...t)=>e.check(As(1,...t)),e.lowercase=t=>e.check(function(e){return new io({check:"string_format",format:"lowercase",...ia(e)})}(t)),e.uppercase=t=>e.check(function(e){return new co({check:"string_format",format:"uppercase",...ia(e)})}(t)),e.trim=()=>e.check(Cs(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Cs(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Cs(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Cs(e=>e.toUpperCase())),e.slugify=()=>e.check(Cs(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),vc=Fn("ZodString",(e,t)=>{vo.init(e,t),gc.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ia(t)})}(xc,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ia(t)})}(kc,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ia(t)})}(Fc,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ia(t)})}(Ec,t)),e.guid=t=>e.check(Es(wc,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ia(t)})}(Sc,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ia(t)})}(Sc,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ia(t)})}(Sc,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ia(t)})}(Sc,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ia(t)})}(jc,t)),e.guid=t=>e.check(Es(wc,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ia(t)})}(Ac,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ia(t)})}(Nc,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ia(t)})}(Cc,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ia(t)})}(Dc,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ia(t)})}(Uc,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ia(t)})}(_c,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ia(t)})}(Tc,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ia(t)})}(Rc,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ia(t)})}(Pc,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ia(t)})}(Oc,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ia(t)})}(Ic,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ia(t)})}(Mc,t)),e.datetime=t=>e.check(Ji(t)),e.date=t=>e.check(Yi(t)),e.time=t=>e.check(Qi(t)),e.duration=t=>e.check(tc(t))});function bc(e){return function(e,t){return new e({type:"string",...ia(t)})}(vc,e)}const yc=Fn("ZodStringFormat",(e,t)=>{bo.init(e,t),gc.init(e,t)}),xc=Fn("ZodEmail",(e,t)=>{wo.init(e,t),yc.init(e,t)}),wc=Fn("ZodGUID",(e,t)=>{yo.init(e,t),yc.init(e,t)}),Sc=Fn("ZodUUID",(e,t)=>{xo.init(e,t),yc.init(e,t)}),kc=Fn("ZodURL",(e,t)=>{So.init(e,t),yc.init(e,t)}),Ec=Fn("ZodEmoji",(e,t)=>{ko.init(e,t),yc.init(e,t)}),jc=Fn("ZodNanoID",(e,t)=>{Eo.init(e,t),yc.init(e,t)}),Ac=Fn("ZodCUID",(e,t)=>{jo.init(e,t),yc.init(e,t)}),Nc=Fn("ZodCUID2",(e,t)=>{Ao.init(e,t),yc.init(e,t)}),Cc=Fn("ZodULID",(e,t)=>{No.init(e,t),yc.init(e,t)}),_c=Fn("ZodXID",(e,t)=>{Co.init(e,t),yc.init(e,t)}),Tc=Fn("ZodKSUID",(e,t)=>{_o.init(e,t),yc.init(e,t)}),Rc=Fn("ZodIPv4",(e,t)=>{Io.init(e,t),yc.init(e,t)}),Pc=Fn("ZodIPv6",(e,t)=>{Do.init(e,t),yc.init(e,t)}),Oc=Fn("ZodCIDRv4",(e,t)=>{Uo.init(e,t),yc.init(e,t)}),Ic=Fn("ZodCIDRv6",(e,t)=>{Mo.init(e,t),yc.init(e,t)}),Dc=Fn("ZodBase64",(e,t)=>{zo.init(e,t),yc.init(e,t)}),Uc=Fn("ZodBase64URL",(e,t)=>{Lo.init(e,t),yc.init(e,t)}),Mc=Fn("ZodE164",(e,t)=>{$o.init(e,t),yc.init(e,t)}),Fc=Fn("ZodJWT",(e,t)=>{Vo.init(e,t),yc.init(e,t)}),zc=Fn("ZodUnknown",(e,t)=>{Wo.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function Lc(){return new zc({type:"unknown"})}const $c=Fn("ZodNever",(e,t)=>{Bo.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function Vc(e){return function(e,t){return new e({type:"never",...ia(t)})}($c,e)}const Wc=Fn("ZodArray",(e,t)=>{Ho.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:s,maximum:i}=e._zod.bag;"number"==typeof s&&(a.minItems=s),"number"==typeof i&&(a.maxItems=i),a.type="array",a.items=Rs(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(As(t,r)),e.nonempty=t=>e.check(As(1,t)),e.max=(t,r)=>e.check(js(t,r)),e.length=(t,r)=>e.check(Ns(t,r)),e.unwrap=()=>e.element});const Bc=Fn("ZodObject",(e,t)=>{Yo.init(e,t),hc.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 s=o.shape;for(const e in s)a.properties[e]=Rs(s[e],t,{...n,path:[...n.path,"properties",e]});const i=new Set(Object.keys(s)),c=new Set([...i].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=Rs(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),Jn(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Zc({type:"enum",entries:r,...ia(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:Lc()}),e.loose=()=>e.clone({...e._zod.def,catchall:Lc()}),e.strict=()=>e.clone({...e._zod.def,catchall:Vc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ra(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=Yn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return qn(this,"shape",r),r}});return sa(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!ra(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Yn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return qn(this,"shape",r),r}});return sa(e,r)}(e,t),e.merge=t=>function(e,t){const r=Yn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return qn(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,Yn(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 qn(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=Yn(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 qn(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=Yn(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 qn(this,"shape",a),a},checks:[]});return sa(t,a)}(qc,e,t[0]),e.required=(...t)=>function(e,t,r){const n=Yn(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 qn(this,"shape",a),a}});return sa(t,n)}(nl,e,t[0])});function Gc(e,t){const r={type:"object",shape:e??{},...ia(t)};return new Bc(r)}const Hc=Fn("ZodUnion",(e,t)=>{Qo.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,s=a.options.map((e,r)=>Rs(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=s:r.anyOf=s})(e,t,r,n),e.options=t.options});const Kc=Fn("ZodIntersection",(e,t)=>{es.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Rs(a.left,t,{...n,path:[...n.path,"allOf",0]}),s=Rs(a.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,c=[...i(o)?o.allOf:[o],...i(s)?s.allOf:[s]];r.allOf=c})(e,t,r,n)});const Zc=Fn("ZodEnum",(e,t)=>{ns.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=Wn(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 Zc({...t,checks:[],...ia(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 Zc({...t,checks:[],...ia(n),entries:a})}});const Jc=Fn("ZodTransform",(e,t)=>{as.init(e,t),hc.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 Ln(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(pa(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(pa(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const qc=Fn("ZodOptional",(e,t)=>{ss.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Ms(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new qc({type:"optional",innerType:e})}const Xc=Fn("ZodExactOptional",(e,t)=>{is.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Ms(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Qc=Fn("ZodNullable",(e,t)=>{cs.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Rs(a.innerType,t,n),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function el(e){return new Qc({type:"nullable",innerType:e})}const tl=Fn("ZodDefault",(e,t)=>{ls.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Rs(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 rl=Fn("ZodPrefault",(e,t)=>{us.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Rs(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 nl=Fn("ZodNonOptional",(e,t)=>{fs.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Rs(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const al=Fn("ZodCatch",(e,t)=>{ms.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;Rs(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 ol=Fn("ZodPipe",(e,t)=>{hs.init(e,t),hc.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;Rs(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 ol({type:"pipe",in:e,out:t})}const il=Fn("ZodReadonly",(e,t)=>{vs.init(e,t),hc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Rs(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 cl=Fn("ZodCustom",(e,t)=>{ys.init(e,t),hc.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 ll=Gc({name:bc().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:bc().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)")}),dl={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:"오류가 발생했습니다"}};function ul({screen:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsx("p",{className:"text-2xl font-bold",children:t?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function fl({logo:t}){return"string"==typeof t?e.jsx("img",{src:t,alt:"Logo",className:"max-h-24"}):e.jsx("img",{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}function pl(e,t){return function(){return e.apply(t,arguments)}}const{toString:ml}=Object.prototype,{getPrototypeOf:hl}=Object,{iterator:gl,toStringTag:vl}=Symbol,bl=(yl=Object.create(null),e=>{const t=ml.call(e);return yl[t]||(yl[t]=t.slice(8,-1).toLowerCase())});var yl;const xl=e=>(e=e.toLowerCase(),t=>bl(t)===e),wl=e=>t=>typeof t===e,{isArray:Sl}=Array,kl=wl("undefined");function El(e){return null!==e&&!kl(e)&&null!==e.constructor&&!kl(e.constructor)&&Nl(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const jl=xl("ArrayBuffer");const Al=wl("string"),Nl=wl("function"),Cl=wl("number"),_l=e=>null!==e&&"object"==typeof e,Tl=e=>{if("object"!==bl(e))return!1;const t=hl(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||vl in e||gl in e)},Rl=xl("Date"),Pl=xl("File"),Ol=xl("Blob"),Il=xl("FileList"),Dl=xl("URLSearchParams"),[Ul,Ml,Fl,zl]=["ReadableStream","Request","Response","Headers"].map(xl);function Ll(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Sl(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(El(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let s;for(n=0;n<o;n++)s=a[n],t.call(null,e[s],s,e)}}function $l(e,t){if(El(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 Vl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Wl=e=>!kl(e)&&e!==Vl;const Bl=(Gl="undefined"!=typeof Uint8Array&&hl(Uint8Array),e=>Gl&&e instanceof Gl);var Gl;const Hl=xl("HTMLFormElement"),Kl=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Zl=xl("RegExp"),Jl=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ll(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const ql=xl("AsyncFunction"),Yl=(Xl="function"==typeof setImmediate,Ql=Nl(Vl.postMessage),Xl?setImmediate:Ql?(ed=`axios@${Math.random()}`,td=[],Vl.addEventListener("message",({source:e,data:t})=>{e===Vl&&t===ed&&td.length&&td.shift()()},!1),e=>{td.push(e),Vl.postMessage(ed,"*")}):e=>setTimeout(e));var Xl,Ql,ed,td;const rd="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Vl):"undefined"!=typeof process&&process.nextTick||Yl;var nd={isArray:Sl,isArrayBuffer:jl,isBuffer:El,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Nl(e.append)&&("formdata"===(t=bl(e))||"object"===t&&Nl(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&jl(e.buffer),t},isString:Al,isNumber:Cl,isBoolean:e=>!0===e||!1===e,isObject:_l,isPlainObject:Tl,isEmptyObject:e=>{if(!_l(e)||El(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ul,isRequest:Ml,isResponse:Fl,isHeaders:zl,isUndefined:kl,isDate:Rl,isFile:Pl,isBlob:Ol,isRegExp:Zl,isFunction:Nl,isStream:e=>_l(e)&&Nl(e.pipe),isURLSearchParams:Dl,isTypedArray:Bl,isFileList:Il,forEach:Ll,merge:function e(){const{caseless:t,skipUndefined:r}=Wl(this)&&this||{},n={},a=(a,o)=>{const s=t&&$l(n,o)||o;Tl(n[s])&&Tl(a)?n[s]=e(n[s],a):Tl(a)?n[s]=e({},a):Sl(a)?n[s]=a.slice():r&&kl(a)||(n[s]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Ll(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Ll(t,(t,n)=>{r&&Nl(t)?Object.defineProperty(e,n,{value:pl(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,s;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],n&&!n(s,e,t)||i[s]||(t[s]=e[s],i[s]=!0);e=!1!==r&&hl(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:bl,kindOfTest:xl,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(Sl(e))return e;let t=e.length;if(!Cl(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[gl]).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:Hl,hasOwnProperty:Kl,hasOwnProp:Kl,reduceDescriptors:Jl,freezeMethods:e=>{Jl(e,(t,r)=>{if(Nl(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Nl(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 Sl(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:$l,global:Vl,isContextDefined:Wl,isSpecCompliantForm:function(e){return!!(e&&Nl(e.append)&&"FormData"===e[vl]&&e[gl])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(_l(e)){if(t.indexOf(e)>=0)return;if(El(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Sl(e)?[]:{};return Ll(e,(e,t)=>{const o=r(e,n+1);!kl(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:ql,isThenable:e=>e&&(_l(e)||Nl(e))&&Nl(e.then)&&Nl(e.catch),setImmediate:Yl,asap:rd,isIterable:e=>null!=e&&Nl(e[gl])};let ad=class e extends Error{static from(t,r,n,a,o,s){const i=new e(t.message,r||t.code,n,a,o);return i.cause=t,i.name=t.name,s&&Object.assign(i,s),i}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:nd.toJSONObject(this.config),code:this.code,status:this.status}}};ad.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ad.ERR_BAD_OPTION="ERR_BAD_OPTION",ad.ECONNABORTED="ECONNABORTED",ad.ETIMEDOUT="ETIMEDOUT",ad.ERR_NETWORK="ERR_NETWORK",ad.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ad.ERR_DEPRECATED="ERR_DEPRECATED",ad.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ad.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ad.ERR_CANCELED="ERR_CANCELED",ad.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ad.ERR_INVALID_URL="ERR_INVALID_URL";function od(e){return nd.isPlainObject(e)||nd.isArray(e)}function sd(e){return nd.endsWith(e,"[]")?e.slice(0,-2):e}function id(e,t,r){return e?e.concat(t).map(function(e,t){return e=sd(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const cd=nd.toFlatObject(nd,{},null,function(e){return/^is[A-Z]/.test(e)});function ld(e,t,r){if(!nd.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=nd.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!nd.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,s=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&nd.isSpecCompliantForm(t);if(!nd.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(nd.isDate(e))return e.toISOString();if(nd.isBoolean(e))return e.toString();if(!i&&nd.isBlob(e))throw new ad("Blob is not supported. Use a Buffer instead.");return nd.isArrayBuffer(e)||nd.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let i=e;if(e&&!a&&"object"==typeof e)if(nd.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(nd.isArray(e)&&function(e){return nd.isArray(e)&&!e.some(od)}(e)||(nd.isFileList(e)||nd.endsWith(r,"[]"))&&(i=nd.toArray(e)))return r=sd(r),i.forEach(function(e,n){!nd.isUndefined(e)&&null!==e&&t.append(!0===s?id([r],n,o):null===s?r:r+"[]",c(e))}),!1;return!!od(e)||(t.append(id(a,r,o),c(e)),!1)}const d=[],u=Object.assign(cd,{defaultVisitor:l,convertValue:c,isVisitable:od});if(!nd.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!nd.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),nd.forEach(r,function(r,o){!0===(!(nd.isUndefined(r)||null===r)&&a.call(t,r,nd.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function dd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ud(e,t){this._pairs=[],e&&ld(e,this,t)}const fd=ud.prototype;function pd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function md(e,t,r){if(!t)return e;const n=r&&r.encode||pd,a=nd.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let s;if(s=o?o(t,a):nd.isURLSearchParams(t)?t.toString():new ud(t,a).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}fd.append=function(e,t){this._pairs.push([e,t])},fd.toString=function(e){const t=e?function(t){return e.call(this,t,dd)}:dd;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class hd{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){nd.forEach(this.handlers,function(t){null!==t&&e(t)})}}var gd={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vd={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ud,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const bd="undefined"!=typeof window&&"undefined"!=typeof document,yd="object"==typeof navigator&&navigator||void 0,xd=bd&&(!yd||["ReactNative","NativeScript","NS"].indexOf(yd.product)<0),wd="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Sd=bd&&window.location.href||"http://localhost";var kd={...Object.freeze({__proto__:null,hasBrowserEnv:bd,hasStandardBrowserEnv:xd,hasStandardBrowserWebWorkerEnv:wd,navigator:yd,origin:Sd}),...vd};function Ed(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),i=a>=e.length;if(o=!o&&nd.isArray(n)?n.length:o,i)return nd.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&nd.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&nd.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])),!s}if(nd.isFormData(e)&&nd.isFunction(e.entries)){const r={};return nd.forEachEntry(e,(e,n)=>{t(function(e){return nd.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const jd={transitional:gd,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=nd.isObject(e);a&&nd.isHTMLForm(e)&&(e=new FormData(e));if(nd.isFormData(e))return n?JSON.stringify(Ed(e)):e;if(nd.isArrayBuffer(e)||nd.isBuffer(e)||nd.isStream(e)||nd.isFile(e)||nd.isBlob(e)||nd.isReadableStream(e))return e;if(nd.isArrayBufferView(e))return e.buffer;if(nd.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 ld(e,new kd.classes.URLSearchParams,{visitor:function(e,t,r,n){return kd.isNode&&nd.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=nd.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ld(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(nd.isString(e))try{return(t||JSON.parse)(e),nd.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||jd.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(nd.isResponse(e)||nd.isReadableStream(e))return e;if(e&&nd.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 ad.from(e,ad.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:kd.classes.FormData,Blob:kd.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};nd.forEach(["delete","get","head","post","put","patch"],e=>{jd.headers[e]={}});const Ad=nd.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 Nd=Symbol("internals");function Cd(e){return e&&String(e).trim().toLowerCase()}function _d(e){return!1===e||null==e?e:nd.isArray(e)?e.map(_d):String(e)}function Td(e,t,r,n,a){return nd.isFunction(n)?n.call(this,t,r):(a&&(t=r),nd.isString(t)?nd.isString(n)?-1!==t.indexOf(n):nd.isRegExp(n)?n.test(t):void 0:void 0)}let Rd=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=Cd(t);if(!a)throw new Error("header name must be a non-empty string");const o=nd.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=_d(e))}const o=(e,t)=>nd.forEach(e,(e,r)=>a(e,r,t));if(nd.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(nd.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]&&Ad[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(nd.isObject(e)&&nd.isIterable(e)){let r,n,a={};for(const t of e){if(!nd.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?nd.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=Cd(e)){const r=nd.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(nd.isFunction(t))return t.call(this,e,r);if(nd.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Cd(e)){const r=nd.findKey(this,e);return!(!r||void 0===this[r]||t&&!Td(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=Cd(e)){const a=nd.findKey(r,e);!a||t&&!Td(0,r[a],a,t)||(delete r[a],n=!0)}}return nd.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&&!Td(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return nd.forEach(this,(n,a)=>{const o=nd.findKey(r,a);if(o)return t[o]=_d(n),void delete t[a];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();s!==a&&delete t[a],t[s]=_d(n),r[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return nd.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&nd.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[Nd]=this[Nd]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Cd(e);t[n]||(!function(e,t){const r=nd.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 nd.isArray(e)?e.forEach(n):n(e),this}};function Pd(e,t){const r=this||jd,n=t||r,a=Rd.from(n.headers);let o=n.data;return nd.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function Od(e){return!(!e||!e.__CANCEL__)}Rd.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),nd.reduceDescriptors(Rd.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),nd.freezeMethods(Rd);let Id=class extends ad{constructor(e,t,r){super(null==e?"canceled":e,ad.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Dd(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ad("Request failed with status code "+r.status,[ad.ERR_BAD_REQUEST,ad.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Ud=(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,s=0;return t=void 0!==t?t:1e3,function(i){const c=Date.now(),l=n[s];a||(a=c),r[o]=i,n[o]=c;let d=s,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+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 s=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=o?s(e,t):(r=e,n||(n=setTimeout(()=>{n=null,s(r)},o-i)))},()=>r&&s(r)]}(r=>{const o=r.loaded,s=r.lengthComputable?r.total:void 0,i=o-n,c=a(i);n=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:i,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})},r)},Md=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Fd=e=>(...t)=>nd.asap(()=>e(...t));var zd=kd.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,kd.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(kd.origin),kd.navigator&&/(msie|trident)/i.test(kd.navigator.userAgent)):()=>!0,Ld=kd.hasStandardBrowserEnv?{write(e,t,r,n,a,o,s){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];nd.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),nd.isString(n)&&i.push(`path=${n}`),nd.isString(a)&&i.push(`domain=${a}`),!0===o&&i.push("secure"),nd.isString(s)&&i.push(`SameSite=${s}`),document.cookie=i.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 $d(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 Vd=e=>e instanceof Rd?{...e}:e;function Wd(e,t){t=t||{};const r={};function n(e,t,r,n){return nd.isPlainObject(e)&&nd.isPlainObject(t)?nd.merge.call({caseless:n},e,t):nd.isPlainObject(t)?nd.merge({},t):nd.isArray(t)?t.slice():t}function a(e,t,r,a){return nd.isUndefined(t)?nd.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!nd.isUndefined(t))return n(void 0,t)}function s(e,t){return nd.isUndefined(t)?nd.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(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:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:i,headers:(e,t,r)=>a(Vd(e),Vd(t),0,!0)};return nd.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,s=o(e[n],t[n],n);nd.isUndefined(s)&&o!==i||(r[n]=s)}),r}var Bd=e=>{const t=Wd({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:s,auth:i}=t;if(t.headers=s=Rd.from(s),t.url=md($d(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&s.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),nd.isFormData(r))if(kd.hasStandardBrowserEnv||kd.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(nd.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&s.set(e,r)})}if(kd.hasStandardBrowserEnv&&(n&&nd.isFunction(n)&&(n=n(t)),n||!1!==n&&zd(t.url))){const e=a&&o&&Ld.read(o);e&&s.set(a,e)}return t};var Gd="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Bd(e);let a=n.data;const o=Rd.from(n.headers).normalize();let s,i,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Rd.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Dd(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 ad("Request aborted",ad.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new ad(n,ad.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||gd;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ad(t,a.clarifyTimeoutError?ad.ETIMEDOUT:ad.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&nd.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),nd.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=Ud(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([i,l]=Ud(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(s=t=>{h&&(r(!t||t.type?new Id(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===kd.protocols.indexOf(v)?r(new ad("Unsupported protocol "+v+":",ad.ERR_BAD_REQUEST,e)):h.send(a||null)})};const Hd=(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,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ad?t:new Id(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new ad(`timeout of ${t}ms exceeded`,ad.ETIMEDOUT))},t);const s=()=>{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:i}=n;return i.unsubscribe=()=>nd.asap(s),i}},Kd=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},Zd=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()}},Jd=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Zd(e))yield*Kd(r,t)}(e,t);let o,s=0,i=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 i(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},{isFunction:qd}=nd,Yd=(({Request:e,Response:t})=>({Request:e,Response:t}))(nd.global),{ReadableStream:Xd,TextEncoder:Qd}=nd.global,eu=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},tu=e=>{e=nd.merge.call({skipUndefined:!0},Yd,e);const{fetch:t,Request:r,Response:n}=e,a=t?qd(t):"function"==typeof fetch,o=qd(r),s=qd(n);if(!a)return!1;const i=a&&qd(Xd),c=a&&("function"==typeof Qd?(l=new Qd,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&i&&eu(()=>{let e=!1;const t=new r(kd.origin,{body:new Xd,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&i&&eu(()=>nd.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 ad(`Response type '${e}' is not supported`,ad.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=nd.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(nd.isBlob(e))return e.size;if(nd.isSpecCompliantForm(e)){const t=new r(kd.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return nd.isArrayBufferView(e)||nd.isArrayBuffer(e)?e.byteLength:(nd.isURLSearchParams(e)&&(e+=""),nd.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:s,data:i,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:b,withCredentials:y="same-origin",fetchOptions:x}=Bd(e),w=t||fetch;v=v?(v+"").toLowerCase():"text";let S=Hd([c,l&&l.toAbortSignal()],m),k=null;const E=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let j;try{if(g&&d&&"get"!==s&&"head"!==s&&0!==(j=await p(b,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(nd.isFormData(i)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=Md(j,Ud(Fd(g)));i=Jd(t.body,65536,e,r)}}nd.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in r.prototype,c={...x,signal:S,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:i,duplex:"half",credentials:t?y:void 0};k=o&&new r(a,c);let l=await(o?w(k,x):w(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=nd.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&Md(t,Ud(Fd(h),!0))||[];l=new n(Jd(l.body,65536,r,()=>{a&&a(),E&&E()}),e)}v=v||"text";let A=await f[nd.findKey(f,v)||"text"](l,e);return!m&&E&&E(),await new Promise((t,r)=>{Dd(t,r,{data:A,headers:Rd.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 ad("Network Error",ad.ERR_NETWORK,e,k),{cause:t.cause||t});throw ad.from(t,t&&t.code,e,k)}}},ru=new Map,nu=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let s,i,c=o.length,l=ru;for(;c--;)s=o[c],i=l.get(s),void 0===i&&l.set(s,i=c?new Map:tu(t)),l=i;return i};nu();const au={http:null,xhr:Gd,fetch:{get:nu}};nd.forEach(au,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const ou=e=>`- ${e}`,su=e=>nd.isFunction(e)||null===e||!1===e;var iu={getAdapter:function(e,t){e=nd.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let s=0;s<r;s++){let r;if(n=e[s],a=n,!su(n)&&(a=au[(r=String(n)).toLowerCase()],void 0===a))throw new ad(`Unknown adapter '${r}'`);if(a&&(nd.isFunction(a)||(a=a.get(t))))break;o[r||"#"+s]=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(ou).join("\n"):" "+ou(e[0]):"as no adapter specified";throw new ad("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:au};function cu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Id(null,e)}function lu(e){cu(e),e.headers=Rd.from(e.headers),e.data=Pd.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return iu.getAdapter(e.adapter||jd.adapter,e)(e).then(function(t){return cu(e),t.data=Pd.call(e,e.transformResponse,t),t.headers=Rd.from(t.headers),t},function(t){return Od(t)||(cu(e),t&&t.response&&(t.response.data=Pd.call(e,e.transformResponse,t.response),t.response.headers=Rd.from(t.response.headers))),Promise.reject(t)})}const du="1.13.4",uu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{uu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const fu={};uu.transitional=function(e,t,r){function n(e,t){return"[Axios v"+du+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new ad(n(a," has been removed"+(t?" in "+t:"")),ad.ERR_DEPRECATED);return t&&!fu[a]&&(fu[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)}},uu.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var pu={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ad("options must be an object",ad.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new ad("option "+o+" must be "+r,ad.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ad("Unknown option "+o,ad.ERR_BAD_OPTION)}},validators:uu};const mu=pu.validators;let hu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new hd,response:new hd}}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=Wd(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&pu.assertOptions(r,{silentJSONParsing:mu.transitional(mu.boolean),forcedJSONParsing:mu.transitional(mu.boolean),clarifyTimeoutError:mu.transitional(mu.boolean)},!1),null!=n&&(nd.isFunction(n)?t.paramsSerializer={serialize:n}:pu.assertOptions(n,{encode:mu.function,serialize:mu.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pu.assertOptions(t,{baseUrl:mu.spelling("baseURL"),withXsrfToken:mu.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&nd.merge(a.common,a[t.method]);a&&nd.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=Rd.concat(o,a);const s=[];let i=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,s.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(!i){const e=[lu.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=s.length;let f=t;for(;u<d;){const e=s[u++],t=s[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=lu.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 md($d((e=Wd(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};nd.forEach(["delete","get","head","options"],function(e){hu.prototype[e]=function(t,r){return this.request(Wd(r||{},{method:e,url:t,data:(r||{}).data}))}}),nd.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(Wd(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}hu.prototype[e]=t(),hu.prototype[e+"Form"]=t(!0)});const gu={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(gu).forEach(([e,t])=>{gu[t]=e});const vu=function e(t){const r=new hu(t),n=pl(hu.prototype.request,r);return nd.extend(n,hu.prototype,r,{allOwnKeys:!0}),nd.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Wd(t,r))},n}(jd);vu.Axios=hu,vu.CanceledError=Id,vu.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 Id(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}}},vu.isCancel=Od,vu.VERSION=du,vu.toFormData=ld,vu.AxiosError=ad,vu.Cancel=vu.CanceledError,vu.all=function(e){return Promise.all(e)},vu.spread=function(e){return function(t){return e.apply(null,t)}},vu.isAxiosError=function(e){return nd.isObject(e)&&!0===e.isAxiosError},vu.mergeConfig=Wd,vu.AxiosHeaders=Rd,vu.formToJSON=e=>Ed(nd.isHTMLForm(e)?new FormData(e):e),vu.getAdapter=iu.getAdapter,vu.HttpStatusCode=gu,vu.default=vu;const{Axios:bu,AxiosError:yu,CanceledError:xu,isCancel:wu,CancelToken:Su,VERSION:ku,all:Eu,Cancel:ju,isAxiosError:Au,spread:Nu,toFormData:Cu,AxiosHeaders:_u,HttpStatusCode:Tu,formToJSON:Ru,getAdapter:Pu,mergeConfig:Ou}=vu;const Iu=new class{constructor(e={}){this.client=vu.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=rt();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 Du(){const e=Gt(),r=Bt(e=>e.auth),n=Bt(e=>e.os),{serverUrl:a,orgId:o,auth:s}=n,{resetCurrentWorkspace:i,currentWorkspace:c}=tr(),l=t.useCallback(async()=>{e.auth(Me());try{const t=await Iu.post(`${a}/api/v1/auth/request`,{orgId:o,clientId:s?.clientId,redirect:{success:s?.redirectUrl||window.location.href,error:s?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(ze()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(ze()),Ie(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,o,s,e]),d=t.useCallback(async()=>{try{s?.callbacks?.onSignOut&&"function"==typeof s.callbacks.onSignOut&&await s.callbacks.onSignOut(),e.auth($e()),i(),tt()}catch(e){Ie(e,{component:"useSaaSAuth",action:"signOut"}),tt()}},[e,i,s?.callbacks?.onSignOut]),u=t.useCallback(e=>{c?rr.openWorkspaceSettings(e):Ie(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[c]),f=t.useMemo(()=>Ke(r.status),[r.status]);return t.useMemo(()=>({user:r.session?.user,session:r.session,status:r.status,...f,signIn:l,signOut:d,openWorkspaceSettings:u}),[r.session,r.status,f,l,d,u])}function Uu(){const e=t.useContext(Xt);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])}}function Mu(){const e=Gt(),r=Bt(e=>e.os),{serverUrl:n,version:a,orgId:o,settings:s}=r,i=t.useRef(!1),c=t.useCallback(async t=>{if(i.current)return s||null;if(s)return s;if(!n||!a||!o)return null;i.current=!0;try{const r=nt(),s=await Ce(`${n}/api/${a}/public/${o}/settings`,{headers:r,signal:t});if(!s.ok)throw new Error("Failed to fetch settings");const i=await s.json();return e.os(mt(i)),i}catch(e){return De(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:n,version:a,orgId:o}}),null}finally{i.current=!1}},[n,a,o,s,e]);return Ht(async e=>{n&&a&&o&&!s&&!i.current&&await c(e)},[n,a,o,c],{onError:e=>De(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:n,version:a,orgId:o}})}),t.useMemo(()=>({settings:s,getSettings:c}),[s,c])}function Fu(...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 n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}function zu(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var Lu,$u=globalThis?.document?a.useLayoutEffect:()=>{},Vu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Zs(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Wu={exports:{}},Bu={};function Gu(){if(Lu)return Bu;Lu=1;var e=t;var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,a=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(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 r=t(),c=n({inst:{value:r,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=r,l.getSnapshot=t,i(l)&&d({inst:l})},[e,r,t]),a(function(){return i(l)&&d({inst:l}),e(function(){i(l)&&d({inst:l})})},[e]),s(r),r};return Bu.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,Bu}var Hu,Ku,Zu={};
|
|
27
21
|
/**
|
|
28
22
|
* @license React
|
|
29
23
|
* use-sync-external-store-shim.development.js
|
|
@@ -32,5 +26,5 @@ var oo={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 ui(){return ci||(ci=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,o=r.useEffect,s=r.useLayoutEffect,i=r.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){c||void 0===r.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();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return s(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),o(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};di.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),di}function fi(){return li||(li=1,"production"===process.env.NODE_ENV?oi.exports=ii():oi.exports=ui()),oi.exports}var pi=fi();function mi(){return()=>{}}var hi="Avatar",[gi]=function(t,r=[]){let n=[];const o=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return o.scopeName=t,[function(r,o){const s=a.createContext(o);s.displayName=r+"Context";const i=n.length;n=[...n,o];const c=r=>{const{scope:n,children:o,...c}=r,l=n?.[t]?.[i]||s,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||s,l=a.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Ws(o,...r)]}(hi),[vi,bi]=gi(hi),yi=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...o}=t,[s,i]=a.useState("idle");return e.jsx(vi,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:e.jsx(ai.span,{...o,ref:r})})});yi.displayName=hi;var xi="AvatarImage",wi=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:o,onLoadingStatusChange:s=()=>{},...i}=t,c=bi(xi,n),l=function(e,{referrerPolicy:t,crossOrigin:r}){const n=pi.useSyncExternalStore(mi,()=>!0,()=>!1),o=a.useRef(null),s=n?(o.current||(o.current=new window.Image),o.current):null,[i,c]=a.useState(()=>ji(s,e));return Gs(()=>{c(ji(s,e))},[s,e]),Gs(()=>{const e=e=>()=>{c(e)};if(!s)return;const n=e("loaded"),a=e("error");return s.addEventListener("load",n),s.addEventListener("error",a),t&&(s.referrerPolicy=t),"string"==typeof r&&(s.crossOrigin=r),()=>{s.removeEventListener("load",n),s.removeEventListener("error",a)}},[s,r,t]),i}(o,i),d=Bs(e=>{s(e),c.onImageLoadingStatusChange(e)});return Gs(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e.jsx(ai.img,{...i,ref:r,src:o}):null});wi.displayName=xi;var Si="AvatarFallback",ki=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:o,...s}=t,i=bi(Si,n),[c,l]=a.useState(void 0===o);return a.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==i.imageLoadingStatus?e.jsx(ai.span,{...s,ref:r}):null});function ji(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}ki.displayName=Si;var Ei=yi,Ai=wi,Ni=ki;function Ci(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=Ci(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function _i(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Ci(e))&&(n&&(n+=" "),n+=t);return n}const Ti=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ri="-",Pi=[],Oi=e=>{const t=Ui(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Di(e);const r=e.split(Ri),n=""===r[0]&&r.length>1?1:0;return Ii(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||Pi}return r[e]||Pi}}},Ii=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=Ii(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const s=0===t?e.join(Ri):e.slice(t).join(Ri),i=o.length;for(let e=0;e<i;e++){const t=o[e];if(t.validator(s))return t.classGroupId}},Di=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})(),Ui=e=>{const{theme:t,classGroups:r}=e;return Mi(r,t)},Mi=(e,t)=>{const r=Ti();for(const n in e){const a=e[n];Fi(a,r,n,t)}return r},Fi=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];zi(a,t,r,n)}},zi=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?Vi(e,t,r,n):$i(e,t,r,n):Li(e,t,r)},Li=(e,t,r)=>{(""===e?t:Wi(t,e)).classGroupId=r},$i=(e,t,r,n)=>{Bi(e)?Fi(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},Vi=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,s]=a[e];Fi(s,Wi(t,o),r,n)}},Wi=(e,t)=>{let r=e;const n=t.split(Ri),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=Ti(),r.nextPart.set(t,a)),r=a}return r},Bi=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Gi=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)}}},Hi=[],Ki=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Zi=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const s=e.length;for(let i=0;i<s;i++){const s=e[i];if(0===n&&0===a){if(":"===s){t.push(e.slice(o,i)),o=i+1;continue}if("/"===s){r=i;continue}}"["===s?n++:"]"===s?n--:"("===s?a++:")"===s&&a--}const i=0===t.length?e:e.slice(o);let c=i,l=!1;i.endsWith("!")?(c=i.slice(0,-1),l=!0):i.startsWith("!")&&(c=i.slice(1),l=!0);return Ki(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)):Ki(Hi,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},Ji=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],s="["===o[0],i=t.has(o);s||i?(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}},qi=/\s+/,Yi=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Yi(e[n]))&&(r&&(r+=" "),r+=t);return r},Xi=(e,...t)=>{let r,n,a,o;const s=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,s=[],i=e.trim().split(qi);let c="";for(let e=i.length-1;e>=0;e-=1){const t=i[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,b=v+h;if(s.indexOf(b)>-1)continue;s.push(b);const y=a(h,m);for(let e=0;e<y.length;++e){const t=y[e];s.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=i=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:Gi(e.cacheSize),parseClassName:Zi(e),sortModifiers:Ji(e),...Oi(e)}))(c),n=r.cache.get,a=r.cache.set,o=s,s(i)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=Yi(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Qi=[],ec=e=>{const t=t=>t[e]||Qi;return t.isThemeGetter=!0,t},tc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nc=/^\d+\/\d+$/,ac=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oc=/\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$/,sc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ic=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,lc=e=>nc.test(e),dc=e=>!!e&&!Number.isNaN(Number(e)),uc=e=>!!e&&Number.isInteger(Number(e)),fc=e=>e.endsWith("%")&&dc(e.slice(0,-1)),pc=e=>ac.test(e),mc=()=>!0,hc=e=>oc.test(e)&&!sc.test(e),gc=()=>!1,vc=e=>ic.test(e),bc=e=>cc.test(e),yc=e=>!wc(e)&&!Nc(e),xc=e=>Ic(e,Fc,gc),wc=e=>tc.test(e),Sc=e=>Ic(e,zc,hc),kc=e=>Ic(e,Lc,dc),jc=e=>Ic(e,Uc,gc),Ec=e=>Ic(e,Mc,bc),Ac=e=>Ic(e,Vc,vc),Nc=e=>rc.test(e),Cc=e=>Dc(e,zc),_c=e=>Dc(e,$c),Tc=e=>Dc(e,Uc),Rc=e=>Dc(e,Fc),Pc=e=>Dc(e,Mc),Oc=e=>Dc(e,Vc,!0),Ic=(e,t,r)=>{const n=tc.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Dc=(e,t,r=!1)=>{const n=rc.exec(e);return!!n&&(n[1]?t(n[1]):r)},Uc=e=>"position"===e||"percentage"===e,Mc=e=>"image"===e||"url"===e,Fc=e=>"length"===e||"size"===e||"bg-size"===e,zc=e=>"length"===e,Lc=e=>"number"===e,$c=e=>"family-name"===e,Vc=e=>"shadow"===e,Wc=Xi(()=>{const e=ec("color"),t=ec("font"),r=ec("text"),n=ec("font-weight"),a=ec("tracking"),o=ec("leading"),s=ec("breakpoint"),i=ec("container"),c=ec("spacing"),l=ec("radius"),d=ec("shadow"),u=ec("inset-shadow"),f=ec("text-shadow"),p=ec("drop-shadow"),m=ec("blur"),h=ec("perspective"),g=ec("aspect"),v=ec("ease"),b=ec("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Nc,wc],x=()=>[Nc,wc,c],w=()=>[lc,"full","auto",...x()],S=()=>[uc,"none","subgrid",Nc,wc],k=()=>["auto",{span:["full",uc,Nc,wc]},uc,Nc,wc],j=()=>[uc,"auto",Nc,wc],E=()=>["auto","min","max","fr",Nc,wc],A=()=>["auto",...x()],N=()=>[lc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],C=()=>[e,Nc,wc],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Tc,jc,{position:[Nc,wc]}],T=()=>["auto","cover","contain",Rc,xc,{size:[Nc,wc]}],R=()=>[fc,Cc,Sc],P=()=>["","none","full",l,Nc,wc],O=()=>["",dc,Cc,Sc],I=()=>[dc,fc,Tc,jc],D=()=>["","none",m,Nc,wc],U=()=>["none",dc,Nc,wc],M=()=>["none",dc,Nc,wc],F=()=>[dc,Nc,wc],z=()=>[lc,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pc],breakpoint:[pc],color:[mc],container:[pc],"drop-shadow":[pc],ease:["in","out","in-out"],font:[yc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pc],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pc],shadow:[pc],spacing:["px",dc],text:[pc],"text-shadow":[pc],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",lc,wc,Nc,g]}],container:["container"],columns:[{columns:[dc,wc,Nc,i]}],"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:y()}],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:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[uc,"auto",Nc,wc]}],basis:[{basis:[lc,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dc,lc,"auto","initial","none",wc]}],grow:[{grow:["",dc,Nc,wc]}],shrink:[{shrink:["",dc,Nc,wc]}],order:[{order:[uc,"first","last","none",Nc,wc]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"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:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],w:[{w:[i,"screen",...N()]}],"min-w":[{"min-w":[i,"screen","none",...N()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",r,Cc,Sc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Nc,kc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fc,wc]}],"font-family":[{font:[_c,wc,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,Nc,wc]}],"line-clamp":[{"line-clamp":[dc,"none",Nc,kc]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",Nc,wc]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Nc,wc]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[dc,"from-font","auto",Nc,Sc]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[dc,"auto",Nc,wc]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Nc,wc]}],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",Nc,wc]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},uc,Nc,wc],radial:["",Nc,wc],conic:[uc,Nc,wc]},Pc,Ec]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":O()}],"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:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[dc,Nc,wc]}],"outline-w":[{outline:["",dc,Cc,Sc]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",d,Oc,Ac]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",u,Oc,Ac]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[dc,Sc]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",f,Oc,Ac]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[dc,Nc,wc]}],"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":[dc]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[Nc,wc]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"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":[dc]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Nc,wc]}],filter:[{filter:["","none",Nc,wc]}],blur:[{blur:D()}],brightness:[{brightness:[dc,Nc,wc]}],contrast:[{contrast:[dc,Nc,wc]}],"drop-shadow":[{"drop-shadow":["","none",p,Oc,Ac]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",dc,Nc,wc]}],"hue-rotate":[{"hue-rotate":[dc,Nc,wc]}],invert:[{invert:["",dc,Nc,wc]}],saturate:[{saturate:[dc,Nc,wc]}],sepia:[{sepia:["",dc,Nc,wc]}],"backdrop-filter":[{"backdrop-filter":["","none",Nc,wc]}],"backdrop-blur":[{"backdrop-blur":D()}],"backdrop-brightness":[{"backdrop-brightness":[dc,Nc,wc]}],"backdrop-contrast":[{"backdrop-contrast":[dc,Nc,wc]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dc,Nc,wc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dc,Nc,wc]}],"backdrop-invert":[{"backdrop-invert":["",dc,Nc,wc]}],"backdrop-opacity":[{"backdrop-opacity":[dc,Nc,wc]}],"backdrop-saturate":[{"backdrop-saturate":[dc,Nc,wc]}],"backdrop-sepia":[{"backdrop-sepia":["",dc,Nc,wc]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Nc,wc]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dc,"initial",Nc,wc]}],ease:[{ease:["linear","initial",v,Nc,wc]}],delay:[{delay:[dc,Nc,wc]}],animate:[{animate:["none",b,Nc,wc]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Nc,wc]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:U()}],"rotate-x":[{"rotate-x":U()}],"rotate-y":[{"rotate-y":U()}],"rotate-z":[{"rotate-z":U()}],scale:[{scale:M()}],"scale-x":[{"scale-x":M()}],"scale-y":[{"scale-y":M()}],"scale-z":[{"scale-z":M()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Nc,wc,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"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",Nc,wc]}],"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":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"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",Nc,wc]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[dc,Cc,Sc,kc]}],stroke:[{stroke:["none",...C()]}],"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 Bc(...e){return Wc(_i(e))}const Gc=a.forwardRef(({className:t,...r},n)=>e.jsx(Ei,{ref:n,className:Bc("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));Gc.displayName=Ei.displayName;const Hc=a.forwardRef(({className:t,...r},n)=>e.jsx(Ai,{ref:n,className:Bc("aspect-square h-full w-full",t),...r}));Hc.displayName=Ai.displayName;const Kc=a.forwardRef(({className:t,...r},n)=>e.jsx(Ni,{ref:n,className:Bc("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));Kc.displayName=Ni.displayName;const Zc=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Jc=_i,qc=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Jc(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,s=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 s=Zc(t)||Zc(n);return a[e][s]}),i=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,...i}[t]):{...o,...i}[t]===r})?[...e,r,n]:e},[]);return Jc(e,s,c,null==r?void 0:r.class,null==r?void 0:r.className)},Yc=qc("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"}}),Xc=a.forwardRef(({className:t,variant:r,progress:n,size:o,startIcon:s,endIcon:i,asChild:c=!1,...l},d)=>{const u=c?Qs:"button",f=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(o);return e.jsxs(u,{disabled:n||l.disabled,className:Bc(Yc({variant:r,size:o,withIcon:null!=n||null!=s||null!=i,className:t})),ref:d,...l,children:[n&&e.jsx(go,{size:f,className:"animate-spin"}),s&&a.cloneElement(s,{size:f}),l.children,i&&a.cloneElement(i,{size:f})]})});function Qc(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function el(t,r=[]){let n=[];const o=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return o.scopeName=t,[function(r,o){const s=a.createContext(o),i=n.length;n=[...n,o];const c=r=>{const{scope:n,children:o,...c}=r,l=n?.[t]?.[i]||s,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||s,l=a.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},tl(o,...r)]}function tl(...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 n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}Xc.displayName="Button";var rl=a[" useId ".trim().toString()]||(()=>{}),nl=0;function al(e){const[t,r]=a.useState(rl());return Gs(()=>{r(e=>e??String(nl++))},[e]),e||(t?`radix-${t}`:"")}var ol=a[" useInsertionEffect ".trim().toString()]||Gs;function sl({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,s,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),o=a.useRef(r),s=a.useRef(t);return ol(()=>{s.current=t},[t]),a.useEffect(()=>{o.current!==r&&(s.current?.(r),o.current=r)},[r,o]),[r,n,s]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${n} 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,n])}const d=a.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else s(t)},[c,e,s,i]);return[l,d]}function il(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ks(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cl=Symbol("radix.slottable");function ll(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cl}var dl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=il(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(ll);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{});var ul,fl="dismissableLayer.update",pl="dismissableLayer.pointerDownOutside",ml="dismissableLayer.focusOutside",hl=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gl=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...d}=t,u=a.useContext(hl),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Zs(r,e=>p(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),x=f?v.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=y,k=function(e,t=globalThis?.document){const r=Bs(e),n=a.useRef(!1),o=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){bl(pl,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);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(s?.(e),c?.(e),e.defaultPrevented||l?.())},m),j=function(e,t=globalThis?.document){const r=Bs(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){bl(ml,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=Bs(e);a.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=>{x===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(ul=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),vl(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=ul)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),vl())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(fl,e),()=>document.removeEventListener(fl,e)},[]),e.jsx(dl.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Qc(t.onFocusCapture,j.onFocusCapture),onBlurCapture:Qc(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Qc(t.onPointerDownCapture,k.onPointerDownCapture)})});gl.displayName="DismissableLayer";function vl(){const e=new CustomEvent(fl);document.dispatchEvent(e)}function bl(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&o.flushSync(()=>e.dispatchEvent(t))}(a,s):a.dispatchEvent(s)}a.forwardRef((t,r)=>{const n=a.useContext(hl),o=a.useRef(null),s=Zs(r,o);return a.useEffect(()=>{const e=o.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(dl.div,{...t,ref:s})}).displayName="DismissableLayerBranch";var yl="focusScope.autoFocusOnMount",xl="focusScope.autoFocusOnUnmount",wl={bubbles:!1,cancelable:!0},Sl=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...c}=t,[l,d]=a.useState(null),u=Bs(s),f=Bs(i),p=a.useRef(null),m=Zs(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:Al(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Al(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Al(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]),a.useEffect(()=>{if(l){Nl.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(yl,wl);l.addEventListener(yl,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Al(n,{select:t}),document.activeElement!==r)return}((e=kl(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Al(l))}return()=>{l.removeEventListener(yl,u),setTimeout(()=>{const e=new CustomEvent(xl,wl);l.addEventListener(xl,f),l.dispatchEvent(e),e.defaultPrevented||Al(t??document.body,{select:!0}),l.removeEventListener(xl,f),Nl.remove(h)},0)}}var e},[l,u,f,h]);const g=a.useCallback(e=>{if(!n&&!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,[a,o]=function(e){const t=kl(e),r=jl(t,e),n=jl(t.reverse(),e);return[r,n]}(t);a&&o?e.shiftKey||r!==o?e.shiftKey&&r===a&&(e.preventDefault(),n&&Al(o,{select:!0})):(e.preventDefault(),n&&Al(a,{select:!0})):r===t&&e.preventDefault()}},[n,o,h.paused]);return e.jsx(dl.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function kl(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 jl(e,t){for(const r of e)if(!El(r,{upTo:t}))return r}function El(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 Al(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()}}Sl.displayName="FocusScope";var Nl=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Cl(e,t),e.unshift(t)},remove(t){e=Cl(e,t),e[0]?.resume()}}}();function Cl(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var _l=a.forwardRef((t,n)=>{const{container:o,...s}=t,[i,c]=a.useState(!1);Gs(()=>c(!0),[]);const l=o||i&&globalThis?.document?.body;return l?r.createPortal(e.jsx(dl.div,{...s,ref:n}),l):null});_l.displayName="Portal";var Tl=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),o=a.useRef(e),s=a.useRef("none"),i=e?"mounted":"unmounted",[c,l]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=Rl(n.current);s.current="mounted"===c?e:"none"},[c]),Gs(()=>{const t=n.current,r=o.current;if(r!==e){const n=s.current,a=Rl(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]),Gs(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const s=Rl(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&s&&(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)})}},i=e=>{e.target===t&&(s.current=Rl(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),s=Zs(n.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||n.isPresent?a.cloneElement(o,{ref:s}):null};function Rl(e){return e?.animationName||"none"}Tl.displayName="Presence";var Pl=0;function Ol(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Il()),document.body.insertAdjacentElement("beforeend",e[1]??Il()),Pl++,()=>{1===Pl&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Pl--}},[])}function Il(){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 Dl=function(){return Dl=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},Dl.apply(this,arguments)};function Ul(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 Ml="right-scroll-bar-position",Fl="width-before-scroll-bar";function zl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Ll="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,$l=new WeakMap;function Vl(e,r){var n,a,o,s=(n=null,a=function(t){return e.forEach(function(e){return zl(e,t)})},(o=t.useState(function(){return{value:n,callback:a,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=a,o.facade);return Ll(function(){var t=$l.get(s);if(t){var r=new Set(t),n=new Set(e),a=s.current;r.forEach(function(e){n.has(e)||zl(e,null)}),n.forEach(function(e){r.has(e)||zl(e,a)})}$l.set(s,e)},[e]),s}function Wl(e){return e}var Bl=function(e){var t=e.sideCar,r=Ul(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,Dl({},r))};Bl.isSideCarExport=!0;var Gl=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Wl);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)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Dl({async:!0,ssr:!1},e),t}(),Hl=function(){},Kl=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:Hl,onWheelCapture:Hl,onTouchMoveCapture:Hl}),o=n[0],s=n[1],i=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,b=e.as,y=void 0===b?"div":b,x=e.gapMode,w=Ul(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Vl([r,t]),j=Dl(Dl({},w),o);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:Gl,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:x}),i?a.cloneElement(a.Children.only(c),Dl(Dl({},j),{ref:k})):a.createElement(y,Dl({},j,{className:l,ref:k}),c))});Kl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Kl.classNames={fullWidth:Fl,zeroRight:Ml};function Zl(){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 Jl=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Zl())&&(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)}}},ql=function(){var e,t=(e=Jl(),function(t,r){a.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}},Yl={left:0,top:0,right:0,gap:0},Xl=function(e){return parseInt(e||"",10)||0},Ql=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Yl;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[Xl(r),Xl(n),Xl(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])}},ed=ql(),td="data-scroll-locked",rd=function(e,t,r,n){var a=e.left,o=e.top,s=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(td,"] {\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(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Ml," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(Fl," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(Ml," .").concat(Ml," {\n right: 0 ").concat(n,";\n }\n \n .").concat(Fl," .").concat(Fl," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(td,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},nd=function(){var e=parseInt(document.body.getAttribute(td)||"0",10);return isFinite(e)?e:0},ad=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(td,(nd()+1).toString()),function(){var e=nd()-1;e<=0?document.body.removeAttribute(td):document.body.setAttribute(td,e.toString())}},[]);var s=a.useMemo(function(){return Ql(o)},[o]);return a.createElement(ed,{styles:rd(s,!t,o,r?"":"!important")})},od=!1;if("undefined"!=typeof window)try{var sd=Object.defineProperty({},"passive",{get:function(){return od=!0,!0}});window.addEventListener("test",sd,sd),window.removeEventListener("test",sd,sd)}catch(e){od=!1}var id=!!od&&{passive:!1},cd=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])},ld=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),dd(e,n)){var a=ud(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},dd=function(e,t){return"v"===e?function(e){return cd(e,"overflowY")}(t):function(e){return cd(e,"overflowX")}(t)},ud=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)},fd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pd=function(e){return[e.deltaX,e.deltaY]},md=function(e){return e&&"current"in e?e.current:e},hd=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},gd=0,vd=[];function bd(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var yd,xd=(yd=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),o=a.useState(gd++)[0],s=a.useState(ql)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.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(md),!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=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,o=fd(e),s=r.current,c="deltaX"in e?e.deltaX:s[0]-o[0],l="deltaY"in e?e.deltaY:s[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=ld(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=ld(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(c||l)&&(n.current=a),!a)return!0;var h=n.current||a;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,s=r.target,i=t.contains(s),c=!1,l=o>0,d=0,u=0;do{if(!s)break;var f=ud(e,s),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&dd(e,s)&&(d+=m,u+=p);var h=s.parentNode;s=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&s!==document.body||i&&(t.contains(s)||t===s));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=a.useCallback(function(e){var r=e;if(vd.length&&vd[vd.length-1]===s){var n="deltaY"in r?pd(r):fd(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=(i.current.shards||[]).map(md).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:bd(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=a.useCallback(function(e){r.current=fd(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,pd(t),t.target,c(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,fd(t),t.target,c(t,e.lockRef.current))},[]);a.useEffect(function(){return vd.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,id),document.addEventListener("touchmove",l,id),document.addEventListener("touchstart",u,id),function(){vd=vd.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,id),document.removeEventListener("touchmove",l,id),document.removeEventListener("touchstart",u,id)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(s,{styles:hd(o)}):null,m?a.createElement(ad,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Gl.useMedium(yd),Bl),wd=a.forwardRef(function(e,t){return a.createElement(Kl,Dl({},e,{ref:t,sideCar:xd}))});wd.classNames=Kl.classNames;var Sd=new WeakMap,kd=new WeakMap,jd={},Ed=0,Ad=function(e){return e&&(e.host||Ad(e.parentNode))},Nd=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Ad(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]);jd[r]||(jd[r]=new WeakMap);var o=jd[r],s=[],i=new Set,c=new Set(a),l=function(e){e&&!i.has(e)&&(i.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(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(Sd.get(e)||0)+1,l=(o.get(e)||0)+1;Sd.set(e,c),o.set(e,l),s.push(e),1===c&&a&&kd.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),i.clear(),Ed++,function(){s.forEach(function(e){var t=Sd.get(e)-1,a=o.get(e)-1;Sd.set(e,t),o.set(e,a),t||(kd.has(e)||e.removeAttribute(n),kd.delete(e)),a||e.removeAttribute(r)}),--Ed||(Sd=new WeakMap,Sd=new WeakMap,kd=new WeakMap,jd={})}},Cd=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"))),Nd(n,a,r,"aria-hidden")):function(){return null}};function _d(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ks(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Td=Symbol("radix.slottable");function Rd(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Td}var Pd="Dialog",[Od,Id]=el(Pd),[Dd,Ud]=Od(Pd),Md=t=>{const{__scopeDialog:r,children:n,open:o,defaultOpen:s,onOpenChange:i,modal:c=!0}=t,l=a.useRef(null),d=a.useRef(null),[u,f]=sl({prop:o,defaultProp:s??!1,onChange:i,caller:Pd});return e.jsx(Dd,{scope:r,triggerRef:l,contentRef:d,contentId:al(),titleId:al(),descriptionId:al(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};Md.displayName=Pd;var Fd="DialogTrigger",zd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ud(Fd,n),s=Zs(r,o.triggerRef);return e.jsx(dl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ou(o.open),...a,ref:s,onClick:Qc(t.onClick,o.onOpenToggle)})});zd.displayName=Fd;var Ld="DialogPortal",[$d,Vd]=Od(Ld,{forceMount:void 0}),Wd=t=>{const{__scopeDialog:r,forceMount:n,children:o,container:s}=t,i=Ud(Ld,r);return e.jsx($d,{scope:r,forceMount:n,children:a.Children.map(o,t=>e.jsx(Tl,{present:n||i.open,children:e.jsx(_l,{asChild:!0,container:s,children:t})}))})};Wd.displayName=Ld;var Bd="DialogOverlay",Gd=a.forwardRef((t,r)=>{const n=Vd(Bd,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Ud(Bd,t.__scopeDialog);return s.modal?e.jsx(Tl,{present:a||s.open,children:e.jsx(Kd,{...o,ref:r})}):null});Gd.displayName=Bd;var Hd=function(t){const r=_d(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Rd);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),Kd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ud(Bd,n);return e.jsx(wd,{as:Hd,allowPinchZoom:!0,shards:[o.contentRef],children:e.jsx(dl.div,{"data-state":ou(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Zd="DialogContent",Jd=a.forwardRef((t,r)=>{const n=Vd(Zd,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Ud(Zd,t.__scopeDialog);return e.jsx(Tl,{present:a||s.open,children:s.modal?e.jsx(qd,{...o,ref:r}):e.jsx(Yd,{...o,ref:r})})});Jd.displayName=Zd;var qd=a.forwardRef((t,r)=>{const n=Ud(Zd,t.__scopeDialog),o=a.useRef(null),s=Zs(r,n.contentRef,o);return a.useEffect(()=>{const e=o.current;if(e)return Cd(e)},[]),e.jsx(Xd,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qc(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Qc(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Qc(t.onFocusOutside,e=>e.preventDefault())})}),Yd=a.forwardRef((t,r)=>{const n=Ud(Zd,t.__scopeDialog),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(Xd,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(o.current||n.triggerRef.current?.focus(),e.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(o.current=!0,"pointerdown"===e.detail.originalEvent.type&&(s.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&s.current&&e.preventDefault()}})}),Xd=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,...c}=t,l=Ud(Zd,n),d=a.useRef(null),u=Zs(r,d);return Ol(),e.jsxs(e.Fragment,{children:[e.jsx(Sl,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:i,children:e.jsx(gl,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ou(l.open),...c,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(lu,{titleId:l.titleId}),e.jsx(du,{contentRef:d,descriptionId:l.descriptionId})]})]})}),Qd="DialogTitle",eu=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ud(Qd,n);return e.jsx(dl.h2,{id:o.titleId,...a,ref:r})});eu.displayName=Qd;var tu="DialogDescription",ru=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ud(tu,n);return e.jsx(dl.p,{id:o.descriptionId,...a,ref:r})});ru.displayName=tu;var nu="DialogClose",au=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ud(nu,n);return e.jsx(dl.button,{type:"button",...a,ref:r,onClick:Qc(t.onClick,()=>o.onOpenChange(!1))})});function ou(e){return e?"open":"closed"}au.displayName=nu;var su="DialogTitleWarning",[iu,cu]=function(t,r){const n=a.createContext(r),o=t=>{const{children:r,...o}=t,s=a.useMemo(()=>o,Object.values(o));return e.jsx(n.Provider,{value:s,children:r})};return o.displayName=t+"Provider",[o,function(e){const o=a.useContext(n);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(su,{contentName:Zd,titleName:Qd,docsSlug:"dialog"}),lu=({titleId:e})=>{const t=cu(su),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 a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},du=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${cu("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},uu=Md,fu=zd,pu=Wd,mu=Gd,hu=Jd,gu=eu,vu=ru,bu=au;function yu(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 xu=["color"],wu=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=yu(e,xu);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Su=["color"],ku=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=yu(e,Su);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))}),ju=["color"],Eu=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=yu(e,ju);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Au=["color"],Nu=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=yu(e,Au);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))});const Cu=uu,_u=fu,Tu=pu,Ru=a.forwardRef(({className:t,...r},n)=>e.jsx(mu,{ref:n,className:Bc("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",t),...r}));Ru.displayName=mu.displayName;const Pu=a.forwardRef(({className:t,children:r,...n},o)=>{const{container:s}=a.useContext(ge);return e.jsxs(Tu,{container:s,children:[e.jsx(Ru,{}),e.jsxs(hu,{ref:o,className:Bc("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",t),...n,children:[r,e.jsxs(bu,{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:[e.jsx(Eu,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});Pu.displayName=hu.displayName;const Ou=({className:t,...r})=>e.jsx("div",{className:Bc("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});Ou.displayName="DialogHeader";const Iu=a.forwardRef(({className:t,...r},n)=>e.jsx(gu,{ref:n,className:Bc("text-lg font-semibold leading-none tracking-tight",t),...r}));Iu.displayName=gu.displayName;const Du=a.forwardRef(({className:t,...r},n)=>e.jsx(vu,{ref:n,className:Bc("text-sm text-muted-foreground",t),...r}));Du.displayName=vu.displayName;var Uu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Xs(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Mu=a.forwardRef((t,r)=>e.jsx(Uu.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Mu.displayName="Label";var Fu=Mu;const zu=qc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Lu=a.forwardRef(({className:t,...r},n)=>e.jsx(Fu,{ref:n,className:Bc(zu(),t),...r}));Lu.displayName=Fu.displayName;const $u=tt,Vu=a.createContext({}),Wu=({...t})=>e.jsx(Vu.Provider,{value:{name:t.name},children:e.jsx(lt,{...t})}),Bu=()=>{const e=a.useContext(Vu),t=a.useContext(Gu),{getFieldState:r,formState:n}=et(),o=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},Gu=a.createContext({}),Hu=a.forwardRef(({className:t,...r},n)=>{const o=a.useId();return e.jsx(Gu.Provider,{value:{id:o},children:e.jsx("div",{ref:n,className:Bc("space-y-2",t),...r})})});Hu.displayName="FormItem";const Ku=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:o}=Bu();return e.jsx(Lu,{ref:n,className:Bc(a&&"text-destructive",t),htmlFor:o,...r})});Ku.displayName="FormLabel";const Zu=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:s}=Bu();return e.jsx(Qs,{ref:r,id:a,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...t})});Zu.displayName="FormControl";const Ju=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=Bu();return e.jsx("p",{ref:n,id:a,className:Bc("text-sm text-muted-foreground",t),...r})});Ju.displayName="FormDescription";const qu=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:o,formMessageId:s}=Bu(),i=o?String(o?.message):r;return i?e.jsx("p",{ref:a,id:s,className:Bc("text-sm font-medium text-destructive",t),...n,children:i}):null});qu.displayName="FormMessage";const Yu=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:Bc("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",t),ref:a,...n}));function Xu(t){const r=Qu(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(tf);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}function Qu(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ks(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Yu.displayName="Input";var ef=Symbol("radix.slottable");function tf(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ef}function rf(r){const n=r+"CollectionProvider",[a,o]=el(n),[s,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),c=r=>{const{scope:n,children:a}=r,o=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(s,{scope:n,itemMap:i,collectionRef:o,children:a})};c.displayName=n;const l=r+"CollectionSlot",d=Xu(l),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,o=Zs(r,i(l,n).collectionRef);return e.jsx(d,{ref:o,children:a})});u.displayName=l;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=Xu(f),h=t.forwardRef((r,n)=>{const{scope:a,children:o,...s}=r,c=t.useRef(null),l=Zs(n,c),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(c,{ref:c,...s}),()=>{d.itemMap.delete(c)})),e.jsx(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},o]}var nf=a.createContext(void 0);function af(e){const t=a.useContext(nf);return e||t||"ltr"}var of="rovingFocusGroup.onEntryFocus",sf={bubbles:!1,cancelable:!0},cf="RovingFocusGroup",[lf,df,uf]=rf(cf),[ff,pf]=el(cf,[uf]),[mf,hf]=ff(cf),gf=a.forwardRef((t,r)=>e.jsx(lf.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(lf.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(vf,{...t,ref:r})})}));gf.displayName=cf;var vf=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Zs(r,m),g=af(i),[v,b]=sl({prop:c,defaultProp:l??null,onChange:d,caller:cf}),[y,x]=a.useState(!1),w=Bs(u),S=df(n),k=a.useRef(!1),[j,E]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(of,w),()=>e.removeEventListener(of,w)},[w]),e.jsx(mf,{scope:n,orientation:o,dir:g,loop:s,currentTabStopId:v,onItemFocus:a.useCallback(e=>b(e),[b]),onItemShiftTab:a.useCallback(()=>x(!0),[]),onFocusableItemAdd:a.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>E(e=>e-1),[]),children:e.jsx(dl.div,{tabIndex:y||0===j?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:Qc(t.onMouseDown,()=>{k.current=!0}),onFocus:Qc(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(of,sf);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);wf([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:Qc(t.onBlur,()=>x(!1))})})}),bf="RovingFocusGroupItem",yf=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:i,children:c,...l}=t,d=al(),u=i||d,f=hf(bf,n),p=f.currentTabStopId===u,m=df(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return a.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),e.jsx(lf.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:e.jsx(dl.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:Qc(t.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:Qc(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Qc(t.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:xf[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(()=>wf(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});yf.displayName=bf;var xf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function wf(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 Sf=gf,kf=yf;function jf(e){const[t,r]=a.useState(void 0);return Gs(()=>{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 Ef(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Af="Radio",[Nf,Cf]=el(Af),[_f,Tf]=Nf(Af),Rf=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:o,checked:s=!1,required:i,disabled:c,value:l="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Zs(r,e=>m(e)),g=a.useRef(!1),v=!p||(u||!!p.closest("form"));return e.jsxs(_f,{scope:n,checked:s,disabled:c,children:[e.jsx(dl.button,{type:"button",role:"radio","aria-checked":s,"data-state":Df(s),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onClick:Qc(t.onClick,e=>{s||d?.(),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&e.jsx(If,{control:p,bubbles:!g.current,name:o,value:l,checked:s,required:i,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});Rf.displayName=Af;var Pf="RadioIndicator",Of=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...o}=t,s=Tf(Pf,n);return e.jsx(Tl,{present:a||s.checked,children:e.jsx(dl.span,{"data-state":Df(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:r})})});Of.displayName=Pf;var If=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Zs(c,i),d=Ef(n),u=jf(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:o});r.call(e,n),e.dispatchEvent(t)}},[d,n,o]),e.jsx(dl.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Df(e){return e?"checked":"unchecked"}If.displayName="RadioBubbleInput";var Uf=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mf="RadioGroup",[Ff]=el(Mf,[pf,Cf]),zf=pf(),Lf=Cf(),[$f,Vf]=Ff(Mf),Wf=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:s,required:i=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=zf(n),h=af(d),[g,v]=sl({prop:s,defaultProp:o??null,onChange:f,caller:Mf});return e.jsx($f,{scope:n,name:a,required:i,disabled:c,value:g,onValueChange:v,children:e.jsx(Sf,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:e.jsx(dl.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});Wf.displayName=Mf;var Bf="RadioGroupItem",Gf=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:o,...s}=t,i=Vf(Bf,n),c=i.disabled||o,l=zf(n),d=Lf(n),u=a.useRef(null),f=Zs(r,u),p=i.value===s.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Uf.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)}},[]),e.jsx(kf,{asChild:!0,...l,focusable:!c,active:p,children:e.jsx(Rf,{disabled:c,required:i.required,checked:p,...d,...s,name:i.name,ref:f,onCheck:()=>i.onValueChange(s.value),onKeyDown:Qc(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Qc(s.onFocus,()=>{m.current&&u.current?.click()})})})});Gf.displayName=Bf;var Hf=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,o=Lf(n);return e.jsx(Of,{...o,...a,ref:r})});Hf.displayName="RadioGroupIndicator";var Kf=Wf,Zf=Gf,Jf=Hf;const qf=a.forwardRef(({className:t,...r},n)=>e.jsx(Kf,{className:Bc("grid gap-2",t),...r,ref:n}));qf.displayName=Kf.displayName;const Yf=a.forwardRef(({className:t,...r},n)=>e.jsx(Zf,{ref:n,className:Bc("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",t),...r,children:e.jsx(Jf,{className:"flex items-center justify-center",children:e.jsx(ku,{className:"h-3.5 w-3.5 fill-primary"})})}));function Xf(e,[t,r]){return Math.min(r,Math.max(t,e))}Yf.displayName=Zf.displayName;var Qf="ScrollArea",[ep]=el(Qf),[tp,rp]=ep(Qf),np=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:o="hover",dir:s,scrollHideDelay:i=600,...c}=t,[l,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[v,b]=a.useState(null),[y,x]=a.useState(0),[w,S]=a.useState(0),[k,j]=a.useState(!1),[E,A]=a.useState(!1),N=Zs(r,e=>d(e)),C=af(s);return e.jsx(tp,{scope:n,type:o,dir:C,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:j,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:A,onCornerWidthChange:x,onCornerHeightChange:S,children:e.jsx(dl.div,{dir:C,...c,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});np.displayName=Qf;var ap="ScrollAreaViewport",op=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:o,nonce:s,...i}=t,c=rp(ap,n),l=Zs(r,a.useRef(null),c.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("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:s}),e.jsx(dl.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});op.displayName=ap;var sp="ScrollAreaScrollbar",ip=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=rp(sp,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:c}=s,l="horizontal"===t.orientation;return a.useEffect(()=>(l?i(!0):c(!0),()=>{l?i(!1):c(!1)}),[l,i,c]),"hover"===s.type?e.jsx(cp,{...o,ref:r,forceMount:n}):"scroll"===s.type?e.jsx(lp,{...o,ref:r,forceMount:n}):"auto"===s.type?e.jsx(dp,{...o,ref:r,forceMount:n}):"always"===s.type?e.jsx(up,{...o,ref:r}):null});ip.displayName=sp;var cp=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=rp(sp,t.__scopeScrollArea),[i,c]=a.useState(!1);return a.useEffect(()=>{const e=s.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),s.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[s.scrollArea,s.scrollHideDelay]),e.jsx(Tl,{present:n||i,children:e.jsx(dp,{"data-state":i?"visible":"hidden",...o,ref:r})})}),lp=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=rp(sp,t.__scopeScrollArea),i="horizontal"===t.orientation,c=Tp(()=>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"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,s.scrollHideDelay,d]),a.useEffect(()=>{const e=s.viewport,t=i?"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)}},[s.viewport,i,d,c]),e.jsx(Tl,{present:n||"hidden"!==l,children:e.jsx(up,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:Qc(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Qc(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),dp=a.forwardRef((t,r)=>{const n=rp(sp,t.__scopeScrollArea),{forceMount:o,...s}=t,[i,c]=a.useState(!1),l="horizontal"===t.orientation,d=Tp(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;c(l?e:t)}},10);return Rp(n.viewport,d),Rp(n.content,d),e.jsx(Tl,{present:o||i,children:e.jsx(up,{"data-state":i?"visible":"hidden",...s,ref:r})})}),up=a.forwardRef((t,r)=>{const{orientation:n="vertical",...o}=t,s=rp(sp,t.__scopeScrollArea),i=a.useRef(null),c=a.useRef(0),[l,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=jp(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Ep(r),o=a/2,s=t||o,i=a-s,c=r.scrollbar.paddingStart+s,l=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Np([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===n?e.jsx(fp,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=Ap(s.viewport.scrollLeft,l,s.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollLeft=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollLeft=p(e,s.dir))}}):"vertical"===n?e.jsx(pp,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=Ap(s.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollTop=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollTop=p(e))}}):null}),fp=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=rp(sp,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Zs(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(gp,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ep(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),Cp(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:kp(c.paddingLeft),paddingEnd:kp(c.paddingRight)}})}})}),pp=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=rp(sp,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Zs(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(gp,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ep(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),Cp(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:kp(c.paddingTop),paddingEnd:kp(c.paddingBottom)}})}})}),[mp,hp]=ep(sp),gp=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:s,onThumbChange:i,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=rp(sp,n),[g,v]=a.useState(null),b=Zs(r,e=>v(e)),y=a.useRef(null),x=a.useRef(""),w=h.viewport,S=o.content-o.viewport,k=Bs(f),j=Bs(d),E=Tp(p,10);function A(e){if(y.current){const t=e.clientX-y.current.left,r=e.clientY-y.current.top;u({x:t,y:r})}}return a.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})},[w,g,S,k]),a.useEffect(j,[o,j]),Rp(g,E),Rp(h.content,E),e.jsx(mp,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:Bs(i),onThumbPointerUp:Bs(c),onThumbPositionChange:j,onThumbPointerDown:Bs(l),children:e.jsx(dl.div,{...m,ref:b,style:{position:"absolute",...m.style},onPointerDown:Qc(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),A(e)}}),onPointerMove:Qc(t.onPointerMove,A),onPointerUp:Qc(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),vp="ScrollAreaThumb",bp=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,o=hp(vp,t.__scopeScrollArea);return e.jsx(Tl,{present:n||o.hasThumb,children:e.jsx(yp,{ref:r,...a})})}),yp=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:o,...s}=t,i=rp(vp,n),c=hp(vp,n),{onThumbPositionChange:l}=c,d=Zs(r,e=>c.onThumbChange(e)),u=a.useRef(void 0),f=Tp(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=_p(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,l]),e.jsx(dl.div,{"data-state":c.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Qc(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:Qc(t.onPointerUp,c.onThumbPointerUp)})});bp.displayName=vp;var xp="ScrollAreaCorner",wp=a.forwardRef((t,r)=>{const n=rp(xp,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Sp,{...t,ref:r}):null});wp.displayName=xp;var Sp=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...o}=t,s=rp(xp,n),[i,c]=a.useState(0),[l,d]=a.useState(0),u=Boolean(i&&l);return Rp(s.scrollbarX,()=>{const e=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(e),d(e)}),Rp(s.scrollbarY,()=>{const e=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(e),c(e)}),u?e.jsx(dl.div,{...o,ref:r,style:{width:i,height:l,position:"absolute",right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:0,...t.style}}):null});function kp(e){return e?parseInt(e,10):0}function jp(e,t){const r=e/t;return isNaN(r)?0:r}function Ep(e){const t=jp(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Ap(e,t,r="ltr"){const n=Ep(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,s=t.content-t.viewport,i=o-n,c=Xf(e,"ltr"===r?[0,s]:[-1*s,0]);return Np([0,s],[0,i])(c)}function Np(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 Cp(e,t){return e>0&&e<t}var _p=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},s=r.left!==o.left,i=r.top!==o.top;(s||i)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Tp(e,t){const r=Bs(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Rp(e,t){const r=Bs(t);Gs(()=>{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 Pp=np,Op=op,Ip=wp;const Dp=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Pp,{ref:a,className:Bc("relative overflow-hidden",t),...n,children:[e.jsx(Op,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Up,{}),e.jsx(Ip,{})]}));Dp.displayName=Pp.displayName;const Up=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(ip,{ref:a,orientation:r,className:Bc("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]",t),...n,children:e.jsx(bp,{className:Bc("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Up.displayName=ip.displayName;var Mp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Xs(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Fp="horizontal",zp=["horizontal","vertical"],Lp=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Fp,...o}=t,s=function(e){return zp.includes(e)}(a)?a:Fp,i=n?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};return e.jsx(Mp.div,{"data-orientation":s,...i,...o,ref:r})});Lp.displayName="Separator";var $p=Lp;const Vp=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},o)=>e.jsx($p,{ref:o,decorative:n,orientation:r,className:Bc("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));function Wp(){const e=ie(),r=se(e=>e.os),{serverUrl:n,version:a,orgId:o,settings:s}=r,i=t.useRef(!1),c=t.useCallback(async t=>{if(i.current)return s||null;if(s)return s;if(!n||!a||!o)return null;i.current=!0;try{const r=E(),s=await de(`${n}/api/${a}/public/${o}/settings`,{headers:r,signal:t});if(!s.ok)throw new Error("Failed to fetch settings");const i=await s.json();return e.os(U(i)),i}catch(e){return le(e)||console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[n,a,o,s,e]);return t.useEffect(()=>{if(!n||!a||!o||s||i.current)return;const e=new AbortController;return c(e.signal),()=>{e.abort()}},[n,a,o,c]),t.useMemo(()=>({settings:s,getSettings:c}),[s,c])}Vp.displayName=$p.displayName;var Bp=Symbol("radix.slottable");var Gp="AlertDialog",[Hp]=el(Gp,[Id]),Kp=Id(),Zp=t=>{const{__scopeAlertDialog:r,...n}=t,a=Kp(r);return e.jsx(uu,{...a,...n,modal:!0})};Zp.displayName=Gp;var Jp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Kp(n);return e.jsx(fu,{...o,...a,ref:r})});Jp.displayName="AlertDialogTrigger";var qp=t=>{const{__scopeAlertDialog:r,...n}=t,a=Kp(r);return e.jsx(pu,{...a,...n})};qp.displayName="AlertDialogPortal";var Yp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Kp(n);return e.jsx(mu,{...o,...a,ref:r})});Yp.displayName="AlertDialogOverlay";var Xp="AlertDialogContent",[Qp,em]=Hp(Xp),tm=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=Bp,r}("AlertDialogContent"),rm=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:o,...s}=t,i=Kp(n),c=a.useRef(null),l=Zs(r,c),d=a.useRef(null);return e.jsx(iu,{contentName:Xp,titleName:nm,docsSlug:"alert-dialog",children:e.jsx(Qp,{scope:n,cancelRef:d,children:e.jsxs(hu,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Qc(s.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(tm,{children:o}),e.jsx(dm,{contentRef:c})]})})})});rm.displayName=Xp;var nm="AlertDialogTitle",am=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Kp(n);return e.jsx(gu,{...o,...a,ref:r})});am.displayName=nm;var om="AlertDialogDescription",sm=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Kp(n);return e.jsx(vu,{...o,...a,ref:r})});sm.displayName=om;var im=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Kp(n);return e.jsx(bu,{...o,...a,ref:r})});im.displayName="AlertDialogAction";var cm="AlertDialogCancel",lm=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:o}=em(cm,n),s=Kp(n),i=Zs(r,o);return e.jsx(bu,{...s,...a,ref:i})});lm.displayName=cm;var dm=({contentRef:e})=>{const t=`\`${Xp}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${Xp}\` by passing a \`${om}\` 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 \`${Xp}\`. 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 a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},um=Yp,fm=rm,pm=im,mm=lm,hm=am,gm=sm;const vm=Zp,bm=Jp,ym=qp,xm=a.forwardRef(({className:t,...r},n)=>e.jsx(um,{className:Bc("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",t),...r,ref:n}));xm.displayName=um.displayName;const wm=a.forwardRef(({className:t,...r},n)=>{const{container:o}=a.useContext(ge);return e.jsxs(ym,{container:o,children:[e.jsx(xm,{}),e.jsx(fm,{ref:n,className:Bc("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",t),...r})]})});wm.displayName=fm.displayName;const Sm=({className:t,...r})=>e.jsx("div",{className:Bc("flex flex-col space-y-2 text-center sm:text-left",t),...r});Sm.displayName="AlertDialogHeader";const km=({className:t,...r})=>e.jsx("div",{className:Bc("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});km.displayName="AlertDialogFooter";const jm=a.forwardRef(({className:t,...r},n)=>e.jsx(hm,{ref:n,className:Bc("text-lg font-semibold",t),...r}));jm.displayName=hm.displayName;const Em=a.forwardRef(({className:t,...r},n)=>e.jsx(gm,{ref:n,className:Bc("text-sm text-muted-foreground",t),...r}));Em.displayName=gm.displayName;const Am=a.forwardRef(({className:t,...r},n)=>e.jsx(pm,{ref:n,className:Bc(Yc(),t),...r}));Am.displayName=pm.displayName;const Nm=a.forwardRef(({className:t,...r},n)=>e.jsx(mm,{ref:n,className:Bc(Yc({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));Nm.displayName=mm.displayName;const Cm="saas-workspace-current",_m=()=>b(Cm),Tm=(e,t)=>!!e&&t.some(t=>t._id===e);function Rm(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 Pm({className:t,...r}){return e.jsx("div",{className:Bc("animate-pulse rounded-md bg-primary/10",t),...r})}function Om(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(Pm,{className:"h-10 w-full"}),e.jsx(Pm,{className:"h-10 w-full"}),e.jsx(Pm,{className:"h-10 w-full"})]})}const Im=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:o}=_x(),s=se(e=>e.auth.session?.user||null);if(!r)return e.jsx(Om,{});const i=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}(r,s?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("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 ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(vm,{children:[e.jsx(bm,{asChild:!0,children:e.jsxs(Xc,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(ko,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(wm,{children:[e.jsxs(Sm,{children:[e.jsx(jm,{children:"Are you absolutely sure?"}),e.jsxs(Em,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(km,{children:[e.jsx(Nm,{disabled:n,children:"Cancel"}),e.jsx(Am,{onClick:async()=>{a(!0);try{await o(r._id)}catch(e){c(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(go,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Dm="Switch",[Um]=el(Dm),[Mm,Fm]=Um(Dm),zm=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:o,checked:s,defaultChecked:i,required:c,disabled:l,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Zs(r,e=>h(e)),v=a.useRef(!1),b=!m||(f||!!m.closest("form")),[y,x]=sl({prop:s,defaultProp:i??!1,onChange:u,caller:Dm});return e.jsxs(Mm,{scope:n,checked:y,disabled:l,children:[e.jsx(dl.button,{type:"button",role:"switch","aria-checked":y,"aria-required":c,"data-state":Wm(y),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:Qc(t.onClick,e=>{x(e=>!e),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),b&&e.jsx(Vm,{control:m,bubbles:!v.current,name:o,value:d,checked:y,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});zm.displayName=Dm;var Lm="SwitchThumb",$m=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,o=Fm(Lm,n);return e.jsx(dl.span,{"data-state":Wm(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});$m.displayName=Lm;var Vm=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Zs(c,i),d=Ef(n),u=jf(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:o});r.call(e,n),e.dispatchEvent(t)}},[d,n,o]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Wm(e){return e?"checked":"unchecked"}Vm.displayName="SwitchBubbleInput";var Bm=zm,Gm=$m;const Hm=a.forwardRef(({className:t,...r},n)=>e.jsx(Bm,{className:Bc("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",t),...r,ref:n,children:e.jsx(Gm,{className:Bc("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")})}));Hm.displayName=Bm.displayName;const Km=({workspaceId:r})=>{const[n,a]=t.useState({}),[o,s]=t.useState(null),{allFeatures:i,updateFeature:c,getWorkspace:l}=_x(),[d,u]=t.useState(null),f=se(e=>e.auth.session?.user||null);if(t.useEffect(()=>{l(r).then(u)},[r]),!d)return e.jsx(Om,{});const p=Rm(d,f?.id??null);return e.jsxs("div",{children:[o&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:o})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!i.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),i.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:i.map(t=>{const r=d?.features?.[t.slug],o=null!==n[t.slug]&&void 0!==n[t.slug],l=n[t.slug],f=!0===l?"Enabling":!1===l?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),o?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(go,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):e.jsx(Hm,{disabled:!p,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(d){a(r=>({...r,[e]:t})),s(null);try{const r=await c(d._id,e,t);u(r);const n=i.find(t=>t.slug===e);s(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{s(null)},5e3)}catch(e){console.error("Failed to update feature:",e)}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})};function Zm(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 Jm=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑💻","👨💻","👩💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨💼","👩💼","👨🏫","👩🏫","👨🔬","👩🔬","👨🎨","👩🎨","👨🔧","👩🔧","👨🚀","👩🚀","👨⚖️","👩⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️🌈","🎟️","🎫"],qm=({workspace:r})=>{const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState(),[l,d]=t.useState(null),{updateWorkspace:u}=_x(),f=se(e=>e.auth.session?.user||null),p=Gt({resolver:eo(Es({name:Xo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Xo().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Om,{});const m=Rm(r,f?.id??null);return e.jsxs("div",{children:[l&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:l})]}),!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx($u,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){a(!0),d(null);try{await u(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:[e.jsx(Wu,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Hu,{children:[e.jsx(Ku,{children:"Name"}),e.jsx(Zu,{children:e.jsx(Yu,{placeholder:"My Awesome Workspace",...t,disabled:!m})}),e.jsx(qu,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Lu,{className:"text-sm font-medium",children:"Icon"}),e.jsx(Ju,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(qf,{value:o,disabled:!m,onValueChange:e=>s(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yf,{value:"emoji",id:"emoji"}),e.jsxs(Lu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(wo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yf,{value:"url",id:"url"}),e.jsxs(Lu,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&p.watch("image")?.trim()&&e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview"})]})]}),m&&e.jsx(Dp,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:Jm.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",Zm(e))})(t),disabled:!m,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Wu,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Hu,{children:[e.jsx(Ku,{children:"Image URL"}),e.jsx(Zu,{children:e.jsx(Yu,{placeholder:"https://example.com/image.png",...t,disabled:!m})}),e.jsx(Ju,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(qu,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:m&&e.jsx(Xc,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var Ym=.999,Xm=/[\\\/_+.#"@\[\(\{&]/,Qm=/[\\\/_+.#"@\[\(\{&]/g,eh=/[\s-]/,th=/[\s-]/g;function rh(e,t,r,n,a,o,s){if(o===t.length)return a===e.length?1:.99;var i=`${a},${o}`;if(void 0!==s[i])return s[i];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=rh(e,t,r,n,p+1,o+1,s))>m&&(p===a?c*=1:Xm.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Qm))&&a>0&&(c*=Math.pow(Ym,d.length))):eh.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(th))&&a>0&&(c*=Math.pow(Ym,u.length))):(c*=.17,a>0&&(c*=Math.pow(Ym,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=rh(e,t,r,n,p+1,o+2,s))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return s[i]=m,m}function nh(e){return e.toLowerCase().replace(th," ")}function ah(e,t,r){return rh(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,nh(e),nh(t),0,0,{})}var oh='[cmdk-group=""]',sh='[cmdk-group-items=""]',ih='[cmdk-item=""]',ch=`${ih}:not([aria-disabled="true"])`,lh="cmdk-item-select",dh="data-value",uh=(e,t,r)=>ah(e,t,r),fh=a.createContext(void 0),ph=()=>a.useContext(fh),mh=a.createContext(void 0),hh=()=>a.useContext(mh),gh=a.createContext(void 0),vh=a.forwardRef((e,t)=>{let r=Rh(()=>{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}}}),n=Rh(()=>new Set),o=Rh(()=>new Map),s=Rh(()=>new Map),i=Rh(()=>new Set),c=_h(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,y=al(),x=al(),w=al(),S=a.useRef(null),k=Ih();Th(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,j.emit()}},[u]),Th(()=>{k(6,T)},[]);let j=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,s,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),N(),k(1,C);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(y))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,j.emit()}),n||k(5,T),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(i=(s=c.current).onValueChange)||i.call(s,e))}}j.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),E=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=s.current.get(e))?void 0:a.value)&&(s.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,A(t,n)),k(2,()=>{N(),j.emit()}))},item:(e,t)=>(n.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{_(),N(),r.current.value||C(),j.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&C(),j.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:y,inputId:w,labelId:x,listInnerRef:S}),[]);function A(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:uh;return e?o(e,r.current.search,t):0}function N(){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;P().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),s=r.getAttribute("id");return(null!=(n=e.get(s))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(sh);t?t.appendChild(e.parentElement===t?e:e.closest(`${sh} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${sh} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${oh}[${dh}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function C(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(dh);j.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of n.current){let n=A(null!=(t=null==(e=s.current.get(o))?void 0:e.value)?t:"",null!=(i=null==(a=s.current.get(o))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(o,n),n>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 T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(oh))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${ih}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(ch))||[])}function O(e){let t=P()[e];t&&j.setState("value",t.getAttribute(dh))}function I(e){var t;let r=R(),n=P(),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&&j.setState("value",o.getAttribute(dh))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(oh);for(;n&&!t;)n=e>0?Nh(n,oh):Ch(n,oh),t=null==n?void 0:n.querySelector(ch);t?j.setState("value",t.getAttribute(dh)):I(e)}let U=()=>O(P().length-1),M=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},F=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(dl.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&M(e);break;case"ArrowDown":M(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(lh);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:Uh},l),Dh(e,e=>a.createElement(mh.Provider,{value:j},a.createElement(fh.Provider,{value:E},e))))}),bh=a.forwardRef((e,t)=>{var r,n;let o=al(),s=a.useRef(null),i=a.useContext(gh),c=ph(),l=_h(e),d=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Th(()=>{if(!d)return c.item(o,null==i?void 0:i.id)},[d]);let u=Oh(o,s,[e.value,e.children,s],e.keywords),f=hh(),p=Ph(e=>e.value&&e.value===u.current),m=Ph(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(a.useEffect(()=>{let t=s.current;if(t&&!e.disabled)return t.addEventListener(lh,h),()=>t.removeEventListener(lh,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:b,onSelect:y,forceMount:x,keywords:w,...S}=e;return a.createElement(dl.div,{ref:Ks(s,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)}),yh=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:o,...s}=e,i=al(),c=a.useRef(null),l=a.useRef(null),d=al(),u=ph(),f=Ph(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Th(()=>u.group(i),[]),Oh(i,c,[e.value,e.heading,l]);let p=a.useMemo(()=>({id:i,forceMount:o}),[o]);return a.createElement(dl.div,{ref:Ks(c,t),...s,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Dh(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(gh.Provider,{value:p},e))))}),xh=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,o=a.useRef(null),s=Ph(e=>!e.search);return r||s?a.createElement(dl.div,{ref:Ks(o,t),...n,"cmdk-separator":"",role:"separator"}):null}),wh=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,o=null!=e.value,s=hh(),i=Ph(e=>e.search),c=Ph(e=>e.selectedItemId),l=ph();return a.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),a.createElement(dl.input,{ref:t,...n,"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:i,onChange:e=>{o||s.setState("search",e.target.value),null==r||r(e.target.value)}})}),Sh=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...o}=e,s=a.useRef(null),i=a.useRef(null),c=Ph(e=>e.selectedItemId),l=ph();return a.useEffect(()=>{if(i.current&&s.current){let e,t=i.current,r=s.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)}}},[]),a.createElement(dl.div,{ref:Ks(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:l.listId},Dh(e,e=>a.createElement("div",{ref:Ks(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),kh=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:o,contentClassName:s,container:i,...c}=e;return a.createElement(uu,{open:r,onOpenChange:n},a.createElement(pu,{container:i},a.createElement(mu,{"cmdk-overlay":"",className:o}),a.createElement(hu,{"aria-label":e.label,"cmdk-dialog":"",className:s},a.createElement(vh,{ref:t,...c}))))}),jh=a.forwardRef((e,t)=>Ph(e=>0===e.filtered.count)?a.createElement(dl.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Eh=a.forwardRef((e,t)=>{let{progress:r,children:n,label:o="Loading...",...s}=e;return a.createElement(dl.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Dh(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Ah=Object.assign(vh,{List:Sh,Item:bh,Input:wh,Group:yh,Separator:xh,Dialog:kh,Empty:jh,Loading:Eh});function Nh(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Ch(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function _h(e){let t=a.useRef(e);return Th(()=>{t.current=e}),t}var Th="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function Rh(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Ph(e){let t=hh(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Oh(e,t,r,n=[]){let o=a.useRef(),s=ph();return Th(()=>{var a;let i=(()=>{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=n.map(e=>e.trim());s.value(e,i,c),null==(a=t.current)||a.setAttribute(dh,i),o.current=i}),o}var Ih=()=>{let[e,t]=a.useState(),r=Rh(()=>new Map);return Th(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Dh({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.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 Uh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Mh=a.forwardRef(({className:t,...r},n)=>e.jsx(Ah,{ref:n,className:Bc("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Mh.displayName=Ah.displayName;const Fh=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(Nu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Ah.Input,{ref:n,className:Bc("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",t),...r})]}));Fh.displayName=Ah.Input.displayName;const zh=a.forwardRef(({className:t,...r},n)=>e.jsx(Ah.List,{ref:n,className:Bc("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));zh.displayName=Ah.List.displayName;a.forwardRef((t,r)=>e.jsx(Ah.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Ah.Empty.displayName;const Lh=a.forwardRef(({className:t,...r},n)=>e.jsx(Ah.Group,{ref:n,className:Bc("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",t),...r}));Lh.displayName=Ah.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Ah.Separator,{ref:n,className:Bc("-mx-1 h-px bg-border",t),...r})).displayName=Ah.Separator.displayName;const $h=a.forwardRef(({className:t,...r},n)=>e.jsx(Ah.Item,{ref:n,className:Bc("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",t),...r}));$h.displayName=Ah.Item.displayName;const Vh=["top","right","bottom","left"],Wh=Math.min,Bh=Math.max,Gh=Math.round,Hh=Math.floor,Kh=e=>({x:e,y:e}),Zh={left:"right",right:"left",bottom:"top",top:"bottom"},Jh={start:"end",end:"start"};function qh(e,t,r){return Bh(e,Wh(t,r))}function Yh(e,t){return"function"==typeof e?e(t):e}function Xh(e){return e.split("-")[0]}function Qh(e){return e.split("-")[1]}function eg(e){return"x"===e?"y":"x"}function tg(e){return"y"===e?"height":"width"}const rg=new Set(["top","bottom"]);function ng(e){return rg.has(Xh(e))?"y":"x"}function ag(e){return eg(ng(e))}function og(e){return e.replace(/start|end/g,e=>Jh[e])}const sg=["left","right"],ig=["right","left"],cg=["top","bottom"],lg=["bottom","top"];function dg(e,t,r,n){const a=Qh(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?ig:sg:t?sg:ig;case"left":case"right":return t?cg:lg;default:return[]}}(Xh(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(og)))),o}function ug(e){return e.replace(/left|right|bottom|top/g,e=>Zh[e])}function fg(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 pg(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 mg(e,t,r){let{reference:n,floating:a}=e;const o=ng(t),s=ag(t),i=tg(s),c=Xh(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/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(Qh(t)){case"start":p[s]-=f*(r&&l?-1:1);break;case"end":p[s]+=f*(r&&l?-1:1)}return p}async function hg(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:s,elements:i,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Yh(t,e),m=fg(p),h=i[f?"floating"===u?"reference":"floating":u],g=pg(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(i.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:s.floating.width,height:s.floating.height}:s.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(i.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},x=pg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:b,strategy:c}):v);return{top:(g.top-x.top+m.top)/y.y,bottom:(x.bottom-g.bottom+m.bottom)/y.y,left:(g.left-x.left+m.left)/y.x,right:(x.right-g.right+m.right)/y.x}}function gg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vg(e){return Vh.some(t=>e[t]>=0)}const bg=new Set(["left","top"]);function yg(){return"undefined"!=typeof window}function xg(e){return kg(e)?(e.nodeName||"").toLowerCase():"#document"}function wg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Sg(e){var t;return null==(t=(kg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function kg(e){return!!yg()&&(e instanceof Node||e instanceof wg(e).Node)}function jg(e){return!!yg()&&(e instanceof Element||e instanceof wg(e).Element)}function Eg(e){return!!yg()&&(e instanceof HTMLElement||e instanceof wg(e).HTMLElement)}function Ag(e){return!(!yg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof wg(e).ShadowRoot)}const Ng=new Set(["inline","contents"]);function Cg(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Lg(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Ng.has(a)}const _g=new Set(["table","td","th"]);function Tg(e){return _g.has(xg(e))}const Rg=[":popover-open",":modal"];function Pg(e){return Rg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Og=["transform","translate","scale","rotate","perspective"],Ig=["transform","translate","scale","rotate","perspective","filter"],Dg=["paint","layout","strict","content"];function Ug(e){const t=Mg(),r=jg(e)?Lg(e):e;return Og.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Ig.some(e=>(r.willChange||"").includes(e))||Dg.some(e=>(r.contain||"").includes(e))}function Mg(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Fg=new Set(["html","body","#document"]);function zg(e){return Fg.has(xg(e))}function Lg(e){return wg(e).getComputedStyle(e)}function $g(e){return jg(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vg(e){if("html"===xg(e))return e;const t=e.assignedSlot||e.parentNode||Ag(e)&&e.host||Sg(e);return Ag(t)?t.host:t}function Wg(e){const t=Vg(e);return zg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Eg(t)&&Cg(t)?t:Wg(t)}function Bg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=Wg(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),s=wg(a);if(o){const e=Gg(s);return t.concat(s,s.visualViewport||[],Cg(a)?a:[],e&&r?Bg(e):[])}return t.concat(a,Bg(a,[],r))}function Gg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hg(e){const t=Lg(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Eg(e),o=a?e.offsetWidth:r,s=a?e.offsetHeight:n,i=Gh(r)!==o||Gh(n)!==s;return i&&(r=o,n=s),{width:r,height:n,$:i}}function Kg(e){return jg(e)?e:e.contextElement}function Zg(e){const t=Kg(e);if(!Eg(t))return Kh(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Hg(t);let s=(o?Gh(r.width):r.width)/n,i=(o?Gh(r.height):r.height)/a;return s&&Number.isFinite(s)||(s=1),i&&Number.isFinite(i)||(i=1),{x:s,y:i}}const Jg=Kh(0);function qg(e){const t=wg(e);return Mg()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Jg}function Yg(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=Kg(e);let s=Kh(1);t&&(n?jg(n)&&(s=Zg(n)):s=Zg(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==wg(e))&&t}(o,r,n)?qg(o):Kh(0);let c=(a.left+i.x)/s.x,l=(a.top+i.y)/s.y,d=a.width/s.x,u=a.height/s.y;if(o){const e=wg(o),t=n&&jg(n)?wg(n):n;let r=e,a=Gg(r);for(;a&&n&&t!==r;){const e=Zg(a),t=a.getBoundingClientRect(),n=Lg(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,s=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=s,r=wg(a),a=Gg(r)}}return pg({width:d,height:u,x:c,y:l})}function Xg(e,t){const r=$g(e).scrollLeft;return t?t.left+r:Yg(Sg(e)).left+r}function Qg(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Xg(e,r),y:r.top+t.scrollTop}}const ev=new Set(["absolute","fixed"]);function tv(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=wg(e),n=Sg(e),a=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,i=0,c=0;if(a){o=a.width,s=a.height;const e=Mg();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,c=a.offsetTop)}const l=Xg(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,s=Math.abs(n.clientWidth-t.clientWidth-a);s<=25&&(o-=s)}else l<=25&&(o+=l);return{width:o,height:s,x:i,y:c}}(e,r);else if("document"===t)n=function(e){const t=Sg(e),r=$g(e),n=e.ownerDocument.body,a=Bh(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Bh(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+Xg(e);const i=-r.scrollTop;return"rtl"===Lg(n).direction&&(s+=Bh(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:s,y:i}}(Sg(e));else if(jg(t))n=function(e,t){const r=Yg(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Eg(e)?Zg(e):Kh(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=qg(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return pg(n)}function rv(e,t){const r=Vg(e);return!(r===t||!jg(r)||zg(r))&&("fixed"===Lg(r).position||rv(r,t))}function nv(e,t,r){const n=Eg(t),a=Sg(t),o="fixed"===r,s=Yg(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const c=Kh(0);function l(){c.x=Xg(a)}if(n||!n&&!o)if(("body"!==xg(t)||Cg(a))&&(i=$g(t)),n){const e=Yg(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?Kh(0):Qg(a,i);return{x:s.left+i.scrollLeft-c.x-d.x,y:s.top+i.scrollTop-c.y-d.y,width:s.width,height:s.height}}function av(e){return"static"===Lg(e).position}function ov(e,t){if(!Eg(e)||"fixed"===Lg(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Sg(e)===r&&(r=r.ownerDocument.body),r}function sv(e,t){const r=wg(e);if(Pg(e))return r;if(!Eg(e)){let t=Vg(e);for(;t&&!zg(t);){if(jg(t)&&!av(t))return t;t=Vg(t)}return r}let n=ov(e,t);for(;n&&Tg(n)&&av(n);)n=ov(n,t);return n&&zg(n)&&av(n)&&!Ug(n)?r:n||function(e){let t=Vg(e);for(;Eg(t)&&!zg(t);){if(Ug(t))return t;if(Pg(t))return null;t=Vg(t)}return null}(e)||r}const iv={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,s=Sg(n),i=!!t&&Pg(t.floating);if(n===s||i&&o)return r;let c={scrollLeft:0,scrollTop:0},l=Kh(1);const d=Kh(0),u=Eg(n);if((u||!u&&!o)&&(("body"!==xg(n)||Cg(s))&&(c=$g(n)),Eg(n))){const e=Yg(n);l=Zg(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!s||u||o?Kh(0):Qg(s,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:Sg,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?Pg(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Bg(e,[],!1).filter(e=>jg(e)&&"body"!==xg(e)),a=null;const o="fixed"===Lg(e).position;let s=o?Vg(e):e;for(;jg(s)&&!zg(s);){const t=Lg(s),r=Ug(s);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&ev.has(a.position)||Cg(s)&&!r&&rv(e,s))?n=n.filter(e=>e!==s):a=t,s=Vg(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=o[0],i=o.reduce((e,r)=>{const n=tv(t,r,a);return e.top=Bh(n.top,e.top),e.right=Wh(n.right,e.right),e.bottom=Wh(n.bottom,e.bottom),e.left=Bh(n.left,e.left),e},tv(t,s,a));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}},getOffsetParent:sv,getElementRects:async function(e){const t=this.getOffsetParent||sv,r=this.getDimensions,n=await r(e.floating);return{reference:nv(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}=Hg(e);return{width:t,height:r}},getScale:Zg,isElement:jg,isRTL:function(e){return"rtl"===Lg(e).direction}};function cv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lv(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=Kg(e),d=a||o?[...l?Bg(l):[],...Bg(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&i?function(e,t){let r,n=null;const a=Sg(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function s(i,c){void 0===i&&(i=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(i||t(),!f||!p)return;const m={rootMargin:-Hh(u)+"px "+-Hh(a.clientWidth-(d+f))+"px "+-Hh(a.clientHeight-(u+p))+"px "+-Hh(d)+"px",threshold:Bh(0,Wh(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return s();n?s(!1,n):r=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==n||cv(l,e.getBoundingClientRect())||s(),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;s&&(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?Yg(e):null;return c&&function t(){const n=Yg(e);h&&!cv(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 dv=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:s,middlewareData:i}=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)),s=Xh(r),i=Qh(r),c="y"===ng(r),l=bg.has(s)?-1:1,d=o&&c?-1:1,u=Yh(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 i&&"number"==typeof m&&(p="end"===i?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return s===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:s}}}}},uv=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:s=!1,limiter:i={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=Yh(e,t),l={x:r,y:n},d=await hg(t,c),u=ng(Xh(a)),f=eg(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=qh(p+d["y"===f?"top":"left"],p,p-d[e])}if(s){const e="y"===u?"bottom":"right";m=qh(m+d["y"===u?"top":"left"],m,m-d[e])}const h=i.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:s}}}}}},fv=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:s,initialPlacement:i,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=Yh(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=Xh(a),b=ng(i),y=Xh(i)===i,x=await(null==c.isRTL?void 0:c.isRTL(l.floating)),w=f||(y||!h?[ug(i)]:function(e){const t=ug(e);return[og(e),t,og(t)]}(i)),S="none"!==m;!f&&S&&w.push(...dg(i,h,m,x));const k=[i,...w],j=await hg(t,g),E=[];let A=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&E.push(j[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Qh(e),a=ag(e),o=tg(a);let s="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=ug(s)),[s,ug(s)]}(a,s,x);E.push(j[e[0]],j[e[1]])}if(A=[...A,{placement:a,overflows:E}],!E.every(e=>e<=0)){var N,C;const e=((null==(N=o.flip)?void 0:N.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&b!==ng(t))||A.every(e=>ng(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:A},reset:{placement:t}}}let r=null==(C=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:C.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=A.filter(e=>{if(S){const t=ng(e.placement);return t===b||"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:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},pv=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:s,elements:i}=t,{apply:c=()=>{},...l}=Yh(e,t),d=await hg(t,l),u=Xh(a),f=Qh(a),p="y"===ng(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==s.isRTL?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const b=h-d.top-d.bottom,y=m-d.left-d.right,x=Wh(h-d[g],b),w=Wh(m-d[v],y),S=!t.middlewareData.shift;let k=x,j=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(j=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=b),S&&!f){const e=Bh(d.left,0),t=Bh(d.right,0),r=Bh(d.top,0),n=Bh(d.bottom,0);p?j=m-2*(0!==e||0!==t?e+t:Bh(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Bh(d.top,d.bottom))}await c({...t,availableWidth:j,availableHeight:k});const E=await s.getDimensions(i.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},mv=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=Yh(e,t);switch(n){case"referenceHidden":{const e=gg(await hg(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:vg(e)}}}case"escaped":{const e=gg(await hg(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:vg(e)}}}default:return{}}}}},hv=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:s,elements:i,middlewareData:c}=t,{element:l,padding:d=0}=Yh(e,t)||{};if(null==l)return{};const u=fg(d),f={x:r,y:n},p=ag(a),m=tg(p),h=await s.getDimensions(l),g="y"===p,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",x=o.reference[m]+o.reference[p]-f[p]-o.floating[m],w=f[p]-o.reference[p],S=await(null==s.getOffsetParent?void 0:s.getOffsetParent(l));let k=S?S[y]:0;k&&await(null==s.isElement?void 0:s.isElement(S))||(k=i.floating[y]||o.floating[m]);const j=x/2-w/2,E=k/2-h[m]/2-1,A=Wh(u[v],E),N=Wh(u[b],E),C=A,_=k-h[m]-N,T=k/2-h[m]/2+j,R=qh(C,T,_),P=!c.arrow&&null!=Qh(a)&&T!==R&&o.reference[m]/2-(T<C?A:N)-h[m]/2<0,O=P?T<C?T-C:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),gv=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:s}=t,{offset:i=0,mainAxis:c=!0,crossAxis:l=!0}=Yh(e,t),d={x:r,y:n},u=ng(a),f=eg(u);let p=d[f],m=d[u];const h=Yh(i,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,b;const e="y"===f?"width":"height",t=bg.has(Xh(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=s.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},vv=(e,t,r)=>{const n=new Map,a={platform:iv,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:s}=r,i=o.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=mg(l,n,c),f=n,p={},m=0;for(let r=0;r<i.length;r++){const{name:o,fn:h}=i[r],{x:g,y:v,data:b,reset:y}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:s,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...b}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(l=!0===y.rects?await s.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:d,y:u}=mg(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var bv="undefined"!=typeof document?t.useLayoutEffect:function(){};function yv(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(!yv(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)&&!yv(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function xv(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wv(e,t){const r=xv(e);return Math.round(t*r)/r}function Sv(e){const t=a.useRef(e);return bv(()=>{t.current=e}),t}const kv=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?hv({element:r.current,padding:n}).fn(t):{}:r?hv({element:r,padding:n}).fn(t):{};var a}}),jv=(e,t)=>({...dv(e),options:[e,t]}),Ev=(e,t)=>({...uv(e),options:[e,t]}),Av=(e,t)=>({...gv(e),options:[e,t]}),Nv=(e,t)=>({...fv(e),options:[e,t]}),Cv=(e,t)=>({...pv(e),options:[e,t]}),_v=(e,t)=>({...mv(e),options:[e,t]}),Tv=(e,t)=>({...kv(e),options:[e,t]});var Rv=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:o=5,...s}=t;return e.jsx(dl.svg,{...s,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});Rv.displayName="Arrow";var Pv=Rv,Ov="Popper",[Iv,Dv]=el(Ov),[Uv,Mv]=Iv(Ov),Fv=t=>{const{__scopePopper:r,children:n}=t,[o,s]=a.useState(null);return e.jsx(Uv,{scope:r,anchor:o,onAnchorChange:s,children:n})};Fv.displayName=Ov;var zv="PopperAnchor",Lv=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:o,...s}=t,i=Mv(zv,n),c=a.useRef(null),l=Zs(r,c),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&i.onAnchorChange(d.current)}),o?null:e.jsx(dl.div,{...s,ref:l})});Lv.displayName=zv;var $v="PopperContent",[Vv,Wv]=Iv($v),Bv=a.forwardRef((t,r)=>{const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:c="center",alignOffset:l=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:v,...b}=t,y=Mv($v,n),[x,w]=a.useState(null),S=Zs(r,e=>w(e)),[k,j]=a.useState(null),E=jf(k),A=E?.width??0,N=E?.height??0,C=s+("center"!==c?"-"+c:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(Zv),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:M}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:c}={},transform:l=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);yv(m,n)||h(n);const[g,v]=a.useState(null),[b,y]=a.useState(null),x=a.useCallback(e=>{e!==j.current&&(j.current=e,v(e))},[]),w=a.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),S=i||g,k=c||b,j=a.useRef(null),E=a.useRef(null),A=a.useRef(f),N=null!=d,C=Sv(d),_=Sv(s),T=Sv(u),R=a.useCallback(()=>{if(!j.current||!E.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),vv(j.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!yv(A.current,t)&&(A.current=t,o.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);bv(()=>{!1===u&&A.current.isPositioned&&(A.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);bv(()=>(P.current=!0,()=>{P.current=!1}),[]),bv(()=>{if(S&&(j.current=S),k&&(E.current=k),S&&k){if(C.current)return C.current(S,k,R);R()}},[S,k,R,C,N]);const O=a.useMemo(()=>({reference:j,floating:E,setReference:x,setFloating:w}),[x,w]),I=a.useMemo(()=>({reference:S,floating:k}),[S,k]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=wv(I.floating,f.x),n=wv(I.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...xv(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:C,whileElementsMounted:(...e)=>lv(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[jv({mainAxis:i+N,alignmentAxis:l}),u&&Ev({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Av():void 0,...P}),u&&Nv({...P}),Cv({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${r}px`),s.setProperty("--radix-popper-available-height",`${n}px`),s.setProperty("--radix-popper-anchor-width",`${a}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&Tv({element:k,padding:d}),Jv({arrowWidth:A,arrowHeight:N}),h&&_v({strategy:"referenceHidden",...P})]}),[F,z]=qv(D),L=Bs(v);Gs(()=>{U&&L?.()},[U,L]);const $=M.arrow?.x,V=M.arrow?.y,W=0!==M.arrow?.centerOffset,[B,G]=a.useState();return Gs(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(Vv,{scope:n,placedSide:F,onArrowChange:j,arrowX:$,arrowY:V,shouldHideArrow:W,children:e.jsx(dl.div,{"data-side":F,"data-align":z,...b,ref:S,style:{...b.style,animation:U?void 0:"none"}})})})});Bv.displayName=$v;var Gv="PopperArrow",Hv={top:"bottom",right:"left",bottom:"top",left:"right"},Kv=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,o=Wv(Gv,n),s=Hv[o.placedSide];return e.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]: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:e.jsx(Pv,{...a,ref:r,style:{...a.style,display:"block"}})})});function Zv(e){return null!==e}Kv.displayName=Gv;var Jv=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,s=o?0:e.arrowWidth,i=o?0:e.arrowHeight,[c,l]=qv(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+s/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-i+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===c?(p=-i+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+i}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function qv(e){const[t,r="center"]=e.split("-");return[t,r]}var Yv=Fv,Xv=Lv,Qv=Bv,eb=Kv;function tb(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ks(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rb=Symbol("radix.slottable");function nb(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===rb}var ab="Popover",[ob]=el(ab,[Dv]),sb=Dv(),[ib,cb]=ob(ab),lb=t=>{const{__scopePopover:r,children:n,open:o,defaultOpen:s,onOpenChange:i,modal:c=!1}=t,l=sb(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=sl({prop:o,defaultProp:s??!1,onChange:i,caller:ab});return e.jsx(Yv,{...l,children:e.jsx(ib,{scope:r,contentId:al(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:c,children:n})})};lb.displayName=ab;var db="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...o}=t,s=cb(db,n),i=sb(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=s;return a.useEffect(()=>(c(),()=>l()),[c,l]),e.jsx(Xv,{...i,...o,ref:r})}).displayName=db;var ub="PopoverTrigger",fb=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=cb(ub,n),s=sb(n),i=Zs(r,o.triggerRef),c=e.jsx(dl.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":jb(o.open),...a,ref:i,onClick:Qc(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:e.jsx(Xv,{asChild:!0,...s,children:c})});fb.displayName=ub;var pb="PopoverPortal",[mb,hb]=ob(pb,{forceMount:void 0}),gb=t=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=t,s=cb(pb,r);return e.jsx(mb,{scope:r,forceMount:n,children:e.jsx(Tl,{present:n||s.open,children:e.jsx(_l,{asChild:!0,container:o,children:a})})})};gb.displayName=pb;var vb="PopoverContent",bb=a.forwardRef((t,r)=>{const n=hb(vb,t.__scopePopover),{forceMount:a=n.forceMount,...o}=t,s=cb(vb,t.__scopePopover);return e.jsx(Tl,{present:a||s.open,children:s.modal?e.jsx(xb,{...o,ref:r}):e.jsx(wb,{...o,ref:r})})});bb.displayName=vb;var yb=function(t){const r=tb(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(nb);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),xb=a.forwardRef((t,r)=>{const n=cb(vb,t.__scopePopover),o=a.useRef(null),s=Zs(r,o),i=a.useRef(!1);return a.useEffect(()=>{const e=o.current;if(e)return Cd(e)},[]),e.jsx(wd,{as:yb,allowPinchZoom:!0,children:e.jsx(Sb,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qc(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Qc(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:Qc(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),wb=a.forwardRef((t,r)=>{const n=cb(vb,t.__scopePopover),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(Sb,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(o.current||n.triggerRef.current?.focus(),e.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(o.current=!0,"pointerdown"===e.detail.originalEvent.type&&(s.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&s.current&&e.preventDefault()}})}),Sb=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=t,p=cb(vb,n),m=sb(n);return Ol(),e.jsx(Sl,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:s,children:e.jsx(gl,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(Qv,{"data-state":jb(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)"}})})})}),kb="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=cb(kb,n);return e.jsx(dl.button,{type:"button",...a,ref:r,onClick:Qc(t.onClick,()=>o.onOpenChange(!1))})}).displayName=kb;function jb(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=sb(n);return e.jsx(eb,{...o,...a,ref:r})}).displayName="PopoverArrow";var Eb=gb,Ab=bb;const Nb=lb,Cb=fb,_b=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...o},s)=>{const{container:i}=a.useContext(ge);return e.jsx(Eb,{container:i,children:e.jsx(Ab,{ref:s,align:r,sideOffset:n,className:Bc("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",t),...o})})});_b.displayName=Ab.displayName;const Tb={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"},Rb={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"},Pb=[{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=Rb[e.code]||"USD",r=Tb[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 Ob(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Pb.find(e=>e.value==n);return e.jsxs(Nb,{open:o,onOpenChange:s,children:[e.jsx(Cb,{asChild:!0,children:e.jsxs(Xc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[i?.text&&e.jsxs("div",{children:[String(i.text).trim(),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:i.flag})]}),!i&&e.jsx("span",{className:"text-muted-foreground",children:"Choose country"}),e.jsx(uo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(_b,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Mh,{children:[e.jsx(Fh,{placeholder:"Choose country..."}),e.jsx(zh,{children:e.jsx(Lh,{children:Pb.map(t=>e.jsxs($h,{className:Bc("whitespace-nowrap text-left",{"text-green-500":n===t.value}),value:t.value,defaultValue:t.value,onSelect:e=>{const n=t.value;a(n),r.onChange&&"function"==typeof r.onChange&&r.onChange(n),s(!1)},children:[n===t.value&&e.jsx(lo,{className:Bc("mr-2 h-4 w-4 text-green-400",n===t.value?"opacity-100":"opacity-0")}),String(t.text).trim(),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.flag})]},t.value))})})]})})]})}const Ib=Pb.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),Db=Array.from(new Set(Ib.map(e=>e.value))).map(e=>Ib.find(t=>t.value===e)).filter(e=>void 0!==e);function Ub(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Db.find(e=>e.value==n);return e.jsxs(Nb,{open:o,onOpenChange:s,children:[e.jsx(Cb,{asChild:!0,children:e.jsxs(Xc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[i?.text&&e.jsxs("div",{children:[String(i.text).trim(),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:i.icon})]}),!i&&e.jsx("span",{className:"text-muted-foreground",children:"Choose Currency"}),e.jsx(uo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(_b,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Mh,{children:[e.jsx(Fh,{placeholder:"Choose currency..."}),e.jsx(zh,{children:e.jsx(Lh,{children:Db.map(t=>e.jsxs($h,{className:Bc("whitespace-nowrap text-left",{"text-green-500":n===t.value}),value:t.value,defaultValue:t.value,onSelect:e=>{const n=t.value;a(n),r.onChange&&"function"==typeof r.onChange&&r.onChange(n),s(!1)},children:[n===t.value&&e.jsx(lo,{className:Bc("mr-2 h-4 w-4 text-green-400",n===t.value?"opacity-100":"opacity-0")}),String(t.text).trim(),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}let Mb=[{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:"🇮🇱"}];Mb=Mb.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),Mb.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const Fb=Mb.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 zb(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Fb.find(e=>e.value==n);return e.jsxs(Nb,{open:o,onOpenChange:s,children:[e.jsx(Cb,{asChild:!0,children:e.jsxs(Xc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[i&&e.jsxs("div",{children:[String(i.label).trim(),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:i.flag})]}),!i&&"Choose language",e.jsx(uo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(_b,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Mh,{children:[e.jsx(Fh,{placeholder:"Choose timezone..."}),e.jsx(zh,{children:e.jsx(Lh,{children:Fb.map(t=>e.jsxs($h,{className:Bc("whitespace-nowrap text-left",{"text-green-500":n===t.value}),value:t.value,defaultValue:t.value,onSelect:e=>{const n=t.value;a(n),r.onChange&&"function"==typeof r.onChange&&r.onChange(n),s(!1)},children:[n===t.value&&e.jsx(lo,{className:Bc("mr-2 h-4 w-4 text-green-400",n===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.flag})]},t.value))})})]})})]})}const Lb=[{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 s=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==s.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${s}) ${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 $b(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Lb.find(e=>e.value==n);return e.jsxs(Nb,{open:o,onOpenChange:s,children:[e.jsx(Cb,{asChild:!0,children:e.jsxs(Xc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[i?.text||"Choose timezone",e.jsx(uo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(_b,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Mh,{children:[e.jsx(Fh,{placeholder:"Choose timezone..."}),e.jsx(zh,{children:e.jsx(Lh,{children:Lb.map(t=>e.jsxs($h,{className:Bc("whitespace-nowrap text-left",{"text-green-500":n===t.value}),value:t.value,defaultValue:t.value,onSelect:e=>{const n=t.value;a(n),r.onChange&&"function"==typeof r.onChange&&r.onChange(n),s(!1)},children:[n===t.value&&e.jsx(lo,{className:Bc("mr-2 h-4 w-4 text-green-400",n===t.value?"opacity-100":"opacity-0")}),String(t.text).trim()]},t.value))})})]})})]})}const Vb=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=_x(),[o,s]=t.useState(!1),[i,c]=t.useState(),[l,d]=t.useState(0),[u,f]=t.useState(null),p=Gt({resolver:eo(Es({name:Xo().min(2,{message:"Name must be at least 2 characters."}),country:Xo().optional(),timezone:Xo().optional(),language:Xo().optional(),currency:Xo().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx($u,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){s(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),setTimeout(()=>{f(null)},5e3)}catch(e){console.error("Failed to update profile:",e)}finally{s(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(Yu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Wu,{disabled:o,control:p.control,name:"name",render:({field:t})=>e.jsxs(Hu,{children:[e.jsx(Ku,{children:"Name"}),e.jsx(Zu,{children:e.jsx(Yu,{...t})}),e.jsx(qu,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(zb,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(Ob,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(Ub,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx($b,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(Xc,{type:"submit",progress:o,disabled:o,children:"Save"}),e.jsx(Xc,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Om,{})},Wb=e=>{const r=se(e=>e.os),n=t.useMemo(()=>new xe(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(null),[s,i]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e){i(!0),d(null);try{const t=await n.getCurrentSubscription(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";d(r),c(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{i(!1)}}else o(null)},[n,e]);return t.useEffect(()=>{u()},[u]),{subscription:a,loading:s,error:l,refetch:u}},Bb=(e,r)=>{const n=se(e=>e.os),a=t.useMemo(()=>new xe(n),[n.serverUrl,n.version,n.orgId]),[o,s]=t.useState(null),[i,l]=t.useState(!1),[d,u]=t.useState(null),f=t.useCallback(async()=>{if(e){l(!0),u(null);try{const t=r?await a.getPlanGroupByVersion(e,r):await a.getPlanGroup(e);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch plan group";u(n),c(t,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:r}})}finally{l(!1)}}else s(null)},[a,e,r]);return t.useEffect(()=>{f()},[f]),{planGroup:o,loading:i,error:d,refetch:f}},Gb=e=>{const r=se(e=>e.os),n=t.useMemo(()=>new xe(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(null),[s,i]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e){i(!0),d(null);try{const t=await n.getPlanGroupVersions(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";d(r),c(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{i(!1)}}else o(null)},[n,e]);return t.useEffect(()=>{u()},[u]),{versions:a,loading:s,error:l,refetch:u}},Hb=e=>{const r=se(e=>e.os),n=t.useMemo(()=>new xe(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(!1),[s,i]=t.useState(null);return{createCheckoutSession:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");o(!0),i(null);try{return await n.createCheckoutSession(e,t)}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw i(n),c(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{o(!1)}},[n,e]),loading:a,error:s}},Kb=e=>{const r=se(e=>e.os),n=t.useMemo(()=>new xe(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(!1),[s,i]=t.useState(null),l=t.useCallback(async(t,r)=>{if(!e)throw new Error("Workspace ID is required");o(!0),i(null);try{const a={planVersionId:t,...r?.billingInterval&&{billingInterval:r.billingInterval},...r?.successUrl&&{successUrl:r.successUrl},...r?.cancelUrl&&{cancelUrl:r.cancelUrl}};return await n.updateSubscription(e,a)}catch(n){const a=n instanceof Error?n.message:"Failed to update subscription";throw i(a),c(n,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:r}}),n}finally{o(!1)}},[n,e]);return{updateSubscription:l,loading:a,error:s}},Zb=(e,r)=>{const n=Wb(e),a=Bb(e,r),o=Kb(e),s=t.useCallback(async()=>{await Promise.all([n.refetch(),a.refetch()])},[n,a]);return{subscription:n.subscription,planGroup:a.planGroup,loading:n.loading||a.loading||o.loading,error:n.error||a.error||o.error,updateSubscription:o.updateSubscription,refetch:s}},Jb=(e,r=10,n)=>{const a=se(e=>e.os),o=t.useMemo(()=>new xe(a),[a.serverUrl,a.version,a.orgId]),[s,i]=t.useState([]),[l,d]=t.useState(!1),[u,f]=t.useState(!1),[p,m]=t.useState(null),h=t.useCallback(async()=>{if(!e)return i([]),void d(!1);f(!0),m(null);try{const t=await o.listInvoices(e,r,n);i(t.invoices||[]),d(t.has_more||!1)}catch(t){const a=t instanceof Error?t.message:"Failed to fetch invoices";m(a),c(t,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:r,startingAfter:n}})}finally{f(!1)}},[o,e,r,n]);return t.useEffect(()=>{h()},[h]),{invoices:s,hasMore:l,loading:u,error:p,refetch:h}},qb=t.lazy(()=>Promise.resolve().then(function(){return dk}).then(e=>({default:e.default}))),Yb=(e,t="usd")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e/100),Xb=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",Qb=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"}},ey=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:o,error:s,updateSubscription:i,refetch:c}=Zb(n),{createCheckoutSession:l}=Hb(n),{versions:d,loading:u,error:f,refetch:p}=Gb(n),{invoices:m,loading:h,error:g,refetch:v}=Jb(n,20),b=o||u,y=s||f,{currentVersion:x,latestVersion:w,hasNewerVersion:S,isDeprecated:k,whatsNew:j,plansToShow:E}=t.useMemo(()=>{const e=d?.currentVersion,t=d?.availableVersions||[],r=null!==a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const o=!!(r&&n&&e)&&n.version>e.version,s=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:o,isDeprecated:o&&r,whatsNew:n?.whatsNew,plansToShow:s}},[d,a?.subscription]),[A,N]=t.useState(!1),[C,_]=t.useState(null),[T,R]=t.useState(null),[P,O]=t.useState(!1),I=async()=>{await Promise.all([c(),p()])};if(b&&!a&&!d)return e.jsx(Om,{});const D=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[y&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm",children:y}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try refreshing the page."})]}),C&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm",children:C})]}),T&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:T})]}),k&&a?.subscription&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Eo,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),e.jsx("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.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e.jsxs("span",{children:["Current: Version ",x?.version||"N/A"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Latest: Version ",w?.version||"N/A"]})]}),j&&(j.newPlans.length>0||j.updatedPlans.length>0)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e.jsxs("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",w?.version,":"]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-amber-700",children:[j.newPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"New Plans: "}),e.jsx("span",{children:j.newPlans.map(e=>e.plan.name).join(", ")})]}),j.updatedPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Updated Plans: "}),e.jsx("span",{children:j.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Subscription"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your workspace subscription plan"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?e.jsx(Xc,{variant:"outline",size:"sm",onClick:()=>O(!0),children:"Change Plan"}):E&&E.length>0?e.jsx(Xc,{size:"sm",onClick:()=>O(!0),children:"View Pricing Plans"}):null,e.jsxs(Xc,{variant:"ghost",size:"sm",onClick:I,disabled:b,children:[e.jsx(bo,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]}),a?.subscription?e.jsxs("div",{className:"border rounded-lg p-4 space-y-3 "+(k?"border-amber-300 bg-amber-50/50":""),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"font-medium",children:a.plan?.name||"No plan assigned"}),k&&e.jsxs("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:[e.jsx(Eo,{className:"h-3 w-3"}),"Deprecated"]})]}),e.jsxs("div",{className:"text-sm text-gray-600",children:["Status:"," ",e.jsx("span",{className:"font-medium "+("active"===a.subscription.subscriptionStatus?"text-green-600":"trialing"===a.subscription.subscriptionStatus?"text-blue-600":"text-red-600"),children:a.subscription.subscriptionStatus}),k&&e.jsxs("span",{className:"ml-2 text-xs text-amber-600",children:["(Version ",x?.version||"N/A",")"]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(fo,{className:"h-5 w-5 text-gray-400"})})]}),a.planVersion&&(()=>{const t=(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}})(a.planVersion);return e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx("div",{className:"text-sm font-medium mb-3",children:"Current Plan Details"}),e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-600",children:"Plan:"})," ",e.jsx("span",{className:"font-medium",children:a.plan?.name||"N/A"})]}),t.features.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Features:"}),e.jsx("ul",{className:"space-y-1.5",children:t.features.map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:r?"text-green-500 mt-0.5":"text-gray-300 mt-0.5",children:r?"✓":"○"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500",children:t.description})]})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Limits:"}),e.jsx("ul",{className:"space-y-1.5",children:t.limits.map(({item:t,value:r})=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-gray-400 mt-0.5",children:"•"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[t.name,":"]})," ",e.jsx("span",{className:"text-gray-700",children:r})]}),t.description&&e.jsx("div",{className:"text-xs text-gray-500",children:t.description})]})]},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Quotas:"}),e.jsx("ul",{className:"space-y-1.5",children:t.quotas.map(({item:t,value:r})=>{const n="object"==typeof r&&null!==r&&"included"in r?`${r.included} included${r.overage?`, ${r.overage} overage`:""}`:String(r);return e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-gray-400 mt-0.5",children:"•"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[t.name,":"]})," ",e.jsx("span",{className:"text-gray-700",children:n})]}),t.description&&e.jsx("div",{className:"text-xs text-gray-500",children:t.description})]})]},t._id)})})]})]})]})})()]}):e.jsx("div",{className:"border rounded-lg p-6 text-center",children:e.jsxs("div",{className:"mb-4",children:[e.jsx(fo,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]})})]}),a?.subscription&&(()=>{const t=m.filter(e=>e.invoice_pdf);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Invoices"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your subscription invoices"})]}),e.jsxs(Xc,{variant:"ghost",size:"sm",onClick:v,disabled:h,children:[e.jsx(bo,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),g&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg",children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm",children:g})]}),h&&0===t.length?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Om,{})}):0===t.length?e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(mo,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:"No invoices with download option found"})]}):e.jsx("div",{className:"space-y-2",children:t.map(t=>{const r=(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"}}})(t);return e.jsx("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t.description||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${Qb(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:Yb(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Created: ",Xb(t.created)]})]}),t.due_date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Due: ",Xb(t.due_date)]})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",Yb(t.amount_paid,t.currency)]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:e.jsxs(Xc,{size:"sm",onClick:()=>window.open(t.hosted_invoice_url,"_blank"),className:r.color,children:[r.text,e.jsx(po,{className:"h-3 w-3 ml-1.5"})]})})]})},t.id)})})]})})(),E&&E.length>0&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(qb,{open:P,onOpenChange:O,planVersions:E,currentPlanVersionId:D||null,onSelectPlan:async e=>{if(n&&a?.planVersion?._id!==e){N(!0),_(null),R(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=a?.subscription?await i(e,{billingInterval:"monthly",successUrl:t,cancelUrl:r}):await l({planVersionId:e,billingInterval:"monthly",successUrl:t,cancelUrl:r}),n&&"checkoutUrl"in n&&n.checkoutUrl)return void(window.location.href=n.checkoutUrl);R("Subscription updated successfully!"),await I()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";_(t)}finally{N(!1),setTimeout(()=>{_(null),R(null)},5e3)}}},loading:A||b})}),!d&&!b&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),y&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",y]}),!y&&e.jsx("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.jsxs(Xc,{variant:"outline",size:"sm",onClick:I,disabled:b,className:"mt-4",children:[e.jsx(bo,{className:"h-4 w-4 mr-2"}),"Retry"]})]})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function ty(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ks(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ry=Symbol("radix.slottable");function ny(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ry}var ay=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"});a.forwardRef((t,r)=>e.jsx(dl.span,{...t,ref:r,style:{...ay,...t.style}})).displayName="VisuallyHidden";var oy=[" ","Enter","ArrowUp","ArrowDown"],sy=[" ","Enter"],iy="Select",[cy,ly,dy]=rf(iy),[uy]=el(iy,[dy,Dv]),fy=Dv(),[py,my]=uy(iy),[hy,gy]=uy(iy),vy=t=>{const{__scopeSelect:r,children:n,open:o,defaultOpen:s,onOpenChange:i,value:c,defaultValue:l,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,v=fy(r),[b,y]=a.useState(null),[x,w]=a.useState(null),[S,k]=a.useState(!1),j=af(u),[E,A]=sl({prop:o,defaultProp:s??!1,onChange:i,caller:iy}),[N,C]=sl({prop:c,defaultProp:l,onChange:d,caller:iy}),_=a.useRef(null),T=!b||(g||!!b.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(Yv,{...v,children:e.jsxs(py,{required:h,scope:r,trigger:b,onTriggerChange:y,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:al(),value:N,onValueChange:C,open:E,onOpenChange:A,dir:j,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(cy.Provider,{scope:r,children:e.jsx(hy,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(tx,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:N,onChange:e=>C(e.target.value),disabled:m,form:g,children:[void 0===N?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};vy.displayName=iy;var by="SelectTrigger",yy=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:o=!1,...s}=t,i=fy(n),c=my(by,n),l=c.disabled||o,d=Zs(r,c.onTriggerChange),u=ly(n),f=a.useRef("touch"),[p,m,h]=nx(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=ax(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 e.jsx(Xv,{asChild:!0,...i,children:e.jsx(dl.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":rx(c.value)?"":void 0,...s,ref:d,onClick:Qc(s.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Qc(s.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:Qc(s.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||oy.includes(e.key)&&(g(),e.preventDefault())})})})});yy.displayName=by;var xy="SelectValue",wy=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:o,children:s,placeholder:i="",...c}=t,l=my(xy,n),{onValueNodeHasChildrenChange:d}=l,u=void 0!==s,f=Zs(r,l.onValueNodeChange);return Gs(()=>{d(u)},[d,u]),e.jsx(dl.span,{...c,ref:f,style:{pointerEvents:"none"},children:rx(l.value)?e.jsx(e.Fragment,{children:i}):s})});wy.displayName=xy;var Sy=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...o}=t;return e.jsx(dl.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});Sy.displayName="SelectIcon";var ky=t=>e.jsx(_l,{asChild:!0,...t});ky.displayName="SelectPortal";var jy="SelectContent",Ey=a.forwardRef((t,r)=>{const n=my(jy,t.__scopeSelect),[s,i]=a.useState();if(Gs(()=>{i(new DocumentFragment)},[]),!n.open){const r=s;return r?o.createPortal(e.jsx(Ny,{scope:t.__scopeSelect,children:e.jsx(cy.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(Ty,{...t,ref:r})});Ey.displayName=jy;var Ay=10,[Ny,Cy]=uy(jy),_y=function(t){const r=ty(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(ny);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),Ty=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b,...y}=t,x=my(jy,n),[w,S]=a.useState(null),[k,j]=a.useState(null),E=Zs(r,e=>S(e)),[A,N]=a.useState(null),[C,_]=a.useState(null),T=ly(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return Cd(w)},[w]),Ol();const I=a.useCallback(e=>{const[t,...r]=T().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}},[T,k]),D=a.useCallback(()=>I([A,w]),[I,A,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:M}=x;a.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),M.current=null};return null!==M.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,M]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[F,z]=nx(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=ax(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&(N(e),n&&(O.current=!0))},[x.value]),$=a.useCallback(()=>w?.focus(),[w]),V=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&_(e)},[x.value]),W="popper"===o?Py:Ry,B=W===Py?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return e.jsx(Ny,{scope:n,content:w,viewport:k,onViewportChange:j,itemRefCallback:L,selectedItem:A,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:D,selectedItemText:C,position:o,isPositioned:R,searchRef:F,children:e.jsx(wd,{as:_y,allowPinchZoom:!0,children:e.jsx(Sl,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Qc(s,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(gl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:e.jsx(W,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...y,...B,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Qc(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().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(()=>I(t)),e.preventDefault()}})})})})})})});Ty.displayName="SelectContentImpl";var Ry=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:o,...s}=t,i=my(jy,n),c=Cy(jy,n),[l,d]=a.useState(null),[u,f]=a.useState(null),p=Zs(r,e=>f(e)),m=ly(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:x}=c,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&v&&b&&y){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=y.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,o=r.left-a,s=e.left-o,i=e.width+s,c=Math.max(i,t.width),d=window.innerWidth-Ay,u=Xf(o,[Ay,Math.max(Ay,d-c)]);l.style.minWidth=i+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,s=window.innerWidth-e.right-o,i=e.width+s,c=Math.max(i,t.width),d=window.innerWidth-Ay,u=Xf(o,[Ay,Math.max(Ay,d-c)]);l.style.minWidth=i+"px",l.style.right=u+"px"}const a=m(),s=window.innerHeight-2*Ay,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),x=f+p+c+parseInt(d.paddingBottom,10)+g,w=Math.min(5*b.offsetHeight,x),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),j=parseInt(S.paddingBottom,10),E=e.top+e.height/2-Ay,A=s-E,N=b.offsetHeight/2,C=f+p+(b.offsetTop+N),_=x-C;if(C<=E){const e=a.length>0&&b===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=C+Math.max(A,N+(e?j:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&b===a[0].ref.current;l.style.top="0px";const t=Math.max(E,f+v.offsetTop+(e?k:0)+N)+_;l.style.height=t+"px",v.scrollTop=C-E+v.offsetTop}l.style.margin=`${Ay}px 0`,l.style.minHeight=w+"px",l.style.maxHeight=s+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,v,b,y,i.dir,o]);Gs(()=>w(),[w]);const[S,k]=a.useState();Gs(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const j=a.useCallback(e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)},[w,x]);return e.jsx(Oy,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(dl.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ry.displayName="SelectItemAlignedPosition";var Py=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=Ay,...s}=t,i=fy(n);return e.jsx(Qv,{...i,...s,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Py.displayName="SelectPopperPosition";var[Oy,Iy]=uy(jy,{}),Dy="SelectViewport",Uy=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:o,...s}=t,i=Cy(Dy,n),c=Iy(Dy,n),l=Zs(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(cy.Slot,{scope:n,children:e.jsx(dl.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Qc(s.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=c;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Ay,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),s=Math.max(a,o);if(s<n){const a=s+e,o=Math.min(n,a),i=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});Uy.displayName=Dy;var My="SelectGroup",[Fy,zy]=uy(My);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=al();return e.jsx(Fy,{scope:n,id:o,children:e.jsx(dl.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=My;var Ly="SelectLabel",$y=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=zy(Ly,n);return e.jsx(dl.div,{id:o.id,...a,ref:r})});$y.displayName=Ly;var Vy="SelectItem",[Wy,By]=uy(Vy),Gy=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:i,...c}=t,l=my(Vy,n),d=Cy(Vy,n),u=l.value===o,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Zs(r,e=>d.itemRefCallback?.(e,o,s)),v=al(),b=a.useRef("touch"),y=()=>{s||(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 e.jsx(Wy,{scope:n,value:o,disabled:s,textId:v,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(cy.ItemSlot,{scope:n,value:o,disabled:s,textValue:f,children:e.jsx(dl.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...c,ref:g,onFocus:Qc(c.onFocus,()=>h(!0)),onBlur:Qc(c.onBlur,()=>h(!1)),onClick:Qc(c.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:Qc(c.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:Qc(c.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:Qc(c.onPointerMove,e=>{b.current=e.pointerType,s?d.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Qc(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Qc(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(sy.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});Gy.displayName=Vy;var Hy="SelectItemText",Ky=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:s,style:i,...c}=t,l=my(Hy,n),d=Cy(Hy,n),u=By(Hy,n),f=gy(Hy,n),[p,m]=a.useState(null),h=Zs(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,v=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:y}=f;return Gs(()=>(b(v),()=>y(v)),[b,y,v]),e.jsxs(e.Fragment,{children:[e.jsx(dl.span,{id:u.textId,...c,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?o.createPortal(c.children,l.valueNode):null]})});Ky.displayName=Hy;var Zy="SelectItemIndicator",Jy=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return By(Zy,n).isSelected?e.jsx(dl.span,{"aria-hidden":!0,...a,ref:r}):null});Jy.displayName=Zy;var qy="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=Cy(qy,t.__scopeSelect),o=Iy(qy,t.__scopeSelect),[s,i]=a.useState(!1),c=Zs(r,o.onScrollButtonChange);return Gs(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),s?e.jsx(Xy,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=qy;var Yy="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=Cy(Yy,t.__scopeSelect),o=Iy(Yy,t.__scopeSelect),[s,i]=a.useState(!1),c=Zs(r,o.onScrollButtonChange);return Gs(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),s?e.jsx(Xy,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=Yy;var Xy=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=t,i=Cy("SelectScrollButton",n),c=a.useRef(null),l=ly(n),d=a.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),Gs(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e.jsx(dl.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:Qc(s.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:Qc(s.onPointerMove,()=>{i.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:Qc(s.onPointerLeave,()=>{d()})})}),Qy=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(dl.div,{"aria-hidden":!0,...a,ref:r})});Qy.displayName="SelectSeparator";var ex="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=fy(n),s=my(ex,n),i=Cy(ex,n);return s.open&&"popper"===i.position?e.jsx(eb,{...o,...a,ref:r}):null}).displayName=ex;var tx=a.forwardRef(({__scopeSelect:t,value:r,...n},o)=>{const s=a.useRef(null),i=Zs(o,s),c=Ef(r);return a.useEffect(()=>{const e=s.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]),e.jsx(dl.select,{...n,style:{...ay,...n.style},ref:i,defaultValue:r})});function rx(e){return""===e||void 0===e}function nx(e){const t=Bs(e),r=a.useRef(""),n=a.useRef(0),o=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),s=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,s]}function ax(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 s=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return s!==r?s:void 0}tx.displayName="SelectBubbleInput";var ox=yy,sx=Sy,ix=ky,cx=Ey,lx=Uy,dx=$y,ux=Gy,fx=Ky,px=Jy,mx=Qy;const hx=vy,gx=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(ox,{ref:a,className:Bc("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",t),...n,children:[r,e.jsx(sx,{asChild:!0,children:e.jsx(wu,{className:"h-4 w-4 opacity-50"})})]}));gx.displayName=ox.displayName;const vx=a.forwardRef(({className:t,children:r,position:n="popper",...o},s)=>{const{container:i}=a.useContext(ge);return e.jsx(ix,{container:i,children:e.jsx(cx,{ref:s,className:Bc("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"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...o,children:e.jsx(lx,{className:Bc("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});vx.displayName=cx.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(dx,{ref:n,className:Bc("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=dx.displayName;const bx=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(ux,{ref:a,className:Bc("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",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(px,{children:e.jsx(ku,{className:"h-4 w-4"})})}),e.jsx(fx,{children:r})]}));bx.displayName=ux.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(mx,{ref:n,className:Bc("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=mx.displayName;const yx=({workspace:r})=>{const n=se(e=>e.auth.session?.user||null),[a,o]=t.useState(0),[s,i]=t.useState(!1),[l,d]=t.useState([]),[u,f]=t.useState(null),{getUsers:p,removeUser:m,updateUser:h}=_x(),{settings:g}=Wp();t.useEffect(()=>{r&&(i(!0),p(r._id).then(e=>{d(e)}).catch(e=>{console.error(e)}).finally(()=>{i(!1)}))},[r,a]);const v=()=>{o(e=>e+1)};if(s||!r)return e.jsx(Om,{});const b=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},y=l.map(e=>({...e,...b(e.user)})),x=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===x,S=(g?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(l.length??0);return e.jsxs("div",{children:[!w&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e.jsxs("div",{className:"mb-4",children:[S&&e.jsx(xx,{onInvite:v,workspaceId:r._id}),!S&&e.jsx("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[l.length," member",1!==l.length?"s":""]})}),e.jsx("div",{children:e.jsx(Xc,{variant:"ghost",size:"sm",onClick:v,progress:s,startIcon:e.jsx(bo,{}),children:"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:y.map((t,a)=>{const o=t.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"flex items-center justify-between border rounded p-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(hx,{disabled:o||!w||s||u===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,o=e,void(Rm(r,a)?c(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}}):(f(a),h(n,a,{role:o}).then(()=>{v()}).catch(e=>{c(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}})}).finally(()=>{f(null)})));var n,a,o},children:[e.jsx(gx,{children:e.jsx(wy,{placeholder:"Select a role"})}),e.jsx(vx,{children:r?.roles.map(t=>e.jsx(bx,{value:t,children:t},t))})]}),u===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(go,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),o&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!o&&!s&&w&&e.jsx(Xc,{variant:"destructive",size:"sm",startIcon:e.jsx(jo,{}),onClick:()=>{var e;e=t.id,Rm(r,e)?c(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):m(r._id,e).then(()=>{v()}).catch(t=>{c(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},a)})}),0===l.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function xx({onInvite:r,workspaceId:n}){const[a,o]=t.useState(""),[s,i]=t.useState("admin"),[c,l]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),{addUser:m,getWorkspace:h}=_x(),[g,v]=t.useState(null),{settings:b}=Wp(),y=b?.workspace.roles??g?.roles??[];t.useEffect(()=>{n&&h(n).then(v)},[n]);const x=()=>{u(null),p(null),o(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Lu,{children:"Invite member by email"}),e.jsx(Yu,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Lu,{children:"Role"}),e.jsxs(hx,{value:s,onValueChange:i,children:[e.jsx(gx,{children:e.jsx(wy,{placeholder:"Select a role"})}),e.jsx(vx,{children:y.map(t=>e.jsx(bx,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(Xc,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await m(n,e,s).then(()=>{p("User invited successfully"),r?.()}).catch(e=>{console.error(e),u(e.message||"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{x()},6e3)})):u("Invalid email address format")},disabled:c||!a||!s,children:c?"Inviting...":`Invite as ${s}`})})]})}const wx=({workspace:t,section:r,setSection:n})=>{const a=se(e=>e.auth.session?.user||null),o=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id;return e.jsxs("div",{className:"w-56 h-full flex flex-col space-y-6",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("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:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:Bc("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(Sx,{title:"Account",children:e.jsx(kx,{activeSection:r,icon:e.jsx(Ao,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(Sx,{title:"Workspace",children:[e.jsx(kx,{activeSection:r,icon:e.jsx(xo,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(kx,{activeSection:r,icon:e.jsx(No,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(kx,{activeSection:r,icon:e.jsx(fo,{className:"h-3.5 w-3.5"}),label:"Subscription",section:"subscription",onClick:()=>n("subscription")}),e.jsx(kx,{activeSection:r,icon:e.jsx(So,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),o&&e.jsx(kx,{activeSection:r,icon:e.jsx(Eo,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function Sx({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function kx({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e.jsxs("button",{className:Bc("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 jx=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:s="profile",section:i,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(s),h=void 0!==a?a:u,g=o||f,v=void 0!==i?i:p,b=c||m;if(!r)return null;const y=e.jsx(Xc,{variant:"outline",size:"icon",children:e.jsx(xo,{className:"h-4 w-4"})});return e.jsxs(Cu,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[l&&e.jsx(_u,{asChild:!0,children:d||y}),e.jsxs(Pu,{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:[e.jsx(Du,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(wx,{workspace:r,section:v,setSection:b}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(Iu,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===v&&"Account","general"===v&&"Workspace Settings","users"===v&&"Workspace Members","subscription"===v&&"Subscription","features"===v&&"Workspace Features","danger"===v&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===v&&e.jsx(Vb,{workspace:r}),"general"===v&&e.jsx(qm,{workspace:r}),"users"===v&&e.jsx(yx,{workspace:r}),"subscription"===v&&e.jsx(ey,{workspace:r}),"features"===v&&e.jsx(Km,{workspaceId:r._id?.toString()}),"danger"===v&&e.jsx(Im,{workspace:r})]})]})]})]})};var Ex=Object.freeze({__proto__:null,WorkspaceSettingsDialog:jx,default:jx});function Ax(r){const{workspaces:n,currentWorkspace:a,loading:o,refreshing:s}=se(e=>e.workspaces),i=se(e=>e.auth.session?.user),{settings:c}=Wp(),[l,d]=t.useState(!1),[u,f]=t.useState(0),[p,m]=t.useState(""),{fetchWorkspaces:h,getFeatures:g,refreshWorkspaces:v,setCurrentWorkspace:b,workspaces:y}=_x(),x=o||s;t.useEffect(()=>{0===y.length?(h(),g()):g()},[]),t.useEffect(()=>{u>0&&v()},[u]);const w=y.length>0?y:n,S=w.filter(e=>e._id!==a?._id).filter(e=>e.name.toLowerCase().includes(p.toLowerCase())),k=c?.workspace.maxWorkspaces??Number.MAX_VALUE,j=w?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===i?.id?.toString()).length,E=k>(j??0);return e.jsxs(Cu,{open:l,onOpenChange:d,children:[e.jsx(_u,{children:r.trigger?.(x,a)}),e.jsxs(Pu,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(Ou,{children:[e.jsxs(Iu,{className:"flex items-center gap-2",children:[e.jsx(co,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(Du,{children:"Select a workspace to switch to or create a new one."})]}),!i&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),i&&e.jsxs("div",{className:"flex flex-col gap-4",children:[a&&e.jsx(Nx,{workspace:a,isCurrentWorkspace:!0,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>d(!1),setCurrentWorkspace:b,setOpen:d,workspacesToUse:w}),e.jsx(Vp,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",S.length,")"]}),e.jsx("div",{children:e.jsx(Xc,{progress:s,disabled:s,variant:"ghost",onClick:function(){f(e=>e+1)},startIcon:e.jsx(bo,{}),children:s?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(yo,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(Yu,{placeholder:"Search workspaces...",value:p,onChange:e=>m(e.target.value),className:"pl-10"})]}),o?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(go,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===S.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(co,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:p?"No workspaces found":"No workspaces available"})]}):e.jsx(Dp,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:S.map(t=>{const n=t._id===a?._id;return e.jsx(Nx,{workspace:t,isCurrentWorkspace:n,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>d(!1),setCurrentWorkspace:b,setOpen:d,workspacesToUse:w},t._id)})})})]}),E&&e.jsxs(e.Fragment,{children:[e.jsx(Vp,{}),e.jsx(Cx,{onCreated:()=>{h()}})]})]})]})]})}function Nx(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:s}=r,i=r.isCurrentWorkspace??!1,[l,d]=t.useState(!1);return e.jsxs("div",{className:Bc("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(Gc,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(Hc,{src:n.image&&n.image.trim()?n.image:void 0})}),e.jsx(Kc,{children:(u=n.name,u.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(No,{className:"h-3 w-3"}),e.jsxs("span",{children:[n.users?.length||0," members"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(Xc,{size:"sm",disabled:l,progress:l,onClick:()=>{d(!0),r.onWorkspaceChange(n).then(()=>{a(n),o(!1)}).catch(e=>{c(e,{component:"WorkspaceItem",action:"onWorkspaceChange",metadata:{workspaceId:n._id}})}).finally(()=>{d(!1)})},children:"Switch to"}),e.jsx(jx,{workspace:n,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(s[e])}}})]})]});var u}function Cx(r){const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState("🏢"),[l,d]=t.useState(!1),{createWorkspace:u}=_x(),f=Gt({resolver:eo(Es({name:Xo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Xo().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(Cu,{open:n,onOpenChange:a,children:[e.jsx(_u,{asChild:!0,children:e.jsxs(Xc,{className:"w-full rounded-none",children:[e.jsx(vo,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(Pu,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(Ou,{children:[e.jsx(Iu,{children:"Create New Workspace"}),e.jsx(Du,{children:"Create a new workspace to get started."})]}),e.jsx($u,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(async function(e){let t="";if("emoji"===o)t=Zm(i);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void f.setError("image",{message:"Please enter a valid URL"})}d(!0);try{await u(e.name,t),a(!1),f.reset(),c("🏢"),s("emoji"),r?.onCreated?.()}catch(e){console.error("Failed to create workspace:",e)}finally{d(!1)}}),children:[e.jsx(Wu,{control:f.control,name:"name",render:({field:t})=>e.jsxs(Hu,{children:[e.jsx(Ku,{children:"Workspace Name"}),e.jsx(Zu,{children:e.jsx(Yu,{placeholder:"My Awesome Workspace",...t})}),e.jsx(qu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Lu,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(Ju,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(qf,{value:o,onValueChange:e=>s(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(Yf,{value:"emoji",id:"emoji"}),e.jsxs(Lu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(wo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(Yf,{value:"url",id:"url"}),e.jsxs(Lu,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:i})]}),e.jsx(Dp,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:Jm.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),f.setValue("image",Zm(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Wu,{control:f.control,name:"image",render:({field:t})=>e.jsxs(Hu,{children:[e.jsx(Ku,{children:"Image URL"}),e.jsx(Zu,{children:e.jsx(Yu,{placeholder:"https://example.com/image.png",...t})}),e.jsx(Ju,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(qu,{})]})}),f.watch("image")&&f.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:f.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(Xc,{type:"button",variant:"outline",onClick:()=>{a(!1),f.reset(),c("🏢"),s("emoji")},disabled:l,children:"Cancel"}),e.jsx(Xc,{type:"submit",disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(go,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const _x=()=>{const e=ie(),r=se(e=>e.os),n=t.useMemo(()=>new xe(r),[r.serverUrl,r.version,r.orgId]),a=se(e=>e.workspaces),o=se(e=>e.auth.session?.user),s=t.useCallback(t=>{if(t._id!==a.currentWorkspace?._id&&t){const r=a.currentWorkspace;e.workspaces(H(t)),he.emitWorkspaceChanged(t,r).catch(e=>{c(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[a.currentWorkspace,e]);t.useEffect(()=>{if(!a.isInitialized){const t=_m();if(e.workspaces(Z(!0)),t){const e=a.workspaces.find(e=>e._id===t);if(e){if(e._id===a.currentWorkspace?._id)return;s(e)}}}},[a.isInitialized,a.workspaces,a.currentWorkspace,e,s]);const i=t.useCallback(()=>{e.workspaces(K())},[e]),l=t.useRef(!1),d=t.useRef(!1),u=t.useCallback(async()=>{if(!a.loading&&!l.current){l.current=!0,e.workspaces(J(!0)),e.workspaces(q(null));try{const t=await n.getWorkspaces();if(e.workspaces(B(t)),t.length>0){const e=_m();if(e&&Tm(e,t)){const r=t.find(t=>t._id===e);r&&s(r)}else t.length>0&&(a.currentWorkspace||s(t[0]))}}catch(t){e.workspaces(q(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(J(!1)),l.current=!1}}},[n,a.loading,a.currentWorkspace?._id,e,s]),f=t.useCallback(async()=>{if(!a.refreshing&&!l.current){l.current=!0,e.workspaces(Y(!0));try{const t=await n.getWorkspaces();e.workspaces(B(t))}catch(e){}finally{e.workspaces(Y(!1)),l.current=!1}}},[n,a.refreshing,e]),p=t.useCallback(async(t,r)=>{const o=await n.createWorkspace({name:t,image:r});e.workspaces(B([...a.workspaces,o])),he.emitWorkspaceCreated(o).catch(e=>{c(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[n,a.workspaces,e]),m=t.useCallback(async(t,r)=>{const o=await n.updateWorkspace(t._id,r);e.workspaces(B(a.workspaces.map(e=>e._id===t._id?o:e))),he.emitWorkspaceUpdated(o).catch(e=>{c(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[n,a.workspaces,e]),h=t.useCallback(async()=>{if(d.current)return a.allFeatures.length>0?a.allFeatures:null;if(a.allFeatures.length>0)return a.allFeatures;d.current=!0;try{const t=await n.getFeatures();return e.workspaces(G(t)),t}catch(e){return c(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{d.current=!1}},[n,e,a.allFeatures]),g=t.useCallback(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);t.useEffect(()=>{if(!a.currentWorkspace?._id||0===a.workspaces.length)return;const e=a.currentWorkspace._id,t=a.workspaces.find(t=>t._id===e);if(t)t!==a.currentWorkspace&&s(t);else if(a.workspaces.length>0){const t=a.workspaces[0];t._id!==e&&s(t)}},[a.workspaces,a.currentWorkspace,s]);const v=t.useCallback(async e=>await n.getWorkspaceUsers(e),[n]),b=t.useCallback(async(e,t,r)=>{const o=await n.addUser(e,{email:t,role:r}),s=a.workspaces.find(t=>t._id===e);return s&&he.emitWorkspaceUserAdded(o.userId,s,r).catch(t=>{c(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:r}})}),o},[n,a.workspaces]),y=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&Rm(r,t))throw new Error("Cannot remove the workspace owner");const o=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),s=await n.removeUser(e,t);if(r&&o){const t=o.role;he.emitWorkspaceUserRemoved(s.userId,r,t).catch(r=>{c(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:s.userId,role:t}})})}return s},[n,a.workspaces]),x=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&Rm(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(r.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=r?.role}const s=await n.updateUser(e,t,r);return r.role&&o&&o!==r.role&&he.emitWorkspaceUserRoleChanged(s.userId,s.workspace,o,r.role).catch(n=>{c(n,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:r.role}})}),s},[n,a.workspaces]),w=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return he.emitUserUpdated(r,t||void 0).catch(e=>{c(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:r._id}})}),r},[n]),S=t.useCallback(async()=>await n.getProfile(),[n]),k=t.useCallback(async e=>await n.getWorkspace(e),[n]),j=t.useCallback(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const r=a.workspaces.find(e=>e._id===t);if(!r)throw new Error("Workspace not found");if(!Rm(r,o.id))throw new Error("Only the workspace creator can delete the workspace");const s=await n.deleteWorkspace(t);return e.workspaces(B(a.workspaces.filter(e=>e._id!==t))),a.currentWorkspace?._id===t&&e.workspaces(K()),r&&he.emitWorkspaceDeleted(r).catch(e=>{c(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),s},[n,a.workspaces,a.currentWorkspace,e,o]);return{workspaces:a.workspaces,loading:a.loading,error:a.error,fetchWorkspaces:u,refreshWorkspaces:f,refreshing:a.refreshing,WorkspaceSwitcher:Ax,currentWorkspace:a.currentWorkspace,setCurrentWorkspace:s,resetCurrentWorkspace:i,createWorkspace:p,allFeatures:a.allFeatures,getFeatures:h,updateFeature:g,getWorkspace:k,switching:a.switching,updateWorkspace:m,getUsers:v,addUser:b,removeUser:y,updateUser:x,getProfile:S,updateUserProfile:w,deleteWorkspace:j}};const Tx=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)})}},Rx=t.lazy(()=>Promise.resolve().then(function(){return Ex}).then(e=>({default:e.default}))),Px=({children:r})=>{const{currentWorkspace:n}=_x(),[a,o]=t.useState(!1),[s,i]=t.useState("profile");return t.useEffect(()=>{const e=Tx.getState();o(e.open),i(e.section);return Tx.subscribe((e,t)=>{o(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&a&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(Rx,{workspace:n,open:a,onOpenChange:e=>{e||Tx.closeSettings()},section:s,onSectionChange:e=>{Tx.setSection(e)},showTrigger:!1})})]})},Ox=(e,t,r)=>{if(t!==exports.ApiVersion.V1)throw new Error(`Invalid version: "${t}". Only "${exports.ApiVersion.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).`)},Ix=t.memo(({serverUrl:r,version:n,orgId:a,auth:o,children:s})=>{Ox(r,n,a);const i=t.useMemo(()=>({serverUrl:r,version:n,orgId:a}),[r,n,a]),c=t.useMemo(()=>o?.callbacks,[o?.callbacks]),d=t.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return t.useEffect(()=>(he.setCallbacks(d?{handleEvent:d}:null),()=>{he.setCallbacks(null)}),[d]),e.jsx(l,{children:e.jsx(oe,{children:e.jsx(pe,{callbacks:c,children:e.jsx(ve,{children:e.jsx(me,{config:i,auth:o,children:e.jsx(ye,{children:e.jsx(Px,{children:s})})})})})})})});Ix.displayName="SaaSOSProvider";let Dx=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await de(`${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),s=await de(`${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(!s.ok)throw new Error(`Failed to submit beta user request: ${s.statusText}`);return s.json()}};const Ux=Es({name:Xo().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:Xo().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)")}),Mx={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:"오류가 발생했습니다"}};function Fx({screen:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsx("p",{className:"text-2xl font-bold",children:t?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function zx({logo:t}){return"string"==typeof t?e.jsx("img",{src:t,alt:"Logo",className:"max-h-24"}):e.jsx("img",{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}function Lx(e,t){return function(){return e.apply(t,arguments)}}const{toString:$x}=Object.prototype,{getPrototypeOf:Vx}=Object,{iterator:Wx,toStringTag:Bx}=Symbol,Gx=(Hx=Object.create(null),e=>{const t=$x.call(e);return Hx[t]||(Hx[t]=t.slice(8,-1).toLowerCase())});var Hx;const Kx=e=>(e=e.toLowerCase(),t=>Gx(t)===e),Zx=e=>t=>typeof t===e,{isArray:Jx}=Array,qx=Zx("undefined");function Yx(e){return null!==e&&!qx(e)&&null!==e.constructor&&!qx(e.constructor)&&ew(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xx=Kx("ArrayBuffer");const Qx=Zx("string"),ew=Zx("function"),tw=Zx("number"),rw=e=>null!==e&&"object"==typeof e,nw=e=>{if("object"!==Gx(e))return!1;const t=Vx(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Bx in e||Wx in e)},aw=Kx("Date"),ow=Kx("File"),sw=Kx("Blob"),iw=Kx("FileList"),cw=Kx("URLSearchParams"),[lw,dw,uw,fw]=["ReadableStream","Request","Response","Headers"].map(Kx);function pw(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Jx(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Yx(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let s;for(n=0;n<o;n++)s=a[n],t.call(null,e[s],s,e)}}function mw(e,t){if(Yx(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 hw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,gw=e=>!qx(e)&&e!==hw;const vw=(bw="undefined"!=typeof Uint8Array&&Vx(Uint8Array),e=>bw&&e instanceof bw);var bw;const yw=Kx("HTMLFormElement"),xw=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ww=Kx("RegExp"),Sw=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};pw(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const kw=Kx("AsyncFunction"),jw=(Ew="function"==typeof setImmediate,Aw=ew(hw.postMessage),Ew?setImmediate:Aw?(Nw=`axios@${Math.random()}`,Cw=[],hw.addEventListener("message",({source:e,data:t})=>{e===hw&&t===Nw&&Cw.length&&Cw.shift()()},!1),e=>{Cw.push(e),hw.postMessage(Nw,"*")}):e=>setTimeout(e));var Ew,Aw,Nw,Cw;const _w="undefined"!=typeof queueMicrotask?queueMicrotask.bind(hw):"undefined"!=typeof process&&process.nextTick||jw;var Tw={isArray:Jx,isArrayBuffer:Xx,isBuffer:Yx,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||ew(e.append)&&("formdata"===(t=Gx(e))||"object"===t&&ew(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Xx(e.buffer),t},isString:Qx,isNumber:tw,isBoolean:e=>!0===e||!1===e,isObject:rw,isPlainObject:nw,isEmptyObject:e=>{if(!rw(e)||Yx(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:lw,isRequest:dw,isResponse:uw,isHeaders:fw,isUndefined:qx,isDate:aw,isFile:ow,isBlob:sw,isRegExp:ww,isFunction:ew,isStream:e=>rw(e)&&ew(e.pipe),isURLSearchParams:cw,isTypedArray:vw,isFileList:iw,forEach:pw,merge:function e(){const{caseless:t,skipUndefined:r}=gw(this)&&this||{},n={},a=(a,o)=>{const s=t&&mw(n,o)||o;nw(n[s])&&nw(a)?n[s]=e(n[s],a):nw(a)?n[s]=e({},a):Jx(a)?n[s]=a.slice():r&&qx(a)||(n[s]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&pw(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(pw(t,(t,n)=>{r&&ew(t)?Object.defineProperty(e,n,{value:Lx(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,s;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],n&&!n(s,e,t)||i[s]||(t[s]=e[s],i[s]=!0);e=!1!==r&&Vx(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Gx,kindOfTest:Kx,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(Jx(e))return e;let t=e.length;if(!tw(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Wx]).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:yw,hasOwnProperty:xw,hasOwnProp:xw,reduceDescriptors:Sw,freezeMethods:e=>{Sw(e,(t,r)=>{if(ew(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];ew(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 Jx(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:mw,global:hw,isContextDefined:gw,isSpecCompliantForm:function(e){return!!(e&&ew(e.append)&&"FormData"===e[Bx]&&e[Wx])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(rw(e)){if(t.indexOf(e)>=0)return;if(Yx(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Jx(e)?[]:{};return pw(e,(e,t)=>{const o=r(e,n+1);!qx(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:kw,isThenable:e=>e&&(rw(e)||ew(e))&&ew(e.then)&&ew(e.catch),setImmediate:jw,asap:_w,isIterable:e=>null!=e&&ew(e[Wx])};let Rw=class e extends Error{static from(t,r,n,a,o,s){const i=new e(t.message,r||t.code,n,a,o);return i.cause=t,i.name=t.name,s&&Object.assign(i,s),i}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:Tw.toJSONObject(this.config),code:this.code,status:this.status}}};Rw.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Rw.ERR_BAD_OPTION="ERR_BAD_OPTION",Rw.ECONNABORTED="ECONNABORTED",Rw.ETIMEDOUT="ETIMEDOUT",Rw.ERR_NETWORK="ERR_NETWORK",Rw.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Rw.ERR_DEPRECATED="ERR_DEPRECATED",Rw.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Rw.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Rw.ERR_CANCELED="ERR_CANCELED",Rw.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Rw.ERR_INVALID_URL="ERR_INVALID_URL";function Pw(e){return Tw.isPlainObject(e)||Tw.isArray(e)}function Ow(e){return Tw.endsWith(e,"[]")?e.slice(0,-2):e}function Iw(e,t,r){return e?e.concat(t).map(function(e,t){return e=Ow(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Dw=Tw.toFlatObject(Tw,{},null,function(e){return/^is[A-Z]/.test(e)});function Uw(e,t,r){if(!Tw.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Tw.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Tw.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,s=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Tw.isSpecCompliantForm(t);if(!Tw.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Tw.isDate(e))return e.toISOString();if(Tw.isBoolean(e))return e.toString();if(!i&&Tw.isBlob(e))throw new Rw("Blob is not supported. Use a Buffer instead.");return Tw.isArrayBuffer(e)||Tw.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let i=e;if(e&&!a&&"object"==typeof e)if(Tw.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Tw.isArray(e)&&function(e){return Tw.isArray(e)&&!e.some(Pw)}(e)||(Tw.isFileList(e)||Tw.endsWith(r,"[]"))&&(i=Tw.toArray(e)))return r=Ow(r),i.forEach(function(e,n){!Tw.isUndefined(e)&&null!==e&&t.append(!0===s?Iw([r],n,o):null===s?r:r+"[]",c(e))}),!1;return!!Pw(e)||(t.append(Iw(a,r,o),c(e)),!1)}const d=[],u=Object.assign(Dw,{defaultVisitor:l,convertValue:c,isVisitable:Pw});if(!Tw.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Tw.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),Tw.forEach(r,function(r,o){!0===(!(Tw.isUndefined(r)||null===r)&&a.call(t,r,Tw.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Mw(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Fw(e,t){this._pairs=[],e&&Uw(e,this,t)}const zw=Fw.prototype;function Lw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $w(e,t,r){if(!t)return e;const n=r&&r.encode||Lw,a=Tw.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let s;if(s=o?o(t,a):Tw.isURLSearchParams(t)?t.toString():new Fw(t,a).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}zw.append=function(e,t){this._pairs.push([e,t])},zw.toString=function(e){const t=e?function(t){return e.call(this,t,Mw)}:Mw;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Vw{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){Tw.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Ww={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Bw={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Fw,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Gw="undefined"!=typeof window&&"undefined"!=typeof document,Hw="object"==typeof navigator&&navigator||void 0,Kw=Gw&&(!Hw||["ReactNative","NativeScript","NS"].indexOf(Hw.product)<0),Zw="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Jw=Gw&&window.location.href||"http://localhost";var qw={...Object.freeze({__proto__:null,hasBrowserEnv:Gw,hasStandardBrowserEnv:Kw,hasStandardBrowserWebWorkerEnv:Zw,navigator:Hw,origin:Jw}),...Bw};function Yw(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),i=a>=e.length;if(o=!o&&Tw.isArray(n)?n.length:o,i)return Tw.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&Tw.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&Tw.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])),!s}if(Tw.isFormData(e)&&Tw.isFunction(e.entries)){const r={};return Tw.forEachEntry(e,(e,n)=>{t(function(e){return Tw.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Xw={transitional:Ww,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=Tw.isObject(e);a&&Tw.isHTMLForm(e)&&(e=new FormData(e));if(Tw.isFormData(e))return n?JSON.stringify(Yw(e)):e;if(Tw.isArrayBuffer(e)||Tw.isBuffer(e)||Tw.isStream(e)||Tw.isFile(e)||Tw.isBlob(e)||Tw.isReadableStream(e))return e;if(Tw.isArrayBufferView(e))return e.buffer;if(Tw.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 Uw(e,new qw.classes.URLSearchParams,{visitor:function(e,t,r,n){return qw.isNode&&Tw.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Tw.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Uw(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(Tw.isString(e))try{return(t||JSON.parse)(e),Tw.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Xw.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Tw.isResponse(e)||Tw.isReadableStream(e))return e;if(e&&Tw.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 Rw.from(e,Rw.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:qw.classes.FormData,Blob:qw.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Tw.forEach(["delete","get","head","post","put","patch"],e=>{Xw.headers[e]={}});const Qw=Tw.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 eS=Symbol("internals");function tS(e){return e&&String(e).trim().toLowerCase()}function rS(e){return!1===e||null==e?e:Tw.isArray(e)?e.map(rS):String(e)}function nS(e,t,r,n,a){return Tw.isFunction(n)?n.call(this,t,r):(a&&(t=r),Tw.isString(t)?Tw.isString(n)?-1!==t.indexOf(n):Tw.isRegExp(n)?n.test(t):void 0:void 0)}let aS=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=tS(t);if(!a)throw new Error("header name must be a non-empty string");const o=Tw.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=rS(e))}const o=(e,t)=>Tw.forEach(e,(e,r)=>a(e,r,t));if(Tw.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Tw.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]&&Qw[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(Tw.isObject(e)&&Tw.isIterable(e)){let r,n,a={};for(const t of e){if(!Tw.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?Tw.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=tS(e)){const r=Tw.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(Tw.isFunction(t))return t.call(this,e,r);if(Tw.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=tS(e)){const r=Tw.findKey(this,e);return!(!r||void 0===this[r]||t&&!nS(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=tS(e)){const a=Tw.findKey(r,e);!a||t&&!nS(0,r[a],a,t)||(delete r[a],n=!0)}}return Tw.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&&!nS(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return Tw.forEach(this,(n,a)=>{const o=Tw.findKey(r,a);if(o)return t[o]=rS(n),void delete t[a];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();s!==a&&delete t[a],t[s]=rS(n),r[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Tw.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Tw.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[eS]=this[eS]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=tS(e);t[n]||(!function(e,t){const r=Tw.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 Tw.isArray(e)?e.forEach(n):n(e),this}};function oS(e,t){const r=this||Xw,n=t||r,a=aS.from(n.headers);let o=n.data;return Tw.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function sS(e){return!(!e||!e.__CANCEL__)}aS.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Tw.reduceDescriptors(aS.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Tw.freezeMethods(aS);let iS=class extends Rw{constructor(e,t,r){super(null==e?"canceled":e,Rw.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 Rw("Request failed with status code "+r.status,[Rw.ERR_BAD_REQUEST,Rw.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const lS=(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,s=0;return t=void 0!==t?t:1e3,function(i){const c=Date.now(),l=n[s];a||(a=c),r[o]=i,n[o]=c;let d=s,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+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 s=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=o?s(e,t):(r=e,n||(n=setTimeout(()=>{n=null,s(r)},o-i)))},()=>r&&s(r)]}(r=>{const o=r.loaded,s=r.lengthComputable?r.total:void 0,i=o-n,c=a(i);n=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:i,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})},r)},dS=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},uS=e=>(...t)=>Tw.asap(()=>e(...t));var fS=qw.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,qw.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(qw.origin),qw.navigator&&/(msie|trident)/i.test(qw.navigator.userAgent)):()=>!0,pS=qw.hasStandardBrowserEnv?{write(e,t,r,n,a,o,s){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];Tw.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),Tw.isString(n)&&i.push(`path=${n}`),Tw.isString(a)&&i.push(`domain=${a}`),!0===o&&i.push("secure"),Tw.isString(s)&&i.push(`SameSite=${s}`),document.cookie=i.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 mS(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 hS=e=>e instanceof aS?{...e}:e;function gS(e,t){t=t||{};const r={};function n(e,t,r,n){return Tw.isPlainObject(e)&&Tw.isPlainObject(t)?Tw.merge.call({caseless:n},e,t):Tw.isPlainObject(t)?Tw.merge({},t):Tw.isArray(t)?t.slice():t}function a(e,t,r,a){return Tw.isUndefined(t)?Tw.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!Tw.isUndefined(t))return n(void 0,t)}function s(e,t){return Tw.isUndefined(t)?Tw.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(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:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:i,headers:(e,t,r)=>a(hS(e),hS(t),0,!0)};return Tw.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,s=o(e[n],t[n],n);Tw.isUndefined(s)&&o!==i||(r[n]=s)}),r}var vS=e=>{const t=gS({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:s,auth:i}=t;if(t.headers=s=aS.from(s),t.url=$w(mS(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&s.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),Tw.isFormData(r))if(qw.hasStandardBrowserEnv||qw.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Tw.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&s.set(e,r)})}if(qw.hasStandardBrowserEnv&&(n&&Tw.isFunction(n)&&(n=n(t)),n||!1!==n&&fS(t.url))){const e=a&&o&&pS.read(o);e&&s.set(a,e)}return t};var bS="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=vS(e);let a=n.data;const o=aS.from(n.headers).normalize();let s,i,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=aS.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 Rw("Request aborted",Rw.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new Rw(n,Rw.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||Ww;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Rw(t,a.clarifyTimeoutError?Rw.ETIMEDOUT:Rw.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&Tw.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),Tw.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=lS(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([i,l]=lS(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(s=t=>{h&&(r(!t||t.type?new iS(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===qw.protocols.indexOf(v)?r(new Rw("Unsupported protocol "+v+":",Rw.ERR_BAD_REQUEST,e)):h.send(a||null)})};const yS=(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,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Rw?t:new iS(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Rw(`timeout of ${t}ms exceeded`,Rw.ETIMEDOUT))},t);const s=()=>{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:i}=n;return i.unsubscribe=()=>Tw.asap(s),i}},xS=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},wS=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()}},SS=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of wS(e))yield*xS(r,t)}(e,t);let o,s=0,i=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 i(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},{isFunction:kS}=Tw,jS=(({Request:e,Response:t})=>({Request:e,Response:t}))(Tw.global),{ReadableStream:ES,TextEncoder:AS}=Tw.global,NS=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},CS=e=>{e=Tw.merge.call({skipUndefined:!0},jS,e);const{fetch:t,Request:r,Response:n}=e,a=t?kS(t):"function"==typeof fetch,o=kS(r),s=kS(n);if(!a)return!1;const i=a&&kS(ES),c=a&&("function"==typeof AS?(l=new AS,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&i&&NS(()=>{let e=!1;const t=new r(qw.origin,{body:new ES,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&i&&NS(()=>Tw.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 Rw(`Response type '${e}' is not supported`,Rw.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=Tw.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Tw.isBlob(e))return e.size;if(Tw.isSpecCompliantForm(e)){const t=new r(qw.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Tw.isArrayBufferView(e)||Tw.isArrayBuffer(e)?e.byteLength:(Tw.isURLSearchParams(e)&&(e+=""),Tw.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:s,data:i,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:b,withCredentials:y="same-origin",fetchOptions:x}=vS(e),w=t||fetch;v=v?(v+"").toLowerCase():"text";let S=yS([c,l&&l.toAbortSignal()],m),k=null;const j=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==s&&"head"!==s&&0!==(E=await p(b,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(Tw.isFormData(i)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=dS(E,lS(uS(g)));i=SS(t.body,65536,e,r)}}Tw.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in r.prototype,c={...x,signal:S,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:i,duplex:"half",credentials:t?y:void 0};k=o&&new r(a,c);let l=await(o?w(k,x):w(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&j)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Tw.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&dS(t,lS(uS(h),!0))||[];l=new n(SS(l.body,65536,r,()=>{a&&a(),j&&j()}),e)}v=v||"text";let A=await f[Tw.findKey(f,v)||"text"](l,e);return!m&&j&&j(),await new Promise((t,r)=>{cS(t,r,{data:A,headers:aS.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(j&&j(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Rw("Network Error",Rw.ERR_NETWORK,e,k),{cause:t.cause||t});throw Rw.from(t,t&&t.code,e,k)}}},_S=new Map,TS=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let s,i,c=o.length,l=_S;for(;c--;)s=o[c],i=l.get(s),void 0===i&&l.set(s,i=c?new Map:CS(t)),l=i;return i};TS();const RS={http:null,xhr:bS,fetch:{get:TS}};Tw.forEach(RS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const PS=e=>`- ${e}`,OS=e=>Tw.isFunction(e)||null===e||!1===e;var IS={getAdapter:function(e,t){e=Tw.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let s=0;s<r;s++){let r;if(n=e[s],a=n,!OS(n)&&(a=RS[(r=String(n)).toLowerCase()],void 0===a))throw new Rw(`Unknown adapter '${r}'`);if(a&&(Tw.isFunction(a)||(a=a.get(t))))break;o[r||"#"+s]=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(PS).join("\n"):" "+PS(e[0]):"as no adapter specified";throw new Rw("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:RS};function DS(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new iS(null,e)}function US(e){DS(e),e.headers=aS.from(e.headers),e.data=oS.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return IS.getAdapter(e.adapter||Xw.adapter,e)(e).then(function(t){return DS(e),t.data=oS.call(e,e.transformResponse,t),t.headers=aS.from(t.headers),t},function(t){return sS(t)||(DS(e),t&&t.response&&(t.response.data=oS.call(e,e.transformResponse,t.response),t.response.headers=aS.from(t.response.headers))),Promise.reject(t)})}const MS="1.13.4",FS={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{FS[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const zS={};FS.transitional=function(e,t,r){function n(e,t){return"[Axios v"+MS+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Rw(n(a," has been removed"+(t?" in "+t:"")),Rw.ERR_DEPRECATED);return t&&!zS[a]&&(zS[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)}},FS.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var LS={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Rw("options must be an object",Rw.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new Rw("option "+o+" must be "+r,Rw.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Rw("Unknown option "+o,Rw.ERR_BAD_OPTION)}},validators:FS};const $S=LS.validators;let VS=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Vw,response:new Vw}}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=gS(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&LS.assertOptions(r,{silentJSONParsing:$S.transitional($S.boolean),forcedJSONParsing:$S.transitional($S.boolean),clarifyTimeoutError:$S.transitional($S.boolean)},!1),null!=n&&(Tw.isFunction(n)?t.paramsSerializer={serialize:n}:LS.assertOptions(n,{encode:$S.function,serialize:$S.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),LS.assertOptions(t,{baseUrl:$S.spelling("baseURL"),withXsrfToken:$S.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&Tw.merge(a.common,a[t.method]);a&&Tw.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=aS.concat(o,a);const s=[];let i=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,s.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(!i){const e=[US.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=s.length;let f=t;for(;u<d;){const e=s[u++],t=s[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=US.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 $w(mS((e=gS(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Tw.forEach(["delete","get","head","options"],function(e){VS.prototype[e]=function(t,r){return this.request(gS(r||{},{method:e,url:t,data:(r||{}).data}))}}),Tw.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(gS(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}VS.prototype[e]=t(),VS.prototype[e+"Form"]=t(!0)});const WS={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(WS).forEach(([e,t])=>{WS[t]=e});const BS=function e(t){const r=new VS(t),n=Lx(VS.prototype.request,r);return Tw.extend(n,VS.prototype,r,{allOwnKeys:!0}),Tw.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(gS(t,r))},n}(Xw);BS.Axios=VS,BS.CanceledError=iS,BS.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 iS(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}}},BS.isCancel=sS,BS.VERSION=MS,BS.toFormData=Uw,BS.AxiosError=Rw,BS.Cancel=BS.CanceledError,BS.all=function(e){return Promise.all(e)},BS.spread=function(e){return function(t){return e.apply(null,t)}},BS.isAxiosError=function(e){return Tw.isObject(e)&&!0===e.isAxiosError},BS.mergeConfig=gS,BS.AxiosHeaders=aS,BS.formToJSON=e=>Yw(Tw.isHTMLForm(e)?new FormData(e):e),BS.getAdapter=IS.getAdapter,BS.HttpStatusCode=WS,BS.default=BS;const{Axios:GS,AxiosError:HS,CanceledError:KS,isCancel:ZS,CancelToken:JS,VERSION:qS,all:YS,Cancel:XS,isAxiosError:QS,spread:ek,toFormData:tk,AxiosHeaders:rk,HttpStatusCode:nk,formToJSON:ak,getAdapter:ok,mergeConfig:sk}=BS;const ik=new class{constructor(e={}){this.client=BS.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=j();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=ie(),r=se(e=>e.auth),n=se(e=>e.os),{serverUrl:a,orgId:o,auth:s}=n,{resetCurrentWorkspace:i,currentWorkspace:l}=_x(),u=t.useCallback(async()=>{e.auth(d());try{const t=await ik.post(`${a}/api/v1/auth/request`,{orgId:o,clientId:s?.clientId,redirect:{success:s?.redirectUrl||window.location.href,error:s?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(f()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(f()),c(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,o,s,e]),p=t.useCallback(async()=>{try{s?.callbacks?.onSignOut&&"function"==typeof s.callbacks.onSignOut&&await s.callbacks.onSignOut(),e.auth(m()),i(),k()}catch(e){c(e,{component:"useSaaSAuth",action:"signOut"}),k()}},[e,i,s?.callbacks?.onSignOut]),h=t.useCallback(e=>{l?Tx.openWorkspaceSettings(e):c(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[l]),g=t.useMemo(()=>v(r.status),[r.status]);return t.useMemo(()=>({user:r.session?.user,session:r.session,status:r.status,...g,signIn:u,signOut:p,openWorkspaceSettings:h}),[r.session,r.status,g,u,p,h])}function lk(){const e=t.useContext(be);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])}}var dk=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:o,onSelectPlan:s,loading:i=!1})=>{const[c,l]=t.useState(!1),d=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),u=(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())})(d);t.useMemo(()=>{const e=new Map;return u.forEach(t=>{const r=t.category||"other";e.has(r)||e.set(r,[]),e.get(r).push(t)}),e},[u]);const f=u.filter(e=>"feature"===e.type),p=u.filter(e=>"limit"===e.type),m=u.filter(e=>"quota"===e.type),h=i||c,g=(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,v=(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 e.jsx(Cu,{open:r,onOpenChange:n,children:e.jsxs(Pu,{className:"max-w-7xl w-full h-[90vh] p-0 flex flex-col",children:[e.jsx("div",{className:"flex items-center justify-between p-6 border-b",children:e.jsxs("div",{children:[e.jsx(Iu,{className:"text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(Du,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:0===d.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.map(t=>{const r=t._id===o,a=(e=>{if(e._id===o)return{label:"Current Plan",variant:"outline",disabled:!0};if(!o)return{label:"Subscribe",variant:"default",disabled:!1};const t=d.findIndex(e=>e._id===o),r=d.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}})(t),u=h&&t._id===o;return e.jsxs("div",{className:"border rounded-lg p-4 "+(r?"border-blue-500 bg-blue-50":"hover:border-gray-300"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t.plan.name}),r&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"Current"})]}),t.plan.description&&e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:t.plan.description}),e.jsx(Xc,{className:"w-full",variant:a.variant,disabled:a.disabled||h,onClick:()=>(async e=>{if(e!==o&&!i&&!c){l(!0);try{await s(e),n(!1)}catch(e){}finally{l(!1)}}})(t._id),children:u?"Updating...":a.label})]},t._id)})}),e.jsxs("div",{className:"border rounded-lg overflow-hidden bg-white",children:[e.jsx("div",{className:"bg-gray-50 p-4 border-b",children:e.jsx("h3",{className:"font-semibold text-lg",children:"Compare all features"})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-gray-50",children:[e.jsx("th",{className:"text-left p-4 font-semibold text-sm sticky left-0 bg-gray-50 z-10 min-w-[250px]",children:"Feature"}),d.map(t=>e.jsxs("th",{className:"text-center p-4 font-semibold text-sm min-w-[150px] "+(t._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:[e.jsx("div",{className:"font-semibold",children:t.plan.name}),t._id===o&&e.jsx("div",{className:"text-xs text-blue-600 font-normal mt-1",children:"Current Plan"})]},t._id))]})}),e.jsxs("tbody",{children:[f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:e.jsx("td",{colSpan:d.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Features"})}),f.map(t=>e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-4 sticky left-0 bg-white z-10",children:[e.jsx("div",{className:"font-medium text-sm text-gray-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t.description})]}),d.map(r=>{const n=g(r,t),a=v(n,t),s="feature"===t.type&&!0===n;return e.jsx("td",{className:"text-center p-4 align-middle "+(r._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:e.jsx("span",{className:"text-sm "+(s?"text-green-600 font-semibold":"—"===a?"text-gray-400":"text-gray-700"),children:a})},r._id)})]},t._id))]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:e.jsx("td",{colSpan:d.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Limits"})}),p.map(t=>e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-4 sticky left-0 bg-white z-10",children:[e.jsx("div",{className:"font-medium text-sm text-gray-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t.description})]}),d.map(r=>{const n=g(r,t),a=v(n,t);return e.jsx("td",{className:"text-center p-4 align-middle "+(r._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:e.jsx("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},r._id)})]},t._id))]}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:e.jsx("td",{colSpan:d.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Quotas"})}),m.map(t=>e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-4 sticky left-0 bg-white z-10",children:[e.jsx("div",{className:"font-medium text-sm text-gray-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t.description})]}),d.map(r=>{const n=g(r,t),a=v(n,t);return e.jsx("td",{className:"text-center p-4 align-middle "+(r._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:e.jsx("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},r._id)})]},t._id))]})]})]})})]})]})})]})})}});exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:o="flex flex-col gap-1.5 w-full",language:s,customTexts:i={},autoFocus:c=!0,showSuccessMessage:l=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,v]=t.useState(!1),{submitBetaForm:b,isLoading:y,isSubmitting:x,error:w,config:S,success:k,message:j}=(()=>{const e=se(e=>e.os),[r,n]=t.useState(null),[a,o]=t.useState(!0),[s,i]=t.useState(!1),[c,l]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{(async()=>{o(!0);const t=new Dx(e),r=await t.fetchConfig();n(r),o(!1)})()},[e]),{isLoading:a,isSubmitting:s,config:r,error:c,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return l(e),{success:!1,message:e}}try{i(!0),l(null),u(!1),p(null);const r=new Dx(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return l(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Mx).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&l&&(h(!0),v(!0)),w&&v(!0)},[k,l,w]);const E={...Mx[s||f],...i},A=Gt({resolver:eo(Ux),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{c&&A.setFocus("name")},[c,A]);const N=A.formState.isValid&&!x;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:y?e.jsxs("div",{className:Bc("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",a),children:[e.jsx(Pm,{className:"h-24 w-24 rounded-lg"}),e.jsx(Pm,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Pm,{className:"h-4 w-16"}),e.jsx(Pm,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Pm,{className:"h-4 w-16"}),e.jsx(Pm,{className:"h-10 w-full"})]}),e.jsx(Pm,{className:"h-10 w-full"})]})]}):e.jsxs("div",{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:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(zx,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(tt,{...A,children:e.jsxs("form",{onSubmit:A.handleSubmit(async e=>{try{const t=await b(e);t.success?(r?.(),A.reset(),l&&h(!0),v(!0)):(n?.(t.message),v(!0))}catch(e){n?.(e instanceof Error?e.message:E.errorMessage),v(!0)}}),className:a,noValidate:!0,"aria-busy":x,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(Fx,{screen:S?.screen?.register}),e.jsx(Wu,{control:A.control,name:"name",render:({field:t})=>e.jsxs(Hu,{className:o,children:[e.jsx(Ku,{children:E.nameLabel}),e.jsx(Zu,{children:e.jsx(Yu,{...t})}),e.jsx(Ju,{}),e.jsx(qu,{})]})}),e.jsx(Wu,{control:A.control,name:"email",render:({field:t})=>e.jsxs(Hu,{className:o,children:[e.jsx(Ku,{children:E.emailLabel}),e.jsx(Zu,{children:e.jsx(Yu,{...t})}),e.jsx(Ju,{}),e.jsx(qu,{})]})}),e.jsx(Xc,{type:"submit",disabled:!N,className:o,children:x?E.submittingText:E.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(Xc,{type:"button",onClick:()=>{v(!1),A.reset()},className:o,children:"Try Again"})})]}),g&&m&&j&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(Fx,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.ErrorBoundary=l,exports.SDKError=s,exports.SDKErrorBoundary=l,exports.SaaSOSProvider=Ix,exports.WhenAuthenticated=e=>{const{children:t}=e,{status:r}=ck();return r!==exports.AuthStatus.authenticated?null:t},exports.WhenRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=ck();return n.includes(a?.role??"")?t:r||null},exports.WhenUnauthenticated=e=>{const{children:t}=e,{status:r}=ck();return r===exports.AuthStatus.authenticated?null:t},exports.WhenUserFeatureDisabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=lk();return n(r)?null:t},exports.WhenUserFeatureEnabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=lk();return n(r)?t:null},exports.WhenWorkspaceFeatureDisabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=_x(),a=n?.features?.[r];return a?null:t},exports.WhenWorkspaceFeatureEnabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=_x(),a=n?.features?.[r];return a?t:null},exports.WhenWorkspaceRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=ck(),{currentWorkspace:o}=_x(),s=o?.users.find(e=>e._id===a?.id);return s&&n.includes(s?.role??"")?t:r||null},exports.WorkspaceSwitcher=Ax,exports.createSDKError=function(e,t,r,n){return new s(e,t,r,n)},exports.errorHandler=i,exports.eventEmitter=he,exports.handleError=c,exports.useCreateCheckoutSession=Hb,exports.useInvoice=(e,r)=>{const n=se(e=>e.os),a=t.useMemo(()=>new xe(n),[n.serverUrl,n.version,n.orgId]),[o,s]=t.useState(null),[i,l]=t.useState(!1),[d,u]=t.useState(null),f=t.useCallback(async()=>{if(e&&r){l(!0),u(null);try{const t=await a.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";u(n),c(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{l(!1)}}else s(null)},[a,e,r]);return t.useEffect(()=>{f()},[f]),{invoice:o,loading:i,error:d,refetch:f}},exports.useInvoices=Jb,exports.usePlanGroup=Bb,exports.usePlanGroupVersions=Gb,exports.useSaaSAuth=ck,exports.useSaaSSettings=Wp,exports.useSaaSWorkspaces=_x,exports.useSubscription=Wb,exports.useSubscriptionManagement=Zb,exports.useUpdateSubscription=Kb,exports.useUserAttributes=function(){const e=t.useContext(be);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=lk;
|
|
29
|
+
*/function Ju(){return Hu||(Hu=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,o=r.useEffect,s=r.useLayoutEffect,i=r.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){c||void 0===r.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();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return s(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),o(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};Zu.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Zu}function qu(){return Ku||(Ku=1,"production"===process.env.NODE_ENV?Wu.exports=Gu():Wu.exports=Ju()),Wu.exports}var Yu=qu();function Xu(){return()=>{}}var Qu="Avatar",[ef]=function(t,r=[]){let n=[];const o=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return o.scopeName=t,[function(r,o){const s=a.createContext(o);s.displayName=r+"Context";const i=n.length;n=[...n,o];const c=r=>{const{scope:n,children:o,...c}=r,l=n?.[t]?.[i]||s,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||s,l=a.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Fu(o,...r)]}(Qu),[tf,rf]=ef(Qu),nf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...o}=t,[s,i]=a.useState("idle");return e.jsx(tf,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:e.jsx(Vu.span,{...o,ref:r})})});nf.displayName=Qu;var af="AvatarImage",of=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:o,onLoadingStatusChange:s=()=>{},...i}=t,c=rf(af,n),l=function(e,{referrerPolicy:t,crossOrigin:r}){const n=Yu.useSyncExternalStore(Xu,()=>!0,()=>!1),o=a.useRef(null),s=n?(o.current||(o.current=new window.Image),o.current):null,[i,c]=a.useState(()=>lf(s,e));return $u(()=>{c(lf(s,e))},[s,e]),$u(()=>{const e=e=>()=>{c(e)};if(!s)return;const n=e("loaded"),a=e("error");return s.addEventListener("load",n),s.addEventListener("error",a),t&&(s.referrerPolicy=t),"string"==typeof r&&(s.crossOrigin=r),()=>{s.removeEventListener("load",n),s.removeEventListener("error",a)}},[s,r,t]),i}(o,i),d=zu(e=>{s(e),c.onImageLoadingStatusChange(e)});return $u(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e.jsx(Vu.img,{...i,ref:r,src:o}):null});of.displayName=af;var sf="AvatarFallback",cf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:o,...s}=t,i=rf(sf,n),[c,l]=a.useState(void 0===o);return a.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==i.imageLoadingStatus?e.jsx(Vu.span,{...s,ref:r}):null});function lf(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}cf.displayName=sf;var df=nf,uf=of,ff=cf;const pf=a.forwardRef(({className:t,...r},n)=>e.jsx(df,{ref:n,className:ke("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));pf.displayName=df.displayName;const mf=a.forwardRef(({className:t,...r},n)=>e.jsx(uf,{ref:n,className:ke("aspect-square h-full w-full",t),...r}));mf.displayName=uf.displayName;const hf=a.forwardRef(({className:t,...r},n)=>e.jsx(ff,{ref:n,className:ke("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function gf(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function vf(t,r=[]){let n=[];const o=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return o.scopeName=t,[function(r,o){const s=a.createContext(o),i=n.length;n=[...n,o];const c=r=>{const{scope:n,children:o,...c}=r,l=n?.[t]?.[i]||s,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||s,l=a.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${e}\` 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 n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}hf.displayName=ff.displayName;var yf=a[" useId ".trim().toString()]||(()=>{}),xf=0;function wf(e){const[t,r]=a.useState(yf());return $u(()=>{r(e=>e??String(xf++))},[e]),e||(t?`radix-${t}`:"")}var Sf=a[" useInsertionEffect ".trim().toString()]||$u;function kf({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,s,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),o=a.useRef(r),s=a.useRef(t);return Sf(()=>{s.current=t},[t]),a.useEffect(()=>{o.current!==r&&(s.current?.(r),o.current=r)},[r,o]),[r,n,s]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${n} 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,n])}const d=a.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else s(t)},[c,e,s,i]);return[l,d]}function Ef(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ws(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jf=Symbol("radix.slottable");function Af(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===jf}var Nf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=Ef(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Af);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{});var Cf,_f="dismissableLayer.update",Tf="dismissableLayer.pointerDownOutside",Rf="dismissableLayer.focusOutside",Pf=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Of=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...d}=t,u=a.useContext(Pf),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Bs(r,e=>p(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),x=f?v.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=y,k=function(e,t=globalThis?.document){const r=zu(e),n=a.useRef(!1),o=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){Df(Tf,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);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(s?.(e),c?.(e),e.defaultPrevented||l?.())},m),E=function(e,t=globalThis?.document){const r=zu(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){Df(Rf,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=zu(e);a.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=>{x===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Cf=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),If(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Cf)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),If())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(_f,e),()=>document.removeEventListener(_f,e)},[]),e.jsx(Nf.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:gf(t.onFocusCapture,E.onFocusCapture),onBlurCapture:gf(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:gf(t.onPointerDownCapture,k.onPointerDownCapture)})});Of.displayName="DismissableLayer";function If(){const e=new CustomEvent(_f);document.dispatchEvent(e)}function Df(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&o.flushSync(()=>e.dispatchEvent(t))}(a,s):a.dispatchEvent(s)}a.forwardRef((t,r)=>{const n=a.useContext(Pf),o=a.useRef(null),s=Bs(r,o);return a.useEffect(()=>{const e=o.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Nf.div,{...t,ref:s})}).displayName="DismissableLayerBranch";var Uf="focusScope.autoFocusOnMount",Mf="focusScope.autoFocusOnUnmount",Ff={bubbles:!1,cancelable:!0},zf=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...c}=t,[l,d]=a.useState(null),u=zu(s),f=zu(i),p=a.useRef(null),m=Bs(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:Wf(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Wf(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Wf(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]),a.useEffect(()=>{if(l){Bf.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Uf,Ff);l.addEventListener(Uf,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Wf(n,{select:t}),document.activeElement!==r)return}((e=Lf(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Wf(l))}return()=>{l.removeEventListener(Uf,u),setTimeout(()=>{const e=new CustomEvent(Mf,Ff);l.addEventListener(Mf,f),l.dispatchEvent(e),e.defaultPrevented||Wf(t??document.body,{select:!0}),l.removeEventListener(Mf,f),Bf.remove(h)},0)}}var e},[l,u,f,h]);const g=a.useCallback(e=>{if(!n&&!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,[a,o]=function(e){const t=Lf(e),r=$f(t,e),n=$f(t.reverse(),e);return[r,n]}(t);a&&o?e.shiftKey||r!==o?e.shiftKey&&r===a&&(e.preventDefault(),n&&Wf(o,{select:!0})):(e.preventDefault(),n&&Wf(a,{select:!0})):r===t&&e.preventDefault()}},[n,o,h.paused]);return e.jsx(Nf.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function Lf(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 $f(e,t){for(const r of e)if(!Vf(r,{upTo:t}))return r}function Vf(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 Wf(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()}}zf.displayName="FocusScope";var Bf=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Gf(e,t),e.unshift(t)},remove(t){e=Gf(e,t),e[0]?.resume()}}}();function Gf(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Hf=a.forwardRef((t,n)=>{const{container:o,...s}=t,[i,c]=a.useState(!1);$u(()=>c(!0),[]);const l=o||i&&globalThis?.document?.body;return l?r.createPortal(e.jsx(Nf.div,{...s,ref:n}),l):null});Hf.displayName="Portal";var Kf=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),o=a.useRef(e),s=a.useRef("none"),i=e?"mounted":"unmounted",[c,l]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=Zf(n.current);s.current="mounted"===c?e:"none"},[c]),$u(()=>{const t=n.current,r=o.current;if(r!==e){const n=s.current,a=Zf(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]),$u(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const s=Zf(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&s&&(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)})}},i=e=>{e.target===t&&(s.current=Zf(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),s=Bs(n.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||n.isPresent?a.cloneElement(o,{ref:s}):null};function Zf(e){return e?.animationName||"none"}Kf.displayName="Presence";var Jf=0;function qf(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Yf()),document.body.insertAdjacentElement("beforeend",e[1]??Yf()),Jf++,()=>{1===Jf&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Jf--}},[])}function Yf(){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 Xf=function(){return Xf=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},Xf.apply(this,arguments)};function Qf(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 ep="right-scroll-bar-position",tp="width-before-scroll-bar";function rp(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var np="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,ap=new WeakMap;function op(e,r){var n,a,o,s=(n=null,a=function(t){return e.forEach(function(e){return rp(e,t)})},(o=t.useState(function(){return{value:n,callback:a,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}})[0]).callback=a,o.facade);return np(function(){var t=ap.get(s);if(t){var r=new Set(t),n=new Set(e),a=s.current;r.forEach(function(e){n.has(e)||rp(e,null)}),n.forEach(function(e){r.has(e)||rp(e,a)})}ap.set(s,e)},[e]),s}function sp(e){return e}var ip=function(e){var t=e.sideCar,r=Qf(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,Xf({},r))};ip.isSideCarExport=!0;var cp=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=sp);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)},s=function(){return Promise.resolve().then(o)};s(),r={push:function(e){t.push(e),s()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Xf({async:!0,ssr:!1},e),t}(),lp=function(){},dp=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:lp,onWheelCapture:lp,onTouchMoveCapture:lp}),o=n[0],s=n[1],i=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,b=e.as,y=void 0===b?"div":b,x=e.gapMode,w=Qf(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=op([r,t]),E=Xf(Xf({},w),o);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:cp,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:x}),i?a.cloneElement(a.Children.only(c),Xf(Xf({},E),{ref:k})):a.createElement(y,Xf({},E,{className:l,ref:k}),c))});dp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dp.classNames={fullWidth:tp,zeroRight:ep};function up(){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=up())&&(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)}}},pp=function(){var e,t=(e=fp(),function(t,r){a.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}},mp={left:0,top:0,right:0,gap:0},hp=function(e){return parseInt(e||"",10)||0},gp=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return mp;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[hp(r),hp(n),hp(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])}},vp=pp(),bp="data-scroll-locked",yp=function(e,t,r,n){var a=e.left,o=e.top,s=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"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(s,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(ep," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(tp," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(ep," .").concat(ep," {\n right: 0 ").concat(n,";\n }\n \n .").concat(tp," .").concat(tp," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(bp,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},xp=function(){var e=parseInt(document.body.getAttribute(bp)||"0",10);return isFinite(e)?e:0},wp=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(bp,(xp()+1).toString()),function(){var e=xp()-1;e<=0?document.body.removeAttribute(bp):document.body.setAttribute(bp,e.toString())}},[]);var s=a.useMemo(function(){return gp(o)},[o]);return a.createElement(vp,{styles:yp(s,!t,o,r?"":"!important")})},Sp=!1;if("undefined"!=typeof window)try{var kp=Object.defineProperty({},"passive",{get:function(){return Sp=!0,!0}});window.addEventListener("test",kp,kp),window.removeEventListener("test",kp,kp)}catch(e){Sp=!1}var Ep=!!Sp&&{passive:!1},jp=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])},Ap=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Np(e,n)){var a=Cp(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Np=function(e,t){return"v"===e?function(e){return jp(e,"overflowY")}(t):function(e){return jp(e,"overflowX")}(t)},Cp=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)},_p=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Tp=function(e){return[e.deltaX,e.deltaY]},Rp=function(e){return e&&"current"in e?e.current:e},Pp=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Op=0,Ip=[];function Dp(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Up,Mp=(Up=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),o=a.useState(Op++)[0],s=a.useState(pp)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.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(Rp),!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=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,o=_p(e),s=r.current,c="deltaX"in e?e.deltaX:s[0]-o[0],l="deltaY"in e?e.deltaY:s[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=Ap(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Ap(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(c||l)&&(n.current=a),!a)return!0;var h=n.current||a;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,s=r.target,i=t.contains(s),c=!1,l=o>0,d=0,u=0;do{if(!s)break;var f=Cp(e,s),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Np(e,s)&&(d+=m,u+=p);var h=s.parentNode;s=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&s!==document.body||i&&(t.contains(s)||t===s));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=a.useCallback(function(e){var r=e;if(Ip.length&&Ip[Ip.length-1]===s){var n="deltaY"in r?Tp(r):_p(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=(i.current.shards||[]).map(Rp).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:Dp(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=a.useCallback(function(e){r.current=_p(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,Tp(t),t.target,c(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,_p(t),t.target,c(t,e.lockRef.current))},[]);a.useEffect(function(){return Ip.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Ep),document.addEventListener("touchmove",l,Ep),document.addEventListener("touchstart",u,Ep),function(){Ip=Ip.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,Ep),document.removeEventListener("touchmove",l,Ep),document.removeEventListener("touchstart",u,Ep)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(s,{styles:Pp(o)}):null,m?a.createElement(wp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},cp.useMedium(Up),ip),Fp=a.forwardRef(function(e,t){return a.createElement(dp,Xf({},e,{ref:t,sideCar:Mp}))});Fp.classNames=dp.classNames;var zp=new WeakMap,Lp=new WeakMap,$p={},Vp=0,Wp=function(e){return e&&(e.host||Wp(e.parentNode))},Bp=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Wp(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]);$p[r]||($p[r]=new WeakMap);var o=$p[r],s=[],i=new Set,c=new Set(a),l=function(e){e&&!i.has(e)&&(i.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(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(zp.get(e)||0)+1,l=(o.get(e)||0)+1;zp.set(e,c),o.set(e,l),s.push(e),1===c&&a&&Lp.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),i.clear(),Vp++,function(){s.forEach(function(e){var t=zp.get(e)-1,a=o.get(e)-1;zp.set(e,t),o.set(e,a),t||(Lp.has(e)||e.removeAttribute(n),Lp.delete(e)),a||e.removeAttribute(r)}),--Vp||(zp=new WeakMap,zp=new WeakMap,Lp=new WeakMap,$p={})}},Gp=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"))),Bp(n,a,r,"aria-hidden")):function(){return null}};function Hp(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ws(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Kp=Symbol("radix.slottable");function Zp(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Kp}var Jp="Dialog",[qp,Yp]=vf(Jp),[Xp,Qp]=qp(Jp),em=t=>{const{__scopeDialog:r,children:n,open:o,defaultOpen:s,onOpenChange:i,modal:c=!0}=t,l=a.useRef(null),d=a.useRef(null),[u,f]=kf({prop:o,defaultProp:s??!1,onChange:i,caller:Jp});return e.jsx(Xp,{scope:r,triggerRef:l,contentRef:d,contentId:wf(),titleId:wf(),descriptionId:wf(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};em.displayName=Jp;var tm="DialogTrigger",rm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Qp(tm,n),s=Bs(r,o.triggerRef);return e.jsx(Nf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Sm(o.open),...a,ref:s,onClick:gf(t.onClick,o.onOpenToggle)})});rm.displayName=tm;var nm="DialogPortal",[am,om]=qp(nm,{forceMount:void 0}),sm=t=>{const{__scopeDialog:r,forceMount:n,children:o,container:s}=t,i=Qp(nm,r);return e.jsx(am,{scope:r,forceMount:n,children:a.Children.map(o,t=>e.jsx(Kf,{present:n||i.open,children:e.jsx(Hf,{asChild:!0,container:s,children:t})}))})};sm.displayName=nm;var im="DialogOverlay",cm=a.forwardRef((t,r)=>{const n=om(im,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Qp(im,t.__scopeDialog);return s.modal?e.jsx(Kf,{present:a||s.open,children:e.jsx(dm,{...o,ref:r})}):null});cm.displayName=im;var lm=function(t){const r=Hp(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Zp);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),dm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Qp(im,n);return e.jsx(Fp,{as:lm,allowPinchZoom:!0,shards:[o.contentRef],children:e.jsx(Nf.div,{"data-state":Sm(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),um="DialogContent",fm=a.forwardRef((t,r)=>{const n=om(um,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Qp(um,t.__scopeDialog);return e.jsx(Kf,{present:a||s.open,children:s.modal?e.jsx(pm,{...o,ref:r}):e.jsx(mm,{...o,ref:r})})});fm.displayName=um;var pm=a.forwardRef((t,r)=>{const n=Qp(um,t.__scopeDialog),o=a.useRef(null),s=Bs(r,n.contentRef,o);return a.useEffect(()=>{const e=o.current;if(e)return Gp(e)},[]),e.jsx(hm,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gf(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:gf(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:gf(t.onFocusOutside,e=>e.preventDefault())})}),mm=a.forwardRef((t,r)=>{const n=Qp(um,t.__scopeDialog),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(hm,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(o.current||n.triggerRef.current?.focus(),e.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(o.current=!0,"pointerdown"===e.detail.originalEvent.type&&(s.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&s.current&&e.preventDefault()}})}),hm=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,...c}=t,l=Qp(um,n),d=a.useRef(null),u=Bs(r,d);return qf(),e.jsxs(e.Fragment,{children:[e.jsx(zf,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:i,children:e.jsx(Of,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Sm(l.open),...c,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Am,{titleId:l.titleId}),e.jsx(Nm,{contentRef:d,descriptionId:l.descriptionId})]})]})}),gm="DialogTitle",vm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Qp(gm,n);return e.jsx(Nf.h2,{id:o.titleId,...a,ref:r})});vm.displayName=gm;var bm="DialogDescription",ym=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Qp(bm,n);return e.jsx(Nf.p,{id:o.descriptionId,...a,ref:r})});ym.displayName=bm;var xm="DialogClose",wm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Qp(xm,n);return e.jsx(Nf.button,{type:"button",...a,ref:r,onClick:gf(t.onClick,()=>o.onOpenChange(!1))})});function Sm(e){return e?"open":"closed"}wm.displayName=xm;var km="DialogTitleWarning",[Em,jm]=function(t,r){const n=a.createContext(r),o=t=>{const{children:r,...o}=t,s=a.useMemo(()=>o,Object.values(o));return e.jsx(n.Provider,{value:s,children:r})};return o.displayName=t+"Provider",[o,function(e){const o=a.useContext(n);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(km,{contentName:um,titleName:gm,docsSlug:"dialog"}),Am=({titleId:e})=>{const t=jm(km),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 a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Nm=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jm("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},Cm=em,_m=rm,Tm=sm,Rm=cm,Pm=fm,Om=vm,Im=ym,Dm=wm;function Um(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 Mm=["color"],Fm=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Um(e,Mm);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))}),zm=["color"],Lm=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Um(e,zm);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))}),$m=["color"],Vm=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Um(e,$m);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Wm=["color"],Bm=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Um(e,Wm);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:r}),t.createElement("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:a,fillRule:"evenodd",clipRule:"evenodd"}))});const Gm=Cm,Hm=_m,Km=Tm,Zm=a.forwardRef(({className:t,...r},n)=>e.jsx(Rm,{ref:n,className:ke("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",t),...r}));Zm.displayName=Rm.displayName;const Jm=a.forwardRef(({className:t,children:r,...n},o)=>{const{container:s}=a.useContext(qt);return e.jsxs(Km,{container:s,children:[e.jsx(Zm,{}),e.jsxs(Pm,{ref:o,className:ke("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",t),...n,children:[r,e.jsxs(Dm,{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:[e.jsx(Vm,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});Jm.displayName=Pm.displayName;const qm=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});qm.displayName="DialogHeader";const Ym=a.forwardRef(({className:t,...r},n)=>e.jsx(Om,{ref:n,className:ke("text-lg font-semibold leading-none tracking-tight",t),...r}));Ym.displayName=Om.displayName;const Xm=a.forwardRef(({className:t,...r},n)=>e.jsx(Im,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));function Qm(t){const r=eh(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(rh);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}function eh(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ws(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Xm.displayName=Im.displayName;var th=Symbol("radix.slottable");function rh(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===th}function nh(r){const n=r+"CollectionProvider",[a,o]=vf(n),[s,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),c=r=>{const{scope:n,children:a}=r,o=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(s,{scope:n,itemMap:i,collectionRef:o,children:a})};c.displayName=n;const l=r+"CollectionSlot",d=Qm(l),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,o=Bs(r,i(l,n).collectionRef);return e.jsx(d,{ref:o,children:a})});u.displayName=l;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=Qm(f),h=t.forwardRef((r,n)=>{const{scope:a,children:o,...s}=r,c=t.useRef(null),l=Bs(n,c),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(c,{ref:c,...s}),()=>{d.itemMap.delete(c)})),e.jsx(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},o]}var ah=a.createContext(void 0);function oh(e){const t=a.useContext(ah);return e||t||"ltr"}var sh="rovingFocusGroup.onEntryFocus",ih={bubbles:!1,cancelable:!0},ch="RovingFocusGroup",[lh,dh,uh]=nh(ch),[fh,ph]=vf(ch,[uh]),[mh,hh]=fh(ch),gh=a.forwardRef((t,r)=>e.jsx(lh.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(lh.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(vh,{...t,ref:r})})}));gh.displayName=ch;var vh=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:s=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Bs(r,m),g=oh(i),[v,b]=kf({prop:c,defaultProp:l??null,onChange:d,caller:ch}),[y,x]=a.useState(!1),w=zu(u),S=dh(n),k=a.useRef(!1),[E,j]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(sh,w),()=>e.removeEventListener(sh,w)},[w]),e.jsx(mh,{scope:n,orientation:o,dir:g,loop:s,currentTabStopId:v,onItemFocus:a.useCallback(e=>b(e),[b]),onItemShiftTab:a.useCallback(()=>x(!0),[]),onFocusableItemAdd:a.useCallback(()=>j(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>j(e=>e-1),[]),children:e.jsx(Nf.div,{tabIndex:y||0===E?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:gf(t.onMouseDown,()=>{k.current=!0}),onFocus:gf(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(sh,ih);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);wh([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:gf(t.onBlur,()=>x(!1))})})}),bh="RovingFocusGroupItem",yh=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:i,children:c,...l}=t,d=wf(),u=i||d,f=hh(bh,n),p=f.currentTabStopId===u,m=dh(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return a.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),e.jsx(lh.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:e.jsx(Nf.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:gf(t.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:gf(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:gf(t.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:xh[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(()=>wh(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});yh.displayName=bh;var xh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function wh(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 Sh=gh,kh=yh;function Eh(e){const[t,r]=a.useState(void 0);return $u(()=>{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 jh(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ah="Radio",[Nh,Ch]=vf(Ah),[_h,Th]=Nh(Ah),Rh=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:o,checked:s=!1,required:i,disabled:c,value:l="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Bs(r,e=>m(e)),g=a.useRef(!1),v=!p||(u||!!p.closest("form"));return e.jsxs(_h,{scope:n,checked:s,disabled:c,children:[e.jsx(Nf.button,{type:"button",role:"radio","aria-checked":s,"data-state":Dh(s),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onClick:gf(t.onClick,e=>{s||d?.(),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&e.jsx(Ih,{control:p,bubbles:!g.current,name:o,value:l,checked:s,required:i,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});Rh.displayName=Ah;var Ph="RadioIndicator",Oh=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...o}=t,s=Th(Ph,n);return e.jsx(Kf,{present:a||s.checked,children:e.jsx(Nf.span,{"data-state":Dh(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:r})})});Oh.displayName=Ph;var Ih=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Bs(c,i),d=jh(n),u=Eh(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:o});r.call(e,n),e.dispatchEvent(t)}},[d,n,o]),e.jsx(Nf.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Dh(e){return e?"checked":"unchecked"}Ih.displayName="RadioBubbleInput";var Uh=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Mh="RadioGroup",[Fh]=vf(Mh,[ph,Ch]),zh=ph(),Lh=Ch(),[$h,Vh]=Fh(Mh),Wh=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:s,required:i=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=zh(n),h=oh(d),[g,v]=kf({prop:s,defaultProp:o??null,onChange:f,caller:Mh});return e.jsx($h,{scope:n,name:a,required:i,disabled:c,value:g,onValueChange:v,children:e.jsx(Sh,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:e.jsx(Nf.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});Wh.displayName=Mh;var Bh="RadioGroupItem",Gh=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:o,...s}=t,i=Vh(Bh,n),c=i.disabled||o,l=zh(n),d=Lh(n),u=a.useRef(null),f=Bs(r,u),p=i.value===s.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Uh.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)}},[]),e.jsx(kh,{asChild:!0,...l,focusable:!c,active:p,children:e.jsx(Rh,{disabled:c,required:i.required,checked:p,...d,...s,name:i.name,ref:f,onCheck:()=>i.onValueChange(s.value),onKeyDown:gf(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:gf(s.onFocus,()=>{m.current&&u.current?.click()})})})});Gh.displayName=Bh;var Hh=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,o=Lh(n);return e.jsx(Oh,{...o,...a,ref:r})});Hh.displayName="RadioGroupIndicator";var Kh=Wh,Zh=Gh,Jh=Hh;const qh=a.forwardRef(({className:t,...r},n)=>e.jsx(Kh,{className:ke("grid gap-2",t),...r,ref:n}));qh.displayName=Kh.displayName;const Yh=a.forwardRef(({className:t,...r},n)=>e.jsx(Zh,{ref:n,className:ke("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",t),...r,children:e.jsx(Jh,{className:"flex items-center justify-center",children:e.jsx(Lm,{className:"h-3.5 w-3.5 fill-primary"})})}));function Xh(e,[t,r]){return Math.min(r,Math.max(t,e))}Yh.displayName=Zh.displayName;var Qh="ScrollArea",[eg]=vf(Qh),[tg,rg]=eg(Qh),ng=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:o="hover",dir:s,scrollHideDelay:i=600,...c}=t,[l,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[v,b]=a.useState(null),[y,x]=a.useState(0),[w,S]=a.useState(0),[k,E]=a.useState(!1),[j,A]=a.useState(!1),N=Bs(r,e=>d(e)),C=oh(s);return e.jsx(tg,{scope:n,type:o,dir:C,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:E,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:j,onScrollbarYEnabledChange:A,onCornerWidthChange:x,onCornerHeightChange:S,children:e.jsx(Nf.div,{dir:C,...c,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});ng.displayName=Qh;var ag="ScrollAreaViewport",og=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:o,nonce:s,...i}=t,c=rg(ag,n),l=Bs(r,a.useRef(null),c.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("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:s}),e.jsx(Nf.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});og.displayName=ag;var sg="ScrollAreaScrollbar",ig=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=rg(sg,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:c}=s,l="horizontal"===t.orientation;return a.useEffect(()=>(l?i(!0):c(!0),()=>{l?i(!1):c(!1)}),[l,i,c]),"hover"===s.type?e.jsx(cg,{...o,ref:r,forceMount:n}):"scroll"===s.type?e.jsx(lg,{...o,ref:r,forceMount:n}):"auto"===s.type?e.jsx(dg,{...o,ref:r,forceMount:n}):"always"===s.type?e.jsx(ug,{...o,ref:r}):null});ig.displayName=sg;var cg=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=rg(sg,t.__scopeScrollArea),[i,c]=a.useState(!1);return a.useEffect(()=>{const e=s.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),s.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[s.scrollArea,s.scrollHideDelay]),e.jsx(Kf,{present:n||i,children:e.jsx(dg,{"data-state":i?"visible":"hidden",...o,ref:r})})}),lg=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=rg(sg,t.__scopeScrollArea),i="horizontal"===t.orientation,c=Tg(()=>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"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,s.scrollHideDelay,d]),a.useEffect(()=>{const e=s.viewport,t=i?"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)}},[s.viewport,i,d,c]),e.jsx(Kf,{present:n||"hidden"!==l,children:e.jsx(ug,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:gf(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:gf(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),dg=a.forwardRef((t,r)=>{const n=rg(sg,t.__scopeScrollArea),{forceMount:o,...s}=t,[i,c]=a.useState(!1),l="horizontal"===t.orientation,d=Tg(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;c(l?e:t)}},10);return Rg(n.viewport,d),Rg(n.content,d),e.jsx(Kf,{present:o||i,children:e.jsx(ug,{"data-state":i?"visible":"hidden",...s,ref:r})})}),ug=a.forwardRef((t,r)=>{const{orientation:n="vertical",...o}=t,s=rg(sg,t.__scopeScrollArea),i=a.useRef(null),c=a.useRef(0),[l,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Eg(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=jg(r),o=a/2,s=t||o,i=a-s,c=r.scrollbar.paddingStart+s,l=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Ng([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===n?e.jsx(fg,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=Ag(s.viewport.scrollLeft,l,s.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollLeft=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollLeft=p(e,s.dir))}}):"vertical"===n?e.jsx(pg,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=Ag(s.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{s.viewport&&(s.viewport.scrollTop=e)},onDragScroll:e=>{s.viewport&&(s.viewport.scrollTop=p(e))}}):null}),fg=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=rg(sg,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Bs(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(gg,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jg(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),Cg(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&o({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:kg(c.paddingLeft),paddingEnd:kg(c.paddingRight)}})}})}),pg=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=rg(sg,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Bs(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(gg,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jg(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),Cg(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&o({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:kg(c.paddingTop),paddingEnd:kg(c.paddingBottom)}})}})}),[mg,hg]=eg(sg),gg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:o,hasThumb:s,onThumbChange:i,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=rg(sg,n),[g,v]=a.useState(null),b=Bs(r,e=>v(e)),y=a.useRef(null),x=a.useRef(""),w=h.viewport,S=o.content-o.viewport,k=zu(f),E=zu(d),j=Tg(p,10);function A(e){if(y.current){const t=e.clientX-y.current.left,r=e.clientY-y.current.top;u({x:t,y:r})}}return a.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})},[w,g,S,k]),a.useEffect(E,[o,E]),Rg(g,j),Rg(h.content,j),e.jsx(mg,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:zu(i),onThumbPointerUp:zu(c),onThumbPositionChange:E,onThumbPointerDown:zu(l),children:e.jsx(Nf.div,{...m,ref:b,style:{position:"absolute",...m.style},onPointerDown:gf(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),A(e)}}),onPointerMove:gf(t.onPointerMove,A),onPointerUp:gf(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),vg="ScrollAreaThumb",bg=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,o=hg(vg,t.__scopeScrollArea);return e.jsx(Kf,{present:n||o.hasThumb,children:e.jsx(yg,{ref:r,...a})})}),yg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:o,...s}=t,i=rg(vg,n),c=hg(vg,n),{onThumbPositionChange:l}=c,d=Bs(r,e=>c.onThumbChange(e)),u=a.useRef(void 0),f=Tg(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=_g(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,l]),e.jsx(Nf.div,{"data-state":c.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:gf(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:gf(t.onPointerUp,c.onThumbPointerUp)})});bg.displayName=vg;var xg="ScrollAreaCorner",wg=a.forwardRef((t,r)=>{const n=rg(xg,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Sg,{...t,ref:r}):null});wg.displayName=xg;var Sg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...o}=t,s=rg(xg,n),[i,c]=a.useState(0),[l,d]=a.useState(0),u=Boolean(i&&l);return Rg(s.scrollbarX,()=>{const e=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(e),d(e)}),Rg(s.scrollbarY,()=>{const e=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(e),c(e)}),u?e.jsx(Nf.div,{...o,ref:r,style:{width:i,height:l,position:"absolute",right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:0,...t.style}}):null});function kg(e){return e?parseInt(e,10):0}function Eg(e,t){const r=e/t;return isNaN(r)?0:r}function jg(e){const t=Eg(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Ag(e,t,r="ltr"){const n=jg(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,s=t.content-t.viewport,i=o-n,c=Xh(e,"ltr"===r?[0,s]:[-1*s,0]);return Ng([0,s],[0,i])(c)}function Ng(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 Cg(e,t){return e>0&&e<t}var _g=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},s=r.left!==o.left,i=r.top!==o.top;(s||i)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Tg(e,t){const r=zu(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Rg(e,t){const r=zu(t);$u(()=>{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 Pg=ng,Og=og,Ig=wg;const Dg=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Pg,{ref:a,className:ke("relative overflow-hidden",t),...n,children:[e.jsx(Og,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Ug,{}),e.jsx(Ig,{})]}));Dg.displayName=Pg.displayName;const Ug=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(ig,{ref:a,orientation:r,className:ke("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]",t),...n,children:e.jsx(bg,{className:ke("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Ug.displayName=ig.displayName;var Mg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Zs(`Primitive.${r}`),o=a.forwardRef((t,a)=>{const{asChild:o,...s}=t,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...s,ref:a})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Fg="horizontal",zg=["horizontal","vertical"],Lg=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Fg,...o}=t,s=function(e){return zg.includes(e)}(a)?a:Fg,i=n?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};return e.jsx(Mg.div,{"data-orientation":s,...i,...o,ref:r})});Lg.displayName="Separator";var $g=Lg;const Vg=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},o)=>e.jsx($g,{ref:o,decorative:n,orientation:r,className:ke("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Vg.displayName=$g.displayName;var Wg=Symbol("radix.slottable");var Bg="AlertDialog",[Gg]=vf(Bg,[Yp]),Hg=Yp(),Kg=t=>{const{__scopeAlertDialog:r,...n}=t,a=Hg(r);return e.jsx(Cm,{...a,...n,modal:!0})};Kg.displayName=Bg;var Zg=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Hg(n);return e.jsx(_m,{...o,...a,ref:r})});Zg.displayName="AlertDialogTrigger";var Jg=t=>{const{__scopeAlertDialog:r,...n}=t,a=Hg(r);return e.jsx(Tm,{...a,...n})};Jg.displayName="AlertDialogPortal";var qg=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Hg(n);return e.jsx(Rm,{...o,...a,ref:r})});qg.displayName="AlertDialogOverlay";var Yg="AlertDialogContent",[Xg,Qg]=Gg(Yg),ev=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=Wg,r}("AlertDialogContent"),tv=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:o,...s}=t,i=Hg(n),c=a.useRef(null),l=Bs(r,c),d=a.useRef(null);return e.jsx(Em,{contentName:Yg,titleName:rv,docsSlug:"alert-dialog",children:e.jsx(Xg,{scope:n,cancelRef:d,children:e.jsxs(Pm,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:gf(s.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(ev,{children:o}),e.jsx(lv,{contentRef:c})]})})})});tv.displayName=Yg;var rv="AlertDialogTitle",nv=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Hg(n);return e.jsx(Om,{...o,...a,ref:r})});nv.displayName=rv;var av="AlertDialogDescription",ov=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Hg(n);return e.jsx(Im,{...o,...a,ref:r})});ov.displayName=av;var sv=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Hg(n);return e.jsx(Dm,{...o,...a,ref:r})});sv.displayName="AlertDialogAction";var iv="AlertDialogCancel",cv=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:o}=Qg(iv,n),s=Hg(n),i=Bs(r,o);return e.jsx(Dm,{...s,...a,ref:i})});cv.displayName=iv;var lv=({contentRef:e})=>{const t=`\`${Yg}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${Yg}\` by passing a \`${av}\` 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 \`${Yg}\`. 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 a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},dv=qg,uv=tv,fv=sv,pv=cv,mv=nv,hv=ov;const gv=Kg,vv=Zg,bv=Jg,yv=a.forwardRef(({className:t,...r},n)=>e.jsx(dv,{className:ke("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",t),...r,ref:n}));yv.displayName=dv.displayName;const xv=a.forwardRef(({className:t,...r},n)=>{const{container:o}=a.useContext(qt);return e.jsxs(bv,{container:o,children:[e.jsx(yv,{}),e.jsx(uv,{ref:n,className:ke("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",t),...r})]})});xv.displayName=uv.displayName;const wv=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",t),...r});wv.displayName="AlertDialogHeader";const Sv=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Sv.displayName="AlertDialogFooter";const kv=a.forwardRef(({className:t,...r},n)=>e.jsx(mv,{ref:n,className:ke("text-lg font-semibold",t),...r}));kv.displayName=mv.displayName;const Ev=a.forwardRef(({className:t,...r},n)=>e.jsx(hv,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));Ev.displayName=hv.displayName;const jv=a.forwardRef(({className:t,...r},n)=>e.jsx(fv,{ref:n,className:ke(Ci(),t),...r}));jv.displayName=fv.displayName;const Av=a.forwardRef(({className:t,...r},n)=>e.jsx(pv,{ref:n,className:ke(Ci({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Nv(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(Hi,{className:"h-10 w-full"}),e.jsx(Hi,{className:"h-10 w-full"}),e.jsx(Hi,{className:"h-10 w-full"})]})}Av.displayName=pv.displayName;const Cv=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:o}=tr(),s=Bt(e=>e.auth.session?.user||null);if(!r)return e.jsx(Nv,{});const i=Ut(r,s?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("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 ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(gv,{children:[e.jsx(vv,{asChild:!0,children:e.jsxs(_i,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(ki,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(xv,{children:[e.jsxs(wv,{children:[e.jsx(kv,{children:"Are you absolutely sure?"}),e.jsxs(Ev,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Sv,{children:[e.jsx(Av,{disabled:n,children:"Cancel"}),e.jsx(jv,{onClick:async()=>{a(!0);try{await o(r._id)}catch(e){Ie(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(gi,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var _v="Switch",[Tv]=vf(_v),[Rv,Pv]=Tv(_v),Ov=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:o,checked:s,defaultChecked:i,required:c,disabled:l,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Bs(r,e=>h(e)),v=a.useRef(!1),b=!m||(f||!!m.closest("form")),[y,x]=kf({prop:s,defaultProp:i??!1,onChange:u,caller:_v});return e.jsxs(Rv,{scope:n,checked:y,disabled:l,children:[e.jsx(Nf.button,{type:"button",role:"switch","aria-checked":y,"aria-required":c,"data-state":Mv(y),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:gf(t.onClick,e=>{x(e=>!e),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),b&&e.jsx(Uv,{control:m,bubbles:!v.current,name:o,value:d,checked:y,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Ov.displayName=_v;var Iv="SwitchThumb",Dv=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,o=Pv(Iv,n);return e.jsx(Nf.span,{"data-state":Mv(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});Dv.displayName=Iv;var Uv=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Bs(c,i),d=jh(n),u=Eh(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:o});r.call(e,n),e.dispatchEvent(t)}},[d,n,o]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Mv(e){return e?"checked":"unchecked"}Uv.displayName="SwitchBubbleInput";var Fv=Ov,zv=Dv;const Lv=a.forwardRef(({className:t,...r},n)=>e.jsx(Fv,{className:ke("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",t),...r,ref:n,children:e.jsx(zv,{className:ke("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")})}));Lv.displayName=Fv.displayName;const $v=({workspaceId:r})=>{const[n,a]=t.useState({}),[o,s]=t.useState(null),{allFeatures:i,updateFeature:c,getWorkspace:l}=tr(),[d,u]=t.useState(null),f=Bt(e=>e.auth.session?.user||null);if(t.useEffect(()=>{l(r).then(u)},[r]),!d)return e.jsx(Nv,{});const p=Dt(d,f?.id??null);return e.jsxs("div",{children:[o&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:o})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!i.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),i.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:i.map(t=>{const r=d?.features?.[t.slug],o=null!==n[t.slug]&&void 0!==n[t.slug],l=n[t.slug],f=!0===l?"Enabling":!1===l?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),o?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(gi,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):e.jsx(Lv,{disabled:!p,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(d){a(r=>({...r,[e]:t})),s(null);try{const r=await c(d._id,e,t);u(r);const n=i.find(t=>t.slug===e);s(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{s(null)},5e3)}catch(t){Ie(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:d._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})};function Vv(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 Wv=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑💻","👨💻","👩💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨💼","👩💼","👨🏫","👩🏫","👨🔬","👩🔬","👨🎨","👩🎨","👨🔧","👩🔧","👨🚀","👩🚀","👨⚖️","👩⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️🌈","🎟️","🎫"],Bv=({workspace:r})=>{const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState(),[l,d]=t.useState(null),{updateWorkspace:u}=tr(),f=Bt(e=>e.auth.session?.user||null),p=Pn({resolver:$s(Gc({name:bc().min(2,{message:"Workspace name must be at least 2 characters."}),image:bc().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Nv,{});const m=Dt(r,f?.id??null);return e.jsxs("div",{children:[l&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:l})]}),!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Di,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){a(!0),d(null);try{await u(r,e),d("Workspace settings saved successfully"),setTimeout(()=>{d(null)},5e3)}catch(e){Ie(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Mi,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Li,{children:[e.jsx($i,{children:"Name"}),e.jsx(Vi,{children:e.jsx(Gi,{placeholder:"My Awesome Workspace",...t,disabled:!m})}),e.jsx(Bi,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ii,{className:"text-sm font-medium",children:"Icon"}),e.jsx(Wi,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(qh,{value:o,disabled:!m,onValueChange:e=>s(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yh,{value:"emoji",id:"emoji"}),e.jsxs(Ii,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(wi,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yh,{value:"url",id:"url"}),e.jsxs(Ii,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(hi,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&p.watch("image")?.trim()&&e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview"})]})]}),m&&e.jsx(Dg,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:Wv.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",Vv(e))})(t),disabled:!m,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Mi,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Li,{children:[e.jsx($i,{children:"Image URL"}),e.jsx(Vi,{children:e.jsx(Gi,{placeholder:"https://example.com/image.png",...t,disabled:!m})}),e.jsx(Wi,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(Bi,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:m&&e.jsx(_i,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var Gv=.999,Hv=/[\\\/_+.#"@\[\(\{&]/,Kv=/[\\\/_+.#"@\[\(\{&]/g,Zv=/[\s-]/,Jv=/[\s-]/g;function qv(e,t,r,n,a,o,s){if(o===t.length)return a===e.length?1:.99;var i=`${a},${o}`;if(void 0!==s[i])return s[i];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=qv(e,t,r,n,p+1,o+1,s))>m&&(p===a?c*=1:Hv.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Kv))&&a>0&&(c*=Math.pow(Gv,d.length))):Zv.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(Jv))&&a>0&&(c*=Math.pow(Gv,u.length))):(c*=.17,a>0&&(c*=Math.pow(Gv,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=qv(e,t,r,n,p+1,o+2,s))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return s[i]=m,m}function Yv(e){return e.toLowerCase().replace(Jv," ")}function Xv(e,t,r){return qv(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Yv(e),Yv(t),0,0,{})}var Qv='[cmdk-group=""]',eb='[cmdk-group-items=""]',tb='[cmdk-item=""]',rb=`${tb}:not([aria-disabled="true"])`,nb="cmdk-item-select",ab="data-value",ob=(e,t,r)=>Xv(e,t,r),sb=a.createContext(void 0),ib=()=>a.useContext(sb),cb=a.createContext(void 0),lb=()=>a.useContext(cb),db=a.createContext(void 0),ub=a.forwardRef((e,t)=>{let r=jb(()=>{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}}}),n=jb(()=>new Set),o=jb(()=>new Map),s=jb(()=>new Map),i=jb(()=>new Set),c=kb(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,y=wf(),x=wf(),w=wf(),S=a.useRef(null),k=Cb();Eb(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,E.emit()}},[u]),Eb(()=>{k(6,T)},[]);let E=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,s,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),N(),k(1,C);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(y))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,E.emit()}),n||k(5,T),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(i=(s=c.current).onValueChange)||i.call(s,e))}}E.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),j=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=s.current.get(e))?void 0:a.value)&&(s.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,A(t,n)),k(2,()=>{N(),E.emit()}))},item:(e,t)=>(n.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{_(),N(),r.current.value||C(),E.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&C(),E.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{s.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:y,inputId:w,labelId:x,listInnerRef:S}),[]);function A(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:ob;return e?o(e,r.current.search,t):0}function N(){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;P().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),s=r.getAttribute("id");return(null!=(n=e.get(s))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(eb);t?t.appendChild(e.parentElement===t?e:e.closest(`${eb} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${eb} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Qv}[${ab}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function C(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(ab);E.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of n.current){let n=A(null!=(t=null==(e=s.current.get(o))?void 0:e.value)?t:"",null!=(i=null==(a=s.current.get(o))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(o,n),n>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 T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Qv))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${tb}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(rb))||[])}function O(e){let t=P()[e];t&&E.setState("value",t.getAttribute(ab))}function I(e){var t;let r=R(),n=P(),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(ab))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(Qv);for(;n&&!t;)n=e>0?wb(n,Qv):Sb(n,Qv),t=null==n?void 0:n.querySelector(rb);t?E.setState("value",t.getAttribute(ab)):I(e)}let U=()=>O(P().length-1),M=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},F=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Nf.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=b.onKeyDown)||t.call(b,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&M(e);break;case"ArrowDown":M(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(nb);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:Tb},l),_b(e,e=>a.createElement(cb.Provider,{value:E},a.createElement(sb.Provider,{value:j},e))))}),fb=a.forwardRef((e,t)=>{var r,n;let o=wf(),s=a.useRef(null),i=a.useContext(db),c=ib(),l=kb(e),d=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Eb(()=>{if(!d)return c.item(o,null==i?void 0:i.id)},[d]);let u=Nb(o,s,[e.value,e.children,s],e.keywords),f=lb(),p=Ab(e=>e.value&&e.value===u.current),m=Ab(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(a.useEffect(()=>{let t=s.current;if(t&&!e.disabled)return t.addEventListener(nb,h),()=>t.removeEventListener(nb,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:b,onSelect:y,forceMount:x,keywords:w,...S}=e;return a.createElement(Nf.div,{ref:Ws(s,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)}),pb=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:o,...s}=e,i=wf(),c=a.useRef(null),l=a.useRef(null),d=wf(),u=ib(),f=Ab(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Eb(()=>u.group(i),[]),Nb(i,c,[e.value,e.heading,l]);let p=a.useMemo(()=>({id:i,forceMount:o}),[o]);return a.createElement(Nf.div,{ref:Ws(c,t),...s,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),_b(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(db.Provider,{value:p},e))))}),mb=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,o=a.useRef(null),s=Ab(e=>!e.search);return r||s?a.createElement(Nf.div,{ref:Ws(o,t),...n,"cmdk-separator":"",role:"separator"}):null}),hb=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,o=null!=e.value,s=lb(),i=Ab(e=>e.search),c=Ab(e=>e.selectedItemId),l=ib();return a.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),a.createElement(Nf.input,{ref:t,...n,"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:i,onChange:e=>{o||s.setState("search",e.target.value),null==r||r(e.target.value)}})}),gb=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...o}=e,s=a.useRef(null),i=a.useRef(null),c=Ab(e=>e.selectedItemId),l=ib();return a.useEffect(()=>{if(i.current&&s.current){let e,t=i.current,r=s.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)}}},[]),a.createElement(Nf.div,{ref:Ws(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:l.listId},_b(e,e=>a.createElement("div",{ref:Ws(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),vb=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:o,contentClassName:s,container:i,...c}=e;return a.createElement(Cm,{open:r,onOpenChange:n},a.createElement(Tm,{container:i},a.createElement(Rm,{"cmdk-overlay":"",className:o}),a.createElement(Pm,{"aria-label":e.label,"cmdk-dialog":"",className:s},a.createElement(ub,{ref:t,...c}))))}),bb=a.forwardRef((e,t)=>Ab(e=>0===e.filtered.count)?a.createElement(Nf.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),yb=a.forwardRef((e,t)=>{let{progress:r,children:n,label:o="Loading...",...s}=e;return a.createElement(Nf.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},_b(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),xb=Object.assign(ub,{List:gb,Item:fb,Input:hb,Group:pb,Separator:mb,Dialog:vb,Empty:bb,Loading:yb});function wb(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Sb(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function kb(e){let t=a.useRef(e);return Eb(()=>{t.current=e}),t}var Eb="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function jb(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Ab(e){let t=lb(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Nb(e,t,r,n=[]){let o=a.useRef(),s=ib();return Eb(()=>{var a;let i=(()=>{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=n.map(e=>e.trim());s.value(e,i,c),null==(a=t.current)||a.setAttribute(ab,i),o.current=i}),o}var Cb=()=>{let[e,t]=a.useState(),r=jb(()=>new Map);return Eb(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function _b({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.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 Tb={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Rb=a.forwardRef(({className:t,...r},n)=>e.jsx(xb,{ref:n,className:ke("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Rb.displayName=xb.displayName;const Pb=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(Bm,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(xb.Input,{ref:n,className:ke("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",t),...r})]}));Pb.displayName=xb.Input.displayName;const Ob=a.forwardRef(({className:t,...r},n)=>e.jsx(xb.List,{ref:n,className:ke("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));Ob.displayName=xb.List.displayName;a.forwardRef((t,r)=>e.jsx(xb.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=xb.Empty.displayName;const Ib=a.forwardRef(({className:t,...r},n)=>e.jsx(xb.Group,{ref:n,className:ke("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",t),...r}));Ib.displayName=xb.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(xb.Separator,{ref:n,className:ke("-mx-1 h-px bg-border",t),...r})).displayName=xb.Separator.displayName;const Db=a.forwardRef(({className:t,...r},n)=>e.jsx(xb.Item,{ref:n,className:ke("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",t),...r}));Db.displayName=xb.Item.displayName;const Ub=["top","right","bottom","left"],Mb=Math.min,Fb=Math.max,zb=Math.round,Lb=Math.floor,$b=e=>({x:e,y:e}),Vb={left:"right",right:"left",bottom:"top",top:"bottom"},Wb={start:"end",end:"start"};function Bb(e,t,r){return Fb(e,Mb(t,r))}function Gb(e,t){return"function"==typeof e?e(t):e}function Hb(e){return e.split("-")[0]}function Kb(e){return e.split("-")[1]}function Zb(e){return"x"===e?"y":"x"}function Jb(e){return"y"===e?"height":"width"}const qb=new Set(["top","bottom"]);function Yb(e){return qb.has(Hb(e))?"y":"x"}function Xb(e){return Zb(Yb(e))}function Qb(e){return e.replace(/start|end/g,e=>Wb[e])}const ey=["left","right"],ty=["right","left"],ry=["top","bottom"],ny=["bottom","top"];function ay(e,t,r,n){const a=Kb(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?ty:ey:t?ey:ty;case"left":case"right":return t?ry:ny;default:return[]}}(Hb(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Qb)))),o}function oy(e){return e.replace(/left|right|bottom|top/g,e=>Vb[e])}function sy(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 iy(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 cy(e,t,r){let{reference:n,floating:a}=e;const o=Yb(t),s=Xb(t),i=Jb(s),c=Hb(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/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(Kb(t)){case"start":p[s]-=f*(r&&l?-1:1);break;case"end":p[s]+=f*(r&&l?-1:1)}return p}async function ly(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:s,elements:i,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Gb(t,e),m=sy(p),h=i[f?"floating"===u?"reference":"floating":u],g=iy(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(i.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:s.floating.width,height:s.floating.height}:s.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(i.floating)),y=await(null==o.isElement?void 0:o.isElement(b))&&await(null==o.getScale?void 0:o.getScale(b))||{x:1,y:1},x=iy(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:b,strategy:c}):v);return{top:(g.top-x.top+m.top)/y.y,bottom:(x.bottom-g.bottom+m.bottom)/y.y,left:(g.left-x.left+m.left)/y.x,right:(x.right-g.right+m.right)/y.x}}function dy(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uy(e){return Ub.some(t=>e[t]>=0)}const fy=new Set(["left","top"]);function py(){return"undefined"!=typeof window}function my(e){return vy(e)?(e.nodeName||"").toLowerCase():"#document"}function hy(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function gy(e){var t;return null==(t=(vy(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function vy(e){return!!py()&&(e instanceof Node||e instanceof hy(e).Node)}function by(e){return!!py()&&(e instanceof Element||e instanceof hy(e).Element)}function yy(e){return!!py()&&(e instanceof HTMLElement||e instanceof hy(e).HTMLElement)}function xy(e){return!(!py()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof hy(e).ShadowRoot)}const wy=new Set(["inline","contents"]);function Sy(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Iy(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!wy.has(a)}const ky=new Set(["table","td","th"]);function Ey(e){return ky.has(my(e))}const jy=[":popover-open",":modal"];function Ay(e){return jy.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Ny=["transform","translate","scale","rotate","perspective"],Cy=["transform","translate","scale","rotate","perspective","filter"],_y=["paint","layout","strict","content"];function Ty(e){const t=Ry(),r=by(e)?Iy(e):e;return Ny.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Cy.some(e=>(r.willChange||"").includes(e))||_y.some(e=>(r.contain||"").includes(e))}function Ry(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Py=new Set(["html","body","#document"]);function Oy(e){return Py.has(my(e))}function Iy(e){return hy(e).getComputedStyle(e)}function Dy(e){return by(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Uy(e){if("html"===my(e))return e;const t=e.assignedSlot||e.parentNode||xy(e)&&e.host||gy(e);return xy(t)?t.host:t}function My(e){const t=Uy(e);return Oy(t)?e.ownerDocument?e.ownerDocument.body:e.body:yy(t)&&Sy(t)?t:My(t)}function Fy(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=My(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),s=hy(a);if(o){const e=zy(s);return t.concat(s,s.visualViewport||[],Sy(a)?a:[],e&&r?Fy(e):[])}return t.concat(a,Fy(a,[],r))}function zy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ly(e){const t=Iy(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=yy(e),o=a?e.offsetWidth:r,s=a?e.offsetHeight:n,i=zb(r)!==o||zb(n)!==s;return i&&(r=o,n=s),{width:r,height:n,$:i}}function $y(e){return by(e)?e:e.contextElement}function Vy(e){const t=$y(e);if(!yy(t))return $b(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Ly(t);let s=(o?zb(r.width):r.width)/n,i=(o?zb(r.height):r.height)/a;return s&&Number.isFinite(s)||(s=1),i&&Number.isFinite(i)||(i=1),{x:s,y:i}}const Wy=$b(0);function By(e){const t=hy(e);return Ry()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Wy}function Gy(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=$y(e);let s=$b(1);t&&(n?by(n)&&(s=Vy(n)):s=Vy(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==hy(e))&&t}(o,r,n)?By(o):$b(0);let c=(a.left+i.x)/s.x,l=(a.top+i.y)/s.y,d=a.width/s.x,u=a.height/s.y;if(o){const e=hy(o),t=n&&by(n)?hy(n):n;let r=e,a=zy(r);for(;a&&n&&t!==r;){const e=Vy(a),t=a.getBoundingClientRect(),n=Iy(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,s=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=s,r=hy(a),a=zy(r)}}return iy({width:d,height:u,x:c,y:l})}function Hy(e,t){const r=Dy(e).scrollLeft;return t?t.left+r:Gy(gy(e)).left+r}function Ky(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Hy(e,r),y:r.top+t.scrollTop}}const Zy=new Set(["absolute","fixed"]);function Jy(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=hy(e),n=gy(e),a=r.visualViewport;let o=n.clientWidth,s=n.clientHeight,i=0,c=0;if(a){o=a.width,s=a.height;const e=Ry();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,c=a.offsetTop)}const l=Hy(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,s=Math.abs(n.clientWidth-t.clientWidth-a);s<=25&&(o-=s)}else l<=25&&(o+=l);return{width:o,height:s,x:i,y:c}}(e,r);else if("document"===t)n=function(e){const t=gy(e),r=Dy(e),n=e.ownerDocument.body,a=Fb(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Fb(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+Hy(e);const i=-r.scrollTop;return"rtl"===Iy(n).direction&&(s+=Fb(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:s,y:i}}(gy(e));else if(by(t))n=function(e,t){const r=Gy(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=yy(e)?Vy(e):$b(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=By(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return iy(n)}function qy(e,t){const r=Uy(e);return!(r===t||!by(r)||Oy(r))&&("fixed"===Iy(r).position||qy(r,t))}function Yy(e,t,r){const n=yy(t),a=gy(t),o="fixed"===r,s=Gy(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const c=$b(0);function l(){c.x=Hy(a)}if(n||!n&&!o)if(("body"!==my(t)||Sy(a))&&(i=Dy(t)),n){const e=Gy(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?$b(0):Ky(a,i);return{x:s.left+i.scrollLeft-c.x-d.x,y:s.top+i.scrollTop-c.y-d.y,width:s.width,height:s.height}}function Xy(e){return"static"===Iy(e).position}function Qy(e,t){if(!yy(e)||"fixed"===Iy(e).position)return null;if(t)return t(e);let r=e.offsetParent;return gy(e)===r&&(r=r.ownerDocument.body),r}function ex(e,t){const r=hy(e);if(Ay(e))return r;if(!yy(e)){let t=Uy(e);for(;t&&!Oy(t);){if(by(t)&&!Xy(t))return t;t=Uy(t)}return r}let n=Qy(e,t);for(;n&&Ey(n)&&Xy(n);)n=Qy(n,t);return n&&Oy(n)&&Xy(n)&&!Ty(n)?r:n||function(e){let t=Uy(e);for(;yy(t)&&!Oy(t);){if(Ty(t))return t;if(Ay(t))return null;t=Uy(t)}return null}(e)||r}const tx={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,s=gy(n),i=!!t&&Ay(t.floating);if(n===s||i&&o)return r;let c={scrollLeft:0,scrollTop:0},l=$b(1);const d=$b(0),u=yy(n);if((u||!u&&!o)&&(("body"!==my(n)||Sy(s))&&(c=Dy(n)),yy(n))){const e=Gy(n);l=Vy(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!s||u||o?$b(0):Ky(s,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:gy,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o="clippingAncestors"===r?Ay(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Fy(e,[],!1).filter(e=>by(e)&&"body"!==my(e)),a=null;const o="fixed"===Iy(e).position;let s=o?Uy(e):e;for(;by(s)&&!Oy(s);){const t=Iy(s),r=Ty(s);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&Zy.has(a.position)||Sy(s)&&!r&&qy(e,s))?n=n.filter(e=>e!==s):a=t,s=Uy(s)}return t.set(e,n),n}(t,this._c):[].concat(r),s=[...o,n],i=s[0],c=s.reduce((e,r)=>{const n=Jy(t,r,a);return e.top=Fb(n.top,e.top),e.right=Mb(n.right,e.right),e.bottom=Mb(n.bottom,e.bottom),e.left=Fb(n.left,e.left),e},Jy(t,i,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ex,getElementRects:async function(e){const t=this.getOffsetParent||ex,r=this.getDimensions,n=await r(e.floating);return{reference:Yy(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}=Ly(e);return{width:t,height:r}},getScale:Vy,isElement:by,isRTL:function(e){return"rtl"===Iy(e).direction}};function rx(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nx(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=$y(e),d=a||o?[...l?Fy(l):[],...Fy(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&i?function(e,t){let r,n=null;const a=gy(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function s(i,c){void 0===i&&(i=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(i||t(),!f||!p)return;const m={rootMargin:-Lb(u)+"px "+-Lb(a.clientWidth-(d+f))+"px "+-Lb(a.clientHeight-(u+p))+"px "+-Lb(d)+"px",threshold:Fb(0,Mb(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return s();n?s(!1,n):r=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==n||rx(l,e.getBoundingClientRect())||s(),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;s&&(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?Gy(e):null;return c&&function t(){const n=Gy(e);h&&!rx(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 ax=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:s,middlewareData:i}=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)),s=Hb(r),i=Kb(r),c="y"===Yb(r),l=fy.has(s)?-1:1,d=o&&c?-1:1,u=Gb(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 i&&"number"==typeof m&&(p="end"===i?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return s===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:s}}}}},ox=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:s=!1,limiter:i={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=Gb(e,t),l={x:r,y:n},d=await ly(t,c),u=Yb(Hb(a)),f=Zb(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=Bb(p+d["y"===f?"top":"left"],p,p-d[e])}if(s){const e="y"===u?"bottom":"right";m=Bb(m+d["y"===u?"top":"left"],m,m-d[e])}const h=i.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:s}}}}}},sx=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:s,initialPlacement:i,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=Gb(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=Hb(a),b=Yb(i),y=Hb(i)===i,x=await(null==c.isRTL?void 0:c.isRTL(l.floating)),w=f||(y||!h?[oy(i)]:function(e){const t=oy(e);return[Qb(e),t,Qb(t)]}(i)),S="none"!==m;!f&&S&&w.push(...ay(i,h,m,x));const k=[i,...w],E=await ly(t,g),j=[];let A=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&j.push(E[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Kb(e),a=Xb(e),o=Jb(a);let s="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=oy(s)),[s,oy(s)]}(a,s,x);j.push(E[e[0]],E[e[1]])}if(A=[...A,{placement:a,overflows:j}],!j.every(e=>e<=0)){var N,C;const e=((null==(N=o.flip)?void 0:N.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&b!==Yb(t))||A.every(e=>Yb(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:A},reset:{placement:t}}}let r=null==(C=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:C.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=A.filter(e=>{if(S){const t=Yb(e.placement);return t===b||"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:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},ix=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:s,elements:i}=t,{apply:c=()=>{},...l}=Gb(e,t),d=await ly(t,l),u=Hb(a),f=Kb(a),p="y"===Yb(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==s.isRTL?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const b=h-d.top-d.bottom,y=m-d.left-d.right,x=Mb(h-d[g],b),w=Mb(m-d[v],y),S=!t.middlewareData.shift;let k=x,E=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(E=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=b),S&&!f){const e=Fb(d.left,0),t=Fb(d.right,0),r=Fb(d.top,0),n=Fb(d.bottom,0);p?E=m-2*(0!==e||0!==t?e+t:Fb(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Fb(d.top,d.bottom))}await c({...t,availableWidth:E,availableHeight:k});const j=await s.getDimensions(i.floating);return m!==j.width||h!==j.height?{reset:{rects:!0}}:{}}}},cx=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=Gb(e,t);switch(n){case"referenceHidden":{const e=dy(await ly(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uy(e)}}}case"escaped":{const e=dy(await ly(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:uy(e)}}}default:return{}}}}},lx=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:s,elements:i,middlewareData:c}=t,{element:l,padding:d=0}=Gb(e,t)||{};if(null==l)return{};const u=sy(d),f={x:r,y:n},p=Xb(a),m=Jb(p),h=await s.getDimensions(l),g="y"===p,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",x=o.reference[m]+o.reference[p]-f[p]-o.floating[m],w=f[p]-o.reference[p],S=await(null==s.getOffsetParent?void 0:s.getOffsetParent(l));let k=S?S[y]:0;k&&await(null==s.isElement?void 0:s.isElement(S))||(k=i.floating[y]||o.floating[m]);const E=x/2-w/2,j=k/2-h[m]/2-1,A=Mb(u[v],j),N=Mb(u[b],j),C=A,_=k-h[m]-N,T=k/2-h[m]/2+E,R=Bb(C,T,_),P=!c.arrow&&null!=Kb(a)&&T!==R&&o.reference[m]/2-(T<C?A:N)-h[m]/2<0,O=P?T<C?T-C:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),dx=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:s}=t,{offset:i=0,mainAxis:c=!0,crossAxis:l=!0}=Gb(e,t),d={x:r,y:n},u=Yb(a),f=Zb(u);let p=d[f],m=d[u];const h=Gb(i,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,b;const e="y"===f?"width":"height",t=fy.has(Hb(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=s.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},ux=(e,t,r)=>{const n=new Map,a={platform:tx,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:s}=r,i=o.filter(Boolean),c=await(null==s.isRTL?void 0:s.isRTL(t));let l=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=cy(l,n,c),f=n,p={},m=0;for(let r=0;r<i.length;r++){const{name:o,fn:h}=i[r],{x:g,y:v,data:b,reset:y}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:s,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...b}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(l=!0===y.rects?await s.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:d,y:u}=cy(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var fx="undefined"!=typeof document?t.useLayoutEffect:function(){};function px(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(!px(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)&&!px(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function mx(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hx(e,t){const r=mx(e);return Math.round(t*r)/r}function gx(e){const t=a.useRef(e);return fx(()=>{t.current=e}),t}const vx=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?lx({element:r.current,padding:n}).fn(t):{}:r?lx({element:r,padding:n}).fn(t):{};var a}}),bx=(e,t)=>({...ax(e),options:[e,t]}),yx=(e,t)=>({...ox(e),options:[e,t]}),xx=(e,t)=>({...dx(e),options:[e,t]}),wx=(e,t)=>({...sx(e),options:[e,t]}),Sx=(e,t)=>({...ix(e),options:[e,t]}),kx=(e,t)=>({...cx(e),options:[e,t]}),Ex=(e,t)=>({...vx(e),options:[e,t]});var jx=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:o=5,...s}=t;return e.jsx(Nf.svg,{...s,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});jx.displayName="Arrow";var Ax=jx,Nx="Popper",[Cx,_x]=vf(Nx),[Tx,Rx]=Cx(Nx),Px=t=>{const{__scopePopper:r,children:n}=t,[o,s]=a.useState(null);return e.jsx(Tx,{scope:r,anchor:o,onAnchorChange:s,children:n})};Px.displayName=Nx;var Ox="PopperAnchor",Ix=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:o,...s}=t,i=Rx(Ox,n),c=a.useRef(null),l=Bs(r,c),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&i.onAnchorChange(d.current)}),o?null:e.jsx(Nf.div,{...s,ref:l})});Ix.displayName=Ox;var Dx="PopperContent",[Ux,Mx]=Cx(Dx),Fx=a.forwardRef((t,r)=>{const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:c="center",alignOffset:l=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:v,...b}=t,y=Rx(Dx,n),[x,w]=a.useState(null),S=Bs(r,e=>w(e)),[k,E]=a.useState(null),j=Eh(k),A=j?.width??0,N=j?.height??0,C=s+("center"!==c?"-"+c:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(Vx),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:M}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:c}={},transform:l=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);px(m,n)||h(n);const[g,v]=a.useState(null),[b,y]=a.useState(null),x=a.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),w=a.useCallback(e=>{e!==j.current&&(j.current=e,y(e))},[]),S=i||g,k=c||b,E=a.useRef(null),j=a.useRef(null),A=a.useRef(f),N=null!=d,C=gx(d),_=gx(s),T=gx(u),R=a.useCallback(()=>{if(!E.current||!j.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),ux(E.current,j.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!px(A.current,t)&&(A.current=t,o.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);fx(()=>{!1===u&&A.current.isPositioned&&(A.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);fx(()=>(P.current=!0,()=>{P.current=!1}),[]),fx(()=>{if(S&&(E.current=S),k&&(j.current=k),S&&k){if(C.current)return C.current(S,k,R);R()}},[S,k,R,C,N]);const O=a.useMemo(()=>({reference:E,floating:j,setReference:x,setFloating:w}),[x,w]),I=a.useMemo(()=>({reference:S,floating:k}),[S,k]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=hx(I.floating,f.x),n=hx(I.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...mx(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:C,whileElementsMounted:(...e)=>nx(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[bx({mainAxis:i+N,alignmentAxis:l}),u&&yx({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?xx():void 0,...P}),u&&wx({...P}),Sx({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${r}px`),s.setProperty("--radix-popper-available-height",`${n}px`),s.setProperty("--radix-popper-anchor-width",`${a}px`),s.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&Ex({element:k,padding:d}),Wx({arrowWidth:A,arrowHeight:N}),h&&kx({strategy:"referenceHidden",...P})]}),[F,z]=Bx(D),L=zu(v);$u(()=>{U&&L?.()},[U,L]);const $=M.arrow?.x,V=M.arrow?.y,W=0!==M.arrow?.centerOffset,[B,G]=a.useState();return $u(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(Ux,{scope:n,placedSide:F,onArrowChange:E,arrowX:$,arrowY:V,shouldHideArrow:W,children:e.jsx(Nf.div,{"data-side":F,"data-align":z,...b,ref:S,style:{...b.style,animation:U?void 0:"none"}})})})});Fx.displayName=Dx;var zx="PopperArrow",Lx={top:"bottom",right:"left",bottom:"top",left:"right"},$x=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,o=Mx(zx,n),s=Lx[o.placedSide];return e.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]: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:e.jsx(Ax,{...a,ref:r,style:{...a.style,display:"block"}})})});function Vx(e){return null!==e}$x.displayName=zx;var Wx=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,s=o?0:e.arrowWidth,i=o?0:e.arrowHeight,[c,l]=Bx(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+s/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-i+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===c?(p=-i+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+i}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function Bx(e){const[t,r="center"]=e.split("-");return[t,r]}var Gx=Px,Hx=Ix,Kx=Fx,Zx=$x;function Jx(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ws(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qx=Symbol("radix.slottable");function Yx(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qx}var Xx="Popover",[Qx]=vf(Xx,[_x]),ew=_x(),[tw,rw]=Qx(Xx),nw=t=>{const{__scopePopover:r,children:n,open:o,defaultOpen:s,onOpenChange:i,modal:c=!1}=t,l=ew(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=kf({prop:o,defaultProp:s??!1,onChange:i,caller:Xx});return e.jsx(Gx,{...l,children:e.jsx(tw,{scope:r,contentId:wf(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:c,children:n})})};nw.displayName=Xx;var aw="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...o}=t,s=rw(aw,n),i=ew(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=s;return a.useEffect(()=>(c(),()=>l()),[c,l]),e.jsx(Hx,{...i,...o,ref:r})}).displayName=aw;var ow="PopoverTrigger",sw=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=rw(ow,n),s=ew(n),i=Bs(r,o.triggerRef),c=e.jsx(Nf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":bw(o.open),...a,ref:i,onClick:gf(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:e.jsx(Hx,{asChild:!0,...s,children:c})});sw.displayName=ow;var iw="PopoverPortal",[cw,lw]=Qx(iw,{forceMount:void 0}),dw=t=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=t,s=rw(iw,r);return e.jsx(cw,{scope:r,forceMount:n,children:e.jsx(Kf,{present:n||s.open,children:e.jsx(Hf,{asChild:!0,container:o,children:a})})})};dw.displayName=iw;var uw="PopoverContent",fw=a.forwardRef((t,r)=>{const n=lw(uw,t.__scopePopover),{forceMount:a=n.forceMount,...o}=t,s=rw(uw,t.__scopePopover);return e.jsx(Kf,{present:a||s.open,children:s.modal?e.jsx(mw,{...o,ref:r}):e.jsx(hw,{...o,ref:r})})});fw.displayName=uw;var pw=function(t){const r=Jx(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Yx);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),mw=a.forwardRef((t,r)=>{const n=rw(uw,t.__scopePopover),o=a.useRef(null),s=Bs(r,o),i=a.useRef(!1);return a.useEffect(()=>{const e=o.current;if(e)return Gp(e)},[]),e.jsx(Fp,{as:pw,allowPinchZoom:!0,children:e.jsx(gw,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gf(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:gf(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:gf(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),hw=a.forwardRef((t,r)=>{const n=rw(uw,t.__scopePopover),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(gw,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(o.current||n.triggerRef.current?.focus(),e.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(o.current=!0,"pointerdown"===e.detail.originalEvent.type&&(s.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&s.current&&e.preventDefault()}})}),gw=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=t,p=rw(uw,n),m=ew(n);return qf(),e.jsx(zf,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:s,children:e.jsx(Of,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(Kx,{"data-state":bw(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)"}})})})}),vw="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=rw(vw,n);return e.jsx(Nf.button,{type:"button",...a,ref:r,onClick:gf(t.onClick,()=>o.onOpenChange(!1))})}).displayName=vw;function bw(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=ew(n);return e.jsx(Zx,{...o,...a,ref:r})}).displayName="PopoverArrow";var yw=dw,xw=fw;const ww=nw,Sw=sw,kw=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...o},s)=>{const{container:i}=a.useContext(qt);return e.jsx(yw,{container:i,children:e.jsx(xw,{ref:s,align:r,sideOffset:n,className:ke("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",t),...o})})});function Ew({options:r,value:n,onChange:a,placeholder:o="Search...",emptyLabel:s="Choose option"}){const[i,c]=t.useState(n??""),[l,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&c(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs(ww,{open:l,onOpenChange:d,children:[e.jsx(Sw,{asChild:!0,children:e.jsxs(_i,{variant:"outline",role:"combobox","aria-expanded":l,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:s}),e.jsx(ui,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(kw,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Rb,{children:[e.jsx(Pb,{placeholder:o}),e.jsx(Ob,{children:e.jsx(Ib,{children:r.map(t=>e.jsxs(Db,{className:ke("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,c(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(di,{className:ke("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}kw.displayName=xw.displayName;const jw={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"},Aw={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"},Nw=[{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=Aw[e.code]||"USD",r=jw[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 Cw({value:t,onChange:r}){const n=Nw.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(Ew,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const _w=Nw.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),Tw=Array.from(new Set(_w.map(e=>e.value))).map(e=>_w.find(t=>t.value===e)).filter(e=>void 0!==e);function Rw({value:t,onChange:r}){const n=Tw.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(Ew,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let Pw=[{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:"🇮🇱"}];Pw=Pw.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),Pw.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const Ow=Pw.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 Iw({value:t,onChange:r}){const n=Ow.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(Ew,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const Dw=[{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 s=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==s.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${s}) ${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 Uw({value:t,onChange:r}){const n=Dw.map(e=>({value:e.value,label:e.text}));return e.jsx(Ew,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const Mw=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=tr(),[o,s]=t.useState(!1),[i,c]=t.useState(),[l,d]=t.useState(0),[u,f]=t.useState(null),p=Pn({resolver:$s(Gc({name:bc().min(2,{message:"Name must be at least 2 characters."}),country:bc().optional(),timezone:bc().optional(),language:bc().optional(),currency:bc().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(Di,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){s(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),setTimeout(()=>{f(null)},5e3)}catch(e){Ie(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{s(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(Gi,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Mi,{disabled:o,control:p.control,name:"name",render:({field:t})=>e.jsxs(Li,{children:[e.jsx($i,{children:"Name"}),e.jsx(Vi,{children:e.jsx(Gi,{...t})}),e.jsx(Bi,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(Iw,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(Cw,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(Rw,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(Uw,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(_i,{type:"submit",progress:o,disabled:o,children:"Save"}),e.jsx(_i,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Nv,{})},Fw=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(null),[s,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),l(null);try{const t=await n.getCurrentSubscription(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";l(r),Ie(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{i(!1)}}else o(null)},[n,e]);return t.useEffect(()=>{d()},[d]),{subscription:a,loading:s,error:c,refetch:d}},zw=(e,r)=>{const n=Bt(e=>e.os),a=t.useMemo(()=>new er(n),[n.serverUrl,n.version,n.orgId]),[o,s]=t.useState(null),[i,c]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e){c(!0),d(null);try{const t=r?await a.getPlanGroupByVersion(e,r):await a.getPlanGroup(e);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch plan group";d(n),Ie(t,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:r}})}finally{c(!1)}}else s(null)},[a,e,r]);return t.useEffect(()=>{u()},[u]),{planGroup:o,loading:i,error:l,refetch:u}},Lw=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(null),[s,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),l(null);try{const t=await n.getPlanGroupVersions(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";l(r),Ie(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{i(!1)}}else o(null)},[n,e]);return t.useEffect(()=>{d()},[d]),{versions:a,loading:s,error:c,refetch:d}},$w=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(!1),[s,i]=t.useState(null);return{createCheckoutSession:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");o(!0),i(null);try{return await n.createCheckoutSession(e,t)}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw i(n),Ie(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{o(!1)}},[n,e]),loading:a,error:s}},Vw=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,o]=t.useState(!1),[s,i]=t.useState(null),c=t.useCallback(async(t,r)=>{if(!e)throw new Error("Workspace ID is required");o(!0),i(null);try{const a={planVersionId:t,...r?.billingInterval&&{billingInterval:r.billingInterval},...r?.successUrl&&{successUrl:r.successUrl},...r?.cancelUrl&&{cancelUrl:r.cancelUrl}};return await n.updateSubscription(e,a)}catch(n){const a=n instanceof Error?n.message:"Failed to update subscription";throw i(a),Ie(n,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:r}}),n}finally{o(!1)}},[n,e]);return{updateSubscription:c,loading:a,error:s}},Ww=(e,r)=>{const n=Fw(e),a=zw(e,r),o=Vw(e),s=t.useCallback(async()=>{await Promise.all([n.refetch(),a.refetch()])},[n,a]);return{subscription:n.subscription,planGroup:a.planGroup,loading:n.loading||a.loading||o.loading,error:n.error||a.error||o.error,updateSubscription:o.updateSubscription,refetch:s}},Bw=(e,r=10,n)=>{const a=Bt(e=>e.os),o=t.useMemo(()=>new er(a),[a.serverUrl,a.version,a.orgId]),[s,i]=t.useState([]),[c,l]=t.useState(!1),[d,u]=t.useState(!1),[f,p]=t.useState(null),m=t.useCallback(async()=>{if(!e)return i([]),void l(!1);u(!0),p(null);try{const t=await o.listInvoices(e,r,n);i(t.invoices||[]),l(t.has_more||!1)}catch(t){const a=t instanceof Error?t.message:"Failed to fetch invoices";p(a),Ie(t,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:r,startingAfter:n}})}finally{u(!1)}},[o,e,r,n]);return t.useEffect(()=>{m()},[m]),{invoices:s,hasMore:c,loading:d,error:f,refetch:m}},Gw=t.lazy(()=>Promise.resolve().then(function(){return kk}).then(e=>({default:e.default}))),Hw=(e,t="usd")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e/100),Kw=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",Zw=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"}},Jw=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:o,error:s,updateSubscription:i,refetch:c}=Ww(n),{createCheckoutSession:l}=$w(n),{versions:d,loading:u,error:f,refetch:p}=Lw(n),{invoices:m,loading:h,error:g,refetch:v}=Bw(n,20),b=o||u,y=s||f,{currentVersion:x,latestVersion:w,hasNewerVersion:S,isDeprecated:k,whatsNew:E,plansToShow:j}=t.useMemo(()=>{const e=d?.currentVersion,t=d?.availableVersions||[],r=null!==a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const o=!!(r&&n&&e)&&n.version>e.version,s=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:o,isDeprecated:o&&r,whatsNew:n?.whatsNew,plansToShow:s}},[d,a?.subscription]),[A,N]=t.useState(!1),[C,_]=t.useState(null),[T,R]=t.useState(null),[P,O]=t.useState(!1),I=async()=>{await Promise.all([c(),p()])};if(b&&!a&&!d)return e.jsx(Nv,{});const D=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[y&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm",children:y}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try refreshing the page."})]}),C&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded",children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm",children:C})]}),T&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:T})]}),k&&a?.subscription&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(ji,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),e.jsx("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.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e.jsxs("span",{children:["Current: Version ",x?.version||"N/A"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Latest: Version ",w?.version||"N/A"]})]}),E&&(E.newPlans.length>0||E.updatedPlans.length>0)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e.jsxs("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",w?.version,":"]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-amber-700",children:[E.newPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"New Plans: "}),e.jsx("span",{children:E.newPlans.map(e=>e.plan.name).join(", ")})]}),E.updatedPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Updated Plans: "}),e.jsx("span",{children:E.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Subscription"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your workspace subscription plan"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?e.jsx(_i,{variant:"outline",size:"sm",onClick:()=>O(!0),children:"Change Plan"}):j&&j.length>0?e.jsx(_i,{size:"sm",onClick:()=>O(!0),children:"View Pricing Plans"}):null,e.jsxs(_i,{variant:"ghost",size:"sm",onClick:I,disabled:b,children:[e.jsx(bi,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]}),a?.subscription?e.jsxs("div",{className:"border rounded-lg p-4 space-y-3 "+(k?"border-amber-300 bg-amber-50/50":""),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{className:"font-medium",children:a.plan?.name||"No plan assigned"}),k&&e.jsxs("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:[e.jsx(ji,{className:"h-3 w-3"}),"Deprecated"]})]}),e.jsxs("div",{className:"text-sm text-gray-600",children:["Status:"," ",e.jsx("span",{className:"font-medium "+("active"===a.subscription.subscriptionStatus?"text-green-600":"trialing"===a.subscription.subscriptionStatus?"text-blue-600":"text-red-600"),children:a.subscription.subscriptionStatus}),k&&e.jsxs("span",{className:"ml-2 text-xs text-amber-600",children:["(Version ",x?.version||"N/A",")"]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(fi,{className:"h-5 w-5 text-gray-400"})})]}),a.planVersion&&(()=>{const t=(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}})(a.planVersion);return e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx("div",{className:"text-sm font-medium mb-3",children:"Current Plan Details"}),e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-600",children:"Plan:"})," ",e.jsx("span",{className:"font-medium",children:a.plan?.name||"N/A"})]}),t.features.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Features:"}),e.jsx("ul",{className:"space-y-1.5",children:t.features.map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:r?"text-green-500 mt-0.5":"text-gray-300 mt-0.5",children:r?"✓":"○"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500",children:t.description})]})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Limits:"}),e.jsx("ul",{className:"space-y-1.5",children:t.limits.map(({item:t,value:r})=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-gray-400 mt-0.5",children:"•"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[t.name,":"]})," ",e.jsx("span",{className:"text-gray-700",children:r})]}),t.description&&e.jsx("div",{className:"text-xs text-gray-500",children:t.description})]})]},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-gray-700 mb-2",children:"Quotas:"}),e.jsx("ul",{className:"space-y-1.5",children:t.quotas.map(({item:t,value:r})=>{const n="object"==typeof r&&null!==r&&"included"in r?`${r.included} included${r.overage?`, ${r.overage} overage`:""}`:String(r);return e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-gray-400 mt-0.5",children:"•"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[t.name,":"]})," ",e.jsx("span",{className:"text-gray-700",children:n})]}),t.description&&e.jsx("div",{className:"text-xs text-gray-500",children:t.description})]})]},t._id)})})]})]})]})})()]}):e.jsx("div",{className:"border rounded-lg p-6 text-center",children:e.jsxs("div",{className:"mb-4",children:[e.jsx(fi,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]})})]}),a?.subscription&&(()=>{const t=m.filter(e=>e.invoice_pdf);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Invoices"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your subscription invoices"})]}),e.jsxs(_i,{variant:"ghost",size:"sm",onClick:v,disabled:h,children:[e.jsx(bi,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),g&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg",children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm",children:g})]}),h&&0===t.length?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Nv,{})}):0===t.length?e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(mi,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:"No invoices with download option found"})]}):e.jsx("div",{className:"space-y-2",children:t.map(t=>{const r=(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"}}})(t);return e.jsx("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t.description||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${Zw(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:Hw(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Created: ",Kw(t.created)]})]}),t.due_date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Due: ",Kw(t.due_date)]})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",Hw(t.amount_paid,t.currency)]})]})]})]}),e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:e.jsxs(_i,{size:"sm",onClick:()=>window.open(t.hosted_invoice_url,"_blank"),className:r.color,children:[r.text,e.jsx(pi,{className:"h-3 w-3 ml-1.5"})]})})]})},t.id)})})]})})(),j&&j.length>0&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(Gw,{open:P,onOpenChange:O,planVersions:j,currentPlanVersionId:D||null,onSelectPlan:async e=>{if(n&&a?.planVersion?._id!==e){N(!0),_(null),R(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=a?.subscription?await i(e,{billingInterval:"monthly",successUrl:t,cancelUrl:r}):await l({planVersionId:e,billingInterval:"monthly",successUrl:t,cancelUrl:r}),n&&"checkoutUrl"in n&&n.checkoutUrl)return void(window.location.href=n.checkoutUrl);R("Subscription updated successfully!"),await I()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";_(t)}finally{N(!1),setTimeout(()=>{_(null),R(null)},5e3)}}},loading:A||b})}),!d&&!b&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),y&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",y]}),!y&&e.jsx("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.jsxs(_i,{variant:"outline",size:"sm",onClick:I,disabled:b,className:"mt-4",children:[e.jsx(bi,{className:"h-4 w-4 mr-2"}),"Retry"]})]})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function qw(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.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}}(n,r.props);return r.type!==a.Fragment&&(o.ref=t?Ws(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yw=Symbol("radix.slottable");function Xw(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Yw}var Qw=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"});a.forwardRef((t,r)=>e.jsx(Nf.span,{...t,ref:r,style:{...Qw,...t.style}})).displayName="VisuallyHidden";var eS=[" ","Enter","ArrowUp","ArrowDown"],tS=[" ","Enter"],rS="Select",[nS,aS,oS]=nh(rS),[sS]=vf(rS,[oS,_x]),iS=_x(),[cS,lS]=sS(rS),[dS,uS]=sS(rS),fS=t=>{const{__scopeSelect:r,children:n,open:o,defaultOpen:s,onOpenChange:i,value:c,defaultValue:l,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,v=iS(r),[b,y]=a.useState(null),[x,w]=a.useState(null),[S,k]=a.useState(!1),E=oh(u),[j,A]=kf({prop:o,defaultProp:s??!1,onChange:i,caller:rS}),[N,C]=kf({prop:c,defaultProp:l,onChange:d,caller:rS}),_=a.useRef(null),T=!b||(g||!!b.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(Gx,{...v,children:e.jsxs(cS,{required:h,scope:r,trigger:b,onTriggerChange:y,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:wf(),value:N,onValueChange:C,open:j,onOpenChange:A,dir:E,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(nS.Provider,{scope:r,children:e.jsx(dS,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(qS,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:N,onChange:e=>C(e.target.value),disabled:m,form:g,children:[void 0===N?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};fS.displayName=rS;var pS="SelectTrigger",mS=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:o=!1,...s}=t,i=iS(n),c=lS(pS,n),l=c.disabled||o,d=Bs(r,c.onTriggerChange),u=aS(n),f=a.useRef("touch"),[p,m,h]=XS(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=QS(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 e.jsx(Hx,{asChild:!0,...i,children:e.jsx(Nf.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":YS(c.value)?"":void 0,...s,ref:d,onClick:gf(s.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:gf(s.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:gf(s.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||eS.includes(e.key)&&(g(),e.preventDefault())})})})});mS.displayName=pS;var hS="SelectValue",gS=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:o,children:s,placeholder:i="",...c}=t,l=lS(hS,n),{onValueNodeHasChildrenChange:d}=l,u=void 0!==s,f=Bs(r,l.onValueNodeChange);return $u(()=>{d(u)},[d,u]),e.jsx(Nf.span,{...c,ref:f,style:{pointerEvents:"none"},children:YS(l.value)?e.jsx(e.Fragment,{children:i}):s})});gS.displayName=hS;var vS=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...o}=t;return e.jsx(Nf.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});vS.displayName="SelectIcon";var bS=t=>e.jsx(Hf,{asChild:!0,...t});bS.displayName="SelectPortal";var yS="SelectContent",xS=a.forwardRef((t,r)=>{const n=lS(yS,t.__scopeSelect),[s,i]=a.useState();if($u(()=>{i(new DocumentFragment)},[]),!n.open){const r=s;return r?o.createPortal(e.jsx(SS,{scope:t.__scopeSelect,children:e.jsx(nS.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(jS,{...t,ref:r})});xS.displayName=yS;var wS=10,[SS,kS]=sS(yS),ES=function(t){const r=qw(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Xw);if(c){const t=c.props.children,o=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...s,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,o):null})}return e.jsx(r,{...s,ref:n,children:o})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),jS=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b,...y}=t,x=lS(yS,n),[w,S]=a.useState(null),[k,E]=a.useState(null),j=Bs(r,e=>S(e)),[A,N]=a.useState(null),[C,_]=a.useState(null),T=aS(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return Gp(w)},[w]),qf();const I=a.useCallback(e=>{const[t,...r]=T().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}},[T,k]),D=a.useCallback(()=>I([A,w]),[I,A,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:M}=x;a.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),M.current=null};return null!==M.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,M]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[F,z]=XS(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=QS(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&(N(e),n&&(O.current=!0))},[x.value]),$=a.useCallback(()=>w?.focus(),[w]),V=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&_(e)},[x.value]),W="popper"===o?NS:AS,B=W===NS?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return e.jsx(SS,{scope:n,content:w,viewport:k,onViewportChange:E,itemRefCallback:L,selectedItem:A,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:D,selectedItemText:C,position:o,isPositioned:R,searchRef:F,children:e.jsx(Fp,{as:ES,allowPinchZoom:!0,children:e.jsx(zf,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:gf(s,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(Of,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:e.jsx(W,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...y,...B,onPlaced:()=>P(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:gf(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().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(()=>I(t)),e.preventDefault()}})})})})})})});jS.displayName="SelectContentImpl";var AS=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:o,...s}=t,i=lS(yS,n),c=kS(yS,n),[l,d]=a.useState(null),[u,f]=a.useState(null),p=Bs(r,e=>f(e)),m=aS(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:x}=c,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&v&&b&&y){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=y.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,o=r.left-a,s=e.left-o,i=e.width+s,c=Math.max(i,t.width),d=window.innerWidth-wS,u=Xh(o,[wS,Math.max(wS,d-c)]);l.style.minWidth=i+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,s=window.innerWidth-e.right-o,i=e.width+s,c=Math.max(i,t.width),d=window.innerWidth-wS,u=Xh(o,[wS,Math.max(wS,d-c)]);l.style.minWidth=i+"px",l.style.right=u+"px"}const a=m(),s=window.innerHeight-2*wS,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),x=f+p+c+parseInt(d.paddingBottom,10)+g,w=Math.min(5*b.offsetHeight,x),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),E=parseInt(S.paddingBottom,10),j=e.top+e.height/2-wS,A=s-j,N=b.offsetHeight/2,C=f+p+(b.offsetTop+N),_=x-C;if(C<=j){const e=a.length>0&&b===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=C+Math.max(A,N+(e?E:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&b===a[0].ref.current;l.style.top="0px";const t=Math.max(j,f+v.offsetTop+(e?k:0)+N)+_;l.style.height=t+"px",v.scrollTop=C-j+v.offsetTop}l.style.margin=`${wS}px 0`,l.style.minHeight=w+"px",l.style.maxHeight=s+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,v,b,y,i.dir,o]);$u(()=>w(),[w]);const[S,k]=a.useState();$u(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const E=a.useCallback(e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)},[w,x]);return e.jsx(CS,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:E,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Nf.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});AS.displayName="SelectItemAlignedPosition";var NS=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=wS,...s}=t,i=iS(n);return e.jsx(Kx,{...i,...s,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});NS.displayName="SelectPopperPosition";var[CS,_S]=sS(yS,{}),TS="SelectViewport",RS=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:o,...s}=t,i=kS(TS,n),c=_S(TS,n),l=Bs(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(nS.Slot,{scope:n,children:e.jsx(Nf.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:gf(s.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=c;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*wS,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),s=Math.max(a,o);if(s<n){const a=s+e,o=Math.min(n,a),i=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});RS.displayName=TS;var PS="SelectGroup",[OS,IS]=sS(PS);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=wf();return e.jsx(OS,{scope:n,id:o,children:e.jsx(Nf.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=PS;var DS="SelectLabel",US=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=IS(DS,n);return e.jsx(Nf.div,{id:o.id,...a,ref:r})});US.displayName=DS;var MS="SelectItem",[FS,zS]=sS(MS),LS=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:i,...c}=t,l=lS(MS,n),d=kS(MS,n),u=l.value===o,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Bs(r,e=>d.itemRefCallback?.(e,o,s)),v=wf(),b=a.useRef("touch"),y=()=>{s||(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 e.jsx(FS,{scope:n,value:o,disabled:s,textId:v,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(nS.ItemSlot,{scope:n,value:o,disabled:s,textValue:f,children:e.jsx(Nf.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...c,ref:g,onFocus:gf(c.onFocus,()=>h(!0)),onBlur:gf(c.onBlur,()=>h(!1)),onClick:gf(c.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:gf(c.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:gf(c.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:gf(c.onPointerMove,e=>{b.current=e.pointerType,s?d.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:gf(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:gf(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(tS.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});LS.displayName=MS;var $S="SelectItemText",VS=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:s,style:i,...c}=t,l=lS($S,n),d=kS($S,n),u=zS($S,n),f=uS($S,n),[p,m]=a.useState(null),h=Bs(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,v=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:y}=f;return $u(()=>(b(v),()=>y(v)),[b,y,v]),e.jsxs(e.Fragment,{children:[e.jsx(Nf.span,{id:u.textId,...c,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?o.createPortal(c.children,l.valueNode):null]})});VS.displayName=$S;var WS="SelectItemIndicator",BS=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return zS(WS,n).isSelected?e.jsx(Nf.span,{"aria-hidden":!0,...a,ref:r}):null});BS.displayName=WS;var GS="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=kS(GS,t.__scopeSelect),o=_S(GS,t.__scopeSelect),[s,i]=a.useState(!1),c=Bs(r,o.onScrollButtonChange);return $u(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),s?e.jsx(KS,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=GS;var HS="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=kS(HS,t.__scopeSelect),o=_S(HS,t.__scopeSelect),[s,i]=a.useState(!1),c=Bs(r,o.onScrollButtonChange);return $u(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),s?e.jsx(KS,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=HS;var KS=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=t,i=kS("SelectScrollButton",n),c=a.useRef(null),l=aS(n),d=a.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),$u(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e.jsx(Nf.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:gf(s.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:gf(s.onPointerMove,()=>{i.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:gf(s.onPointerLeave,()=>{d()})})}),ZS=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Nf.div,{"aria-hidden":!0,...a,ref:r})});ZS.displayName="SelectSeparator";var JS="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=iS(n),s=lS(JS,n),i=kS(JS,n);return s.open&&"popper"===i.position?e.jsx(Zx,{...o,...a,ref:r}):null}).displayName=JS;var qS=a.forwardRef(({__scopeSelect:t,value:r,...n},o)=>{const s=a.useRef(null),i=Bs(o,s),c=jh(r);return a.useEffect(()=>{const e=s.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]),e.jsx(Nf.select,{...n,style:{...Qw,...n.style},ref:i,defaultValue:r})});function YS(e){return""===e||void 0===e}function XS(e){const t=zu(e),r=a.useRef(""),n=a.useRef(0),o=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),s=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,s]}function QS(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 s=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return s!==r?s:void 0}qS.displayName="SelectBubbleInput";var ek=mS,tk=vS,rk=bS,nk=xS,ak=RS,ok=US,sk=LS,ik=VS,ck=BS,lk=ZS;const dk=fS,uk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(ek,{ref:a,className:ke("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",t),...n,children:[r,e.jsx(tk,{asChild:!0,children:e.jsx(Fm,{className:"h-4 w-4 opacity-50"})})]}));uk.displayName=ek.displayName;const fk=a.forwardRef(({className:t,children:r,position:n="popper",...o},s)=>{const{container:i}=a.useContext(qt);return e.jsx(rk,{container:i,children:e.jsx(nk,{ref:s,className:ke("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"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...o,children:e.jsx(ak,{className:ke("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});fk.displayName=nk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(ok,{ref:n,className:ke("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=ok.displayName;const pk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(sk,{ref:a,className:ke("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",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ck,{children:e.jsx(Lm,{className:"h-4 w-4"})})}),e.jsx(ik,{children:r})]}));pk.displayName=sk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(lk,{ref:n,className:ke("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=lk.displayName;const mk=({workspace:r})=>{const n=Bt(e=>e.auth.session?.user||null),[a,o]=t.useState(0),[s,i]=t.useState(!1),[c,l]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=tr(),{settings:h}=Mu();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{l(e)}).catch(e=>{Ie(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const g=()=>{o(e=>e+1)};if(s||!r)return e.jsx(Nv,{});const v=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},b=c.map(e=>({...e,...v(e.user)})),y=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,x="admin"===y,w=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e.jsxs("div",{children:[!x&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),x&&e.jsxs("div",{className:"mb-4",children:[w&&e.jsx(hk,{onInvite:g,workspaceId:r._id}),!w&&e.jsx("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),e.jsx("div",{children:e.jsx(_i,{variant:"ghost",size:"sm",onClick:g,progress:s,startIcon:e.jsx(bi,{}),children:"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:b.map((t,a)=>{const o=t.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"flex items-center justify-between border rounded p-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(dk,{disabled:o||!x||s||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,o=e,void(Dt(r,a)?Ie(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}}):(u(a),m(n,a,{role:o}).then(()=>{g()}).catch(e=>{Ie(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}})}).finally(()=>{u(null)})));var n,a,o},children:[e.jsx(uk,{children:e.jsx(gS,{placeholder:"Select a role"})}),e.jsx(fk,{children:r?.roles.map(t=>e.jsx(pk,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(gi,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),o&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!o&&!s&&x&&e.jsx(_i,{variant:"destructive",size:"sm",startIcon:e.jsx(Ei,{}),onClick:()=>{var e;e=t.id,Dt(r,e)?Ie(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{g()}).catch(t=>{Ie(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},a)})}),0===c.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function hk({onInvite:r,workspaceId:n}){const[a,o]=t.useState(""),[s,i]=t.useState("admin"),[c,l]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),{addUser:m,getWorkspace:h}=tr(),[g,v]=t.useState(null),{settings:b}=Mu(),y=b?.workspace.roles??g?.roles??[];t.useEffect(()=>{n&&h(n).then(v)},[n]);const x=()=>{u(null),p(null),o(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Ii,{children:"Invite member by email"}),e.jsx(Gi,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Ii,{children:"Role"}),e.jsxs(dk,{value:s,onValueChange:i,children:[e.jsx(uk,{children:e.jsx(gS,{placeholder:"Select a role"})}),e.jsx(fk,{children:y.map(t=>e.jsx(pk,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(_i,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await m(n,e,s).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{Ie(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:s}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{x()},6e3)})):u("Invalid email address format")},disabled:c||!a||!s,children:c?"Inviting...":`Invite as ${s}`})})]})}const gk=({workspace:t,section:r,setSection:n})=>{const a=Bt(e=>e.auth.session?.user||null),o=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id;return e.jsxs("div",{className:"w-56 h-full flex flex-col space-y-6",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("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:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:ke("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(vk,{title:"Account",children:e.jsx(bk,{activeSection:r,icon:e.jsx(Ai,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(vk,{title:"Workspace",children:[e.jsx(bk,{activeSection:r,icon:e.jsx(xi,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(bk,{activeSection:r,icon:e.jsx(Ni,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(bk,{activeSection:r,icon:e.jsx(fi,{className:"h-3.5 w-3.5"}),label:"Subscription",section:"subscription",onClick:()=>n("subscription")}),e.jsx(bk,{activeSection:r,icon:e.jsx(Si,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),o&&e.jsx(bk,{activeSection:r,icon:e.jsx(ji,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function vk({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function bk({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e.jsxs("button",{className:ke("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 yk=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:s="profile",section:i,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(s),h=void 0!==a?a:u,g=o||f,v=void 0!==i?i:p,b=c||m;if(!r)return null;const y=e.jsx(_i,{variant:"outline",size:"icon",children:e.jsx(xi,{className:"h-4 w-4"})});return e.jsxs(Gm,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[l&&e.jsx(Hm,{asChild:!0,children:d||y}),e.jsxs(Jm,{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:[e.jsx(Xm,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(gk,{workspace:r,section:v,setSection:b}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(Ym,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===v&&"Account","general"===v&&"Workspace Settings","users"===v&&"Workspace Members","subscription"===v&&"Subscription","features"===v&&"Workspace Features","danger"===v&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===v&&e.jsx(Mw,{workspace:r}),"general"===v&&e.jsx(Bv,{workspace:r}),"users"===v&&e.jsx(mk,{workspace:r}),"subscription"===v&&e.jsx(Jw,{workspace:r}),"features"===v&&e.jsx($v,{workspaceId:r._id?.toString()}),"danger"===v&&e.jsx(Cv,{workspace:r})]})]})]})]})};var xk=Object.freeze({__proto__:null,WorkspaceSettingsDialog:yk,default:yk});function wk(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:o,switchingToId:s}=t,i=t.isCurrentWorkspace??!1,c=s===r._id;return e.jsxs("div",{className:ke("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(pf,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(mf,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(hf,{children:(l=r.name,l.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Ni,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(_i,{size:"sm",disabled:null!==s||c,progress:c,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{Ie(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(yk,{workspace:r,onClose:()=>{if(i){const e=o.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(o[e])}}})]})]});var l}function Sk(r){const{switching:n}=tr(),[a,o]=t.useState(!1),[s,i]=t.useState("emoji"),[c,l]=t.useState("🏢"),[d,u]=t.useState(!1),{createWorkspace:f}=tr(),p=Pn({resolver:$s(Gc({name:bc().min(2,{message:"Workspace name must be at least 2 characters."}),image:bc().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(Gm,{open:a,onOpenChange:o,children:[e.jsx(Hm,{asChild:!0,children:e.jsxs(_i,{className:"w-full rounded-none",disabled:n,children:[e.jsx(vi,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(Jm,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(qm,{children:[e.jsx(Ym,{children:"Create New Workspace"}),e.jsx(Xm,{children:"Create a new workspace to get started."})]}),e.jsx(Di,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===s)t=Vv(c);else if("url"===s&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),o(!1),p.reset(),l("🏢"),i("emoji"),r?.onCreated?.()}catch(t){Ie(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(Mi,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Li,{children:[e.jsx($i,{children:"Workspace Name"}),e.jsx(Vi,{children:e.jsx(Gi,{placeholder:"My Awesome Workspace",...t})}),e.jsx(Bi,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Ii,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(Wi,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(qh,{value:s,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(Yh,{value:"emoji",id:"emoji"}),e.jsxs(Ii,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(wi,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(Yh,{value:"url",id:"url"}),e.jsxs(Ii,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(hi,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),e.jsx(Dg,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:Wv.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),p.setValue("image",Vv(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Mi,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Li,{children:[e.jsx($i,{children:"Image URL"}),e.jsx(Vi,{children:e.jsx(Gi,{placeholder:"https://example.com/image.png",...t})}),e.jsx(Wi,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(Bi,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(_i,{type:"button",variant:"outline",onClick:()=>{o(!1),p.reset(),l("🏢"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(_i,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(gi,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}var kk=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:o,onSelectPlan:s,loading:i=!1})=>{const[c,l]=t.useState(!1),d=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),u=(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())})(d);t.useMemo(()=>{const e=new Map;return u.forEach(t=>{const r=t.category||"other";e.has(r)||e.set(r,[]),e.get(r).push(t)}),e},[u]);const f=u.filter(e=>"feature"===e.type),p=u.filter(e=>"limit"===e.type),m=u.filter(e=>"quota"===e.type),h=i||c,g=(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,v=(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 e.jsx(Gm,{open:r,onOpenChange:n,children:e.jsxs(Jm,{className:"max-w-7xl w-full h-[90vh] p-0 flex flex-col",children:[e.jsx("div",{className:"flex items-center justify-between p-6 border-b",children:e.jsxs("div",{children:[e.jsx(Ym,{className:"text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(Xm,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-6",children:0===d.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.map(t=>{const r=t._id===o,a=(e=>{if(e._id===o)return{label:"Current Plan",variant:"outline",disabled:!0};if(!o)return{label:"Subscribe",variant:"default",disabled:!1};const t=d.findIndex(e=>e._id===o),r=d.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}})(t),u=h&&t._id===o;return e.jsxs("div",{className:"border rounded-lg p-4 "+(r?"border-blue-500 bg-blue-50":"hover:border-gray-300"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t.plan.name}),r&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"Current"})]}),t.plan.description&&e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:t.plan.description}),e.jsx(_i,{className:"w-full",variant:a.variant,disabled:a.disabled||h,onClick:()=>(async e=>{if(e!==o&&!i&&!c){l(!0);try{await s(e),n(!1)}catch(e){}finally{l(!1)}}})(t._id),children:u?"Updating...":a.label})]},t._id)})}),e.jsxs("div",{className:"border rounded-lg overflow-hidden bg-white",children:[e.jsx("div",{className:"bg-gray-50 p-4 border-b",children:e.jsx("h3",{className:"font-semibold text-lg",children:"Compare all features"})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-gray-50",children:[e.jsx("th",{className:"text-left p-4 font-semibold text-sm sticky left-0 bg-gray-50 z-10 min-w-[250px]",children:"Feature"}),d.map(t=>e.jsxs("th",{className:"text-center p-4 font-semibold text-sm min-w-[150px] "+(t._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:[e.jsx("div",{className:"font-semibold",children:t.plan.name}),t._id===o&&e.jsx("div",{className:"text-xs text-blue-600 font-normal mt-1",children:"Current Plan"})]},t._id))]})}),e.jsxs("tbody",{children:[f.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:e.jsx("td",{colSpan:d.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Features"})}),f.map(t=>e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-4 sticky left-0 bg-white z-10",children:[e.jsx("div",{className:"font-medium text-sm text-gray-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t.description})]}),d.map(r=>{const n=g(r,t),a=v(n,t),s="feature"===t.type&&!0===n;return e.jsx("td",{className:"text-center p-4 align-middle "+(r._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:e.jsx("span",{className:"text-sm "+(s?"text-green-600 font-semibold":"—"===a?"text-gray-400":"text-gray-700"),children:a})},r._id)})]},t._id))]}),p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:e.jsx("td",{colSpan:d.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Limits"})}),p.map(t=>e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-4 sticky left-0 bg-white z-10",children:[e.jsx("div",{className:"font-medium text-sm text-gray-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t.description})]}),d.map(r=>{const n=g(r,t),a=v(n,t);return e.jsx("td",{className:"text-center p-4 align-middle "+(r._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:e.jsx("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},r._id)})]},t._id))]}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("tr",{className:"bg-gray-100 border-b-2 border-gray-300",children:e.jsx("td",{colSpan:d.length+1,className:"p-3 font-bold text-sm uppercase tracking-wide text-gray-700",children:"Quotas"})}),m.map(t=>e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-4 sticky left-0 bg-white z-10",children:[e.jsx("div",{className:"font-medium text-sm text-gray-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:t.description})]}),d.map(r=>{const n=g(r,t),a=v(n,t);return e.jsx("td",{className:"text-center p-4 align-middle "+(r._id===o?"bg-blue-50 border-l-2 border-r-2 border-blue-500":""),children:e.jsx("span",{className:"text-sm "+("—"===a?"text-gray-400":"text-gray-700 font-medium"),children:a})},r._id)})]},t._id))]})]})]})})]})]})})]})})}});exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:o="flex flex-col gap-1.5 w-full",language:s,customTexts:i={},autoFocus:c=!0,showSuccessMessage:l=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,v]=t.useState(!1),{submitBetaForm:b,isLoading:y,isSubmitting:x,error:w,config:S,success:k,message:E}=(()=>{const e=Bt(e=>e.os),[r,n]=t.useState(null),[a,o]=t.useState(!0),[s,i]=t.useState(!1),[c,l]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{(async()=>{o(!0);const t=new Ki(e),r=await t.fetchConfig();n(r),o(!1)})()},[e]),{isLoading:a,isSubmitting:s,config:r,error:c,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return l(e),{success:!1,message:e}}try{i(!0),l(null),u(!1),p(null);const r=new Ki(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return l(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(dl).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&l&&(h(!0),v(!0)),w&&v(!0)},[k,l,w]);const j={...dl[s||f],...i},A=Pn({resolver:$s(ll),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{c&&A.setFocus("name")},[c,A]);const N=A.formState.isValid&&!x;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:y?e.jsxs("div",{className:ke("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",a),children:[e.jsx(Hi,{className:"h-24 w-24 rounded-lg"}),e.jsx(Hi,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Hi,{className:"h-4 w-16"}),e.jsx(Hi,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Hi,{className:"h-4 w-16"}),e.jsx(Hi,{className:"h-10 w-full"})]}),e.jsx(Hi,{className:"h-10 w-full"})]})]}):e.jsxs("div",{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:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(fl,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx($r,{...A,children:e.jsxs("form",{onSubmit:A.handleSubmit(async e=>{try{const t=await b(e);t.success?(r?.(),A.reset(),l&&h(!0),v(!0)):(n?.(t.message),v(!0))}catch(e){n?.(e instanceof Error?e.message:j.errorMessage),v(!0)}}),className:a,noValidate:!0,"aria-busy":x,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(ul,{screen:S?.screen?.register}),e.jsx(Mi,{control:A.control,name:"name",render:({field:t})=>e.jsxs(Li,{className:o,children:[e.jsx($i,{children:j.nameLabel}),e.jsx(Vi,{children:e.jsx(Gi,{...t})}),e.jsx(Wi,{}),e.jsx(Bi,{})]})}),e.jsx(Mi,{control:A.control,name:"email",render:({field:t})=>e.jsxs(Li,{className:o,children:[e.jsx($i,{children:j.emailLabel}),e.jsx(Vi,{children:e.jsx(Gi,{...t})}),e.jsx(Wi,{}),e.jsx(Bi,{})]})}),e.jsx(_i,{type:"submit",disabled:!N,className:o,children:x?j.submittingText:j.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(_i,{type:"button",onClick:()=>{v(!1),A.reset()},className:o,children:"Try Again"})})]}),g&&m&&E&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(ul,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.SaaSOSProvider=sr,exports.WhenAuthenticated=e=>{const{children:t}=e,{status:r}=Du();return r!==exports.AuthStatus.authenticated?null:t},exports.WhenRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Du();return n.includes(a?.role??"")?t:r||null},exports.WhenUnauthenticated=e=>{const{children:t}=e,{status:r}=Du();return r===exports.AuthStatus.authenticated?null:t},exports.WhenUserFeatureDisabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Uu();return n(r)?null:t},exports.WhenUserFeatureEnabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Uu();return n(r)?t:null},exports.WhenWorkspaceFeatureDisabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=tr(),a=n?.features?.[r];return a?null:t},exports.WhenWorkspaceFeatureEnabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=tr(),a=n?.features?.[r];return a?t:null},exports.WhenWorkspaceRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Du(),{currentWorkspace:o}=tr(),s=o?.users.find(e=>e._id===a?.id);return s&&n.includes(s?.role??"")?t:r||null},exports.WorkspaceSwitcher=function(r){const{workspaces:n,currentWorkspace:a,loading:o,refreshing:s,switchingToId:i}=Bt(e=>e.workspaces),c=Bt(e=>e.auth.session?.user),{settings:l}=Mu(),[d,u]=t.useState(!1),[f,p]=t.useState(0),[m,h]=t.useState(""),{fetchWorkspaces:g,getFeatures:v,refreshWorkspaces:b,setCurrentWorkspace:y,switchToWorkspace:x,workspaces:w}=tr(),S=o||s;t.useEffect(()=>{0===w.length?(g(),v()):v()},[]),t.useEffect(()=>{f>0&&b()},[f]);const k=w.length>0?w:n,E=k.filter(e=>e._id!==a?._id).filter(e=>e.name.toLowerCase().includes(m.toLowerCase())),j=l?.workspace.maxWorkspaces??Number.MAX_VALUE,A=k?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===c?.id?.toString()).length,N=j>(A??0);return e.jsxs(Gm,{open:d,onOpenChange:u,children:[e.jsx(Hm,{children:r.trigger?.(S,a)}),e.jsxs(Jm,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(qm,{children:[e.jsxs(Ym,{className:"flex items-center gap-2",children:[e.jsx(li,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(Xm,{children:"Select a workspace to switch to or create a new one."})]}),!c&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&e.jsxs("div",{className:"flex flex-col gap-4",children:[a&&e.jsx(wk,{workspace:a,isCurrentWorkspace:!0,switchToWorkspace:x,switchingToId:i,onClose:()=>u(!1),setCurrentWorkspace:y,setOpen:u,workspacesToUse:k}),e.jsx(Vg,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),e.jsx("div",{children:e.jsx(_i,{progress:s,disabled:s,variant:"ghost",onClick:function(){p(e=>e+1)},startIcon:e.jsx(bi,{}),children:s?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(yi,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(Gi,{placeholder:"Search workspaces...",value:m,onChange:e=>h(e.target.value),className:"pl-10"})]}),o?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(gi,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(li,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:m?"No workspaces found":"No workspaces available"})]}):e.jsx(Dg,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(t=>{const r=t._id===a?._id;return e.jsx(wk,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:x,switchingToId:i,onClose:()=>u(!1),setCurrentWorkspace:y,setOpen:u,workspacesToUse:k},t._id)})})})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx(Vg,{}),e.jsx(Sk,{onCreated:()=>{g()}})]})]})]})]})},exports.eventEmitter=Jt,exports.useCreateCheckoutSession=$w,exports.useInvoice=(e,r)=>{const n=Bt(e=>e.os),a=t.useMemo(()=>new er(n),[n.serverUrl,n.version,n.orgId]),[o,s]=t.useState(null),[i,c]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e&&r){c(!0),d(null);try{const t=await a.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";d(n),Ie(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{c(!1)}}else s(null)},[a,e,r]);return t.useEffect(()=>{u()},[u]),{invoice:o,loading:i,error:l,refetch:u}},exports.useInvoices=Bw,exports.usePlanGroup=zw,exports.usePlanGroupVersions=Lw,exports.useSaaSAuth=Du,exports.useSaaSSettings=Mu,exports.useSaaSWorkspaces=tr,exports.useSubscription=Fw,exports.useSubscriptionManagement=Ww,exports.useUpdateSubscription=Vw,exports.useUserAttributes=function(){const e=t.useContext(Xt);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=Uu;
|
|
36
30
|
//# sourceMappingURL=index.js.map
|