@buildbase/sdk 0.0.8 → 0.0.9

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/dist/index.js CHANGED
@@ -1,29 +1,29 @@
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_FAILED"}),f=e=>({type:"SET_SESSION",payload:e}),p=()=>({type:"REMOVE_SESSION"});function m({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 h;function g(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 v(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function b(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){console.warn(`Failed to remove ${e} from localStorage:`,t)}}!function(e){e.loading="loading",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(h||(h={}));const y="code",w="saas-session-id";function x(){b(w)}function S(){if("undefined"==typeof window)return null;try{return g(w)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function k(){const e=S(),t={};return e&&(t["x-session-id"]=e),t}function A(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const E=()=>({session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:h.unauthenticated}),{Provider:C,useState:j,useDispatch:T}=m({name:"Auth",initialState:E(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,isLoading:!0,isAuthenticated:!1,isRedirecting:!0,status:h.authenticating};case"AUTHENTICATION_FAILED":return{...e,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:h.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,v(w,r),{...e,session:n,isAuthenticated:!0,isRedirecting:!1,isLoading:!1,status:h.authenticated}}case"REMOVE_SESSION":return x(),{...e,session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:h.unauthenticated};default:return e}var r},initializer:E}),N=C,_=j,R=T,P=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),O=e=>({type:"SET_SETTINGS",payload:e}),D=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:I,useState:M,useDispatch:U}=m({name:"OS",initialState:D(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return D();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),F=I,L=M,z=U,B=e=>({type:"SET_WORKSPACES",payload:e}),W=e=>({type:"SET_ALL_FEATURES",payload:e}),V=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),$=()=>({type:"RESET_CURRENT_WORKSPACE"}),G=e=>({type:"SET_IS_INITIALIZED",payload:e}),K=e=>({type:"SET_LOADING",payload:e}),H=e=>({type:"SET_ERROR",payload:e}),Z=e=>({type:"SET_REFRESHING",payload:e}),q="saas-workspace-current";const{Provider:J,useState:Y,useDispatch:X}=m({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)?v(q,r):b(q),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return b(q),{...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}}),Q=J,ee=Y,te=X,re=t.memo(({children:t})=>e.jsx(F,{children:e.jsx(N,{children:e.jsx(Q,{children:t})})}));function ne(e,r){const n=L(),a=_(),o=ee(),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 ae(){const e=R(),r=z(),n=te();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}re.displayName="SDKContextProvider";const oe=t.memo(({children:r,callbacks:n})=>{const a=ae(),o=ne(e=>e.auth),s=ne(e=>e.os),i=t.useRef(!1),l=t.useRef(null),d=t.useMemo(()=>n,[n]),p=t.useCallback(async e=>{try{if(d?.handleAuthentication){const{sessionId:t}=await d.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 fetch(`${n}/api/${o}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}});if(!c.ok)throw new Error("Failed to fetch user profile");let l;try{l=await c.json()}catch(e){throw new Error("Failed to parse user profile response")}const u=l._id||l.id;if(!u||"string"!=typeof u)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 p=A({id:u,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);a.auth(f(p)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(y),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(u()),t}},[a,d,s]);return t.useEffect(()=>{if("undefined"==typeof window)return;if(o.isAuthenticated)return;const e=S();if(!e)return;(async()=>{try{const{serverUrl:t,version:r,orgId:n}=s;if(!t||!r||!n)return void c(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const o=await fetch(`${t}/api/${r}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"}});if(!o.ok)return c(new Error("Session invalid, removing from localStorage"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{status:o.status}}),void x();let i;try{i=await o.json()}catch(e){return c(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"parseResponse"}}),void x()}const l=i._id||i.id;if(!l||"string"!=typeof l)return c(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void x();if(!i.email||"string"!=typeof i.email)return c(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void x();const d=A({id:l,name:i.name||"",org:n,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);a.auth(f(d))}catch(e){c(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),x()}})()},[o.isAuthenticated,a,s]),t.useEffect(()=>{const e=function(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(y)}catch(e){return console.error("Error getting token from URL:",e),null}}();if(!e)return;if(i.current||l.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(i.current=!0,l.current=e,p(e).then(()=>{l.current=null}).catch(t=>{c(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),l.current=null}).finally(()=>{i.current=!1}))},[p,s.serverUrl,s.version,s.orgId]),e.jsx(e.Fragment,{children:r})});oe.displayName="AuthProviderWrapper";const se=t.memo(({config:r,auth:n,children:a})=>{const o=ae(),s=ne(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(P({...r,auth:i}))},[r,i,o]),t.useEffect(()=>{const{serverUrl:e,version:t,orgId:r,settings:n}=s;if(e&&t&&r&&!n){(async()=>{try{const n=k(),a=await fetch(`${e}/api/${t}/public/${r}/settings`,{headers:n});if(a.ok){const e=await a.json();o.os(O(e))}}catch(n){c(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})()}},[s.serverUrl,s.version,s.orgId,s.settings,o]),e.jsx(e.Fragment,{children:a})});se.displayName="ContextConfigProvider";const ie=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})}},ce=t.createContext({container:null,setContainer:()=>{}}),le=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(ce.Provider,{value:o,children:[s,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});le.displayName="PortalProvider";const de=t.createContext(void 0),ue=t.memo(({children:r})=>{const n=ne(e=>e.os),a=ne(e=>e.auth),{serverUrl:o,version:s}=n,i=a.isAuthenticated,[l,d]=t.useState({}),[u,f]=t.useState({}),[p,m]=t.useState(!1),[h,g]=t.useState(null),v=t.useCallback(async()=>{if(o&&s&&i)try{const e=await fetch(`${o}/api/${s}/public/users/attributes`,{headers:k()});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]),b=t.useCallback(async()=>{if(o&&s&&i){m(!0),g(null);try{await v()}finally{m(!1)}}},[o,s,i,v]),y=t.useCallback(async e=>{if(!o||!s)throw new Error("Server URL or version is missing");m(!0),g(null);try{const t=await fetch(`${o}/api/${s}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...k()},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 v(),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,v]),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 fetch(`${o}/api/${s}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...k()},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 v(),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,v]),x=t.useCallback(async()=>{if(o&&s&&i)try{const e=await fetch(`${o}/api/${s}/public/users/features`,{headers:k()});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]),S=t.useCallback(async()=>{if(o&&s&&i){m(!0),g(null);try{await x()}finally{m(!1)}}},[o,s,i,x]);t.useEffect(()=>{i&&o&&s?(m(!0),g(null),Promise.all([v(),x()]).finally(()=>{m(!1)})):(d({}),f({}))},[i,o,s,v,x]);const A=t.useMemo(()=>({attributes:l,features:u,isLoading:p,error:h,updateAttributes:y,updateAttribute:w,refreshAttributes:b,refreshFeatures:S}),[l,u,p,h,y,w,b,S]);return e.jsx(de.Provider,{value:A,children:r})});ue.displayName="UserProvider";class fe{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return k()}async getWorkspaces(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch workspaces");return e.json()}async createWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to create workspace");return t.json()}async updateWorkspace(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok)throw new Error("Failed to update workspace");return r.json()}async deleteWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to delete workspace");return t.json()}async getWorkspaceUsers(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace users");return t.json()}async addUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to invite member")}return r.json()}async removeUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to remove user")}return r.json()}async updateUser(e,t,r){const n=await fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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()}}var pe=e=>"checkbox"===e.type,me=e=>e instanceof Date,he=e=>null==e;const ge=e=>"object"==typeof e;var ve=e=>!he(e)&&!Array.isArray(e)&&ge(e)&&!me(e),be=e=>ve(e)&&e.target?pe(e.target)?e.target.checked:e.target.value:e,ye=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),we="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function xe(e){let t;const r=Array.isArray(e),n="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(we&&(e instanceof Blob||n)||!r&&!ve(e))return e;if(t=r?[]:Object.create(Object.getPrototypeOf(e)),r||(e=>{const t=e.constructor&&e.constructor.prototype;return ve(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=xe(e[r]));else t=e}return t}var Se=e=>/^\w*$/.test(e),ke=e=>void 0===e,Ae=e=>Array.isArray(e)?e.filter(Boolean):[],Ee=e=>Ae(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ce=(e,t,r)=>{if(!t||!ve(e))return r;const n=(Se(t)?[t]:Ee(t)).reduce((e,t)=>he(e)?e:e[t],e);return ke(n)||n===e?ke(e[t])?r:e[t]:n},je=e=>"boolean"==typeof e,Te=(e,t,r)=>{let n=-1;const a=Se(t)?[t]:Ee(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=ve(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Ne="blur",_e="focusout",Re="change",Pe="onBlur",Oe="onChange",De="onSubmit",Ie="onTouched",Me="all",Ue="max",Fe="min",Le="maxLength",ze="minLength",Be="pattern",We="required",Ve="validate",$e=t.createContext(null);$e.displayName="HookFormContext";const Ge=()=>t.useContext($e),Ke=e=>{const{children:r,...n}=e;return t.createElement($e.Provider,{value:n},r)};var He=(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]!==Me&&(t._proxyFormState[a]=!n||Me),r&&(r[a]=!0),e[a]}});return a};const Ze="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var qe=e=>"string"==typeof e,Je=(e,t,r,n,a)=>qe(e)?(n&&t.watch.add(e),Ce(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Ce(r,e))):(n&&(t.watchAll=!0),r),Ye=e=>he(e)||!ge(e);function Xe(e,t,r=new WeakSet){if(Ye(e)||Ye(t))return e===t;if(me(e)&&me(t))return 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(me(n)&&me(e)||ve(n)&&ve(e)||Array.isArray(n)&&Array.isArray(e)?!Xe(n,e,r):n!==e)return!1}}return!0}function Qe(e){const r=Ge(),{name:n,disabled:a,control:o=r.control,shouldUnregister:s,defaultValue:i}=e,c=ye(o._names.array,n),l=t.useMemo(()=>Ce(o._formValues,n,Ce(o._defaultValues,n,i)),[o,n,i]),d=function(e){const r=Ge(),{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);d.current=c;const f=t.useMemo(()=>n._getWatch(a,l.current),[n,a]),[p,m]=t.useState(d.current?d.current(f):f);return Ze(()=>n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{if(!s){const t=Je(a,n._names,e.values||n._formValues,!1,l.current);if(d.current){const e=d.current(t);Xe(e,u.current)||(m(e),u.current=e)}else m(t)}}}),[n,s,a,i]),t.useEffect(()=>n._removeUnmounted()),p}({control:o,name:n,defaultValue:l,exact:!0}),u=function(e){const r=Ge(),{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 Ze(()=>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(()=>He(i,n,l.current,!1),[i,n])}({control:o,name:n,exact:!0}),f=t.useRef(e),p=t.useRef(o.register(n,{...e.rules,value:d,...je(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const m=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ce(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ce(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ce(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ce(u.validatingFields,n)},error:{enumerable:!0,get:()=>Ce(u.errors,n)}}),[u,n]),h=t.useCallback(e=>p.current.onChange({target:{value:be(e),name:n},type:Re}),[n]),g=t.useCallback(()=>p.current.onBlur({target:{value:Ce(o._formValues,n),name:n},type:Ne}),[n,o._formValues]),v=t.useCallback(e=>{const t=Ce(o._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[o._fields,n]),b=t.useMemo(()=>({name:n,value:d,...je(a)||u.disabled?{disabled:u.disabled||a}:{},onChange:h,onBlur:g,ref:v}),[n,a,u.disabled,h,g,v,d]);return t.useEffect(()=>{const e=o._options.shouldUnregister||s;o.register(n,{...f.current.rules,...je(f.current.disabled)?{disabled:f.current.disabled}:{}});const t=(e,t)=>{const r=Ce(o._fields,e);r&&r._f&&(r._f.mount=t)};if(t(n,!0),e){const e=xe(Ce(o._options.defaultValues,n));Te(o._defaultValues,n,e),ke(Ce(o._formValues,n))&&Te(o._formValues,n,e)}return!c&&o.register(n),()=>{(c?e&&!o._state.action:e)?o.unregister(n):t(n,!1)}},[n,o,c,s]),t.useEffect(()=>{o._setDisabledField({disabled:a,name:n})},[a,n,o]),t.useMemo(()=>({field:b,formState:u,fieldState:m}),[b,u,m])}const et=e=>e.render(Qe(e));var tt=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},rt=e=>Array.isArray(e)?e:[e],nt=()=>{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=[]}}},at=e=>ve(e)&&!Object.keys(e).length,ot=e=>"file"===e.type,st=e=>"function"==typeof e,it=e=>{if(!we)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ct=e=>"select-multiple"===e.type,lt=e=>"radio"===e.type,dt=e=>it(e)&&e.isConnected;function ut(e,t){const r=Array.isArray(t)?t:Se(t)?[t]:Ee(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=ke(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(ve(n)&&at(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!ke(e[t]))return!1;return!0}(n))&&ut(e,r.slice(0,-1)),e}var ft=e=>{for(const t in e)if(st(e[t]))return!0;return!1};function pt(e,t={}){const r=Array.isArray(e);if(ve(e)||r)for(const r in e)Array.isArray(e[r])||ve(e[r])&&!ft(e[r])?(t[r]=Array.isArray(e[r])?[]:{},pt(e[r],t[r])):he(e[r])||(t[r]=!0);return t}function mt(e,t,r){const n=Array.isArray(e);if(ve(e)||n)for(const n in e)Array.isArray(e[n])||ve(e[n])&&!ft(e[n])?ke(t)||Ye(r[n])?r[n]=Array.isArray(e[n])?pt(e[n],[]):{...pt(e[n])}:mt(e[n],he(t)?{}:t[n],r[n]):r[n]=!Xe(e[n],t[n]);return r}var ht=(e,t)=>mt(e,t,pt(t));const gt={value:!1,isValid:!1},vt={value:!0,isValid:!0};var bt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ke(e[0].attributes.value)?ke(e[0].value)||""===e[0].value?vt:{value:e[0].value,isValid:!0}:vt:gt}return gt},yt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>ke(e)?e:t?""===e?NaN:e?+e:e:r&&qe(e)?new Date(e):n?n(e):e;const wt={isValid:!1,value:null};var xt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,wt):wt;function St(e){const t=e.ref;return ot(t)?t.files:lt(t)?xt(e.refs).value:ct(t)?[...t.selectedOptions].map(({value:e})=>e):pe(t)?bt(e.refs).value:yt(ke(t.value)?e.ref.value:t.value,e)}var kt=e=>e instanceof RegExp,At=e=>ke(e)?e:kt(e)?e.source:ve(e)?kt(e.value)?e.value.source:e.value:e,Et=e=>({isOnSubmit:!e||e===De,isOnBlur:e===Pe,isOnChange:e===Oe,isOnAll:e===Me,isOnTouch:e===Ie});const Ct="AsyncFunction";var jt=e=>!!e&&!!e.validate&&!!(st(e.validate)&&e.validate.constructor.name===Ct||ve(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Ct)),Tt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Nt=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Ce(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(Nt(o,t))break}else if(ve(o)&&Nt(o,t))break}}};function _t(e,t,r){const n=Ce(e,r);if(n||Se(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Ce(t,n),s=Ce(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 Rt=(e,t,r)=>{const n=rt(Ce(e,r));return Te(n,"root",t[r]),Te(e,r,n),e},Pt=e=>qe(e);function Ot(e,t,r="validate"){if(Pt(e)||Array.isArray(e)&&e.every(Pt)||je(e)&&!e)return{type:r,message:Pt(e)?e:"",ref:t}}var Dt=e=>ve(e)&&!kt(e)?e:{value:e,message:""},It=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=Ce(r,h);if(!v||t.has(h))return{};const y=i?i[0]:s,w=e=>{a&&y.reportValidity&&(y.setCustomValidity(je(e)?"":e||""),y.reportValidity())},x={},S=lt(s),k=pe(s),A=S||k,E=(g||ot(s))&&ke(s.value)&&ke(b)||it(s)&&""===s.value||""===b||Array.isArray(b)&&!b.length,C=tt.bind(null,h,n,x),j=(e,t,r,n=Le,a=ze)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:s,...C(e?n:a,o)}};if(o?!Array.isArray(b)||!b.length:c&&(!A&&(E||he(b))||je(b)&&!b||k&&!bt(i).isValid||S&&!xt(i).isValid)){const{value:e,message:t}=Pt(c)?{value:!!c,message:c}:Dt(c);if(e&&(x[h]={type:We,message:t,ref:y,...C(We,t)},!n))return w(t),x}if(!(E||he(u)&&he(f))){let e,t;const r=Dt(f),a=Dt(u);if(he(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;qe(r.value)&&b&&(e=i?o(b)>o(r.value):c?b>r.value:n>new Date(r.value)),qe(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);he(r.value)||(e=n>r.value),he(a.value)||(t=n<a.value)}if((e||t)&&(j(!!e,r.message,a.message,Ue,Fe),!n))return w(x[h].message),x}if((l||d)&&!E&&(qe(b)||o&&Array.isArray(b))){const e=Dt(l),t=Dt(d),r=!he(e.value)&&b.length>+e.value,a=!he(t.value)&&b.length<+t.value;if((r||a)&&(j(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!E&&qe(b)){const{value:e,message:t}=Dt(p);if(kt(e)&&!b.match(e)&&(x[h]={type:Be,message:t,ref:s,...C(Be,t)},!n))return w(t),x}if(m)if(st(m)){const e=Ot(await m(b,r),y);if(e&&(x[h]={...e,...C(Ve,e.message)},!n))return w(e.message),x}else if(ve(m)){let e={};for(const t in m){if(!at(e)&&!n)break;const a=Ot(await m[t](b,r),y,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(x[h]=e))}if(!at(e)&&(x[h]={ref:y,...e},!n))return x}return w(!0),x};const Mt={mode:De,reValidateMode:Oe,shouldFocusError:!0};function Ut(e={}){let t,r={...Mt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:st(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(ve(r.defaultValues)||ve(r.values))&&xe(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:xe(o),i={action:!1,mount:!1,watch:!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};let u={...d};const f={array:nt(),state:nt()},p=r.criteriaMode===Me,m=async e=>{if(!r.disabled&&(d.isValid||u.isValid||e)){const e=r.resolver?at((await y()).errors):await w(a,!0);e!==n.isValid&&f.state.next({isValid:e})}},h=(e,t)=>{!r.disabled&&(d.isValidating||d.validatingFields||u.isValidating||u.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?Te(n.validatingFields,e,t):ut(n.validatingFields,e))}),f.state.next({validatingFields:n.validatingFields,isValidating:!at(n.validatingFields)}))},g=(e,t,r,n)=>{const c=Ce(a,e);if(c){const a=Ce(s,e,ke(r)?Ce(o,e):r);ke(a)||n&&n.defaultChecked||t?Te(s,e,t?a:St(c._f)):k(e,a),i.mount&&m()}},v=(e,t,a,s,i)=>{let c=!1,l=!1;const p={name:e};if(!r.disabled){if(!a||s){(d.isDirty||u.isDirty)&&(l=n.isDirty,n.isDirty=p.isDirty=x(),c=l!==p.isDirty);const r=Xe(Ce(o,e),t);l=!!Ce(n.dirtyFields,e),r?ut(n.dirtyFields,e):Te(n.dirtyFields,e,!0),p.dirtyFields=n.dirtyFields,c=c||(d.dirtyFields||u.dirtyFields)&&l!==!r}if(a){const t=Ce(n.touchedFields,e);t||(Te(n.touchedFields,e,a),p.touchedFields=n.touchedFields,c=c||(d.touchedFields||u.touchedFields)&&t!==a)}c&&i&&f.state.next(p)}return c?p:{}},b=(e,a,o,s)=>{const i=Ce(n.errors,e),c=(d.isValid||u.isValid)&&je(a)&&n.isValid!==a;var p;if(r.delayError&&o?(p=()=>((e,t)=>{Te(n.errors,e,t),f.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(l),l=setTimeout(p,e)},t(r.delayError)):(clearTimeout(l),t=null,o?Te(n.errors,e,o):ut(n.errors,e)),(o?!Xe(i,o):i)||!at(s)||c){const t={...s,...c&&je(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},f.state.next(t)}},y=async e=>{h(e,!0);const t=await r.resolver(s,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Ce(t,r);e&&Te(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return h(e),t},w=async(e,t,a={valid:!0})=>{for(const o in e){const i=e[o];if(i){const{_f:e,...l}=i;if(e){const l=c.array.has(e.name),u=i._f&&jt(i._f);u&&d.validatingFields&&h([o],!0);const f=await It(i,c.disabled,s,p,r.shouldUseNativeValidation&&!t,l);if(u&&d.validatingFields&&h([o]),f[e.name]&&(a.valid=!1,t))break;!t&&(Ce(f,e.name)?l?Rt(n.errors,f,e.name):Te(n.errors,e.name,f[e.name]):ut(n.errors,e.name))}!at(l)&&await w(l,t,a)}}return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Te(s,e,t),!Xe(N(),o)),S=(e,t,r)=>Je(e,c,{...i.mount?s:ke(t)?o:qe(e)?{[e]:t}:t},r,t),k=(e,t,r={})=>{const n=Ce(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Te(s,e,yt(t,r)),o=it(r.ref)&&he(t)?"":t,ct(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?pe(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):ot(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||f.state.next({name:e,values:xe(s)})))}(r.shouldDirty||r.shouldTouch)&&v(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&T(e)},A=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],s=e+"."+n,i=Ce(a,s);(c.array.has(e)||ve(o)||i&&!i._f)&&!me(o)?A(s,o,r):k(s,o,r)}},E=(e,t,r={})=>{const l=Ce(a,e),p=c.array.has(e),m=xe(t);Te(s,e,m),p?(f.array.next({name:e,values:xe(s)}),(d.isDirty||d.dirtyFields||u.isDirty||u.dirtyFields)&&r.shouldDirty&&f.state.next({name:e,dirtyFields:ht(o,s),isDirty:x(e,m)})):!l||l._f||he(m)?k(e,m,r):A(e,m,r),Tt(e,c)&&f.state.next({...n,name:e}),f.state.next({name:i.mount?e:void 0,values:xe(s)})},C=async e=>{i.mount=!0;const o=e.target;let l=o.name,g=!0;const x=Ce(a,l),S=e=>{g=Number.isNaN(e)||me(e)&&isNaN(e.getTime())||Xe(e,Ce(s,l,e))},k=Et(r.mode),A=Et(r.reValidateMode);if(x){let i,E;const C=o.type?St(x._f):be(e),j=e.type===Ne||e.type===_e,N=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(x._f)&&!r.resolver&&!Ce(n.errors,l)&&!x._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))(j,Ce(n.touchedFields,l),n.isSubmitted,A,k),_=Tt(l,c,j);Te(s,l,C),j?o&&o.readOnly||(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const R=v(l,C,j),P=!at(R)||_;if(!j&&f.state.next({name:l,type:e.type,values:xe(s)}),N)return(d.isValid||u.isValid)&&("onBlur"===r.mode?j&&m():j||m()),P&&f.state.next({name:l,..._?{}:R});if(!j&&_&&f.state.next({...n}),r.resolver){const{errors:e}=await y([l]);if(S(C),g){const t=_t(n.errors,a,l),r=_t(e,a,t.name||l);i=r.error,l=r.name,E=at(e)}}else h([l],!0),i=(await It(x,c.disabled,s,p,r.shouldUseNativeValidation))[l],h([l]),S(C),g&&(i?E=!1:(d.isValid||u.isValid)&&(E=await w(a,!0)));g&&(x._f.deps&&T(x._f.deps),b(l,E,i,R))}},j=(e,t)=>{if(Ce(n.errors,t)&&e.focus)return e.focus(),1},T=async(e,t={})=>{let o,s;const i=rt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await y(e);if(e)for(const r of e){const e=Ce(t,r);e?Te(n.errors,r,e):ut(n.errors,r)}else n.errors=t;return t})(ke(e)?e:i);o=at(t),s=e?!i.some(e=>Ce(t,e)):o}else e?(s=(await Promise.all(i.map(async e=>{const t=Ce(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||n.isValid)&&m()):s=o=await w(a);return f.state.next({...!qe(e)||(d.isValid||u.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!s&&Nt(a,j,e?i:c.mount),s},N=e=>{const t={...i.mount?s:o};return ke(e)?t:qe(e)?Ce(t,e):e.map(e=>Ce(t,e))},_=(e,t)=>({invalid:!!Ce((t||n).errors,e),isDirty:!!Ce((t||n).dirtyFields,e),error:Ce((t||n).errors,e),isValidating:!!Ce(n.validatingFields,e),isTouched:!!Ce((t||n).touchedFields,e)}),R=(e,t,r)=>{const o=(Ce(a,e,{_f:{}})._f||{}).ref,s=Ce(n.errors,e)||{},{ref:i,message:c,type:l,...d}=s;Te(n.errors,e,{...d,...t,ref:o}),f.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},P=e=>f.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!rt(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 at(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Me))})(t,e.formState||d,z,e.reRenderRoot)||e.callback({values:{...s},...n,...t,defaultValues:o})}}).unsubscribe,O=(e,t={})=>{for(const i of e?rt(e):c.mount)c.mount.delete(i),c.array.delete(i),t.keepValue||(ut(a,i),ut(s,i)),!t.keepError&&ut(n.errors,i),!t.keepDirty&&ut(n.dirtyFields,i),!t.keepTouched&&ut(n.touchedFields,i),!t.keepIsValidating&&ut(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&ut(o,i);f.state.next({values:xe(s)}),f.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&m()},D=({disabled:e,name:t})=>{(je(e)&&i.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},I=(e,t={})=>{let n=Ce(a,e);const s=je(t.disabled)||je(r.disabled);return Te(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?D({disabled:je(t.disabled)?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...s?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:At(t.min),max:At(t.max),minLength:At(t.minLength),maxLength:At(t.maxLength),pattern:At(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:s=>{if(s){I(e,t),n=Ce(a,e);const r=ke(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=(e=>lt(e)||pe(e))(r),c=n._f.refs||[];if(i?c.find(e=>e===r):r===n._f.ref)return;Te(a,e,{_f:{...n._f,...i?{refs:[...c.filter(dt),r,...Array.isArray(Ce(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=Ce(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!ye(c.array,e)||!i.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&Nt(a,j,c.mount),U=(e,t)=>async o=>{let i;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=xe(s);if(f.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await y();n.errors=e,l=xe(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)ut(l,e);if(ut(n.errors,"root"),at(n.errors)){f.state.next({errors:{}});try{await e(l,o)}catch(e){i=e}}else t&&await t({...n.errors},o),M(),setTimeout(M);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:at(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},F=(e,t={})=>{const l=e?xe(e):o,u=xe(l),p=at(e),m=p?o:u;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(ht(o,s))]);for(const t of Array.from(e))Ce(n.dirtyFields,t)?Te(m,t,Ce(s,t)):E(t,Ce(m,t))}else{if(we&&ke(e))for(const e of c.mount){const t=Ce(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(it(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)E(e,Ce(m,e));else a={}}s=r.shouldUnregister?t.keepDefaultValues?xe(o):{}:xe(m),f.array.next({values:{...m}}),f.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=!d.isValid||!!t.keepIsValid||!!t.keepDirtyValues,i.watch=!!r.shouldUnregister,f.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!p&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Xe(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:p?{}:t.keepDirtyValues?t.keepDefaultValues&&s?ht(o,s):n.dirtyFields:t.keepDefaultValues&&e?ht(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)=>F(st(e)?e(s):e,t),z=e=>{n={...n,...e}},B={control:{register:I,unregister:O,getFieldState:_,handleSubmit:U,setError:R,_subscribe:P,_runSchema:y,_focusError:M,_getWatch:S,_getDirty:x,_setValid:m,_setFieldArray:(e,t=[],c,l,p=!0,m=!0)=>{if(l&&c&&!r.disabled){if(i.action=!0,m&&Array.isArray(Ce(a,e))){const t=c(Ce(a,e),l.argA,l.argB);p&&Te(a,e,t)}if(m&&Array.isArray(Ce(n.errors,e))){const t=c(Ce(n.errors,e),l.argA,l.argB);p&&Te(n.errors,e,t),((e,t)=>{!Ae(Ce(e,t)).length&&ut(e,t)})(n.errors,e)}if((d.touchedFields||u.touchedFields)&&m&&Array.isArray(Ce(n.touchedFields,e))){const t=c(Ce(n.touchedFields,e),l.argA,l.argB);p&&Te(n.touchedFields,e,t)}(d.dirtyFields||u.dirtyFields)&&(n.dirtyFields=ht(o,s)),f.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Te(s,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,f.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ae(Ce(i.mount?s:o,e,r.shouldUnregister?Ce(o,e,[]):[])),_reset:F,_resetDefaultValues:()=>st(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Ce(a,e);t&&(t._f.refs?t._f.refs.every(e=>!dt(e)):!dt(t._f.ref))&&O(e)}c.unMount=new Set},_disableForm:e=>{je(e)&&(f.state.next({disabled:e}),Nt(a,(t,r)=>{const n=Ce(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:f,_proxyFormState:d,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,u={...u,...e.formState},P({...e,formState:u})),trigger:T,register:I,handleSubmit:U,watch:(e,t)=>st(e)?f.state.subscribe({next:r=>"values"in r&&e(S(void 0,t),r)}):S(e,t,!0),setValue:E,getValues:N,reset:L,resetField:(e,t={})=>{Ce(a,e)&&(ke(t.defaultValue)?E(e,xe(Ce(o,e))):(E(e,t.defaultValue),Te(o,e,xe(t.defaultValue))),t.keepTouched||ut(n.touchedFields,e),t.keepDirty||(ut(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,xe(Ce(o,e))):x()),t.keepError||(ut(n.errors,e),d.isValid&&m()),f.state.next({...n}))},clearErrors:e=>{e&&rt(e).forEach(e=>ut(n.errors,e)),f.state.next({errors:e?n.errors:{}})},unregister:O,setError:R,setFocus:(e,t={})=>{const r=Ce(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&st(e.select)&&e.select())}},getFieldState:_};return{...B,formControl:B}}function Ft(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,o]=t.useState({isDirty:!1,isValidating:!1,isLoading:st(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:st(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!st(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Ut(e);r.current={...n,formState:a}}const s=r.current.control;return s._options=e,Ze(()=>{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(()=>{e.values&&!Xe(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),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=He(a,s),r.current}const Lt=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Ce(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},zt=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Lt(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>Lt(t,r,e))}},Bt=(e,t)=>{t.shouldUseNativeValidation&&zt(e,t);const r={};for(const n in e){const a=Ce(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(Wt(t.names||Object.keys(e),n)){const e=Object.assign({},Ce(r,n));Te(e,"root",o),Te(r,n,e)}else Te(r,n,o)}return r},Wt=(e,t)=>{const r=Vt(t);return e.some(e=>Vt(e).match(`^${r}\\.\\d+`))};function Vt(e){return e.replace(/\]|\[/g,"")}function $t(e,t,r){function n(r,n){var a;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(a=r._zod).traits??(a.traits=new Set),r._zod.traits.add(e),t(r,n);for(const e in s.prototype)e in r||Object.defineProperty(r,e,{value:s.prototype[e].bind(r)});r._zod.constr=s,r._zod.def=n}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 Gt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Kt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Ht={};function Zt(e){return Ht}function qt(e,t){return"bigint"==typeof t?t.toString():t}function Jt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Yt(e){return null==e}function Xt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Qt=Symbol("evaluating");function er(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Qt)return void 0===n&&(n=Qt,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function nr(e){return JSON.stringify(e)}const ar="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function or(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const sr=Jt(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ir(e){if(!1===or(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==or(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function cr(e){return ir(e)?{...e}:Array.isArray(e)?[...e]:e}const lr=new Set(["string","number","symbol"]);function dr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ur(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function fr(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 pr(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 mr(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function hr(e){return"string"==typeof e?e:e?.message}function gr(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=hr(e.inst?._zod.def?.error?.(e))??hr(t?.error?.(e))??hr(r.customError?.(e))??hr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function vr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function br(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const yr=(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,qt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wr=$t("$ZodError",yr),xr=$t("$ZodError",yr,{Parent:Error});const Sr=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 Gt;if(s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>gr(e,o,Zt())));throw ar(t,a?.callee),t}return s.value},kr=Sr(xr),Ar=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=>gr(e,o,Zt())));throw ar(t,a?.callee),t}return s.value},Er=Ar(xr),Cr=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 Gt;return o.issues.length?{success:!1,error:new(e??wr)(o.issues.map(e=>gr(e,a,Zt())))}:{success:!0,data:o.value}},jr=Cr(xr),Tr=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=>gr(e,a,Zt())))}:{success:!0,data:o.value}},Nr=Tr(xr),_r=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Sr(e)(t,r,a)},Rr=e=>(t,r,n)=>Sr(e)(t,r,n),Pr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ar(e)(t,r,a)},Or=e=>async(t,r,n)=>Ar(e)(t,r,n),Dr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Cr(e)(t,r,a)},Ir=e=>(t,r,n)=>Cr(e)(t,r,n),Mr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tr(e)(t,r,a)},Ur=e=>async(t,r,n)=>Tr(e)(t,r,n),Fr=/^[cC][^\s-]{8,}$/,Lr=/^[0-9a-z]+$/,zr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Br=/^[0-9a-vA-V]{20}$/,Wr=/^[A-Za-z0-9]{27}$/,Vr=/^[a-zA-Z0-9_-]{21}$/,$r=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gr=/^([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})$/,Kr=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)$/,Hr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Zr=/^(?:(?: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])$/,qr=/^(([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}|:))$/,Jr=/^((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])$/,Yr=/^(([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])$/,Xr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qr=/^[A-Za-z0-9_-]*$/,en=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,tn=/^\+(?:[0-9]){6,14}[0-9]$/,rn="(?:(?:\\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])))",nn=new RegExp(`^${rn}$`);function an(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 on=/^[^A-Z]*$/,sn=/^[^a-z]*$/,cn=$t("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ln=$t("$ZodCheckMaxLength",(e,t)=>{var r;cn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Yt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=vr(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dn=$t("$ZodCheckMinLength",(e,t)=>{var r;cn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Yt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=vr(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),un=$t("$ZodCheckLengthEquals",(e,t)=>{var r;cn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Yt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const o=vr(n),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})}}),fn=$t("$ZodCheckStringFormat",(e,t)=>{var r,n;cn.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=()=>{})}),pn=$t("$ZodCheckRegex",(e,t)=>{fn.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})}}),mn=$t("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=on),fn.init(e,t)}),hn=$t("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=sn),fn.init(e,t)}),gn=$t("$ZodCheckIncludes",(e,t)=>{cn.init(e,t);const r=dr(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})}}),vn=$t("$ZodCheckStartsWith",(e,t)=>{cn.init(e,t);const r=new RegExp(`^${dr(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})}}),bn=$t("$ZodCheckEndsWith",(e,t)=>{cn.init(e,t);const r=new RegExp(`.*${dr(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})}}),yn=$t("$ZodCheckOverwrite",(e,t)=>{cn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class wn{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const xn={major:4,minor:1,patch:8},Sn=$t("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xn;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=pr(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 Gt;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(a||(a=pr(e,t)))});else{if(e.issues.length===t)continue;a||(a=pr(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(pr(r))return r.aborted=!0,r;const s=t(a,n,o);if(s instanceof Promise){if(!1===o.async)throw new Gt;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 Gt;return s.then(e=>t(e,n,o))}return t(s,n,o)}}e["~standard"]={validate:t=>{try{const r=jr(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Nr(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),kn=$t("$ZodString",(e,t)=>{var r;Sn.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}}),An=$t("$ZodStringFormat",(e,t)=>{fn.init(e,t),kn.init(e,t)}),En=$t("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Gr),An.init(e,t)}),Cn=$t("$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=Kr(e))}else t.pattern??(t.pattern=Kr());An.init(e,t)}),jn=$t("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Hr),An.init(e,t)}),Tn=$t("$ZodURL",(e,t)=>{An.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:en.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})}}}),Nn=$t("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),An.init(e,t)}),_n=$t("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Vr),An.init(e,t)}),Rn=$t("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fr),An.init(e,t)}),Pn=$t("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Lr),An.init(e,t)}),On=$t("$ZodULID",(e,t)=>{t.pattern??(t.pattern=zr),An.init(e,t)}),Dn=$t("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Br),An.init(e,t)}),In=$t("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wr),An.init(e,t)}),Mn=$t("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=an({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(`^${rn}T(?:${n})$`)}(t)),An.init(e,t)}),Un=$t("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nn),An.init(e,t)}),Fn=$t("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${an(t)}$`)),An.init(e,t)}),Ln=$t("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$r),An.init(e,t)}),zn=$t("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zr),An.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Bn=$t("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qr),An.init(e,t),e._zod.onattach.push(e=>{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})}}}),Wn=$t("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Jr),An.init(e,t)}),Vn=$t("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yr),An.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 $n(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Gn=$t("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Xr),An.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{$n(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Kn=$t("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qr),An.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!Qr.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return $n(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})}}),Hn=$t("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tn),An.init(e,t)});const Zn=$t("$ZodJWT",(e,t)=>{An.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})}}),qn=$t("$ZodUnknown",(e,t)=>{Sn.init(e,t),e._zod.parse=e=>e}),Jn=$t("$ZodNever",(e,t)=>{Sn.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Yn(e,t,r){e.issues.length&&t.issues.push(...mr(r,e.issues)),t.value[r]=e.value}const Xn=$t("$ZodArray",(e,t)=>{Sn.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=>Yn(t,r,e))):Yn(i,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Qn(e,t,r,n){e.issues.length&&t.issues.push(...mr(r,e.issues)),void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ea(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ta(e,t,r,n,a,o){const s=[],i=a.keySet,c=a.catchall._zod,l=c.def.type;for(const a of Object.keys(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=>Qn(e,r,a,t))):Qn(o,r,a,t)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const ra=$t("$ZodObject",(e,t)=>{Sn.init(e,t);const r=Jt(()=>ea(t));er(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 n=or,a=t.catchall;let o;e._zod.parse=(t,s)=>{o??(o=r.value);const i=t.value;if(!n(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],l=o.shape;for(const e of o.keys){const r=l[e]._zod.run({value:i[e],issues:[]},s);r instanceof Promise?c.push(r.then(r=>Qn(r,t,e,i))):Qn(r,t,e,i)}return a?ta(c,i,t,s,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),na=$t("$ZodObjectJIT",(e,t)=>{ra.init(e,t);const r=e._zod.parse,n=Jt(()=>ea(t));let a;const o=or,s=!Ht.jitless,i=s&&sr.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 wn(["shape","payload","ctx"]),r=n.value,a=e=>{const t=nr(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 e of r.keys){const r=o[e],n=nr(e);t.write(`const ${r} = ${a(e)};`),t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}]\n })));\n }\n \n \n if (${r}.value === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n newResult[${n}] = ${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?ta([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function aa(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=>!pr(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=>gr(e,n,Zt())))}),t)}const oa=$t("$ZodUnion",(e,t)=>{Sn.init(e,t),er(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),er(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),er(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),er(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=>Xt(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=>aa(t,a,e,o)):aa(i,a,e,o)}}),sa=$t("$ZodIntersection",(e,t)=>{Sn.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])=>ca(e,t,r)):ca(e,a,o)}});function ia(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(ir(e)&&ir(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=ia(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=ia(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 ca(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),pr(e))return e;const n=ia(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const la=$t("$ZodEnum",(e,t)=>{Sn.init(e,t);const r=function(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}(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>lr.has(typeof e)).map(e=>"string"==typeof e?dr(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),da=$t("$ZodTransform",(e,t)=>{Sn.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Kt(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 Gt;return r.value=a,r}});function ua(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const fa=$t("$ZodOptional",(e,t)=>{Sn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",er(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),er(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Xt(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>ua(t,e.value)):ua(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),pa=$t("$ZodNullable",(e,t)=>{Sn.init(e,t),er(e._zod,"optin",()=>t.innerType._zod.optin),er(e._zod,"optout",()=>t.innerType._zod.optout),er(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Xt(e.source)}|null)$`):void 0}),er(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)}),ma=$t("$ZodDefault",(e,t)=>{Sn.init(e,t),e._zod.optin="optional",er(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=>ha(e,t)):ha(n,t)}});function ha(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const ga=$t("$ZodPrefault",(e,t)=>{Sn.init(e,t),e._zod.optin="optional",er(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),va=$t("$ZodNonOptional",(e,t)=>{Sn.init(e,t),er(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>ba(t,e)):ba(a,e)}});function ba(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ya=$t("$ZodCatch",(e,t)=>{Sn.init(e,t),er(e._zod,"optin",()=>t.innerType._zod.optin),er(e._zod,"optout",()=>t.innerType._zod.optout),er(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=>gr(e,r,Zt()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>gr(e,r,Zt()))},input:e.value}),e.issues=[]),e)}}),wa=$t("$ZodPipe",(e,t)=>{Sn.init(e,t),er(e._zod,"values",()=>t.in._zod.values),er(e._zod,"optin",()=>t.in._zod.optin),er(e._zod,"optout",()=>t.out._zod.optout),er(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=>xa(e,t.in,r)):xa(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>xa(e,t.out,r)):xa(n,t.out,r)}});function xa(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Sa=$t("$ZodReadonly",(e,t)=>{Sn.init(e,t),er(e._zod,"propValues",()=>t.innerType._zod.propValues),er(e._zod,"values",()=>t.innerType._zod.values),er(e._zod,"optin",()=>t.innerType._zod.optin),er(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(ka):ka(n)}});function ka(e){return e.value=Object.freeze(e.value),e}const Aa=$t("$ZodCustom",(e,t)=>{cn.init(e,t),Sn.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=>Ea(t,r,n,e));Ea(a,r,n,e)}});function Ea(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(br(e))}}class Ca{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return 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)}}function ja(){return new Ca}const Ta=ja();function Na(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...fr(t)})}function _a(e,t){return new ln({check:"max_length",...fr(t),maximum:e})}function Ra(e,t){return new dn({check:"min_length",...fr(t),minimum:e})}function Pa(e,t){return new un({check:"length_equals",...fr(t),length:e})}function Oa(e){return new yn({check:"overwrite",tx:e})}function Da(e){const t=function(e,t){const r=new cn({check:"custom",...fr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(br(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(br(n))}},e(r.value,r)));return t}function Ia(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Ma(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]=tt(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Ua(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]=tt(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Fa(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(Ia(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&zt({},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:Bt(Ma(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(Ia(function(){return Promise.resolve(("sync"===r.mode?kr:Er)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&zt({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof wr}(e))return{values:{},errors:Bt(Ua(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")}
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_FAILED"}),f=e=>({type:"SET_SESSION",payload:e}),p=()=>({type:"REMOVE_SESSION"});function m({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 h;function g(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 v(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function y(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){console.warn(`Failed to remove ${e} from localStorage:`,t)}}!function(e){e.loading="loading",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(h||(h={}));const b="code",w="saas-session-id";function x(){y(w)}function S(){if("undefined"==typeof window)return null;try{return g(w)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function k(){const e=S(),t={};return e&&(t["x-session-id"]=e),t}function E(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const A=()=>({session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:h.unauthenticated}),{Provider:C,useState:j,useDispatch:T}=m({name:"Auth",initialState:A(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,isLoading:!0,isAuthenticated:!1,isRedirecting:!0,status:h.authenticating};case"AUTHENTICATION_FAILED":return{...e,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:h.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,v(w,r),{...e,session:n,isAuthenticated:!0,isRedirecting:!1,isLoading:!1,status:h.authenticated}}case"REMOVE_SESSION":return x(),{...e,session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:h.unauthenticated};default:return e}var r},initializer:A}),_=C,N=j,R=T,O=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),P=e=>({type:"SET_SETTINGS",payload:e}),D=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:I,useState:U,useDispatch:M}=m({name:"OS",initialState:D(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return D();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),z=I,F=U,L=M,$=e=>({type:"SET_WORKSPACES",payload:e}),W=e=>({type:"SET_ALL_FEATURES",payload:e}),B=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),V=()=>({type:"RESET_CURRENT_WORKSPACE"}),G=e=>({type:"SET_IS_INITIALIZED",payload:e}),K=e=>({type:"SET_LOADING",payload:e}),H=e=>({type:"SET_ERROR",payload:e}),Z=e=>({type:"SET_REFRESHING",payload:e}),J="saas-workspace-current";const{Provider:q,useState:Y,useDispatch:X}=m({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)?v(J,r):y(J),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return y(J),{...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}}),Q=q,ee=Y,te=X,re=t.memo(({children:t})=>e.jsx(z,{children:e.jsx(_,{children:e.jsx(Q,{children:t})})}));function ne(e,r){const n=F(),a=N(),o=ee(),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 ae(){const e=R(),r=L(),n=te();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}re.displayName="SDKContextProvider";const oe=t.memo(({children:r,callbacks:n})=>{const a=ae(),o=ne(e=>e.auth),s=ne(e=>e.os),i=t.useRef(!1),l=t.useRef(null),d=t.useMemo(()=>n,[n]),p=t.useCallback(async e=>{try{if(d?.handleAuthentication){const{sessionId:t}=await d.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 fetch(`${n}/api/${o}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}});if(!c.ok)throw new Error("Failed to fetch user profile");let l;try{l=await c.json()}catch(e){throw new Error("Failed to parse user profile response")}const u=l._id||l.id;if(!u||"string"!=typeof u)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 p=E({id:u,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);a.auth(f(p)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(b),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(u()),t}},[a,d,s]);return t.useEffect(()=>{if("undefined"==typeof window)return;if(o.isAuthenticated)return;const e=S();if(!e)return;(async()=>{try{const{serverUrl:t,version:r,orgId:n}=s;if(!t||!r||!n)return void c(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const o=await fetch(`${t}/api/${r}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"}});if(!o.ok)return c(new Error("Session invalid, removing from localStorage"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{status:o.status}}),void x();let i;try{i=await o.json()}catch(e){return c(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"parseResponse"}}),void x()}const l=i._id||i.id;if(!l||"string"!=typeof l)return c(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void x();if(!i.email||"string"!=typeof i.email)return c(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void x();const d=E({id:l,name:i.name||"",org:n,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);a.auth(f(d))}catch(e){c(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),x()}})()},[o.isAuthenticated,a,s]),t.useEffect(()=>{const e=function(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(b)}catch(e){return console.error("Error getting token from URL:",e),null}}();if(!e)return;if(i.current||l.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(i.current=!0,l.current=e,p(e).then(()=>{l.current=null}).catch(t=>{c(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),l.current=null}).finally(()=>{i.current=!1}))},[p,s.serverUrl,s.version,s.orgId]),e.jsx(e.Fragment,{children:r})});oe.displayName="AuthProviderWrapper";const se=t.memo(({config:r,auth:n,children:a})=>{const o=ae(),s=ne(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(O({...r,auth:i}))},[r,i,o]),t.useEffect(()=>{const{serverUrl:e,version:t,orgId:r,settings:n}=s;if(e&&t&&r&&!n){(async()=>{try{const n=k(),a=await fetch(`${e}/api/${t}/public/${r}/settings`,{headers:n});if(a.ok){const e=await a.json();o.os(P(e))}}catch(n){c(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})()}},[s.serverUrl,s.version,s.orgId,s.settings,o]),e.jsx(e.Fragment,{children:a})});se.displayName="ContextConfigProvider";const ie=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})}},ce=t.createContext({container:null,setContainer:()=>{}}),le=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(ce.Provider,{value:o,children:[s,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});le.displayName="PortalProvider";const de=t.createContext(void 0),ue=t.memo(({children:r})=>{const n=ne(e=>e.os),a=ne(e=>e.auth),{serverUrl:o,version:s}=n,i=a.isAuthenticated,[l,d]=t.useState({}),[u,f]=t.useState({}),[p,m]=t.useState(!1),[h,g]=t.useState(null),v=t.useCallback(async()=>{if(o&&s&&i)try{const e=await fetch(`${o}/api/${s}/public/users/attributes`,{headers:k()});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 v()}finally{m(!1)}}},[o,s,i,v]),b=t.useCallback(async e=>{if(!o||!s)throw new Error("Server URL or version is missing");m(!0),g(null);try{const t=await fetch(`${o}/api/${s}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...k()},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 v(),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,v]),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 fetch(`${o}/api/${s}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...k()},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 v(),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,v]),x=t.useCallback(async()=>{if(o&&s&&i)try{const e=await fetch(`${o}/api/${s}/public/users/features`,{headers:k()});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]),S=t.useCallback(async()=>{if(o&&s&&i){m(!0),g(null);try{await x()}finally{m(!1)}}},[o,s,i,x]);t.useEffect(()=>{i&&o&&s?(m(!0),g(null),Promise.all([v(),x()]).finally(()=>{m(!1)})):(d({}),f({}))},[i,o,s,v,x]);const E=t.useMemo(()=>({attributes:l,features:u,isLoading:p,error:h,updateAttributes:b,updateAttribute:w,refreshAttributes:y,refreshFeatures:S}),[l,u,p,h,b,w,y,S]);return e.jsx(de.Provider,{value:E,children:r})});ue.displayName="UserProvider";class fe{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return k()}async getWorkspaces(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch workspaces");return e.json()}async createWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to create workspace");return t.json()}async updateWorkspace(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok)throw new Error("Failed to update workspace");return r.json()}async deleteWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to delete workspace");return t.json()}async getWorkspaceUsers(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace users");return t.json()}async addUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to invite member")}return r.json()}async removeUser(e,t){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()});if(!r.ok){const e=await r.json();throw new Error(e.message||"Failed to remove user")}return r.json()}async updateUser(e,t,r){const n=await fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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 fetch(`${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()}}var pe=e=>"checkbox"===e.type,me=e=>e instanceof Date,he=e=>null==e;const ge=e=>"object"==typeof e;var ve=e=>!he(e)&&!Array.isArray(e)&&ge(e)&&!me(e),ye=e=>ve(e)&&e.target?pe(e.target)?e.target.checked:e.target.value:e,be=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),we="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function xe(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(we&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||ve(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return ve(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=xe(e[t]));return n}var Se=e=>/^\w*$/.test(e),ke=e=>void 0===e,Ee=e=>Array.isArray(e)?e.filter(Boolean):[],Ae=e=>Ee(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ce=(e,t,r)=>{if(!t||!ve(e))return r;const n=(Se(t)?[t]:Ae(t)).reduce((e,t)=>he(e)?e:e[t],e);return ke(n)||n===e?ke(e[t])?r:e[t]:n},je=e=>"boolean"==typeof e,Te=e=>"function"==typeof e,_e=(e,t,r)=>{let n=-1;const a=Se(t)?[t]:Ae(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=ve(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Ne="blur",Re="focusout",Oe="change",Pe="onBlur",De="onChange",Ie="onSubmit",Ue="onTouched",Me="all",ze="max",Fe="min",Le="maxLength",$e="minLength",We="pattern",Be="required",Ve="validate",Ge=t.createContext(null);Ge.displayName="HookFormContext";const Ke=()=>t.useContext(Ge),He=e=>{const{children:r,...n}=e;return t.createElement(Ge.Provider,{value:n},r)};var Ze=(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]!==Me&&(t._proxyFormState[a]=!n||Me),r&&(r[a]=!0),e[a]}});return a};const Je="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var qe=e=>"string"==typeof e,Ye=(e,t,r,n,a)=>qe(e)?(n&&t.watch.add(e),Ce(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Ce(r,e))):(n&&(t.watchAll=!0),r),Xe=e=>he(e)||!ge(e);function Qe(e,t,r=new WeakSet){if(Xe(e)||Xe(t))return Object.is(e,t);if(me(e)&&me(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(me(n)&&me(e)||ve(n)&&ve(e)||Array.isArray(n)&&Array.isArray(e)?!Qe(n,e,r):!Object.is(n,e))return!1}}return!0}function et(e){const r=Ke(),{name:n,disabled:a,control:o=r.control,shouldUnregister:s,defaultValue:i,exact:c=!0}=e,l=be(o._names.array,n),d=t.useMemo(()=>Ce(o._formValues,n,Ce(o._defaultValues,n,i)),[o,n,i]),u=function(e){const r=Ke(),{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=Ye(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=Ye(a,n._names,e||n._formValues,!1,l.current);if(d.current){const e=d.current(t);Qe(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,s,a]);Je(()=>(f.current===n&&Qe(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 y=f.current!==n,b=p.current,w=t.useMemo(()=>{if(s)return null;const e=!y&&!Qe(b,a);return y||e?g():null},[s,y,a,b,g]);return null!==w?w:m}({control:o,name:n,defaultValue:d,exact:c}),f=function(e){const r=Ke(),{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 Je(()=>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(()=>Ze(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,...je(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ce(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ce(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ce(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ce(f.validatingFields,n)},error:{enumerable:!0,get:()=>Ce(f.errors,n)}}),[f,n]),v=t.useCallback(e=>h.current.onChange({target:{value:ye(e),name:n},type:Oe}),[n]),y=t.useCallback(()=>h.current.onBlur({target:{value:Ce(o._formValues,n),name:n},type:Ne}),[n,o._formValues]),b=t.useCallback(e=>{const t=Ce(o._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>Te(e.focus)&&e.focus(),select:()=>Te(e.select)&&e.select(),setCustomValidity:t=>Te(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Te(e.reportValidity)&&e.reportValidity()})},[o._fields,n]),w=t.useMemo(()=>({name:n,value:u,...je(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:v,onBlur:y,ref:b}),[n,a,f.disabled,v,y,b,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,...je(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=Ce(o._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=xe(Ce(o._options.defaultValues,n,p.current.defaultValue));_e(o._defaultValues,n,e),ke(Ce(o._formValues,n))&&_e(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:w,formState:f,fieldState:g}),[w,f,g])}const tt=e=>e.render(et(e));var rt=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},nt=e=>Array.isArray(e)?e:[e],at=()=>{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 ot(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&ve(a)&&o){const e=ot(a,o);ve(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var st=e=>ve(e)&&!Object.keys(e).length,it=e=>"file"===e.type,ct=e=>{if(!we)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},lt=e=>"select-multiple"===e.type,dt=e=>"radio"===e.type,ut=e=>ct(e)&&e.isConnected;function ft(e,t){const r=Array.isArray(t)?t:Se(t)?[t]:Ae(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=ke(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(ve(n)&&st(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!ke(e[t]))return!1;return!0}(n))&&ft(e,r.slice(0,-1)),e}function pt(e){return Array.isArray(e)||ve(e)&&!(e=>{for(const t in e)if(Te(e[t]))return!0;return!1})(e)}function mt(e,t={}){for(const r in e){const n=e[r];pt(n)?(t[r]=Array.isArray(n)?[]:{},mt(n,t[r])):ke(n)||(t[r]=!0)}return t}function ht(e,t,r){r||(r=mt(t));for(const n in e){const a=e[n];if(pt(a))ke(t)||Xe(r[n])?r[n]=mt(a,Array.isArray(a)?[]:{}):ht(a,he(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Qe(a,e)}}return r}const gt={value:!1,isValid:!1},vt={value:!0,isValid:!0};var yt=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&&!ke(e[0].attributes.value)?ke(e[0].value)||""===e[0].value?vt:{value:e[0].value,isValid:!0}:vt:gt}return gt},bt=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>ke(e)?e:t?""===e?NaN:e?+e:e:r&&qe(e)?new Date(e):n?n(e):e;const wt={isValid:!1,value:null};var xt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,wt):wt;function St(e){const t=e.ref;return it(t)?t.files:dt(t)?xt(e.refs).value:lt(t)?[...t.selectedOptions].map(({value:e})=>e):pe(t)?yt(e.refs).value:bt(ke(t.value)?e.ref.value:t.value,e)}var kt=e=>e instanceof RegExp,Et=e=>ke(e)?e:kt(e)?e.source:ve(e)?kt(e.value)?e.value.source:e.value:e,At=e=>({isOnSubmit:!e||e===Ie,isOnBlur:e===Pe,isOnChange:e===De,isOnAll:e===Me,isOnTouch:e===Ue});const Ct="AsyncFunction";var jt=e=>!!e&&!!e.validate&&!!(Te(e.validate)&&e.validate.constructor.name===Ct||ve(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Ct)),Tt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const _t=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Ce(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(_t(o,t))break}else if(ve(o)&&_t(o,t))break}}};function Nt(e,t,r){const n=Ce(e,r);if(n||Se(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Ce(t,n),s=Ce(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 Rt=(e,t,r)=>{const n=nt(Ce(e,r));return _e(n,"root",t[r]),_e(e,r,n),e};function Ot(e,t,r="validate"){if(qe(e)||Array.isArray(e)&&e.every(qe)||je(e)&&!e)return{type:r,message:qe(e)?e:"",ref:t}}var Pt=e=>ve(e)&&!kt(e)?e:{value:e,message:""},Dt=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,y=Ce(r,h);if(!v||t.has(h))return{};const b=i?i[0]:s,w=e=>{a&&b.reportValidity&&(b.setCustomValidity(je(e)?"":e||""),b.reportValidity())},x={},S=dt(s),k=pe(s),E=S||k,A=(g||it(s))&&ke(s.value)&&ke(y)||ct(s)&&""===s.value||""===y||Array.isArray(y)&&!y.length,C=rt.bind(null,h,n,x),j=(e,t,r,n=Le,a=$e)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:s,...C(e?n:a,o)}};if(o?!Array.isArray(y)||!y.length:c&&(!E&&(A||he(y))||je(y)&&!y||k&&!yt(i).isValid||S&&!xt(i).isValid)){const{value:e,message:t}=qe(c)?{value:!!c,message:c}:Pt(c);if(e&&(x[h]={type:Be,message:t,ref:b,...C(Be,t)},!n))return w(t),x}if(!(A||he(u)&&he(f))){let e,t;const r=Pt(f),a=Pt(u);if(he(y)||isNaN(y)){const n=s.valueAsDate||new Date(y),o=e=>new Date((new Date).toDateString()+" "+e),i="time"==s.type,c="week"==s.type;qe(r.value)&&y&&(e=i?o(y)>o(r.value):c?y>r.value:n>new Date(r.value)),qe(a.value)&&y&&(t=i?o(y)<o(a.value):c?y<a.value:n<new Date(a.value))}else{const n=s.valueAsNumber||(y?+y:y);he(r.value)||(e=n>r.value),he(a.value)||(t=n<a.value)}if((e||t)&&(j(!!e,r.message,a.message,ze,Fe),!n))return w(x[h].message),x}if((l||d)&&!A&&(qe(y)||o&&Array.isArray(y))){const e=Pt(l),t=Pt(d),r=!he(e.value)&&y.length>+e.value,a=!he(t.value)&&y.length<+t.value;if((r||a)&&(j(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!A&&qe(y)){const{value:e,message:t}=Pt(p);if(kt(e)&&!y.match(e)&&(x[h]={type:We,message:t,ref:s,...C(We,t)},!n))return w(t),x}if(m)if(Te(m)){const e=Ot(await m(y,r),b);if(e&&(x[h]={...e,...C(Ve,e.message)},!n))return w(e.message),x}else if(ve(m)){let e={};for(const t in m){if(!st(e)&&!n)break;const a=Ot(await m[t](y,r),b,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(x[h]=e))}if(!st(e)&&(x[h]={ref:b,...e},!n))return x}return w(!0),x};const It={mode:Ie,reValidateMode:De,shouldFocusError:!0};function Ut(e={}){let t,r={...It,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(ve(r.defaultValues)||ve(r.values))&&xe(r.defaultValues||r.values)||{},s=r.shouldUnregister?{}:xe(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:at(),state:at()},m=r.criteriaMode===Me,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=st((await w()).errors),g()):e=await x(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?_e(n.validatingFields,e,t):ft(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!st(n.validatingFields)}))},v=(e,t,r,n)=>{const c=Ce(a,e);if(c){const a=Ce(s,e,ke(r)?Ce(o,e):r);ke(a)||n&&n.defaultChecked||t?_e(s,e,t?a:St(c._f)):E(e,a),i.mount&&!i.action&&h()}},y=(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=Qe(Ce(o,e),t);l=!!Ce(n.dirtyFields,e),r?ft(n.dirtyFields,e):_e(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=Ce(n.touchedFields,e);t||(_e(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:{}},b=(e,a,o,s)=>{const i=Ce(n.errors,e),c=(u.isValid||f.isValid)&&je(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{_e(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?_e(n.errors,e,o):ft(n.errors,e)),(o?!Qe(i,o):i)||!st(s)||c){const t={...s,...c&&je(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{g(e,!0);const t=await r.resolver(s,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Ce(t,r);e&&_e(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(t,a,o={valid:!0})=>{for(const 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&&jt(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await Dt(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&&(Ce(f,t.name)?i?Rt(n.errors,f,t.name):_e(n.errors,t.name,f[t.name]):ft(n.errors,t.name))}!st(i)&&await x(i,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&_e(s,e,t),!Qe(N(),o)),k=(e,t,r)=>Ye(e,c,{...i.mount?s:ke(t)?o:qe(e)?{[e]:t}:t},r,t),E=(e,t,r={})=>{const n=Ce(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&_e(s,e,bt(t,r)),o=ct(r.ref)&&he(t)?"":t,lt(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?pe(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):it(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:xe(s)})))}(r.shouldDirty||r.shouldTouch)&&y(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},A=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],s=e+"."+n,i=Ce(a,s);(c.array.has(e)||ve(o)||i&&!i._f)&&!me(o)?A(s,o,r):E(s,o,r)}},C=(e,t,r={})=>{const l=Ce(a,e),d=c.array.has(e),m=xe(t);_e(s,e,m),d?(p.array.next({name:e,values:xe(s)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:ht(o,s),isDirty:S(e,m)})):!l||l._f||he(m)?E(e,m,r):A(e,m,r),Tt(e,c)?p.state.next({...n,name:e,values:xe(s)}):p.state.next({name:i.mount?e:void 0,values:xe(s)})},j=async e=>{i.mount=!0;const o=e.target;let l=o.name,d=!0;const v=Ce(a,l),S=e=>{d=Number.isNaN(e)||me(e)&&isNaN(e.getTime())||Qe(e,Ce(s,l,e))},k=At(r.mode),E=At(r.reValidateMode);if(v){let i,A;const C=o.type?St(v._f):ye(e),j=e.type===Ne||e.type===Re,T=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(v._f)&&!r.resolver&&!Ce(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))(j,Ce(n.touchedFields,l),n.isSubmitted,E,k),N=Tt(l,c,j);_e(s,l,C),j?o&&o.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);const R=y(l,C,j),O=!st(R)||N;if(!j&&p.state.next({name:l,type:e.type,values:xe(s)}),T)return(u.isValid||f.isValid)&&("onBlur"===r.mode?j&&h():j||h()),O&&p.state.next({name:l,...N?{}:R});if(!j&&N&&p.state.next({...n}),r.resolver){const{errors:e}=await w([l]);if(g([l]),S(C),d){const t=Nt(n.errors,a,l),r=Nt(e,a,t.name||l);i=r.error,l=r.name,A=st(e)}}else g([l],!0),i=(await Dt(v,c.disabled,s,m,r.shouldUseNativeValidation))[l],g([l]),S(C),d&&(i?A=!1:(u.isValid||f.isValid)&&(A=await x(a,!0)));d&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&_(v._f.deps),b(l,A,i,R))}},T=(e,t)=>{if(Ce(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let o,s;const i=nt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(g(e),e)for(const r of e){const e=Ce(t,r);e?_e(n.errors,r,e):ft(n.errors,r)}else n.errors=t;return t})(ke(e)?e:i);o=st(t),s=e?!i.some(e=>Ce(t,e)):o}else e?(s=(await Promise.all(i.map(async e=>{const t=Ce(a,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(s||n.isValid)&&h()):s=o=await x(a);return p.state.next({...!qe(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!s&&_t(a,T,e?i:c.mount),s},N=(e,t)=>{let r={...i.mount?s:o};return t&&(r=ot(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),ke(e)?r:qe(e)?Ce(r,e):e.map(e=>Ce(r,e))},R=(e,t)=>({invalid:!!Ce((t||n).errors,e),isDirty:!!Ce((t||n).dirtyFields,e),error:Ce((t||n).errors,e),isValidating:!!Ce(n.validatingFields,e),isTouched:!!Ce((t||n).touchedFields,e)}),O=(e,t,r)=>{const o=(Ce(a,e,{_f:{}})._f||{}).ref,s=Ce(n.errors,e)||{},{ref:i,message:c,type:l,...d}=s;_e(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()},P=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!nt(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 st(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Me))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...s},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const i of e?nt(e):c.mount)c.mount.delete(i),c.array.delete(i),t.keepValue||(ft(a,i),ft(s,i)),!t.keepError&&ft(n.errors,i),!t.keepDirty&&ft(n.dirtyFields,i),!t.keepTouched&&ft(n.touchedFields,i),!t.keepIsValidating&&ft(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&ft(o,i);p.state.next({values:xe(s)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},I=({disabled:e,name:t})=>{(je(e)&&i.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},U=(e,t={})=>{let n=Ce(a,e);const s=je(t.disabled)||je(r.disabled);return _e(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?I({disabled:je(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:Et(t.min),max:Et(t.max),minLength:Et(t.minLength),maxLength:Et(t.maxLength),pattern:Et(t.pattern)}:{},name:e,onChange:j,onBlur:j,ref:s=>{if(s){U(e,t),n=Ce(a,e);const r=ke(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=(e=>dt(e)||pe(e))(r),c=n._f.refs||[];if(i?c.find(e=>e===r):r===n._f.ref)return;_e(a,e,{_f:{...n._f,...i?{refs:[...c.filter(ut),r,...Array.isArray(Ce(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),v(e,!1,void 0,r)}else n=Ce(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!be(c.array,e)||!i.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&_t(a,T,c.mount),z=(e,t)=>async o=>{let i;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=xe(s);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();g(),n.errors=e,l=xe(t)}else await x(a);if(c.disabled.size)for(const e of c.disabled)ft(l,e);if(ft(n.errors,"root"),st(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:st(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},F=(e,t={})=>{const l=e?xe(e):o,d=xe(l),f=st(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(ht(o,s))]);for(const t of Array.from(e)){const e=Ce(n.dirtyFields,t),r=Ce(s,t),a=Ce(m,t);e&&!ke(r)?_e(m,t,r):e||ke(a)||C(t,a)}}else{if(we&&ke(e))for(const e of c.mount){const t=Ce(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(ct(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)C(e,Ce(m,e));else a={}}s=r.shouldUnregister?t.keepDefaultValues?xe(o):{}:xe(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&&!st(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||Qe(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&s?ht(o,s):n.dirtyFields:t.keepDefaultValues&&e?ht(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)=>F(Te(e)?e(s):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},W={control:{register:U,unregister:D,getFieldState:R,handleSubmit:z,setError:O,_subscribe:P,_runSchema:w,_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(Ce(a,e))){const t=c(Ce(a,e),l.argA,l.argB);d&&_e(a,e,t)}if(m&&Array.isArray(Ce(n.errors,e))){const t=c(Ce(n.errors,e),l.argA,l.argB);d&&_e(n.errors,e,t),((e,t)=>{!Ee(Ce(e,t)).length&&ft(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Ce(n.touchedFields,e))){const t=c(Ce(n.touchedFields,e),l.argA,l.argB);d&&_e(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=ht(o,s)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else _e(s,e,t)},_setDisabledField:I,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ee(Ce(i.mount?s:o,e,r.shouldUnregister?Ce(o,e,[]):[])),_reset:F,_resetDefaultValues:()=>Te(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Ce(a,e);t&&(t._f.refs?t._f.refs.every(e=>!ut(e)):!ut(t._f.ref))&&D(e)}c.unMount=new Set},_disableForm:e=>{je(e)&&(p.state.next({disabled:e}),_t(a,(t,r)=>{const n=Ce(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},P({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:z,watch:(e,t)=>Te(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:C,getValues:N,reset:L,resetField:(e,t={})=>{Ce(a,e)&&(ke(t.defaultValue)?C(e,xe(Ce(o,e))):(C(e,t.defaultValue),_e(o,e,xe(t.defaultValue))),t.keepTouched||ft(n.touchedFields,e),t.keepDirty||(ft(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,xe(Ce(o,e))):S()),t.keepError||(ft(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&nt(e).forEach(e=>ft(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:O,setFocus:(e,t={})=>{const r=Ce(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Te(e.select)&&e.select()})}},getFieldState:R};return{...W,formControl:W}}function Mt(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,o]=t.useState({isDirty:!1,isValidating:!1,isLoading:Te(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:Te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!Te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Ut(e);r.current={...n,formState:a}}const s=r.current.control;return s._options=e,Je(()=>{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&&!Qe(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=Ze(a,s),r.current}const zt=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Ce(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Ft=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?zt(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>zt(t,r,e))}},Lt=(e,t)=>{t.shouldUseNativeValidation&&Ft(e,t);const r={};for(const n in e){const a=Ce(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if($t(t.names||Object.keys(e),n)){const e=Object.assign({},Ce(r,n));_e(e,"root",o),_e(r,n,e)}else _e(r,n,o)}return r},$t=(e,t)=>{const r=Wt(t);return e.some(e=>Wt(e).match(`^${r}\\.\\d+`))};function Wt(e){return e.replace(/\]|\[/g,"")}function Bt(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 Vt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Gt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Kt={};function Ht(e){return Kt}function Zt(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 Jt(e,t){return"bigint"==typeof t?t.toString():t}function qt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Yt(e){return null==e}function Xt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Qt=Symbol("evaluating");function er(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Qt)return void 0===n&&(n=Qt,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function nr(e){return JSON.stringify(e)}const ar="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function or(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const sr=qt(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ir(e){if(!1===or(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!==or(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function cr(e){return ir(e)?{...e}:Array.isArray(e)?[...e]:e}const lr=new Set(["string","number","symbol"]);function dr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ur(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function fr(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 pr(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 mr(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function hr(e){return"string"==typeof e?e:e?.message}function gr(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=hr(e.inst?._zod.def?.error?.(e))??hr(t?.error?.(e))??hr(r.customError?.(e))??hr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function vr(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function yr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const br=(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,Jt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wr=Bt("$ZodError",br),xr=Bt("$ZodError",br,{Parent:Error});const Sr=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 Vt;if(s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>gr(e,o,Ht())));throw ar(t,a?.callee),t}return s.value},kr=Sr(xr),Er=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=>gr(e,o,Ht())));throw ar(t,a?.callee),t}return s.value},Ar=Er(xr),Cr=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 Vt;return o.issues.length?{success:!1,error:new(e??wr)(o.issues.map(e=>gr(e,a,Ht())))}:{success:!0,data:o.value}},jr=Cr(xr),Tr=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=>gr(e,a,Ht())))}:{success:!0,data:o.value}},_r=Tr(xr),Nr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Sr(e)(t,r,a)},Rr=e=>(t,r,n)=>Sr(e)(t,r,n),Or=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Er(e)(t,r,a)},Pr=e=>async(t,r,n)=>Er(e)(t,r,n),Dr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Cr(e)(t,r,a)},Ir=e=>(t,r,n)=>Cr(e)(t,r,n),Ur=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tr(e)(t,r,a)},Mr=e=>async(t,r,n)=>Tr(e)(t,r,n),zr=/^[cC][^\s-]{8,}$/,Fr=/^[0-9a-z]+$/,Lr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$r=/^[0-9a-vA-V]{20}$/,Wr=/^[A-Za-z0-9]{27}$/,Br=/^[a-zA-Z0-9_-]{21}$/,Vr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gr=/^([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})$/,Kr=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)$/,Hr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Zr=/^(?:(?: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])$/,Jr=/^(([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}|:))$/,qr=/^((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])$/,Yr=/^(([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])$/,Xr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qr=/^[A-Za-z0-9_-]*$/,en=/^\+[1-9]\d{6,14}$/,tn="(?:(?:\\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])))",rn=new RegExp(`^${tn}$`);function nn(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 an=/^[^A-Z]*$/,on=/^[^a-z]*$/,sn=Bt("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),cn=Bt("$ZodCheckMaxLength",(e,t)=>{var r;sn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Yt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=vr(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ln=Bt("$ZodCheckMinLength",(e,t)=>{var r;sn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Yt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=vr(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dn=Bt("$ZodCheckLengthEquals",(e,t)=>{var r;sn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Yt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const o=vr(n),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})}}),un=Bt("$ZodCheckStringFormat",(e,t)=>{var r,n;sn.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=()=>{})}),fn=Bt("$ZodCheckRegex",(e,t)=>{un.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})}}),pn=Bt("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=an),un.init(e,t)}),mn=Bt("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=on),un.init(e,t)}),hn=Bt("$ZodCheckIncludes",(e,t)=>{sn.init(e,t);const r=dr(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})}}),gn=Bt("$ZodCheckStartsWith",(e,t)=>{sn.init(e,t);const r=new RegExp(`^${dr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),vn=Bt("$ZodCheckEndsWith",(e,t)=>{sn.init(e,t);const r=new RegExp(`.*${dr(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})}}),yn=Bt("$ZodCheckOverwrite",(e,t)=>{sn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class bn{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 wn={major:4,minor:3,patch:5},xn=Bt("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;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=pr(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 Vt;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(a||(a=pr(e,t)))});else{if(e.issues.length===t)continue;a||(a=pr(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(pr(r))return r.aborted=!0,r;const s=t(a,n,o);if(s instanceof Promise){if(!1===o.async)throw new Vt;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 Vt;return s.then(e=>t(e,n,o))}return t(s,n,o)}}er(e,"~standard",()=>({validate:t=>{try{const r=jr(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return _r(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Sn=Bt("$ZodString",(e,t)=>{var r;xn.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}}),kn=Bt("$ZodStringFormat",(e,t)=>{un.init(e,t),Sn.init(e,t)}),En=Bt("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Gr),kn.init(e,t)}),An=Bt("$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=Kr(e))}else t.pattern??(t.pattern=Kr());kn.init(e,t)}),Cn=Bt("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Hr),kn.init(e,t)}),jn=Bt("$ZodURL",(e,t)=>{kn.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})}}}),Tn=Bt("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kn.init(e,t)}),_n=Bt("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Br),kn.init(e,t)}),Nn=Bt("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zr),kn.init(e,t)}),Rn=Bt("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Fr),kn.init(e,t)}),On=Bt("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Lr),kn.init(e,t)}),Pn=Bt("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$r),kn.init(e,t)}),Dn=Bt("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wr),kn.init(e,t)}),In=Bt("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=nn({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(`^${tn}T(?:${n})$`)}(t)),kn.init(e,t)}),Un=Bt("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rn),kn.init(e,t)}),Mn=Bt("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${nn(t)}$`)),kn.init(e,t)}),zn=Bt("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vr),kn.init(e,t)}),Fn=Bt("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zr),kn.init(e,t),e._zod.bag.format="ipv4"}),Ln=Bt("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Jr),kn.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})}}}),$n=Bt("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=qr),kn.init(e,t)}),Wn=Bt("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yr),kn.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 Bn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Vn=Bt("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Xr),kn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Bn(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Gn=Bt("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qr),kn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!Qr.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Bn(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})}}),Kn=Bt("$ZodE164",(e,t)=>{t.pattern??(t.pattern=en),kn.init(e,t)});const Hn=Bt("$ZodJWT",(e,t)=>{kn.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})}}),Zn=Bt("$ZodUnknown",(e,t)=>{xn.init(e,t),e._zod.parse=e=>e}),Jn=Bt("$ZodNever",(e,t)=>{xn.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function qn(e,t,r){e.issues.length&&t.issues.push(...mr(r,e.issues)),t.value[r]=e.value}const Yn=Bt("$ZodArray",(e,t)=>{xn.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=>qn(t,r,e))):qn(i,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Xn(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...mr(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Qn(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 ea(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=>Xn(e,r,a,t,d))):Xn(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 ta=Bt("$ZodObject",(e,t)=>{xn.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=qt(()=>Qn(t));er(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=or,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=>Xn(r,t,e,i,a))):Xn(o,t,e,i,a)}return o?ea(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ra=Bt("$ZodObjectJIT",(e,t)=>{ta.init(e,t);const r=e._zod.parse,n=qt(()=>Qn(t));let a;const o=or,s=!Kt.jitless,i=s&&sr.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 bn(["shape","payload","ctx"]),r=n.value,a=e=>{const t=nr(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=nr(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?ea([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function na(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=>!pr(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=>gr(e,n,Ht())))}),t)}const aa=Bt("$ZodUnion",(e,t)=>{xn.init(e,t),er(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),er(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),er(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),er(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=>Xt(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=>na(t,a,e,o)):na(i,a,e,o)}}),oa=Bt("$ZodIntersection",(e,t)=>{xn.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])=>ia(e,t,r)):ia(e,a,o)}});function sa(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(ir(e)&&ir(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=sa(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=sa(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 ia(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}),pr(e))return e;const s=sa(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 ca=Bt("$ZodEnum",(e,t)=>{xn.init(e,t);const r=Zt(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>lr.has(typeof e)).map(e=>"string"==typeof e?dr(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}}),la=Bt("$ZodTransform",(e,t)=>{xn.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Gt(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 Vt;return r.value=a,r}});function da(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const ua=Bt("$ZodOptional",(e,t)=>{xn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",er(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),er(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Xt(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=>da(t,e.value)):da(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),fa=Bt("$ZodExactOptional",(e,t)=>{ua.init(e,t),er(e._zod,"values",()=>t.innerType._zod.values),er(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),pa=Bt("$ZodNullable",(e,t)=>{xn.init(e,t),er(e._zod,"optin",()=>t.innerType._zod.optin),er(e._zod,"optout",()=>t.innerType._zod.optout),er(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Xt(e.source)}|null)$`):void 0}),er(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)}),ma=Bt("$ZodDefault",(e,t)=>{xn.init(e,t),e._zod.optin="optional",er(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=>ha(e,t)):ha(n,t)}});function ha(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const ga=Bt("$ZodPrefault",(e,t)=>{xn.init(e,t),e._zod.optin="optional",er(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),va=Bt("$ZodNonOptional",(e,t)=>{xn.init(e,t),er(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=>ya(t,e)):ya(a,e)}});function ya(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 ba=Bt("$ZodCatch",(e,t)=>{xn.init(e,t),er(e._zod,"optin",()=>t.innerType._zod.optin),er(e._zod,"optout",()=>t.innerType._zod.optout),er(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=>gr(e,r,Ht()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>gr(e,r,Ht()))},input:e.value}),e.issues=[]),e)}}),wa=Bt("$ZodPipe",(e,t)=>{xn.init(e,t),er(e._zod,"values",()=>t.in._zod.values),er(e._zod,"optin",()=>t.in._zod.optin),er(e._zod,"optout",()=>t.out._zod.optout),er(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=>xa(e,t.in,r)):xa(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>xa(e,t.out,r)):xa(n,t.out,r)}});function xa(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Sa=Bt("$ZodReadonly",(e,t)=>{xn.init(e,t),er(e._zod,"propValues",()=>t.innerType._zod.propValues),er(e._zod,"values",()=>t.innerType._zod.values),er(e._zod,"optin",()=>t.innerType?._zod?.optin),er(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(ka):ka(n)}});function ka(e){return e.value=Object.freeze(e.value),e}const Ea=Bt("$ZodCustom",(e,t)=>{sn.init(e,t),xn.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=>Aa(t,r,n,e));Aa(a,r,n,e)}});function Aa(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(yr(e))}}var Ca;class ja{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)}}(Ca=globalThis).__zod_globalRegistry??(Ca.__zod_globalRegistry=new ja);const Ta=globalThis.__zod_globalRegistry;function _a(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...fr(t)})}function Na(e,t){return new cn({check:"max_length",...fr(t),maximum:e})}function Ra(e,t){return new ln({check:"min_length",...fr(t),minimum:e})}function Oa(e,t){return new dn({check:"length_equals",...fr(t),length:e})}function Pa(e){return new yn({check:"overwrite",tx:e})}function Da(e){const t=function(e,t){const r=new sn({check:"custom",...fr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(yr(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(yr(n))}},e(r.value,r)));return t}function Ia(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??Ta,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 Ua(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),Ua(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(s.schema,c),"input"===t.io&&Fa(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 Ma(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 za(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)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:La(t,"input",e.processors),output:La(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Fa(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 Fa(n.element,r);if("set"===n.type)return Fa(n.valueType,r);if("lazy"===n.type)return Fa(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 Fa(n.innerType,r);if("intersection"===n.type)return Fa(n.left,r)||Fa(n.right,r);if("record"===n.type||"map"===n.type)return Fa(n.keyType,r)||Fa(n.valueType,r);if("pipe"===n.type)return Fa(n.in,r)||Fa(n.out,r);if("object"===n.type){for(const e in n.shape)if(Fa(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Fa(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Fa(e,r))return!0;return!(!n.rest||!Fa(n.rest,r))}return!1}const La=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},s=Ia({...a??{},target:o,io:t,processors:r});return Ua(e,s),Ma(s,e),za(s,e)},$a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wa=(e,t,r,n)=>{const a=e._zod.def;Ua(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Ba(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Va(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]=rt(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Ga(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]=rt(s,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Ka(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(Ba(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&Ft({},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:Lt(Va(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(Ba(function(){return Promise.resolve(("sync"===r.mode?kr:Ar)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&Ft({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof wr}(e))return{values:{},errors:Lt(Ga(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
2
  /**
3
3
  * @license lucide-react v0.544.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const La=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),za=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)},Ba=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),Wa=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
7
+ */const Ha=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Za=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)},Ja=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),qa=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
8
8
  /**
9
9
  * @license lucide-react v0.544.0 - ISC
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
13
  */
14
- var Va={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"};
14
+ var Ya={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
15
  /**
16
16
  * @license lucide-react v0.544.0 - ISC
17
17
  *
18
18
  * This source code is licensed under the ISC license.
19
19
  * See the LICENSE file in the root directory of this source tree.
20
- */const $a=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,...Va,width:r,height:r,stroke:e,strokeWidth:a?24*Number(n)/Number(r):n,className:Ba("lucide",o),...!s&&!Wa(c)&&{"aria-hidden":"true"},...c},[...i.map(([e,r])=>t.createElement(e,r)),...Array.isArray(s)?s:[s]])),Ga=(e,r)=>{const n=t.forwardRef(({className:n,...a},o)=>t.createElement($a,{ref:o,iconNode:r,className:Ba(`lucide-${La(za(e))}`,`lucide-${e}`,n),...a}));return n.displayName=za(e),n},Ka=Ga("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"}]]),Ha=Ga("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),Za=Ga("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),qa=Ga("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"}]]),Ja=Ga("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Ya=Ga("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Xa=Ga("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"}]]),Qa=Ga("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),eo=Ga("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"}]]),to=Ga("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"}]]),ro=Ga("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),no=Ga("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"}]]),ao=Ga("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"}]]),oo=Ga("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"}]]),so=Ga("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"}]]),io=Ga("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"}]]),co=$t("ZodISODateTime",(e,t)=>{Mn.init(e,t),Do.init(e,t)});
20
+ */const Xa=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,...Ya,width:r,height:r,stroke:e,strokeWidth:a?24*Number(n)/Number(r):n,className:Ja("lucide",o),...!s&&!qa(c)&&{"aria-hidden":"true"},...c},[...i.map(([e,r])=>t.createElement(e,r)),...Array.isArray(s)?s:[s]])),Qa=(e,r)=>{const n=t.forwardRef(({className:n,...a},o)=>t.createElement(Xa,{ref:o,iconNode:r,className:Ja(`lucide-${Ha(Za(e))}`,`lucide-${e}`,n),...a}));return n.displayName=Za(e),n},eo=Qa("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"}]]),to=Qa("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),ro=Qa("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),no=Qa("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"}]]),ao=Qa("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),oo=Qa("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),so=Qa("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"}]]),io=Qa("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),co=Qa("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"}]]),lo=Qa("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"}]]),uo=Qa("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),fo=Qa("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"}]]),po=Qa("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"}]]),mo=Qa("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"}]]),ho=Qa("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"}]]),go=Qa("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"}]]),vo=Bt("ZodISODateTime",(e,t)=>{In.init(e,t),Wo.init(e,t)});
21
21
  /**
22
22
  * @license lucide-react v0.544.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */function lo(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...fr(t)})}(co,e)}const uo=$t("ZodISODate",(e,t)=>{Un.init(e,t),Do.init(e,t)});function fo(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...fr(t)})}(uo,e)}const po=$t("ZodISOTime",(e,t)=>{Fn.init(e,t),Do.init(e,t)});function mo(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...fr(t)})}(po,e)}const ho=$t("ZodISODuration",(e,t)=>{Ln.init(e,t),Do.init(e,t)});function go(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...fr(t)})}(ho,e)}const vo=$t("ZodError",(e,t)=>{wr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const r=t||function(e){return e.message},n={_errors:[]},a=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>a({issues:e}));else if("invalid_key"===t.code)a({issues:t.issues});else if("invalid_element"===t.code)a({issues:t.issues});else if(0===t.path.length)n._errors.push(r(t));else{let e=n,a=0;for(;a<t.path.length;){const n=t.path[a];a===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(r(t))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(e),n}(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,qt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,qt,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),bo=Sr(vo),yo=Ar(vo),wo=Cr(vo),xo=Tr(vo),So=_r(vo),ko=Rr(vo),Ao=Pr(vo),Eo=Or(vo),Co=Dr(vo),jo=Ir(vo),To=Mr(vo),No=Ur(vo),_o=$t("ZodType",(e,t)=>(Sn.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>ur(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>bo(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>wo(e,t,r),e.parseAsync=async(t,r)=>yo(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>xo(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>So(e,t,r),e.decode=(t,r)=>ko(e,t,r),e.encodeAsync=async(t,r)=>Ao(e,t,r),e.decodeAsync=async(t,r)=>Eo(e,t,r),e.safeEncode=(t,r)=>Co(e,t,r),e.safeDecode=(t,r)=>jo(e,t,r),e.safeEncodeAsync=async(t,r)=>To(e,t,r),e.safeDecodeAsync=async(t,r)=>No(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,...fr(r)})}(Ss,e,t)}(t,r)),e.superRefine=t=>e.check(Da(t)),e.overwrite=t=>e.check(Oa(t)),e.optional=()=>fs(e),e.nullable=()=>ms(e),e.nullish=()=>fs(ms(e)),e.nonoptional=t=>function(e,t){return new vs({type:"nonoptional",innerType:e,...fr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...fr(r)})}(as,e,t);var t},e.or=t=>function(e,t){return new is({type:"union",options:e,...fr(t)})}([e,t]),e.and=t=>new cs({type:"intersection",left:e,right:t}),e.transform=t=>ws(e,new ds({type:"transform",transform:t})),e.default=t=>{return r=t,new hs({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():cr(r)}});var r},e.prefault=t=>{return r=t,new gs({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():cr(r)}});var r},e.catch=t=>{return new bs({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>ws(e,t),e.readonly=()=>new xs({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Ta.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Ta.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Ta.get(e);const r=e.clone();return Ta.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ro=$t("_ZodString",(e,t)=>{kn.init(e,t),_o.init(e,t);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 pn({check:"string_format",format:"regex",...fr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new gn({check:"string_format",format:"includes",...fr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new vn({check:"string_format",format:"starts_with",...fr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new bn({check:"string_format",format:"ends_with",...fr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Ra(...t)),e.max=(...t)=>e.check(_a(...t)),e.length=(...t)=>e.check(Pa(...t)),e.nonempty=(...t)=>e.check(Ra(1,...t)),e.lowercase=t=>e.check(function(e){return new mn({check:"string_format",format:"lowercase",...fr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new hn({check:"string_format",format:"uppercase",...fr(e)})}(t)),e.trim=()=>e.check(Oa(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Oa(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Oa(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Oa(e=>e.toUpperCase()))}),Po=$t("ZodString",(e,t)=>{kn.init(e,t),Ro.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...fr(t)})}(Io,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...fr(t)})}(Fo,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...fr(t)})}(Qo,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...fr(t)})}(Lo,t)),e.guid=t=>e.check(Na(Mo,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...fr(t)})}(Uo,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...fr(t)})}(Uo,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...fr(t)})}(Uo,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...fr(t)})}(Uo,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...fr(t)})}(zo,t)),e.guid=t=>e.check(Na(Mo,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...fr(t)})}(Bo,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...fr(t)})}(Wo,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...fr(t)})}(Vo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...fr(t)})}(Jo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...fr(t)})}(Yo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...fr(t)})}($o,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...fr(t)})}(Go,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...fr(t)})}(Ko,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...fr(t)})}(Ho,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...fr(t)})}(Zo,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...fr(t)})}(qo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...fr(t)})}(Xo,t)),e.datetime=t=>e.check(lo(t)),e.date=t=>e.check(fo(t)),e.time=t=>e.check(mo(t)),e.duration=t=>e.check(go(t))});function Oo(e){return function(e,t){return new e({type:"string",...fr(t)})}(Po,e)}const Do=$t("ZodStringFormat",(e,t)=>{An.init(e,t),Ro.init(e,t)}),Io=$t("ZodEmail",(e,t)=>{jn.init(e,t),Do.init(e,t)}),Mo=$t("ZodGUID",(e,t)=>{En.init(e,t),Do.init(e,t)}),Uo=$t("ZodUUID",(e,t)=>{Cn.init(e,t),Do.init(e,t)}),Fo=$t("ZodURL",(e,t)=>{Tn.init(e,t),Do.init(e,t)}),Lo=$t("ZodEmoji",(e,t)=>{Nn.init(e,t),Do.init(e,t)}),zo=$t("ZodNanoID",(e,t)=>{_n.init(e,t),Do.init(e,t)}),Bo=$t("ZodCUID",(e,t)=>{Rn.init(e,t),Do.init(e,t)}),Wo=$t("ZodCUID2",(e,t)=>{Pn.init(e,t),Do.init(e,t)}),Vo=$t("ZodULID",(e,t)=>{On.init(e,t),Do.init(e,t)}),$o=$t("ZodXID",(e,t)=>{Dn.init(e,t),Do.init(e,t)}),Go=$t("ZodKSUID",(e,t)=>{In.init(e,t),Do.init(e,t)}),Ko=$t("ZodIPv4",(e,t)=>{zn.init(e,t),Do.init(e,t)}),Ho=$t("ZodIPv6",(e,t)=>{Bn.init(e,t),Do.init(e,t)}),Zo=$t("ZodCIDRv4",(e,t)=>{Wn.init(e,t),Do.init(e,t)}),qo=$t("ZodCIDRv6",(e,t)=>{Vn.init(e,t),Do.init(e,t)}),Jo=$t("ZodBase64",(e,t)=>{Gn.init(e,t),Do.init(e,t)}),Yo=$t("ZodBase64URL",(e,t)=>{Kn.init(e,t),Do.init(e,t)}),Xo=$t("ZodE164",(e,t)=>{Hn.init(e,t),Do.init(e,t)}),Qo=$t("ZodJWT",(e,t)=>{Zn.init(e,t),Do.init(e,t)}),es=$t("ZodUnknown",(e,t)=>{qn.init(e,t),_o.init(e,t)});function ts(){return new es({type:"unknown"})}const rs=$t("ZodNever",(e,t)=>{Jn.init(e,t),_o.init(e,t)});function ns(e){return function(e,t){return new e({type:"never",...fr(t)})}(rs,e)}const as=$t("ZodArray",(e,t)=>{Xn.init(e,t),_o.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(Ra(t,r)),e.nonempty=t=>e.check(Ra(1,t)),e.max=(t,r)=>e.check(_a(t,r)),e.length=(t,r)=>e.check(Pa(t,r)),e.unwrap=()=>e.element});const os=$t("ZodObject",(e,t)=>{na.init(e,t),_o.init(e,t),er(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new ls({type:"enum",entries:r,...fr(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:ts()}),e.loose=()=>e.clone({...e._zod.def,catchall:ts()}),e.strict=()=>e.clone({...e._zod.def,catchall:ns()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ir(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const n=rr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return tr(this,"shape",r),r},checks:[]});return ur(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!ir(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return tr(this,"shape",r),r},checks:e._zod.def.checks};return ur(e,r)}(e,t),e.merge=t=>function(e,t){const r=rr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return tr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ur(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def;return ur(e,rr(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 tr(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=rr(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 tr(this,"shape",n),n},checks:[]});return ur(e,n)}(e,t),e.partial=(...t)=>function(e,t,r){const n=rr(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 tr(this,"shape",a),a},checks:[]});return ur(t,n)}(us,e,t[0]),e.required=(...t)=>function(e,t,r){const n=rr(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 tr(this,"shape",a),a},checks:[]});return ur(t,n)}(vs,e,t[0])});function ss(e,t){const r={type:"object",get shape(){var t;return tr(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...fr(t)};return new os(r)}const is=$t("ZodUnion",(e,t)=>{oa.init(e,t),_o.init(e,t),e.options=t.options});const cs=$t("ZodIntersection",(e,t)=>{sa.init(e,t),_o.init(e,t)});const ls=$t("ZodEnum",(e,t)=>{la.init(e,t),_o.init(e,t),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 ls({...t,checks:[],...fr(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 ls({...t,checks:[],...fr(n),entries:a})}});const ds=$t("ZodTransform",(e,t)=>{da.init(e,t),_o.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Kt(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(br(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(br(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const us=$t("ZodOptional",(e,t)=>{fa.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType});function fs(e){return new us({type:"optional",innerType:e})}const ps=$t("ZodNullable",(e,t)=>{pa.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ms(e){return new ps({type:"nullable",innerType:e})}const hs=$t("ZodDefault",(e,t)=>{ma.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const gs=$t("ZodPrefault",(e,t)=>{ga.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType});const vs=$t("ZodNonOptional",(e,t)=>{va.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType});const bs=$t("ZodCatch",(e,t)=>{ya.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const ys=$t("ZodPipe",(e,t)=>{wa.init(e,t),_o.init(e,t),e.in=t.in,e.out=t.out});function ws(e,t){return new ys({type:"pipe",in:e,out:t})}const xs=$t("ZodReadonly",(e,t)=>{Sa.init(e,t),_o.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Ss=$t("ZodCustom",(e,t)=>{Aa.init(e,t),_o.init(e,t)});function ks(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}\``)}]},As(o,...r)]}function As(...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 Es(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var Cs=globalThis?.document?a.useLayoutEffect:()=>{};function js(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ts(...e){return t=>{let r=!1;const n=e.map(e=>{const n=js(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():js(e[t],null)}}}}function Ns(...e){return a.useCallback(Ts(...e),e)}function _s(t){const r=Ps(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Ds);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 Rs=_s("Slot");function Ps(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?Ts(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 Os=Symbol("radix.slottable");function Ds(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Os}var Is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=_s(`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 Ms,Us={exports:{}},Fs={};function Ls(){if(Ms)return Fs;Ms=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 Fs.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,Fs}var zs,Bs,Ws={};
26
+ */function yo(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...fr(t)})}(vo,e)}const bo=Bt("ZodISODate",(e,t)=>{Un.init(e,t),Wo.init(e,t)});function wo(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...fr(t)})}(bo,e)}const xo=Bt("ZodISOTime",(e,t)=>{Mn.init(e,t),Wo.init(e,t)});function So(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...fr(t)})}(xo,e)}const ko=Bt("ZodISODuration",(e,t)=>{zn.init(e,t),Wo.init(e,t)});function Eo(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...fr(t)})}(ko,e)}const Ao=Bt("ZodError",(e,t)=>{wr.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,Jt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Jt,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Co=Sr(Ao),jo=Er(Ao),To=Cr(Ao),_o=Tr(Ao),No=Nr(Ao),Ro=Rr(Ao),Oo=Or(Ao),Po=Pr(Ao),Do=Dr(Ao),Io=Ir(Ao),Uo=Ur(Ao),Mo=Mr(Ao),zo=Bt("ZodType",(e,t)=>(xn.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:La(e,"input"),output:La(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Ia({...r,processors:t});return Ua(e,n),Ma(n,e),za(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(rr(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)=>ur(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Co(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>To(e,t,r),e.parseAsync=async(t,r)=>jo(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>_o(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>No(e,t,r),e.decode=(t,r)=>Ro(e,t,r),e.encodeAsync=async(t,r)=>Oo(e,t,r),e.decodeAsync=async(t,r)=>Po(e,t,r),e.safeEncode=(t,r)=>Do(e,t,r),e.safeDecode=(t,r)=>Io(e,t,r),e.safeEncodeAsync=async(t,r)=>Uo(e,t,r),e.safeDecodeAsync=async(t,r)=>Mo(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,...fr(r)})}(Rs,e,t)}(t,r)),e.superRefine=t=>e.check(Da(t)),e.overwrite=t=>e.check(Pa(t)),e.optional=()=>ws(e),e.exactOptional=()=>new xs({type:"optional",innerType:e}),e.nullable=()=>ks(e),e.nullish=()=>ws(ks(e)),e.nonoptional=t=>function(e,t){return new Cs({type:"nonoptional",innerType:e,...fr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...fr(r)})}(fs,e,t);var t},e.or=t=>function(e,t){return new hs({type:"union",options:e,...fr(t)})}([e,t]),e.and=t=>new gs({type:"intersection",left:e,right:t}),e.transform=t=>_s(e,new ys({type:"transform",transform:t})),e.default=t=>{return r=t,new Es({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():cr(r)}});var r},e.prefault=t=>{return r=t,new As({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():cr(r)}});var r},e.catch=t=>{return new js({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>_s(e,t),e.readonly=()=>new Ns({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Ta.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Ta.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Ta.get(e);const r=e.clone();return Ta.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Fo=Bt("_ZodString",(e,t)=>{Sn.init(e,t),zo.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=$a[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 fn({check:"string_format",format:"regex",...fr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new hn({check:"string_format",format:"includes",...fr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new gn({check:"string_format",format:"starts_with",...fr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new vn({check:"string_format",format:"ends_with",...fr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Ra(...t)),e.max=(...t)=>e.check(Na(...t)),e.length=(...t)=>e.check(Oa(...t)),e.nonempty=(...t)=>e.check(Ra(1,...t)),e.lowercase=t=>e.check(function(e){return new pn({check:"string_format",format:"lowercase",...fr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new mn({check:"string_format",format:"uppercase",...fr(e)})}(t)),e.trim=()=>e.check(Pa(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Pa(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Pa(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Pa(e=>e.toUpperCase())),e.slugify=()=>e.check(Pa(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Lo=Bt("ZodString",(e,t)=>{Sn.init(e,t),Fo.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...fr(t)})}(Bo,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...fr(t)})}(Ko,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...fr(t)})}(is,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...fr(t)})}(Ho,t)),e.guid=t=>e.check(_a(Vo,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...fr(t)})}(Go,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...fr(t)})}(Go,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...fr(t)})}(Go,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...fr(t)})}(Go,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...fr(t)})}(Zo,t)),e.guid=t=>e.check(_a(Vo,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...fr(t)})}(Jo,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...fr(t)})}(qo,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...fr(t)})}(Yo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...fr(t)})}(as,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...fr(t)})}(os,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...fr(t)})}(Xo,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...fr(t)})}(Qo,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...fr(t)})}(es,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...fr(t)})}(ts,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...fr(t)})}(rs,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...fr(t)})}(ns,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...fr(t)})}(ss,t)),e.datetime=t=>e.check(yo(t)),e.date=t=>e.check(wo(t)),e.time=t=>e.check(So(t)),e.duration=t=>e.check(Eo(t))});function $o(e){return function(e,t){return new e({type:"string",...fr(t)})}(Lo,e)}const Wo=Bt("ZodStringFormat",(e,t)=>{kn.init(e,t),Fo.init(e,t)}),Bo=Bt("ZodEmail",(e,t)=>{Cn.init(e,t),Wo.init(e,t)}),Vo=Bt("ZodGUID",(e,t)=>{En.init(e,t),Wo.init(e,t)}),Go=Bt("ZodUUID",(e,t)=>{An.init(e,t),Wo.init(e,t)}),Ko=Bt("ZodURL",(e,t)=>{jn.init(e,t),Wo.init(e,t)}),Ho=Bt("ZodEmoji",(e,t)=>{Tn.init(e,t),Wo.init(e,t)}),Zo=Bt("ZodNanoID",(e,t)=>{_n.init(e,t),Wo.init(e,t)}),Jo=Bt("ZodCUID",(e,t)=>{Nn.init(e,t),Wo.init(e,t)}),qo=Bt("ZodCUID2",(e,t)=>{Rn.init(e,t),Wo.init(e,t)}),Yo=Bt("ZodULID",(e,t)=>{On.init(e,t),Wo.init(e,t)}),Xo=Bt("ZodXID",(e,t)=>{Pn.init(e,t),Wo.init(e,t)}),Qo=Bt("ZodKSUID",(e,t)=>{Dn.init(e,t),Wo.init(e,t)}),es=Bt("ZodIPv4",(e,t)=>{Fn.init(e,t),Wo.init(e,t)}),ts=Bt("ZodIPv6",(e,t)=>{Ln.init(e,t),Wo.init(e,t)}),rs=Bt("ZodCIDRv4",(e,t)=>{$n.init(e,t),Wo.init(e,t)}),ns=Bt("ZodCIDRv6",(e,t)=>{Wn.init(e,t),Wo.init(e,t)}),as=Bt("ZodBase64",(e,t)=>{Vn.init(e,t),Wo.init(e,t)}),os=Bt("ZodBase64URL",(e,t)=>{Gn.init(e,t),Wo.init(e,t)}),ss=Bt("ZodE164",(e,t)=>{Kn.init(e,t),Wo.init(e,t)}),is=Bt("ZodJWT",(e,t)=>{Hn.init(e,t),Wo.init(e,t)}),cs=Bt("ZodUnknown",(e,t)=>{Zn.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function ls(){return new cs({type:"unknown"})}const ds=Bt("ZodNever",(e,t)=>{Jn.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function us(e){return function(e,t){return new e({type:"never",...fr(t)})}(ds,e)}const fs=Bt("ZodArray",(e,t)=>{Yn.init(e,t),zo.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=Ua(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Ra(t,r)),e.nonempty=t=>e.check(Ra(1,t)),e.max=(t,r)=>e.check(Na(t,r)),e.length=(t,r)=>e.check(Oa(t,r)),e.unwrap=()=>e.element});const ps=Bt("ZodObject",(e,t)=>{ra.init(e,t),zo.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]=Ua(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=Ua(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),er(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new vs({type:"enum",entries:r,...fr(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:ls()}),e.loose=()=>e.clone({...e._zod.def,catchall:ls()}),e.strict=()=>e.clone({...e._zod.def,catchall:us()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ir(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=rr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return tr(this,"shape",r),r}});return ur(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!ir(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=rr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return tr(this,"shape",r),r}});return ur(e,r)}(e,t),e.merge=t=>function(e,t){const r=rr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return tr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ur(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 ur(e,rr(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 tr(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=rr(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 tr(this,"shape",n),n},checks:[]});return ur(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=rr(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 tr(this,"shape",a),a},checks:[]});return ur(t,a)}(bs,e,t[0]),e.required=(...t)=>function(e,t,r){const n=rr(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 tr(this,"shape",a),a}});return ur(t,n)}(Cs,e,t[0])});function ms(e,t){const r={type:"object",shape:e??{},...fr(t)};return new ps(r)}const hs=Bt("ZodUnion",(e,t)=>{aa.init(e,t),zo.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)=>Ua(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 gs=Bt("ZodIntersection",(e,t)=>{oa.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ua(a.left,t,{...n,path:[...n.path,"allOf",0]}),s=Ua(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 vs=Bt("ZodEnum",(e,t)=>{ca.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=Zt(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 vs({...t,checks:[],...fr(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 vs({...t,checks:[],...fr(n),entries:a})}});const ys=Bt("ZodTransform",(e,t)=>{la.init(e,t),zo.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 Gt(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(yr(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(yr(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const bs=Bt("ZodOptional",(e,t)=>{ua.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Wa(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function ws(e){return new bs({type:"optional",innerType:e})}const xs=Bt("ZodExactOptional",(e,t)=>{fa.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Wa(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Ss=Bt("ZodNullable",(e,t)=>{pa.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ua(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 ks(e){return new Ss({type:"nullable",innerType:e})}const Es=Bt("ZodDefault",(e,t)=>{ma.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ua(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 As=Bt("ZodPrefault",(e,t)=>{ga.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ua(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 Cs=Bt("ZodNonOptional",(e,t)=>{va.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ua(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const js=Bt("ZodCatch",(e,t)=>{ba.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;Ua(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 Ts=Bt("ZodPipe",(e,t)=>{wa.init(e,t),zo.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;Ua(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function _s(e,t){return new Ts({type:"pipe",in:e,out:t})}const Ns=Bt("ZodReadonly",(e,t)=>{Sa.init(e,t),zo.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ua(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 Rs=Bt("ZodCustom",(e,t)=>{Ea.init(e,t),zo.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 Os(...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 Ps(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var Ds=globalThis?.document?a.useLayoutEffect:()=>{};function Is(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Us(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Is(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():Is(e[t],null)}}}}function Ms(...e){return a.useCallback(Us(...e),e)}var zs=Symbol.for("react.lazy"),Fs=a[" use ".trim().toString()];function Ls(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===zs&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function $s(t){const r=Bs(t),n=a.forwardRef((t,n)=>{let{children:o,...s}=t;Ls(o)&&"function"==typeof Fs&&(o=Fs(o._payload));const i=a.Children.toArray(o),c=i.find(Gs);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 Ws=$s("Slot");function Bs(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(Ls(r)&&"function"==typeof Fs&&(r=Fs(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?Us(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 Vs=Symbol("radix.slottable");function Gs(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Vs}var Ks,Hs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=$s(`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}},{}),Zs={exports:{}},Js={};function qs(){if(Ks)return Js;Ks=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 Js.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,Js}var Ys,Xs,Qs={};
27
27
  /**
28
28
  * @license React
29
29
  * use-sync-external-store-shim.development.js
@@ -32,5 +32,5 @@ var Va={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */function Vs(){return zs||(zs=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};Ws.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())}()),Ws}function $s(){return Bs||(Bs=1,"production"===process.env.NODE_ENV?Us.exports=Ls():Us.exports=Vs()),Us.exports}var Gs=$s();function Ks(){return()=>{}}var Hs="Avatar",[Zs,qs]=ks(Hs),[Js,Ys]=Zs(Hs),Xs=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...o}=t,[s,i]=a.useState("idle");return e.jsx(Js,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:e.jsx(Is.span,{...o,ref:r})})});Xs.displayName=Hs;var Qs="AvatarImage",ei=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:o,onLoadingStatusChange:s=()=>{},...i}=t,c=Ys(Qs,n),l=function(e,{referrerPolicy:t,crossOrigin:r}){const n=Gs.useSyncExternalStore(Ks,()=>!0,()=>!1),o=a.useRef(null),s=n?(o.current||(o.current=new window.Image),o.current):null,[i,c]=a.useState(()=>ni(s,e));return Cs(()=>{c(ni(s,e))},[s,e]),Cs(()=>{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=Es(e=>{s(e),c.onImageLoadingStatusChange(e)});return Cs(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e.jsx(Is.img,{...i,ref:r,src:o}):null});ei.displayName=Qs;var ti="AvatarFallback",ri=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:o,...s}=t,i=Ys(ti,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(Is.span,{...s,ref:r}):null});function ni(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}ri.displayName=ti;var ai=Xs,oi=ei,si=ri;function ii(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=ii(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ci(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=ii(e))&&(n&&(n+=" "),n+=t);return n}const li=e=>{const t=pi(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),di(r,t)||fi(e)},getConflictingClassGroupIds:(e,t)=>{const a=r[e]||[];return t&&n[e]?[...a,...n[e]]:a}}},di=(e,t)=>{if(0===e.length)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?di(e.slice(1),n):void 0;if(a)return a;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},ui=/^\[(.+)\]$/,fi=e=>{if(ui.test(e)){const t=ui.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},pi=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const e in r)mi(r[e],n,e,t);return n},mi=(e,t,r,n)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:hi(t,e)).classGroupId=r)}if("function"==typeof e)return gi(e)?void mi(e(n),t,r,n):void t.validators.push({validator:e,classGroupId:r});Object.entries(e).forEach(([e,a])=>{mi(a,hi(t,e),r,n)})})},hi=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},gi=e=>e.isThemeGetter,vi=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(a,o)=>{r.set(a,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=n.get(e))?(a(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):a(e,t)}}},bi=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;for(let s=0;s<e.length;s++){let i=e[s];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,s)),o=s+1;continue}if("/"===i){r=s;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.substring(o),i=yi(s);return{modifiers:t,hasImportantModifier:i!==s,baseClassName:i,maybePostfixModifierPosition:r&&r>o?r-o:void 0}};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0}}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},yi=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,wi=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return e=>{if(e.length<=1)return e;const r=[];let n=[];return e.forEach(e=>{"["===e[0]||t[e]?(r.push(...n.sort(),e),n=[]):n.push(e)}),r.push(...n.sort()),r}},xi=/\s+/;function Si(){let e,t,r=0,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=ki(e))&&(n&&(n+=" "),n+=t);return n}const ki=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=ki(e[n]))&&(r&&(r+=" "),r+=t);return r};function Ai(e,...t){let r,n,a,o=function(i){const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:vi(e.cacheSize),parseClassName:bi(e),sortModifiers:wi(e),...li(e)}))(c),n=r.cache.get,a=r.cache.set,o=s,s(i)};function 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(xi);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=o(d).join(":"),v=u?g+"!":g,b=v+h;if(s.includes(b))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 function(){return o(Si.apply(null,arguments))}}const Ei=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Ci=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ji=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ti=/^\d+\/\d+$/,Ni=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_i=/\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$/,Ri=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Oi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Di=e=>Ti.test(e),Ii=e=>!!e&&!Number.isNaN(Number(e)),Mi=e=>!!e&&Number.isInteger(Number(e)),Ui=e=>e.endsWith("%")&&Ii(e.slice(0,-1)),Fi=e=>Ni.test(e),Li=()=>!0,zi=e=>_i.test(e)&&!Ri.test(e),Bi=()=>!1,Wi=e=>Pi.test(e),Vi=e=>Oi.test(e),$i=e=>!Ki(e)&&!Xi(e),Gi=e=>oc(e,lc,Bi),Ki=e=>Ci.test(e),Hi=e=>oc(e,dc,zi),Zi=e=>oc(e,uc,Ii),qi=e=>oc(e,ic,Bi),Ji=e=>oc(e,cc,Vi),Yi=e=>oc(e,pc,Wi),Xi=e=>ji.test(e),Qi=e=>sc(e,dc),ec=e=>sc(e,fc),tc=e=>sc(e,ic),rc=e=>sc(e,lc),nc=e=>sc(e,cc),ac=e=>sc(e,pc,!0),oc=(e,t,r)=>{const n=Ci.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},sc=(e,t,r=!1)=>{const n=ji.exec(e);return!!n&&(n[1]?t(n[1]):r)},ic=e=>"position"===e||"percentage"===e,cc=e=>"image"===e||"url"===e,lc=e=>"length"===e||"size"===e||"bg-size"===e,dc=e=>"length"===e,uc=e=>"number"===e,fc=e=>"family-name"===e,pc=e=>"shadow"===e,mc=Ai(()=>{const e=Ei("color"),t=Ei("font"),r=Ei("text"),n=Ei("font-weight"),a=Ei("tracking"),o=Ei("leading"),s=Ei("breakpoint"),i=Ei("container"),c=Ei("spacing"),l=Ei("radius"),d=Ei("shadow"),u=Ei("inset-shadow"),f=Ei("text-shadow"),p=Ei("drop-shadow"),m=Ei("blur"),h=Ei("perspective"),g=Ei("aspect"),v=Ei("ease"),b=Ei("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Xi,Ki],w=()=>[Xi,Ki,c],x=()=>[Di,"full","auto",...w()],S=()=>[Mi,"none","subgrid",Xi,Ki],k=()=>["auto",{span:["full",Mi,Xi,Ki]},Mi,Xi,Ki],A=()=>[Mi,"auto",Xi,Ki],E=()=>["auto","min","max","fr",Xi,Ki],C=()=>["auto",...w()],j=()=>[Di,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],T=()=>[e,Xi,Ki],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",tc,qi,{position:[Xi,Ki]}],_=()=>["auto","cover","contain",rc,Gi,{size:[Xi,Ki]}],R=()=>[Ui,Qi,Hi],P=()=>["","none","full",l,Xi,Ki],O=()=>["",Ii,Qi,Hi],D=()=>[Ii,Ui,tc,qi],I=()=>["","none",m,Xi,Ki],M=()=>["none",Ii,Xi,Ki],U=()=>["none",Ii,Xi,Ki],F=()=>[Ii,Xi,Ki],L=()=>[Di,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fi],breakpoint:[Fi],color:[Li],container:[Fi],"drop-shadow":[Fi],ease:["in","out","in-out"],font:[$i],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fi],shadow:[Fi],spacing:["px",Ii],text:[Fi],"text-shadow":[Fi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Di,Ki,Xi,g]}],container:["container"],columns:[{columns:[Ii,Ki,Xi,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:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Mi,"auto",Xi,Ki]}],basis:[{basis:[Di,"full","auto",i,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ii,Di,"auto","initial","none",Ki]}],grow:[{grow:["",Ii,Xi,Ki]}],shrink:[{shrink:["",Ii,Xi,Ki]}],order:[{order:[Mi,"first","last","none",Xi,Ki]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],w:[{w:[i,"screen",...j()]}],"min-w":[{"min-w":[i,"screen","none",...j()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",r,Qi,Hi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Xi,Zi]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ui,Ki]}],"font-family":[{font:[ec,Ki,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,Xi,Ki]}],"line-clamp":[{"line-clamp":[Ii,"none",Xi,Zi]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",Xi,Ki]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Xi,Ki]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ii,"from-font","auto",Xi,Hi]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[Ii,"auto",Xi,Ki]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xi,Ki]}],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",Xi,Ki]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Mi,Xi,Ki],radial:["",Xi,Ki],conic:[Mi,Xi,Ki]},nc,Ji]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],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:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ii,Xi,Ki]}],"outline-w":[{outline:["",Ii,Qi,Hi]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",d,ac,Yi]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,ac,Yi]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[Ii,Hi]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",f,ac,Yi]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[Ii,Xi,Ki]}],"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":[Ii]}],"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":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"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":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"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":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"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":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"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":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"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":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"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":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[Xi,Ki]}],"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":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"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":[Ii]}],"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":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Xi,Ki]}],filter:[{filter:["","none",Xi,Ki]}],blur:[{blur:I()}],brightness:[{brightness:[Ii,Xi,Ki]}],contrast:[{contrast:[Ii,Xi,Ki]}],"drop-shadow":[{"drop-shadow":["","none",p,ac,Yi]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",Ii,Xi,Ki]}],"hue-rotate":[{"hue-rotate":[Ii,Xi,Ki]}],invert:[{invert:["",Ii,Xi,Ki]}],saturate:[{saturate:[Ii,Xi,Ki]}],sepia:[{sepia:["",Ii,Xi,Ki]}],"backdrop-filter":[{"backdrop-filter":["","none",Xi,Ki]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[Ii,Xi,Ki]}],"backdrop-contrast":[{"backdrop-contrast":[Ii,Xi,Ki]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ii,Xi,Ki]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ii,Xi,Ki]}],"backdrop-invert":[{"backdrop-invert":["",Ii,Xi,Ki]}],"backdrop-opacity":[{"backdrop-opacity":[Ii,Xi,Ki]}],"backdrop-saturate":[{"backdrop-saturate":[Ii,Xi,Ki]}],"backdrop-sepia":[{"backdrop-sepia":["",Ii,Xi,Ki]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Xi,Ki]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ii,"initial",Xi,Ki]}],ease:[{ease:["linear","initial",v,Xi,Ki]}],delay:[{delay:[Ii,Xi,Ki]}],animate:[{animate:["none",b,Xi,Ki]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Xi,Ki]}],"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:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Xi,Ki,"","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:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"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",Xi,Ki]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xi,Ki]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[Ii,Qi,Hi,Zi]}],stroke:[{stroke:["none",...T()]}],"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 hc(...e){return mc(ci(e))}const gc=a.forwardRef(({className:t,...r},n)=>e.jsx(ai,{ref:n,className:hc("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));gc.displayName=ai.displayName;const vc=a.forwardRef(({className:t,...r},n)=>e.jsx(oi,{ref:n,className:hc("aspect-square h-full w-full",t),...r}));vc.displayName=oi.displayName;const bc=a.forwardRef(({className:t,...r},n)=>e.jsx(si,{ref:n,className:hc("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));bc.displayName=si.displayName;const yc=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,wc=ci,xc=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return wc(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=yc(t)||yc(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 wc(e,s,c,null==r?void 0:r.class,null==r?void 0:r.className)},Sc=xc("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"}}),kc=a.forwardRef(({className:t,variant:r,progress:n,size:o,startIcon:s,endIcon:i,asChild:c=!1,...l},d)=>{const u=c?Rs:"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:hc(Sc({variant:r,size:o,withIcon:null!=n||null!=s||null!=i,className:t})),ref:d,...l,children:[n&&e.jsx(Ja,{size:f,className:"animate-spin"}),s&&a.cloneElement(s,{size:f}),l.children,i&&a.cloneElement(i,{size:f})]})});function Ac(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}kc.displayName="Button";var Ec=a[" useId ".trim().toString()]||(()=>{}),Cc=0;function jc(e){const[t,r]=a.useState(Ec());return Cs(()=>{r(e=>e??String(Cc++))},[e]),e||(t?`radix-${t}`:"")}var Tc=a[" useInsertionEffect ".trim().toString()]||Cs;function Nc({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 Tc(()=>{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]}var _c,Rc="dismissableLayer.update",Pc="dismissableLayer.pointerDownOutside",Oc="dismissableLayer.focusOutside",Dc=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ic=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...d}=t,u=a.useContext(Dc),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Ns(r,e=>p(e)),v=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=f?v.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=y,k=function(e,t=globalThis?.document){const r=Es(e),n=a.useRef(!1),o=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){Uc(Pc,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),A=function(e,t=globalThis?.document){const r=Es(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){Uc(Oc,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=Es(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=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(_c=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Mc(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=_c)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Mc())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(Rc,e),()=>document.removeEventListener(Rc,e)},[]),e.jsx(Is.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:Ac(t.onFocusCapture,A.onFocusCapture),onBlurCapture:Ac(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ac(t.onPointerDownCapture,k.onPointerDownCapture)})});Ic.displayName="DismissableLayer";function Mc(){const e=new CustomEvent(Rc);document.dispatchEvent(e)}function Uc(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(Dc),o=a.useRef(null),s=Ns(r,o);return a.useEffect(()=>{const e=o.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Is.div,{...t,ref:s})}).displayName="DismissableLayerBranch";var Fc="focusScope.autoFocusOnMount",Lc="focusScope.autoFocusOnUnmount",zc={bubbles:!1,cancelable:!0},Bc=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...c}=t,[l,d]=a.useState(null),u=Es(s),f=Es(i),p=a.useRef(null),m=Ns(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:Gc(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||Gc(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Gc(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){Kc.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Fc,zc);l.addEventListener(Fc,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Gc(n,{select:t}),document.activeElement!==r)return}((e=Wc(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Gc(l))}return()=>{l.removeEventListener(Fc,u),setTimeout(()=>{const e=new CustomEvent(Lc,zc);l.addEventListener(Lc,f),l.dispatchEvent(e),e.defaultPrevented||Gc(t??document.body,{select:!0}),l.removeEventListener(Lc,f),Kc.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=Wc(e),r=Vc(t,e),n=Vc(t.reverse(),e);return[r,n]}(t);a&&o?e.shiftKey||r!==o?e.shiftKey&&r===a&&(e.preventDefault(),n&&Gc(o,{select:!0})):(e.preventDefault(),n&&Gc(a,{select:!0})):r===t&&e.preventDefault()}},[n,o,h.paused]);return e.jsx(Is.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function Wc(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 Vc(e,t){for(const r of e)if(!$c(r,{upTo:t}))return r}function $c(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 Gc(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()}}Bc.displayName="FocusScope";var Kc=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Hc(e,t),e.unshift(t)},remove(t){e=Hc(e,t),e[0]?.resume()}}}();function Hc(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Zc=a.forwardRef((t,n)=>{const{container:o,...s}=t,[i,c]=a.useState(!1);Cs(()=>c(!0),[]);const l=o||i&&globalThis?.document?.body;return l?r.createPortal(e.jsx(Is.div,{...s,ref:n}),l):null});Zc.displayName="Portal";var qc=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=Jc(n.current);s.current="mounted"===c?e:"none"},[c]),Cs(()=>{const t=n.current,r=o.current;if(r!==e){const n=s.current,a=Jc(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),Cs(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const s=Jc(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=Jc(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=Ns(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 Jc(e){return e?.animationName||"none"}qc.displayName="Presence";var Yc=0;function Xc(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Qc()),document.body.insertAdjacentElement("beforeend",e[1]??Qc()),Yc++,()=>{1===Yc&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Yc--}},[])}function Qc(){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 el=function(){return el=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},el.apply(this,arguments)};function tl(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 rl="right-scroll-bar-position",nl="width-before-scroll-bar";function al(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var ol="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,sl=new WeakMap;function il(e,r){var n,a,o,s=(n=null,a=function(t){return e.forEach(function(e){return al(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 ol(function(){var t=sl.get(s);if(t){var r=new Set(t),n=new Set(e),a=s.current;r.forEach(function(e){n.has(e)||al(e,null)}),n.forEach(function(e){r.has(e)||al(e,a)})}sl.set(s,e)},[e]),s}function cl(e){return e}var ll=function(e){var t=e.sideCar,r=tl(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,el({},r))};ll.isSideCarExport=!0;var dl=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=cl);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=el({async:!0,ssr:!1},e),t}(),ul=function(){},fl=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:ul,onWheelCapture:ul,onTouchMoveCapture:ul}),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,w=e.gapMode,x=tl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=il([r,t]),A=el(el({},x),o);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:dl,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:w}),i?a.cloneElement(a.Children.only(c),el(el({},A),{ref:k})):a.createElement(y,el({},A,{className:l,ref:k}),c))});fl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},fl.classNames={fullWidth:nl,zeroRight:rl};function pl(){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 ml=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=pl())&&(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)}}},hl=function(){var e,t=(e=ml(),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}},gl={left:0,top:0,right:0,gap:0},vl=function(e){return parseInt(e||"",10)||0},bl=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return gl;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[vl(r),vl(n),vl(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])}},yl=hl(),wl="data-scroll-locked",xl=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(wl,"] {\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(rl," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(nl," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(rl," .").concat(rl," {\n right: 0 ").concat(n,";\n }\n \n .").concat(nl," .").concat(nl," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(wl,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Sl=function(){var e=parseInt(document.body.getAttribute(wl)||"0",10);return isFinite(e)?e:0},kl=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(wl,(Sl()+1).toString()),function(){var e=Sl()-1;e<=0?document.body.removeAttribute(wl):document.body.setAttribute(wl,e.toString())}},[]);var s=a.useMemo(function(){return bl(o)},[o]);return a.createElement(yl,{styles:xl(s,!t,o,r?"":"!important")})},Al=!1;if("undefined"!=typeof window)try{var El=Object.defineProperty({},"passive",{get:function(){return Al=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch(e){Al=!1}var Cl=!!Al&&{passive:!1},jl=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])},Tl=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Nl(e,n)){var a=_l(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Nl=function(e,t){return"v"===e?function(e){return jl(e,"overflowY")}(t):function(e){return jl(e,"overflowX")}(t)},_l=function(e,t){return"v"===e?[(r=t).scrollTop,r.scrollHeight,r.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var r},Rl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Pl=function(e){return[e.deltaX,e.deltaY]},Ol=function(e){return e&&"current"in e?e.current:e},Dl=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Il=0,Ml=[];function Ul(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Fl,Ll=(Fl=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),o=a.useState(Il++)[0],s=a.useState(hl)[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(Ol),!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=Rl(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=Tl(u,d);if(!f)return!0;if(f?a=u:(a="v"===u?"h":"v",f=Tl(u,d)),!f)return!1;if(!n.current&&"changedTouches"in e&&(c||l)&&(n.current=a),!a)return!0;var p=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=_l(e,s),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Nl(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}(p,t,e,"h"===p?c:l)},[]),l=a.useCallback(function(e){var r=e;if(Ml.length&&Ml[Ml.length-1]===s){var n="deltaY"in r?Pl(r):Rl(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(Ol).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:Ul(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=Rl(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,Pl(t),t.target,c(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,Rl(t),t.target,c(t,e.lockRef.current))},[]);a.useEffect(function(){return Ml.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Cl),document.addEventListener("touchmove",l,Cl),document.addEventListener("touchstart",u,Cl),function(){Ml=Ml.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,Cl),document.removeEventListener("touchmove",l,Cl),document.removeEventListener("touchstart",u,Cl)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(s,{styles:Dl(o)}):null,m?a.createElement(kl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},dl.useMedium(Fl),ll),zl=a.forwardRef(function(e,t){return a.createElement(fl,el({},e,{ref:t,sideCar:Ll}))});zl.classNames=fl.classNames;var Bl=new WeakMap,Wl=new WeakMap,Vl={},$l=0,Gl=function(e){return e&&(e.host||Gl(e.parentNode))},Kl=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Gl(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]);Vl[r]||(Vl[r]=new WeakMap);var o=Vl[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=(Bl.get(e)||0)+1,l=(o.get(e)||0)+1;Bl.set(e,c),o.set(e,l),s.push(e),1===c&&a&&Wl.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(),$l++,function(){s.forEach(function(e){var t=Bl.get(e)-1,a=o.get(e)-1;Bl.set(e,t),o.set(e,a),t||(Wl.has(e)||e.removeAttribute(n),Wl.delete(e)),a||e.removeAttribute(r)}),--$l||(Bl=new WeakMap,Bl=new WeakMap,Wl=new WeakMap,Vl={})}},Hl=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"))),Kl(n,a,r,"aria-hidden")):function(){return null}},Zl="Dialog",[ql,Jl]=ks(Zl),[Yl,Xl]=ql(Zl),Ql=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]=Nc({prop:o,defaultProp:s??!1,onChange:i,caller:Zl});return e.jsx(Yl,{scope:r,triggerRef:l,contentRef:d,contentId:jc(),titleId:jc(),descriptionId:jc(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};Ql.displayName=Zl;var ed="DialogTrigger",td=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Xl(ed,n),s=Ns(r,o.triggerRef);return e.jsx(Is.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xd(o.open),...a,ref:s,onClick:Ac(t.onClick,o.onOpenToggle)})});td.displayName=ed;var rd="DialogPortal",[nd,ad]=ql(rd,{forceMount:void 0}),od=t=>{const{__scopeDialog:r,forceMount:n,children:o,container:s}=t,i=Xl(rd,r);return e.jsx(nd,{scope:r,forceMount:n,children:a.Children.map(o,t=>e.jsx(qc,{present:n||i.open,children:e.jsx(Zc,{asChild:!0,container:s,children:t})}))})};od.displayName=rd;var sd="DialogOverlay",id=a.forwardRef((t,r)=>{const n=ad(sd,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Xl(sd,t.__scopeDialog);return s.modal?e.jsx(qc,{present:a||s.open,children:e.jsx(ld,{...o,ref:r})}):null});id.displayName=sd;var cd=_s("DialogOverlay.RemoveScroll"),ld=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Xl(sd,n);return e.jsx(zl,{as:cd,allowPinchZoom:!0,shards:[o.contentRef],children:e.jsx(Is.div,{"data-state":xd(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),dd="DialogContent",ud=a.forwardRef((t,r)=>{const n=ad(dd,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Xl(dd,t.__scopeDialog);return e.jsx(qc,{present:a||s.open,children:s.modal?e.jsx(fd,{...o,ref:r}):e.jsx(pd,{...o,ref:r})})});ud.displayName=dd;var fd=a.forwardRef((t,r)=>{const n=Xl(dd,t.__scopeDialog),o=a.useRef(null),s=Ns(r,n.contentRef,o);return a.useEffect(()=>{const e=o.current;if(e)return Hl(e)},[]),e.jsx(md,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ac(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ac(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Ac(t.onFocusOutside,e=>e.preventDefault())})}),pd=a.forwardRef((t,r)=>{const n=Xl(dd,t.__scopeDialog),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(md,{...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()}})}),md=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,...c}=t,l=Xl(dd,n),d=a.useRef(null),u=Ns(r,d);return Xc(),e.jsxs(e.Fragment,{children:[e.jsx(Bc,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:i,children:e.jsx(Ic,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":xd(l.open),...c,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Ed,{titleId:l.titleId}),e.jsx(Cd,{contentRef:d,descriptionId:l.descriptionId})]})]})}),hd="DialogTitle",gd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Xl(hd,n);return e.jsx(Is.h2,{id:o.titleId,...a,ref:r})});gd.displayName=hd;var vd="DialogDescription",bd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Xl(vd,n);return e.jsx(Is.p,{id:o.descriptionId,...a,ref:r})});bd.displayName=vd;var yd="DialogClose",wd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Xl(yd,n);return e.jsx(Is.button,{type:"button",...a,ref:r,onClick:Ac(t.onClick,()=>o.onOpenChange(!1))})});function xd(e){return e?"open":"closed"}wd.displayName=yd;var Sd="DialogTitleWarning",[kd,Ad]=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}\``)}]}(Sd,{contentName:dd,titleName:hd,docsSlug:"dialog"}),Ed=({titleId:e})=>{const t=Ad(Sd),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},Cd=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ad("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},jd=Ql,Td=td,Nd=od,_d=id,Rd=ud,Pd=gd,Od=bd,Dd=wd;function Id(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 Md=["color"],Ud=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Id(e,Md);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"}))}),Fd=["color"],Ld=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Id(e,Fd);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"}))}),zd=["color"],Bd=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Id(e,zd);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"}))}),Wd=["color"],Vd=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=Id(e,Wd);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 $d=jd,Gd=Td,Kd=Nd,Hd=a.forwardRef(({className:t,...r},n)=>e.jsx(_d,{ref:n,className:hc("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}));Hd.displayName=_d.displayName;const Zd=a.forwardRef(({className:t,children:r,...n},o)=>{const{container:s}=a.useContext(ce);return e.jsxs(Kd,{container:s,children:[e.jsx(Hd,{}),e.jsxs(Rd,{ref:o,className:hc("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(Dd,{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(Bd,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});Zd.displayName=Rd.displayName;const qd=({className:t,...r})=>e.jsx("div",{className:hc("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});qd.displayName="DialogHeader";const Jd=a.forwardRef(({className:t,...r},n)=>e.jsx(Pd,{ref:n,className:hc("text-lg font-semibold leading-none tracking-tight",t),...r}));Jd.displayName=Pd.displayName;const Yd=a.forwardRef(({className:t,...r},n)=>e.jsx(Od,{ref:n,className:hc("text-sm text-muted-foreground",t),...r}));Yd.displayName=Od.displayName;var Xd=a.forwardRef((t,r)=>e.jsx(Is.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Xd.displayName="Label";var Qd=Xd;const eu=xc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),tu=a.forwardRef(({className:t,...r},n)=>e.jsx(Qd,{ref:n,className:hc(eu(),t),...r}));tu.displayName=Qd.displayName;const ru=Ke,nu=a.createContext({}),au=({...t})=>e.jsx(nu.Provider,{value:{name:t.name},children:e.jsx(et,{...t})}),ou=()=>{const e=a.useContext(nu),t=a.useContext(su),{getFieldState:r,formState:n}=Ge(),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}},su=a.createContext({}),iu=a.forwardRef(({className:t,...r},n)=>{const o=a.useId();return e.jsx(su.Provider,{value:{id:o},children:e.jsx("div",{ref:n,className:hc("space-y-2",t),...r})})});iu.displayName="FormItem";const cu=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:o}=ou();return e.jsx(tu,{ref:n,className:hc(a&&"text-destructive",t),htmlFor:o,...r})});cu.displayName="FormLabel";const lu=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:s}=ou();return e.jsx(Rs,{ref:r,id:a,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...t})});lu.displayName="FormControl";const du=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=ou();return e.jsx("p",{ref:n,id:a,className:hc("text-sm text-muted-foreground",t),...r})});du.displayName="FormDescription";const uu=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:o,formMessageId:s}=ou(),i=o?String(o?.message):r;return i?e.jsx("p",{ref:a,id:s,className:hc("text-sm font-medium text-destructive",t),...n,children:i}):null});uu.displayName="FormMessage";const fu=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:hc("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 pu(r){const n=r+"CollectionProvider",[a,o]=ks(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=_s(l),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,o=Ns(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=_s(f),h=t.forwardRef((r,n)=>{const{scope:a,children:o,...s}=r,c=t.useRef(null),l=Ns(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]}fu.displayName="Input";var mu=a.createContext(void 0);function hu(e){const t=a.useContext(mu);return e||t||"ltr"}var gu="rovingFocusGroup.onEntryFocus",vu={bubbles:!1,cancelable:!0},bu="RovingFocusGroup",[yu,wu,xu]=pu(bu),[Su,ku]=ks(bu,[xu]),[Au,Eu]=Su(bu),Cu=a.forwardRef((t,r)=>e.jsx(yu.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(yu.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ju,{...t,ref:r})})}));Cu.displayName=bu;var ju=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=Ns(r,m),g=hu(i),[v,b]=Nc({prop:c,defaultProp:l??null,onChange:d,caller:bu}),[y,w]=a.useState(!1),x=Es(u),S=wu(n),k=a.useRef(!1),[A,E]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(gu,x),()=>e.removeEventListener(gu,x)},[x]),e.jsx(Au,{scope:n,orientation:o,dir:g,loop:s,currentTabStopId:v,onItemFocus:a.useCallback(e=>b(e),[b]),onItemShiftTab:a.useCallback(()=>w(!0),[]),onFocusableItemAdd:a.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>E(e=>e-1),[]),children:e.jsx(Is.div,{tabIndex:y||0===A?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:Ac(t.onMouseDown,()=>{k.current=!0}),onFocus:Ac(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(gu,vu);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Ru([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:Ac(t.onBlur,()=>w(!1))})})}),Tu="RovingFocusGroupItem",Nu=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:i,children:c,...l}=t,d=jc(),u=i||d,f=Eu(Tu,n),p=f.currentTabStopId===u,m=wu(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return a.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),e.jsx(yu.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:e.jsx(Is.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:Ac(t.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:Ac(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Ac(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:_u[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(()=>Ru(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});Nu.displayName=Tu;var _u={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ru(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 Pu=Cu,Ou=Nu;function Du(e){const[t,r]=a.useState(void 0);return Cs(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Iu(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 Mu="Radio",[Uu,Fu]=ks(Mu),[Lu,zu]=Uu(Mu),Bu=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=Ns(r,e=>m(e)),g=a.useRef(!1),v=!p||(u||!!p.closest("form"));return e.jsxs(Lu,{scope:n,checked:s,disabled:c,children:[e.jsx(Is.button,{type:"button",role:"radio","aria-checked":s,"data-state":Gu(s),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onClick:Ac(t.onClick,e=>{s||d?.(),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&e.jsx($u,{control:p,bubbles:!g.current,name:o,value:l,checked:s,required:i,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});Bu.displayName=Mu;var Wu="RadioIndicator",Vu=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...o}=t,s=zu(Wu,n);return e.jsx(qc,{present:a||s.checked,children:e.jsx(Is.span,{"data-state":Gu(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:r})})});Vu.displayName=Wu;var $u=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Ns(c,i),d=Iu(n),u=Du(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(Is.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 Gu(e){return e?"checked":"unchecked"}$u.displayName="RadioBubbleInput";var Ku=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Hu="RadioGroup",[Zu,qu]=ks(Hu,[ku,Fu]),Ju=ku(),Yu=Fu(),[Xu,Qu]=Zu(Hu),ef=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=Ju(n),h=hu(d),[g,v]=Nc({prop:s,defaultProp:o??null,onChange:f,caller:Hu});return e.jsx(Xu,{scope:n,name:a,required:i,disabled:c,value:g,onValueChange:v,children:e.jsx(Pu,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:e.jsx(Is.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});ef.displayName=Hu;var tf="RadioGroupItem",rf=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:o,...s}=t,i=Qu(tf,n),c=i.disabled||o,l=Ju(n),d=Yu(n),u=a.useRef(null),f=Ns(r,u),p=i.value===s.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Ku.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(Ou,{asChild:!0,...l,focusable:!c,active:p,children:e.jsx(Bu,{disabled:c,required:i.required,checked:p,...d,...s,name:i.name,ref:f,onCheck:()=>i.onValueChange(s.value),onKeyDown:Ac(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Ac(s.onFocus,()=>{m.current&&u.current?.click()})})})});rf.displayName=tf;var nf=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,o=Yu(n);return e.jsx(Vu,{...o,...a,ref:r})});nf.displayName="RadioGroupIndicator";var af=ef,of=rf,sf=nf;const cf=a.forwardRef(({className:t,...r},n)=>e.jsx(af,{className:hc("grid gap-2",t),...r,ref:n}));cf.displayName=af.displayName;const lf=a.forwardRef(({className:t,...r},n)=>e.jsx(of,{ref:n,className:hc("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(sf,{className:"flex items-center justify-center",children:e.jsx(Ld,{className:"h-3.5 w-3.5 fill-primary"})})}));function df(e,[t,r]){return Math.min(r,Math.max(t,e))}lf.displayName=of.displayName;var uf="ScrollArea",[ff,pf]=ks(uf),[mf,hf]=ff(uf),gf=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,w]=a.useState(0),[x,S]=a.useState(0),[k,A]=a.useState(!1),[E,C]=a.useState(!1),j=Ns(r,e=>d(e)),T=hu(s);return e.jsx(mf,{scope:n,type:o,dir:T,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:A,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:S,children:e.jsx(Is.div,{dir:T,...c,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":x+"px",...t.style}})})});gf.displayName=uf;var vf="ScrollAreaViewport",bf=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:o,nonce:s,...i}=t,c=hf(vf,n),l=Ns(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(Is.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})})]})});bf.displayName=vf;var yf="ScrollAreaScrollbar",wf=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=hf(yf,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(xf,{...o,ref:r,forceMount:n}):"scroll"===s.type?e.jsx(Sf,{...o,ref:r,forceMount:n}):"auto"===s.type?e.jsx(kf,{...o,ref:r,forceMount:n}):"always"===s.type?e.jsx(Af,{...o,ref:r}):null});wf.displayName=yf;var xf=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=hf(yf,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(qc,{present:n||i,children:e.jsx(kf,{"data-state":i?"visible":"hidden",...o,ref:r})})}),Sf=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=hf(yf,t.__scopeScrollArea),i="horizontal"===t.orientation,c=Vf(()=>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(qc,{present:n||"hidden"!==l,children:e.jsx(Af,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:Ac(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ac(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),kf=a.forwardRef((t,r)=>{const n=hf(yf,t.__scopeScrollArea),{forceMount:o,...s}=t,[i,c]=a.useState(!1),l="horizontal"===t.orientation,d=Vf(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;c(l?e:t)}},10);return $f(n.viewport,d),$f(n.content,d),e.jsx(qc,{present:o||i,children:e.jsx(Af,{"data-state":i?"visible":"hidden",...s,ref:r})})}),Af=a.forwardRef((t,r)=>{const{orientation:n="vertical",...o}=t,s=hf(yf,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=Uf(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=Ff(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 zf([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===n?e.jsx(Ef,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=Lf(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(Cf,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=Lf(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}),Ef=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=hf(yf,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Ns(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(Nf,{"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":Ff(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),Bf(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:Mf(c.paddingLeft),paddingEnd:Mf(c.paddingRight)}})}})}),Cf=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=hf(yf,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Ns(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(Nf,{"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":Ff(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),Bf(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:Mf(c.paddingTop),paddingEnd:Mf(c.paddingBottom)}})}})}),[jf,Tf]=ff(yf),Nf=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=hf(yf,n),[g,v]=a.useState(null),b=Ns(r,e=>v(e)),y=a.useRef(null),w=a.useRef(""),x=h.viewport,S=o.content-o.viewport,k=Es(f),A=Es(d),E=Vf(p,10);function C(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})},[x,g,S,k]),a.useEffect(A,[o,A]),$f(g,E),$f(h.content,E),e.jsx(jf,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:Es(i),onThumbPointerUp:Es(c),onThumbPositionChange:A,onThumbPointerDown:Es(l),children:e.jsx(Is.div,{...m,ref:b,style:{position:"absolute",...m.style},onPointerDown:Ac(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:Ac(t.onPointerMove,C),onPointerUp:Ac(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),_f="ScrollAreaThumb",Rf=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,o=Tf(_f,t.__scopeScrollArea);return e.jsx(qc,{present:n||o.hasThumb,children:e.jsx(Pf,{ref:r,...a})})}),Pf=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:o,...s}=t,i=hf(_f,n),c=Tf(_f,n),{onThumbPositionChange:l}=c,d=Ns(r,e=>c.onThumbChange(e)),u=a.useRef(void 0),f=Vf(()=>{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=Wf(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,l]),e.jsx(Is.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:Ac(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:Ac(t.onPointerUp,c.onThumbPointerUp)})});Rf.displayName=_f;var Of="ScrollAreaCorner",Df=a.forwardRef((t,r)=>{const n=hf(Of,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(If,{...t,ref:r}):null});Df.displayName=Of;var If=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...o}=t,s=hf(Of,n),[i,c]=a.useState(0),[l,d]=a.useState(0),u=Boolean(i&&l);return $f(s.scrollbarX,()=>{const e=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(e),d(e)}),$f(s.scrollbarY,()=>{const e=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(e),c(e)}),u?e.jsx(Is.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 Mf(e){return e?parseInt(e,10):0}function Uf(e,t){const r=e/t;return isNaN(r)?0:r}function Ff(e){const t=Uf(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Lf(e,t,r="ltr"){const n=Ff(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,s=t.content-t.viewport,i=o-n,c=df(e,"ltr"===r?[0,s]:[-1*s,0]);return zf([0,s],[0,i])(c)}function zf(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 Bf(e,t){return e>0&&e<t}var Wf=(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 Vf(e,t){const r=Es(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 $f(e,t){const r=Es(t);Cs(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var Gf=gf,Kf=bf,Hf=Df;const Zf=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Gf,{ref:a,className:hc("relative overflow-hidden",t),...n,children:[e.jsx(Kf,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(qf,{}),e.jsx(Hf,{})]}));Zf.displayName=Gf.displayName;const qf=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(wf,{ref:a,orientation:r,className:hc("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(Rf,{className:hc("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));qf.displayName=wf.displayName;var Jf="horizontal",Yf=["horizontal","vertical"],Xf=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Jf,...o}=t,s=function(e){return Yf.includes(e)}(a)?a:Jf,i=n?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};return e.jsx(Is.div,{"data-orientation":s,...i,...o,ref:r})});Xf.displayName="Separator";var Qf=Xf;const ep=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},o)=>e.jsx(Qf,{ref:o,decorative:n,orientation:r,className:hc("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));function tp(){const e=ae(),r=ne(e=>e.os),{serverUrl:n,version:a,orgId:o,settings:s}=r,i=t.useRef(!1),c=t.useCallback(async()=>{if(i.current)return s||null;if(s)return s;if(!n||!a||!o)return null;i.current=!0;try{const t=k(),r=await fetch(`${n}/api/${a}/public/${o}/settings`,{headers:t});if(!r.ok)throw new Error("Failed to fetch settings");const s=await r.json();return e.os(O(s)),s}catch(e){return console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[n,a,o,s,e]);return t.useEffect(()=>{n&&a&&o&&!s&&!i.current&&c()},[n,a,o]),t.useMemo(()=>({settings:s,getSettings:c}),[s,c])}ep.displayName=Qf.displayName;var rp="AlertDialog",[np,ap]=ks(rp,[Jl]),op=Jl(),sp=t=>{const{__scopeAlertDialog:r,...n}=t,a=op(r);return e.jsx(jd,{...a,...n,modal:!0})};sp.displayName=rp;var ip=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=op(n);return e.jsx(Td,{...o,...a,ref:r})});ip.displayName="AlertDialogTrigger";var cp=t=>{const{__scopeAlertDialog:r,...n}=t,a=op(r);return e.jsx(Nd,{...a,...n})};cp.displayName="AlertDialogPortal";var lp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=op(n);return e.jsx(_d,{...o,...a,ref:r})});lp.displayName="AlertDialogOverlay";var dp="AlertDialogContent",[up,fp]=np(dp),pp=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=Os,r}("AlertDialogContent"),mp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:o,...s}=t,i=op(n),c=a.useRef(null),l=Ns(r,c),d=a.useRef(null);return e.jsx(kd,{contentName:dp,titleName:hp,docsSlug:"alert-dialog",children:e.jsx(up,{scope:n,cancelRef:d,children:e.jsxs(Rd,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Ac(s.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(pp,{children:o}),e.jsx(Sp,{contentRef:c})]})})})});mp.displayName=dp;var hp="AlertDialogTitle",gp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=op(n);return e.jsx(Pd,{...o,...a,ref:r})});gp.displayName=hp;var vp="AlertDialogDescription",bp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=op(n);return e.jsx(Od,{...o,...a,ref:r})});bp.displayName=vp;var yp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=op(n);return e.jsx(Dd,{...o,...a,ref:r})});yp.displayName="AlertDialogAction";var wp="AlertDialogCancel",xp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:o}=fp(wp,n),s=op(n),i=Ns(r,o);return e.jsx(Dd,{...s,...a,ref:i})});xp.displayName=wp;var Sp=({contentRef:e})=>{const t=`\`${dp}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${dp}\` by passing a \`${vp}\` 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 \`${dp}\`. 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},kp=lp,Ap=mp,Ep=yp,Cp=xp,jp=gp,Tp=bp;const Np=sp,_p=ip,Rp=cp,Pp=a.forwardRef(({className:t,...r},n)=>e.jsx(kp,{className:hc("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}));Pp.displayName=kp.displayName;const Op=a.forwardRef(({className:t,...r},n)=>{const{container:o}=a.useContext(ce);return e.jsxs(Rp,{container:o,children:[e.jsx(Pp,{}),e.jsx(Ap,{ref:n,className:hc("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})]})});Op.displayName=Ap.displayName;const Dp=({className:t,...r})=>e.jsx("div",{className:hc("flex flex-col space-y-2 text-center sm:text-left",t),...r});Dp.displayName="AlertDialogHeader";const Ip=({className:t,...r})=>e.jsx("div",{className:hc("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Ip.displayName="AlertDialogFooter";const Mp=a.forwardRef(({className:t,...r},n)=>e.jsx(jp,{ref:n,className:hc("text-lg font-semibold",t),...r}));Mp.displayName=jp.displayName;const Up=a.forwardRef(({className:t,...r},n)=>e.jsx(Tp,{ref:n,className:hc("text-sm text-muted-foreground",t),...r}));Up.displayName=Tp.displayName;const Fp=a.forwardRef(({className:t,...r},n)=>e.jsx(Ep,{ref:n,className:hc(Sc(),t),...r}));Fp.displayName=Ep.displayName;const Lp=a.forwardRef(({className:t,...r},n)=>e.jsx(Cp,{ref:n,className:hc(Sc({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));Lp.displayName=Cp.displayName;const zp="saas-workspace-current",Bp=()=>g(zp),Wp=(e,t)=>!!e&&t.some(t=>t._id===e);function Vp(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 $p({className:t,...r}){return e.jsx("div",{className:hc("animate-pulse rounded-md bg-primary/10",t),...r})}function Gp(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx($p,{className:"h-10 w-full"}),e.jsx($p,{className:"h-10 w-full"}),e.jsx($p,{className:"h-10 w-full"})]})}const Kp=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:o}=Ey(),s=ne(e=>e.auth.session?.user||null);if(!r)return e.jsx(Gp,{});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(Np,{children:[e.jsx(_p,{asChild:!0,children:e.jsxs(kc,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(no,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Op,{children:[e.jsxs(Dp,{children:[e.jsx(Mp,{children:"Are you absolutely sure?"}),e.jsxs(Up,{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(Ip,{children:[e.jsx(Lp,{disabled:n,children:"Cancel"}),e.jsx(Fp,{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(Ja,{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 Hp="Switch",[Zp,qp]=ks(Hp),[Jp,Yp]=Zp(Hp),Xp=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=Ns(r,e=>h(e)),v=a.useRef(!1),b=!m||(f||!!m.closest("form")),[y,w]=Nc({prop:s,defaultProp:i??!1,onChange:u,caller:Hp});return e.jsxs(Jp,{scope:n,checked:y,disabled:l,children:[e.jsx(Is.button,{type:"button",role:"switch","aria-checked":y,"aria-required":c,"data-state":rm(y),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:Ac(t.onClick,e=>{w(e=>!e),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),b&&e.jsx(tm,{control:m,bubbles:!v.current,name:o,value:d,checked:y,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Xp.displayName=Hp;var Qp="SwitchThumb",em=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,o=Yp(Qp,n);return e.jsx(Is.span,{"data-state":rm(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});em.displayName=Qp;var tm=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Ns(c,i),d=Iu(n),u=Du(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 rm(e){return e?"checked":"unchecked"}tm.displayName="SwitchBubbleInput";var nm=Xp,am=em;const om=a.forwardRef(({className:t,...r},n)=>e.jsx(nm,{className:hc("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(am,{className:hc("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")})}));om.displayName=nm.displayName;const sm=({workspaceId:r})=>{const[n,a]=t.useState({}),{allFeatures:o,updateFeature:s,getWorkspace:i}=Ey(),[c,l]=t.useState(null),d=ne(e=>e.auth.session?.user||null);if(t.useEffect(()=>{i(r).then(l)},[r]),!c)return e.jsx(Gp,{});const u=Vp(c,d?.id??null);return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!u&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!o.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),o.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:o.map(t=>{const r=c?.features?.[t.slug];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})]}),e.jsx(om,{disabled:n[t.slug]||!u,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(!c)return;a(r=>({...r,[e]:t}));const r=await s(c._id,e,t);l(r),a(t=>({...t,[e]:!1}))}(t.slug,e)})]},t._id)})})]})})};function im(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 cm=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],lm=({workspace:r})=>{const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState(),{updateWorkspace:l}=Ey(),d=ne(e=>e.auth.session?.user||null),u=Ft({resolver:Fa(ss({name:Oo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Oo().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Gp,{});const f=Vp(r,d?.id??null);return e.jsxs("div",{children:[!f&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(ru,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(async function(e){a(!0);try{await l(r,e)}catch(e){console.error("Failed to update workspace:",e)}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(au,{control:u.control,name:"name",render:({field:t})=>e.jsxs(iu,{children:[e.jsx(cu,{children:"Name"}),e.jsx(lu,{children:e.jsx(fu,{placeholder:"My Awesome Workspace",...t,disabled:!f})}),e.jsx(uu,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(tu,{className:"text-sm font-medium",children:"Icon"}),e.jsx(du,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(cf,{value:o,disabled:!f,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(lf,{value:"emoji",id:"emoji"}),e.jsxs(tu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(to,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lf,{value:"url",id:"url"}),e.jsxs(tu,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(qa,{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&&u.watch("image")?.trim()&&e.jsx("img",{src:u.watch("image")||void 0,alt:"Workspace preview"})]})]}),f&&e.jsx(Zf,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:cm.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),u.setValue("image",im(e))})(t),disabled:!f,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(au,{control:u.control,name:"image",render:({field:t})=>e.jsxs(iu,{children:[e.jsx(cu,{children:"Image URL"}),e.jsx(lu,{children:e.jsx(fu,{placeholder:"https://example.com/image.png",...t,disabled:!f})}),e.jsx(du,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(uu,{})]})}),u.watch("image")&&u.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:u.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:f&&e.jsx(kc,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var dm=.999,um=/[\\\/_+.#"@\[\(\{&]/,fm=/[\\\/_+.#"@\[\(\{&]/g,pm=/[\s-]/,mm=/[\s-]/g;function hm(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=hm(e,t,r,n,p+1,o+1,s))>m&&(p===a?c*=1:um.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(fm))&&a>0&&(c*=Math.pow(dm,d.length))):pm.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(mm))&&a>0&&(c*=Math.pow(dm,u.length))):(c*=.17,a>0&&(c*=Math.pow(dm,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=hm(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 gm(e){return e.toLowerCase().replace(mm," ")}function vm(e,t,r){return hm(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,gm(e),gm(t),0,0,{})}var bm='[cmdk-group=""]',ym='[cmdk-group-items=""]',wm='[cmdk-item=""]',xm=`${wm}:not([aria-disabled="true"])`,Sm="cmdk-item-select",km="data-value",Am=(e,t,r)=>vm(e,t,r),Em=a.createContext(void 0),Cm=()=>a.useContext(Em),jm=a.createContext(void 0),Tm=()=>a.useContext(jm),Nm=a.createContext(void 0),_m=a.forwardRef((e,t)=>{let r=$m(()=>{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=$m(()=>new Set),o=$m(()=>new Map),s=$m(()=>new Map),i=$m(()=>new Set),c=Wm(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,y=jc(),w=jc(),x=jc(),S=a.useRef(null),k=Hm();Vm(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,A.emit()}},[u]),Vm(()=>{k(6,_)},[]);let A=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(),j(),k(1,T);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(y))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,A.emit()}),n||k(5,_),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))}}A.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,C(t,n)),k(2,()=>{j(),A.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(),j(),r.current.value||T(),A.emit()}),()=>{s.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{N(),(null==t?void 0:t.getAttribute("id"))===e&&T(),A.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:x,labelId:w,listInnerRef:S}),[]);function C(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:Am;return e?o(e,r.current.search,t):0}function j(){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(ym);t?t.appendChild(e.parentElement===t?e:e.closest(`${ym} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${ym} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${bm}[${km}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function T(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(km);A.setState("value",t||void 0)}function N(){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=C(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 _(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(bm))?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(`${wm}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(xm))||[])}function O(e){let t=P()[e];t&&A.setState("value",t.getAttribute(km))}function D(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&&A.setState("value",o.getAttribute(km))}function I(e){let t,r=R(),n=null==r?void 0:r.closest(bm);for(;n&&!t;)n=e>0?zm(n,bm):Bm(n,bm),t=null==n?void 0:n.querySelector(xm);t?A.setState("value",t.getAttribute(km)):D(e)}let M=()=>O(P().length-1),U=e=>{e.preventDefault(),e.metaKey?M():e.altKey?I(1):D(1)},F=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?I(-1):D(-1)};return a.createElement(Is.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&&U(e);break;case"ArrowDown":U(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(),M();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(Sm);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:qm},l),Zm(e,e=>a.createElement(jm.Provider,{value:A},a.createElement(Em.Provider,{value:E},e))))}),Rm=a.forwardRef((e,t)=>{var r,n;let o=jc(),s=a.useRef(null),i=a.useContext(Nm),c=Cm(),l=Wm(e),d=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Vm(()=>{if(!d)return c.item(o,null==i?void 0:i.id)},[d]);let u=Km(o,s,[e.value,e.children,s],e.keywords),f=Tm(),p=Gm(e=>e.value&&e.value===u.current),m=Gm(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(Sm,h),()=>t.removeEventListener(Sm,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:b,onSelect:y,forceMount:w,keywords:x,...S}=e;return a.createElement(Is.div,{ref:Ts(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)}),Pm=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:o,...s}=e,i=jc(),c=a.useRef(null),l=a.useRef(null),d=jc(),u=Cm(),f=Gm(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Vm(()=>u.group(i),[]),Km(i,c,[e.value,e.heading,l]);let p=a.useMemo(()=>({id:i,forceMount:o}),[o]);return a.createElement(Is.div,{ref:Ts(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),Zm(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(Nm.Provider,{value:p},e))))}),Om=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,o=a.useRef(null),s=Gm(e=>!e.search);return r||s?a.createElement(Is.div,{ref:Ts(o,t),...n,"cmdk-separator":"",role:"separator"}):null}),Dm=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,o=null!=e.value,s=Tm(),i=Gm(e=>e.search),c=Gm(e=>e.selectedItemId),l=Cm();return a.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),a.createElement(Is.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)}})}),Im=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...o}=e,s=a.useRef(null),i=a.useRef(null),c=Gm(e=>e.selectedItemId),l=Cm();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(Is.div,{ref:Ts(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:l.listId},Zm(e,e=>a.createElement("div",{ref:Ts(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Mm=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:o,contentClassName:s,container:i,...c}=e;return a.createElement(jd,{open:r,onOpenChange:n},a.createElement(Nd,{container:i},a.createElement(_d,{"cmdk-overlay":"",className:o}),a.createElement(Rd,{"aria-label":e.label,"cmdk-dialog":"",className:s},a.createElement(_m,{ref:t,...c}))))}),Um=a.forwardRef((e,t)=>Gm(e=>0===e.filtered.count)?a.createElement(Is.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Fm=a.forwardRef((e,t)=>{let{progress:r,children:n,label:o="Loading...",...s}=e;return a.createElement(Is.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Zm(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Lm=Object.assign(_m,{List:Im,Item:Rm,Input:Dm,Group:Pm,Separator:Om,Dialog:Mm,Empty:Um,Loading:Fm});function zm(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Bm(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Wm(e){let t=a.useRef(e);return Vm(()=>{t.current=e}),t}var Vm="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function $m(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Gm(e){let t=Tm(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Km(e,t,r,n=[]){let o=a.useRef(),s=Cm();return Vm(()=>{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(km,i),o.current=i}),o}var Hm=()=>{let[e,t]=a.useState(),r=$m(()=>new Map);return Vm(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Zm({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 qm={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Jm=a.forwardRef(({className:t,...r},n)=>e.jsx(Lm,{ref:n,className:hc("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Jm.displayName=Lm.displayName;const Ym=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(Vd,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Lm.Input,{ref:n,className:hc("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})]}));Ym.displayName=Lm.Input.displayName;const Xm=a.forwardRef(({className:t,...r},n)=>e.jsx(Lm.List,{ref:n,className:hc("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));Xm.displayName=Lm.List.displayName;a.forwardRef((t,r)=>e.jsx(Lm.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Lm.Empty.displayName;const Qm=a.forwardRef(({className:t,...r},n)=>e.jsx(Lm.Group,{ref:n,className:hc("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}));Qm.displayName=Lm.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Lm.Separator,{ref:n,className:hc("-mx-1 h-px bg-border",t),...r})).displayName=Lm.Separator.displayName;const eh=a.forwardRef(({className:t,...r},n)=>e.jsx(Lm.Item,{ref:n,className:hc("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}));eh.displayName=Lm.Item.displayName;const th=["top","right","bottom","left"],rh=Math.min,nh=Math.max,ah=Math.round,oh=Math.floor,sh=e=>({x:e,y:e}),ih={left:"right",right:"left",bottom:"top",top:"bottom"},ch={start:"end",end:"start"};function lh(e,t,r){return nh(e,rh(t,r))}function dh(e,t){return"function"==typeof e?e(t):e}function uh(e){return e.split("-")[0]}function fh(e){return e.split("-")[1]}function ph(e){return"x"===e?"y":"x"}function mh(e){return"y"===e?"height":"width"}const hh=new Set(["top","bottom"]);function gh(e){return hh.has(uh(e))?"y":"x"}function vh(e){return ph(gh(e))}function bh(e){return e.replace(/start|end/g,e=>ch[e])}const yh=["left","right"],wh=["right","left"],xh=["top","bottom"],Sh=["bottom","top"];function kh(e,t,r,n){const a=fh(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?wh:yh:t?yh:wh;case"left":case"right":return t?xh:Sh;default:return[]}}(uh(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(bh)))),o}function Ah(e){return e.replace(/left|right|bottom|top/g,e=>ih[e])}function Eh(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 Ch(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 jh(e,t,r){let{reference:n,floating:a}=e;const o=gh(t),s=vh(t),i=mh(s),c=uh(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(fh(t)){case"start":p[s]-=f*(r&&l?-1:1);break;case"end":p[s]+=f*(r&&l?-1:1)}return p}async function Th(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}=dh(t,e),m=Eh(p),h=i[f?"floating"===u?"reference":"floating":u],g=Ch(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},w=Ch(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:b,strategy:c}):v);return{top:(g.top-w.top+m.top)/y.y,bottom:(w.bottom-g.bottom+m.bottom)/y.y,left:(g.left-w.left+m.left)/y.x,right:(w.right-g.right+m.right)/y.x}}function Nh(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _h(e){return th.some(t=>e[t]>=0)}const Rh=new Set(["left","top"]);function Ph(){return"undefined"!=typeof window}function Oh(e){return Mh(e)?(e.nodeName||"").toLowerCase():"#document"}function Dh(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ih(e){var t;return null==(t=(Mh(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Mh(e){return!!Ph()&&(e instanceof Node||e instanceof Dh(e).Node)}function Uh(e){return!!Ph()&&(e instanceof Element||e instanceof Dh(e).Element)}function Fh(e){return!!Ph()&&(e instanceof HTMLElement||e instanceof Dh(e).HTMLElement)}function Lh(e){return!(!Ph()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Dh(e).ShadowRoot)}const zh=new Set(["inline","contents"]);function Bh(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Qh(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!zh.has(a)}const Wh=new Set(["table","td","th"]);function Vh(e){return Wh.has(Oh(e))}const $h=[":popover-open",":modal"];function Gh(e){return $h.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Kh=["transform","translate","scale","rotate","perspective"],Hh=["transform","translate","scale","rotate","perspective","filter"],Zh=["paint","layout","strict","content"];function qh(e){const t=Jh(),r=Uh(e)?Qh(e):e;return Kh.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Hh.some(e=>(r.willChange||"").includes(e))||Zh.some(e=>(r.contain||"").includes(e))}function Jh(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Yh=new Set(["html","body","#document"]);function Xh(e){return Yh.has(Oh(e))}function Qh(e){return Dh(e).getComputedStyle(e)}function eg(e){return Uh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tg(e){if("html"===Oh(e))return e;const t=e.assignedSlot||e.parentNode||Lh(e)&&e.host||Ih(e);return Lh(t)?t.host:t}function rg(e){const t=tg(e);return Xh(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fh(t)&&Bh(t)?t:rg(t)}function ng(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=rg(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),s=Dh(a);if(o){const e=ag(s);return t.concat(s,s.visualViewport||[],Bh(a)?a:[],e&&r?ng(e):[])}return t.concat(a,ng(a,[],r))}function ag(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function og(e){const t=Qh(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Fh(e),o=a?e.offsetWidth:r,s=a?e.offsetHeight:n,i=ah(r)!==o||ah(n)!==s;return i&&(r=o,n=s),{width:r,height:n,$:i}}function sg(e){return Uh(e)?e:e.contextElement}function ig(e){const t=sg(e);if(!Fh(t))return sh(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=og(t);let s=(o?ah(r.width):r.width)/n,i=(o?ah(r.height):r.height)/a;return s&&Number.isFinite(s)||(s=1),i&&Number.isFinite(i)||(i=1),{x:s,y:i}}const cg=sh(0);function lg(e){const t=Dh(e);return Jh()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:cg}function dg(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=sg(e);let s=sh(1);t&&(n?Uh(n)&&(s=ig(n)):s=ig(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Dh(e))&&t}(o,r,n)?lg(o):sh(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=Dh(o),t=n&&Uh(n)?Dh(n):n;let r=e,a=ag(r);for(;a&&n&&t!==r;){const e=ig(a),t=a.getBoundingClientRect(),n=Qh(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=Dh(a),a=ag(r)}}return Ch({width:d,height:u,x:c,y:l})}function ug(e,t){const r=eg(e).scrollLeft;return t?t.left+r:dg(Ih(e)).left+r}function fg(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-ug(e,r),y:r.top+t.scrollTop}}const pg=new Set(["absolute","fixed"]);function mg(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Dh(e),n=Ih(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=Jh();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,c=a.offsetTop)}const l=ug(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=Ih(e),r=eg(e),n=e.ownerDocument.body,a=nh(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=nh(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+ug(e);const i=-r.scrollTop;return"rtl"===Qh(n).direction&&(s+=nh(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:s,y:i}}(Ih(e));else if(Uh(t))n=function(e,t){const r=dg(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Fh(e)?ig(e):sh(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=lg(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ch(n)}function hg(e,t){const r=tg(e);return!(r===t||!Uh(r)||Xh(r))&&("fixed"===Qh(r).position||hg(r,t))}function gg(e,t,r){const n=Fh(t),a=Ih(t),o="fixed"===r,s=dg(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const c=sh(0);function l(){c.x=ug(a)}if(n||!n&&!o)if(("body"!==Oh(t)||Bh(a))&&(i=eg(t)),n){const e=dg(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?sh(0):fg(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 vg(e){return"static"===Qh(e).position}function bg(e,t){if(!Fh(e)||"fixed"===Qh(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Ih(e)===r&&(r=r.ownerDocument.body),r}function yg(e,t){const r=Dh(e);if(Gh(e))return r;if(!Fh(e)){let t=tg(e);for(;t&&!Xh(t);){if(Uh(t)&&!vg(t))return t;t=tg(t)}return r}let n=bg(e,t);for(;n&&Vh(n)&&vg(n);)n=bg(n,t);return n&&Xh(n)&&vg(n)&&!qh(n)?r:n||function(e){let t=tg(e);for(;Fh(t)&&!Xh(t);){if(qh(t))return t;if(Gh(t))return null;t=tg(t)}return null}(e)||r}const wg={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,s=Ih(n),i=!!t&&Gh(t.floating);if(n===s||i&&o)return r;let c={scrollLeft:0,scrollTop:0},l=sh(1);const d=sh(0),u=Fh(n);if((u||!u&&!o)&&(("body"!==Oh(n)||Bh(s))&&(c=eg(n)),Fh(n))){const e=dg(n);l=ig(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!s||u||o?sh(0):fg(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:Ih,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?Gh(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=ng(e,[],!1).filter(e=>Uh(e)&&"body"!==Oh(e)),a=null;const o="fixed"===Qh(e).position;let s=o?tg(e):e;for(;Uh(s)&&!Xh(s);){const t=Qh(s),r=qh(s);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&pg.has(a.position)||Bh(s)&&!r&&hg(e,s))?n=n.filter(e=>e!==s):a=t,s=tg(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=o[0],i=o.reduce((e,r)=>{const n=mg(t,r,a);return e.top=nh(n.top,e.top),e.right=rh(n.right,e.right),e.bottom=rh(n.bottom,e.bottom),e.left=nh(n.left,e.left),e},mg(t,s,a));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}},getOffsetParent:yg,getElementRects:async function(e){const t=this.getOffsetParent||yg,r=this.getDimensions,n=await r(e.floating);return{reference:gg(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}=og(e);return{width:t,height:r}},getScale:ig,isElement:Uh,isRTL:function(e){return"rtl"===Qh(e).direction}};function xg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Sg(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=sg(e),d=a||o?[...l?ng(l):[],...ng(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=Ih(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:-oh(u)+"px "+-oh(a.clientWidth-(d+f))+"px "+-oh(a.clientHeight-(u+p))+"px "+-oh(d)+"px",threshold:nh(0,rh(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||xg(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?dg(e):null;return c&&function t(){const n=dg(e);h&&!xg(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 kg=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=uh(r),i=fh(r),c="y"===gh(r),l=Rh.has(s)?-1:1,d=o&&c?-1:1,u=dh(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}}}}},Ag=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}=dh(e,t),l={x:r,y:n},d=await Th(t,c),u=gh(uh(a)),f=ph(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=lh(p+d["y"===f?"top":"left"],p,p-d[e])}if(s){const e="y"===u?"bottom":"right";m=lh(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}}}}}},Eg=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}=dh(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=uh(a),b=gh(i),y=uh(i)===i,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(y||!h?[Ah(i)]:function(e){const t=Ah(e);return[bh(e),t,bh(t)]}(i)),S="none"!==m;!f&&S&&x.push(...kh(i,h,m,w));const k=[i,...x],A=await Th(t,g),E=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&E.push(A[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=fh(e),a=vh(e),o=mh(a);let s="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Ah(s)),[s,Ah(s)]}(a,s,w);E.push(A[e[0]],A[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var j,T;const e=((null==(j=o.flip)?void 0:j.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&b!==gh(t))||C.every(e=>gh(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(T=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:T.placement;if(!r)switch(p){case"bestFit":{var N;const e=null==(N=C.filter(e=>{if(S){const t=gh(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:N[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},Cg=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}=dh(e,t),d=await Th(t,l),u=uh(a),f=fh(a),p="y"===gh(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,w=rh(h-d[g],b),x=rh(m-d[v],y),S=!t.middlewareData.shift;let k=w,A=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(A=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=b),S&&!f){const e=nh(d.left,0),t=nh(d.right,0),r=nh(d.top,0),n=nh(d.bottom,0);p?A=m-2*(0!==e||0!==t?e+t:nh(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:nh(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:k});const E=await s.getDimensions(i.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},jg=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=dh(e,t);switch(n){case"referenceHidden":{const e=Nh(await Th(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_h(e)}}}case"escaped":{const e=Nh(await Th(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:_h(e)}}}default:return{}}}}},Tg=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}=dh(e,t)||{};if(null==l)return{};const u=Eh(d),f={x:r,y:n},p=vh(a),m=mh(p),h=await s.getDimensions(l),g="y"===p,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=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 A=w/2-x/2,E=k/2-h[m]/2-1,C=rh(u[v],E),j=rh(u[b],E),T=C,N=k-h[m]-j,_=k/2-h[m]/2+A,R=lh(T,_,N),P=!c.arrow&&null!=fh(a)&&_!==R&&o.reference[m]/2-(_<T?C:j)-h[m]/2<0,O=P?_<T?_-T:_-N:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:_-R-O,...P&&{alignmentOffset:O}},reset:P}}}),Ng=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}=dh(e,t),d={x:r,y:n},u=gh(a),f=ph(u);let p=d[f],m=d[u];const h=dh(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=Rh.has(uh(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}}}},_g=(e,t,r)=>{const n=new Map,a={platform:wg,...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}=jh(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}=jh(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Rg="undefined"!=typeof document?t.useLayoutEffect:function(){};function Pg(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(!Pg(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)&&!Pg(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Og(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dg(e,t){const r=Og(e);return Math.round(t*r)/r}function Ig(e){const t=a.useRef(e);return Rg(()=>{t.current=e}),t}const Mg=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?Tg({element:r.current,padding:n}).fn(t):{}:r?Tg({element:r,padding:n}).fn(t):{};var a}}),Ug=(e,t)=>({...kg(e),options:[e,t]}),Fg=(e,t)=>({...Ag(e),options:[e,t]}),Lg=(e,t)=>({...Ng(e),options:[e,t]}),zg=(e,t)=>({...Eg(e),options:[e,t]}),Bg=(e,t)=>({...Cg(e),options:[e,t]}),Wg=(e,t)=>({...jg(e),options:[e,t]}),Vg=(e,t)=>({...Mg(e),options:[e,t]});var $g=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:o=5,...s}=t;return e.jsx(Is.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"})})});$g.displayName="Arrow";var Gg=$g,Kg="Popper",[Hg,Zg]=ks(Kg),[qg,Jg]=Hg(Kg),Yg=t=>{const{__scopePopper:r,children:n}=t,[o,s]=a.useState(null);return e.jsx(qg,{scope:r,anchor:o,onAnchorChange:s,children:n})};Yg.displayName=Kg;var Xg="PopperAnchor",Qg=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:o,...s}=t,i=Jg(Xg,n),c=a.useRef(null),l=Ns(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(Is.div,{...s,ref:l})});Qg.displayName=Xg;var ev="PopperContent",[tv,rv]=Hg(ev),nv=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=Jg(ev,n),[w,x]=a.useState(null),S=Ns(r,e=>x(e)),[k,A]=a.useState(null),E=Du(k),C=E?.width??0,j=E?.height??0,T=s+("center"!==c?"-"+c:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},_=Array.isArray(f)?f:[f],R=_.length>0,P={padding:N,boundary:_.filter(iv),altBoundary:R},{refs:O,floatingStyles:D,placement:I,isPositioned:M,middlewareData:U}=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);Pg(m,n)||h(n);const[g,v]=a.useState(null),[b,y]=a.useState(null),w=a.useCallback(e=>{e!==A.current&&(A.current=e,v(e))},[]),x=a.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),S=i||g,k=c||b,A=a.useRef(null),E=a.useRef(null),C=a.useRef(f),j=null!=d,T=Ig(d),N=Ig(s),_=Ig(u),R=a.useCallback(()=>{if(!A.current||!E.current)return;const e={placement:t,strategy:r,middleware:m};N.current&&(e.platform=N.current),_g(A.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==_.current};P.current&&!Pg(C.current,t)&&(C.current=t,o.flushSync(()=>{p(t)}))})},[m,t,r,N,_]);Rg(()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);Rg(()=>(P.current=!0,()=>{P.current=!1}),[]),Rg(()=>{if(S&&(A.current=S),k&&(E.current=k),S&&k){if(T.current)return T.current(S,k,R);R()}},[S,k,R,T,j]);const O=a.useMemo(()=>({reference:A,floating:E,setReference:w,setFloating:x}),[w,x]),D=a.useMemo(()=>({reference:S,floating:k}),[S,k]),I=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=Dg(D.floating,f.x),n=Dg(D.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...Og(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,D.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:D,floatingStyles:I}),[f,R,O,D,I])}({strategy:"fixed",placement:T,whileElementsMounted:(...e)=>Sg(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[Ug({mainAxis:i+j,alignmentAxis:l}),u&&Fg({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Lg():void 0,...P}),u&&zg({...P}),Bg({...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&&Vg({element:k,padding:d}),cv({arrowWidth:C,arrowHeight:j}),h&&Wg({strategy:"referenceHidden",...P})]}),[F,L]=lv(I),z=Es(v);Cs(()=>{M&&z?.()},[M,z]);const B=U.arrow?.x,W=U.arrow?.y,V=0!==U.arrow?.centerOffset,[$,G]=a.useState();return Cs(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:M?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(tv,{scope:n,placedSide:F,onArrowChange:A,arrowX:B,arrowY:W,shouldHideArrow:V,children:e.jsx(Is.div,{"data-side":F,"data-align":L,...b,ref:S,style:{...b.style,animation:M?void 0:"none"}})})})});nv.displayName=ev;var av="PopperArrow",ov={top:"bottom",right:"left",bottom:"top",left:"right"},sv=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,o=rv(av,n),s=ov[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(Gg,{...a,ref:r,style:{...a.style,display:"block"}})})});function iv(e){return null!==e}sv.displayName=av;var cv=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]=lv(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 lv(e){const[t,r="center"]=e.split("-");return[t,r]}var dv=Yg,uv=Qg,fv=nv,pv=sv,mv="Popover",[hv,gv]=ks(mv,[Zg]),vv=Zg(),[bv,yv]=hv(mv),wv=t=>{const{__scopePopover:r,children:n,open:o,defaultOpen:s,onOpenChange:i,modal:c=!1}=t,l=vv(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=Nc({prop:o,defaultProp:s??!1,onChange:i,caller:mv});return e.jsx(dv,{...l,children:e.jsx(bv,{scope:r,contentId:jc(),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})})};wv.displayName=mv;var xv="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...o}=t,s=yv(xv,n),i=vv(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=s;return a.useEffect(()=>(c(),()=>l()),[c,l]),e.jsx(uv,{...i,...o,ref:r})}).displayName=xv;var Sv="PopoverTrigger",kv=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=yv(Sv,n),s=vv(n),i=Ns(r,o.triggerRef),c=e.jsx(Is.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Iv(o.open),...a,ref:i,onClick:Ac(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:e.jsx(uv,{asChild:!0,...s,children:c})});kv.displayName=Sv;var Av="PopoverPortal",[Ev,Cv]=hv(Av,{forceMount:void 0}),jv=t=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=t,s=yv(Av,r);return e.jsx(Ev,{scope:r,forceMount:n,children:e.jsx(qc,{present:n||s.open,children:e.jsx(Zc,{asChild:!0,container:o,children:a})})})};jv.displayName=Av;var Tv="PopoverContent",Nv=a.forwardRef((t,r)=>{const n=Cv(Tv,t.__scopePopover),{forceMount:a=n.forceMount,...o}=t,s=yv(Tv,t.__scopePopover);return e.jsx(qc,{present:a||s.open,children:s.modal?e.jsx(Rv,{...o,ref:r}):e.jsx(Pv,{...o,ref:r})})});Nv.displayName=Tv;var _v=_s("PopoverContent.RemoveScroll"),Rv=a.forwardRef((t,r)=>{const n=yv(Tv,t.__scopePopover),o=a.useRef(null),s=Ns(r,o),i=a.useRef(!1);return a.useEffect(()=>{const e=o.current;if(e)return Hl(e)},[]),e.jsx(zl,{as:_v,allowPinchZoom:!0,children:e.jsx(Ov,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ac(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ac(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:Ac(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pv=a.forwardRef((t,r)=>{const n=yv(Tv,t.__scopePopover),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(Ov,{...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()}})}),Ov=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=yv(Tv,n),m=vv(n);return Xc(),e.jsx(Bc,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:s,children:e.jsx(Ic,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(fv,{"data-state":Iv(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)"}})})})}),Dv="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=yv(Dv,n);return e.jsx(Is.button,{type:"button",...a,ref:r,onClick:Ac(t.onClick,()=>o.onOpenChange(!1))})}).displayName=Dv;function Iv(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=vv(n);return e.jsx(pv,{...o,...a,ref:r})}).displayName="PopoverArrow";var Mv=jv,Uv=Nv;const Fv=wv,Lv=kv,zv=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...o},s)=>{const{container:i}=a.useContext(ce);return e.jsx(Mv,{container:i,children:e.jsx(Uv,{ref:s,align:r,sideOffset:n,className:hc("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})})});zv.displayName=Uv.displayName;const Bv={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"},Wv={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"},Vv=[{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=Wv[e.code]||"USD",r=Bv[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 $v(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Vv.find(e=>e.value==n);return e.jsxs(Fv,{open:o,onOpenChange:s,children:[e.jsx(Lv,{asChild:!0,children:e.jsxs(kc,{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(Za,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(zv,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Jm,{children:[e.jsx(Ym,{placeholder:"Choose country..."}),e.jsx(Xm,{children:e.jsx(Qm,{children:Vv.map(t=>e.jsxs(eh,{className:hc("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(Ha,{className:hc("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 Gv=Vv.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),Kv=Array.from(new Set(Gv.map(e=>e.value))).map(e=>Gv.find(t=>t.value===e)).filter(e=>void 0!==e);function Hv(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Kv.find(e=>e.value==n);return e.jsxs(Fv,{open:o,onOpenChange:s,children:[e.jsx(Lv,{asChild:!0,children:e.jsxs(kc,{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(Za,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(zv,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Jm,{children:[e.jsx(Ym,{placeholder:"Choose currency..."}),e.jsx(Xm,{children:e.jsx(Qm,{children:Kv.map(t=>e.jsxs(eh,{className:hc("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(Ha,{className:hc("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 Zv=[{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:"🇮🇱"}];Zv=Zv.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),Zv.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const qv=Zv.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 Jv(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=qv.find(e=>e.value==n);return e.jsxs(Fv,{open:o,onOpenChange:s,children:[e.jsx(Lv,{asChild:!0,children:e.jsxs(kc,{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(Za,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(zv,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Jm,{children:[e.jsx(Ym,{placeholder:"Choose timezone..."}),e.jsx(Xm,{children:e.jsx(Qm,{children:qv.map(t=>e.jsxs(eh,{className:hc("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(Ha,{className:hc("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 Yv=[{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 Xv(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Yv.find(e=>e.value==n);return e.jsxs(Fv,{open:o,onOpenChange:s,children:[e.jsx(Lv,{asChild:!0,children:e.jsxs(kc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[i?.text||"Choose timezone",e.jsx(Za,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(zv,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Jm,{children:[e.jsx(Ym,{placeholder:"Choose timezone..."}),e.jsx(Xm,{children:e.jsx(Qm,{children:Yv.map(t=>e.jsxs(eh,{className:hc("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(Ha,{className:hc("mr-2 h-4 w-4 text-green-400",n===t.value?"opacity-100":"opacity-0")}),String(t.text).trim()]},t.value))})})]})})]})}const Qv=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=Ey(),[o,s]=t.useState(!1),[i,c]=t.useState(),[l,d]=t.useState(0),u=Ft({resolver:Fa(ss({name:Oo().min(2,{message:"Name must be at least 2 characters."}),country:Oo().optional(),timezone:Oo().optional(),language:Oo().optional(),currency:Oo().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),u.setValue("name",e.name),u.setValue("country",e.country),u.setValue("timezone",e.timezone),u.setValue("language",e.language),u.setValue("currency",e.currency)})},[l]),i?e.jsxs("div",{children:[e.jsx("div",{className:"space-y-4",children:e.jsx(ru,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(async function(e){s(!0),await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),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(fu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(au,{disabled:o,control:u.control,name:"name",render:({field:t})=>e.jsxs(iu,{children:[e.jsx(cu,{children:"Name"}),e.jsx(lu,{children:e.jsx(fu,{...t})}),e.jsx(uu,{})]})}),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(Jv,{value:u.getValues("language"),onChange:e=>{u.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($v,{value:u.getValues("country"),onChange:e=>{u.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(Hv,{value:u.getValues("currency"),onChange:e=>{u.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(Xv,{value:u.getValues("timezone"),onChange:e=>{u.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(kc,{type:"submit",progress:o,disabled:o,children:"Save"}),e.jsx(kc,{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(Gp,{})};var eb=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(Is.span,{...t,ref:r,style:{...eb,...t.style}})).displayName="VisuallyHidden";var tb=[" ","Enter","ArrowUp","ArrowDown"],rb=[" ","Enter"],nb="Select",[ab,ob,sb]=pu(nb),[ib,cb]=ks(nb,[sb,Zg]),lb=Zg(),[db,ub]=ib(nb),[fb,pb]=ib(nb),mb=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=lb(r),[b,y]=a.useState(null),[w,x]=a.useState(null),[S,k]=a.useState(!1),A=hu(u),[E,C]=Nc({prop:o,defaultProp:s??!1,onChange:i,caller:nb}),[j,T]=Nc({prop:c,defaultProp:l,onChange:d,caller:nb}),N=a.useRef(null),_=!b||(g||!!b.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(dv,{...v,children:e.jsxs(db,{required:h,scope:r,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:jc(),value:j,onValueChange:T,open:E,onOpenChange:C,dir:A,triggerPointerDownPosRef:N,disabled:m,children:[e.jsx(ab.Provider,{scope:r,children:e.jsx(fb,{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})}),_?e.jsxs(Xb,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:j,onChange:e=>T(e.target.value),disabled:m,form:g,children:[void 0===j?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};mb.displayName=nb;var hb="SelectTrigger",gb=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:o=!1,...s}=t,i=lb(n),c=ub(hb,n),l=c.disabled||o,d=Ns(r,c.onTriggerChange),u=ob(n),f=a.useRef("touch"),[p,m,h]=ey(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=ty(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(uv,{asChild:!0,...i,children:e.jsx(Is.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":Qb(c.value)?"":void 0,...s,ref:d,onClick:Ac(s.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Ac(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:Ac(s.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||tb.includes(e.key)&&(g(),e.preventDefault())})})})});gb.displayName=hb;var vb="SelectValue",bb=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:o,children:s,placeholder:i="",...c}=t,l=ub(vb,n),{onValueNodeHasChildrenChange:d}=l,u=void 0!==s,f=Ns(r,l.onValueNodeChange);return Cs(()=>{d(u)},[d,u]),e.jsx(Is.span,{...c,ref:f,style:{pointerEvents:"none"},children:Qb(l.value)?e.jsx(e.Fragment,{children:i}):s})});bb.displayName=vb;var yb=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...o}=t;return e.jsx(Is.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});yb.displayName="SelectIcon";var wb=t=>e.jsx(Zc,{asChild:!0,...t});wb.displayName="SelectPortal";var xb="SelectContent",Sb=a.forwardRef((t,r)=>{const n=ub(xb,t.__scopeSelect),[s,i]=a.useState();if(Cs(()=>{i(new DocumentFragment)},[]),!n.open){const r=s;return r?o.createPortal(e.jsx(Ab,{scope:t.__scopeSelect,children:e.jsx(ab.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(jb,{...t,ref:r})});Sb.displayName=xb;var kb=10,[Ab,Eb]=ib(xb),Cb=_s("SelectContent.RemoveScroll"),jb=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,w=ub(xb,n),[x,S]=a.useState(null),[k,A]=a.useState(null),E=Ns(r,e=>S(e)),[C,j]=a.useState(null),[T,N]=a.useState(null),_=ob(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(x)return Hl(x)},[x]),Xc();const D=a.useCallback(e=>{const[t,...r]=_().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[_,k]),I=a.useCallback(()=>D([C,x]),[D,C,x]);a.useEffect(()=>{R&&I()},[R,I]);const{onOpenChange:M,triggerPointerDownPosRef:U}=w;a.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(U.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(U.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():x.contains(r.target)||M(!1),document.removeEventListener("pointermove",t),U.current=null};return null!==U.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[x,M,U]),a.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[F,L]=ey(e=>{const t=_().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=ty(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),z=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==w.value&&w.value===t||n)&&(j(e),n&&(O.current=!0))},[w.value]),B=a.useCallback(()=>x?.focus(),[x]),W=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==w.value&&w.value===t||n)&&N(e)},[w.value]),V="popper"===o?Nb:Tb,$=V===Nb?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return e.jsx(Ab,{scope:n,content:x,viewport:k,onViewportChange:A,itemRefCallback:z,selectedItem:C,onItemLeave:B,itemTextRefCallback:W,focusSelectedItem:I,selectedItemText:T,position:o,isPositioned:R,searchRef:F,children:e.jsx(zl,{as:Cb,allowPinchZoom:!0,children:e.jsx(Bc,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Ac(s,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(Ic,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:e.jsx(V,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...$,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Ac(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||L(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=_().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});jb.displayName="SelectContentImpl";var Tb=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:o,...s}=t,i=ub(xb,n),c=Eb(xb,n),[l,d]=a.useState(null),[u,f]=a.useState(null),p=Ns(r,e=>f(e)),m=ob(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=c,x=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-kb,u=df(o,[kb,Math.max(kb,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-kb,u=df(o,[kb,Math.max(kb,d-c)]);l.style.minWidth=i+"px",l.style.right=u+"px"}const a=m(),s=window.innerHeight-2*kb,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,x=Math.min(5*b.offsetHeight,w),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),A=parseInt(S.paddingBottom,10),E=e.top+e.height/2-kb,C=s-E,j=b.offsetHeight/2,T=f+p+(b.offsetTop+j),N=w-T;if(T<=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=T+Math.max(C,j+(e?A: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)+j)+N;l.style.height=t+"px",v.scrollTop=T-E+v.offsetTop}l.style.margin=`${kb}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=s+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,v,b,y,i.dir,o]);Cs(()=>x(),[x]);const[S,k]=a.useState();Cs(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const A=a.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return e.jsx(_b,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:A,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Is.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Tb.displayName="SelectItemAlignedPosition";var Nb=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=kb,...s}=t,i=lb(n);return e.jsx(fv,{...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)"}})});Nb.displayName="SelectPopperPosition";var[_b,Rb]=ib(xb,{}),Pb="SelectViewport",Ob=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:o,...s}=t,i=Eb(Pb,n),c=Rb(Pb,n),l=Ns(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(ab.Slot,{scope:n,children:e.jsx(Is.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ac(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*kb,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})})})]})});Ob.displayName=Pb;var Db="SelectGroup",[Ib,Mb]=ib(Db);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=jc();return e.jsx(Ib,{scope:n,id:o,children:e.jsx(Is.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=Db;var Ub="SelectLabel",Fb=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=Mb(Ub,n);return e.jsx(Is.div,{id:o.id,...a,ref:r})});Fb.displayName=Ub;var Lb="SelectItem",[zb,Bb]=ib(Lb),Wb=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:i,...c}=t,l=ub(Lb,n),d=Eb(Lb,n),u=l.value===o,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Ns(r,e=>d.itemRefCallback?.(e,o,s)),v=jc(),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(zb,{scope:n,value:o,disabled:s,textId:v,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(ab.ItemSlot,{scope:n,value:o,disabled:s,textValue:f,children:e.jsx(Is.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:Ac(c.onFocus,()=>h(!0)),onBlur:Ac(c.onBlur,()=>h(!1)),onClick:Ac(c.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:Ac(c.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:Ac(c.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:Ac(c.onPointerMove,e=>{b.current=e.pointerType,s?d.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ac(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Ac(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(rb.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});Wb.displayName=Lb;var Vb="SelectItemText",$b=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:s,style:i,...c}=t,l=ub(Vb,n),d=Eb(Vb,n),u=Bb(Vb,n),f=pb(Vb,n),[p,m]=a.useState(null),h=Ns(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 Cs(()=>(b(v),()=>y(v)),[b,y,v]),e.jsxs(e.Fragment,{children:[e.jsx(Is.span,{id:u.textId,...c,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?o.createPortal(c.children,l.valueNode):null]})});$b.displayName=Vb;var Gb="SelectItemIndicator",Kb=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return Bb(Gb,n).isSelected?e.jsx(Is.span,{"aria-hidden":!0,...a,ref:r}):null});Kb.displayName=Gb;var Hb="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=Eb(Hb,t.__scopeSelect),o=Rb(Hb,t.__scopeSelect),[s,i]=a.useState(!1),c=Ns(r,o.onScrollButtonChange);return Cs(()=>{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(qb,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=Hb;var Zb="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=Eb(Zb,t.__scopeSelect),o=Rb(Zb,t.__scopeSelect),[s,i]=a.useState(!1),c=Ns(r,o.onScrollButtonChange);return Cs(()=>{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(qb,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=Zb;var qb=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=t,i=Eb("SelectScrollButton",n),c=a.useRef(null),l=ob(n),d=a.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),Cs(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e.jsx(Is.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:Ac(s.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:Ac(s.onPointerMove,()=>{i.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:Ac(s.onPointerLeave,()=>{d()})})}),Jb=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Is.div,{"aria-hidden":!0,...a,ref:r})});Jb.displayName="SelectSeparator";var Yb="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=lb(n),s=ub(Yb,n),i=Eb(Yb,n);return s.open&&"popper"===i.position?e.jsx(pv,{...o,...a,ref:r}):null}).displayName=Yb;var Xb=a.forwardRef(({__scopeSelect:t,value:r,...n},o)=>{const s=a.useRef(null),i=Ns(o,s),c=Iu(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(Is.select,{...n,style:{...eb,...n.style},ref:i,defaultValue:r})});function Qb(e){return""===e||void 0===e}function ey(e){const t=Es(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 ty(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}Xb.displayName="SelectBubbleInput";var ry=gb,ny=yb,ay=wb,oy=Sb,sy=Ob,iy=Fb,cy=Wb,ly=$b,dy=Kb,uy=Jb;const fy=mb,py=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(ry,{ref:a,className:hc("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(ny,{asChild:!0,children:e.jsx(Ud,{className:"h-4 w-4 opacity-50"})})]}));py.displayName=ry.displayName;const my=a.forwardRef(({className:t,children:r,position:n="popper",...o},s)=>{const{container:i}=a.useContext(ce);return e.jsx(ay,{container:i,children:e.jsx(oy,{ref:s,className:hc("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(sy,{className:hc("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});my.displayName=oy.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(iy,{ref:n,className:hc("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=iy.displayName;const hy=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(cy,{ref:a,className:hc("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(dy,{children:e.jsx(Ld,{className:"h-4 w-4"})})}),e.jsx(ly,{children:r})]}));hy.displayName=cy.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(uy,{ref:n,className:hc("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=uy.displayName;const gy=({workspace:r})=>{const n=ne(e=>e.auth.session?.user||null),[a,o]=t.useState(0),[s,i]=t.useState(!1),[l,d]=t.useState([]),{getUsers:u,removeUser:f,updateUser:p}=Ey(),{settings:m}=tp();t.useEffect(()=>{r&&(i(!0),u(r._id).then(e=>{d(e)}).catch(e=>{console.error(e)}).finally(()=>{i(!1)}))},[r,a]);const h=()=>{o(e=>e+1)};if(s||!r)return e.jsx(Gp,{});const g=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},v=l.map(e=>({...e,...g(e.user)})),b=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,y="admin"===b,w=(m?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(l.length??0);return e.jsxs("div",{children:[!y&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),y&&e.jsxs("div",{className:"mb-4",children:[w&&e.jsx(vy,{onInvite:h,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:[l.length," member",1!==l.length?"s":""]})}),e.jsx("div",{children:e.jsx(kc,{variant:"ghost",size:"sm",onClick:h,progress:s,startIcon:e.jsx(Xa,{}),children:"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:v.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.jsx("div",{children:e.jsxs(fy,{disabled:o||!y||s,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,o=e,void(Vp(r,a)?c(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}}):p(n,a,{role:o}).then(()=>{h()}).catch(e=>{c(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}})}));var n,a,o},children:[e.jsx(py,{children:e.jsx(bb,{placeholder:"Select a role"})}),e.jsx(my,{children:r?.roles.map(t=>e.jsx(hy,{value:t,children:t},t))})]})}),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&&y&&e.jsx(kc,{variant:"destructive",size:"sm",startIcon:e.jsx(ao,{}),onClick:()=>{var e;e=t.id,Vp(r,e)?c(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):f(r._id,e).then(()=>{h()}).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 vy({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}=Ey(),[g,v]=t.useState(null),{settings:b}=tp(),y=b?.workspace.roles??g?.roles??[];t.useEffect(()=>{n&&h(n).then(v)},[n]);const w=()=>{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(tu,{children:"Invite member by email"}),e.jsx(fu,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(tu,{children:"Role"}),e.jsxs(fy,{value:s,onValueChange:i,children:[e.jsx(py,{children:e.jsx(bb,{placeholder:"Select a role"})}),e.jsx(my,{children:y.map(t=>e.jsx(hy,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(kc,{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(()=>{w()},6e3)})):u("Invalid email address format")},disabled:c||!a||!s,children:c?"Inviting...":`Invite as ${s}`})})]})}const by=({workspace:t,section:r,setSection:n})=>{const a=ne(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:hc("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(yy,{title:"Account",children:e.jsx(wy,{activeSection:r,icon:e.jsx(so,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(yy,{title:"Workspace",children:[e.jsx(wy,{activeSection:r,icon:e.jsx(eo,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(wy,{activeSection:r,icon:e.jsx(io,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(wy,{activeSection:r,icon:e.jsx(ro,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),o&&e.jsx(wy,{activeSection:r,icon:e.jsx(oo,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function yy({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 wy({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e.jsxs("button",{className:hc("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 xy=({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(kc,{variant:"outline",size:"icon",children:e.jsx(eo,{className:"h-4 w-4"})});return e.jsxs($d,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[l&&e.jsx(Gd,{asChild:!0,children:d||y}),e.jsxs(Zd,{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(Yd,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(by,{workspace:r,section:v,setSection:b}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(Jd,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===v&&"Account","general"===v&&"Workspace Settings","users"===v&&"Workspace Members","features"===v&&"Workspace Features","danger"===v&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===v&&e.jsx(Qv,{workspace:r}),"general"===v&&e.jsx(lm,{workspace:r}),"users"===v&&e.jsx(gy,{workspace:r}),"features"===v&&e.jsx(sm,{workspaceId:r._id?.toString()}),"danger"===v&&e.jsx(Kp,{workspace:r})]})]})]})]})};function Sy(r){const{workspaces:n,currentWorkspace:a,loading:o,refreshing:s}=ne(e=>e.workspaces),i=ne(e=>e.auth.session?.user),{settings:c}=tp(),[l,d]=t.useState(!1),[u,f]=t.useState(0),[p,m]=t.useState(""),{fetchWorkspaces:h,getFeatures:g,refreshWorkspaces:v,setCurrentWorkspace:b,workspaces:y}=Ey(),w=o||s;t.useEffect(()=>{0===y.length?(h(),g()):g()},[]),t.useEffect(()=>{u>0&&v()},[u]);const x=y.length>0?y:n,S=x.filter(e=>e._id!==a?._id).filter(e=>e.name.toLowerCase().includes(p.toLowerCase())),k=c?.workspace.maxWorkspaces??Number.MAX_VALUE,A=x?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===i?.id?.toString()).length,E=k>(A??0);return e.jsxs($d,{open:l,onOpenChange:d,children:[e.jsx(Gd,{children:r.trigger?.(w,a)}),e.jsxs(Zd,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(qd,{children:[e.jsxs(Jd,{className:"flex items-center gap-2",children:[e.jsx(Ka,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(Yd,{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(ky,{workspace:a,isCurrentWorkspace:!0,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>d(!1),setCurrentWorkspace:b,setOpen:d,workspacesToUse:x}),e.jsx(ep,{}),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(kc,{progress:s,disabled:s,variant:"ghost",onClick:function(){f(e=>e+1)},startIcon:e.jsx(Xa,{}),children:s?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Qa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(fu,{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(Ja,{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(Ka,{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(Zf,{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(ky,{workspace:t,isCurrentWorkspace:n,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>d(!1),setCurrentWorkspace:b,setOpen:d,workspacesToUse:x},t._id)})})})]}),E&&e.jsxs(e.Fragment,{children:[e.jsx(ep,{}),e.jsx(Ay,{onCreated:()=>{h()}})]})]})]})]})}function ky(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:hc("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(vc,{src:n.image&&n.image.trim()?n.image:void 0})}),e.jsx(bc,{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(io,{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(kc,{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(xy,{workspace:n,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(s[e])}}})]})]});var u}function Ay(r){const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState("🏢"),[l,d]=t.useState(!1),{createWorkspace:u}=Ey(),f=Ft({resolver:Fa(ss({name:Oo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Oo().optional()})),defaultValues:{name:"",image:""}});return e.jsxs($d,{open:n,onOpenChange:a,children:[e.jsx(Gd,{asChild:!0,children:e.jsxs(kc,{className:"w-full rounded-none",children:[e.jsx(Ya,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(Zd,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(qd,{children:[e.jsx(Jd,{children:"Create New Workspace"}),e.jsx(Yd,{children:"Create a new workspace to get started."})]}),e.jsx(ru,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(async function(e){let t="";if("emoji"===o)t=im(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(au,{control:f.control,name:"name",render:({field:t})=>e.jsxs(iu,{children:[e.jsx(cu,{children:"Workspace Name"}),e.jsx(lu,{children:e.jsx(fu,{placeholder:"My Awesome Workspace",...t})}),e.jsx(uu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(tu,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(du,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(cf,{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(lf,{value:"emoji",id:"emoji"}),e.jsxs(tu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(to,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(lf,{value:"url",id:"url"}),e.jsxs(tu,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(qa,{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(Zf,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:cm.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),f.setValue("image",im(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(au,{control:f.control,name:"image",render:({field:t})=>e.jsxs(iu,{children:[e.jsx(cu,{children:"Image URL"}),e.jsx(lu,{children:e.jsx(fu,{placeholder:"https://example.com/image.png",...t})}),e.jsx(du,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(uu,{})]})}),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(kc,{type:"button",variant:"outline",onClick:()=>{a(!1),f.reset(),c("🏢"),s("emoji")},disabled:l,children:"Cancel"}),e.jsx(kc,{type:"submit",disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(Ja,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const Ey=()=>{const e=ae(),r=ne(e=>e.os),n=t.useMemo(()=>new fe(r),[r]),a=ne(e=>e.workspaces),o=ne(e=>e.auth.session?.user),s=t.useCallback(t=>{if(t._id!==a.currentWorkspace?._id&&t){const r=a.currentWorkspace;e.workspaces(V(t)),ie.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=Bp();if(e.workspaces(G(!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($())},[e]),l=t.useRef(!1),d=t.useRef(!1),u=t.useCallback(async()=>{if(!a.loading&&!l.current){l.current=!0,e.workspaces(K(!0)),e.workspaces(H(null));try{const t=await n.getWorkspaces();if(e.workspaces(B(t)),t.length>0){const e=Bp();if(e&&Wp(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(H(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(K(!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(Z(!0));try{const t=await n.getWorkspaces();e.workspaces(B(t))}catch(e){}finally{e.workspaces(Z(!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])),ie.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))),ie.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(W(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&&ie.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&&Vp(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;ie.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]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&Vp(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&&ie.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]),x=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return ie.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]),A=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(!Vp(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($()),r&&ie.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:Sy,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:w,getProfile:S,updateUserProfile:x,deleteWorkspace:A}};const Cy=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)})}},jy=({children:r})=>{const{currentWorkspace:n}=Ey(),[a,o]=t.useState(!1),[s,i]=t.useState("profile");return t.useEffect(()=>{const e=Cy.getState();o(e.open),i(e.section);return Cy.subscribe((e,t)=>{o(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&e.jsx(xy,{workspace:n,open:a,onOpenChange:e=>{e||Cy.closeSettings()},section:s,onSectionChange:e=>{Cy.setSection(e)},showTrigger:!1})]})},Ty=(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).`)},Ny=t.memo(({serverUrl:r,version:n,orgId:a,auth:o,children:s})=>{Ty(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(()=>(ie.setCallbacks(d?{handleEvent:d}:null),()=>{ie.setCallbacks(null)}),[d]),e.jsx(l,{children:e.jsx(re,{children:e.jsx(oe,{callbacks:c,children:e.jsx(le,{children:e.jsx(se,{config:i,auth:o,children:e.jsx(ue,{children:e.jsx(jy,{children:s})})})})})})})});Ny.displayName="SaaSOSProvider";let _y=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await fetch(`${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 fetch(`${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 Ry=ss({name:Oo().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:Oo().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)")}),Py={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 Oy({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 Dy({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 Iy(e,t){return function(){return e.apply(t,arguments)}}const{toString:My}=Object.prototype,{getPrototypeOf:Uy}=Object,{iterator:Fy,toStringTag:Ly}=Symbol,zy=(By=Object.create(null),e=>{const t=My.call(e);return By[t]||(By[t]=t.slice(8,-1).toLowerCase())});var By;const Wy=e=>(e=e.toLowerCase(),t=>zy(t)===e),Vy=e=>t=>typeof t===e,{isArray:$y}=Array,Gy=Vy("undefined");function Ky(e){return null!==e&&!Gy(e)&&null!==e.constructor&&!Gy(e.constructor)&&qy(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Hy=Wy("ArrayBuffer");const Zy=Vy("string"),qy=Vy("function"),Jy=Vy("number"),Yy=e=>null!==e&&"object"==typeof e,Xy=e=>{if("object"!==zy(e))return!1;const t=Uy(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ly in e||Fy in e)},Qy=Wy("Date"),ew=Wy("File"),tw=Wy("Blob"),rw=Wy("FileList"),nw=Wy("URLSearchParams"),[aw,ow,sw,iw]=["ReadableStream","Request","Response","Headers"].map(Wy);function cw(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),$y(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Ky(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 lw(e,t){if(Ky(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 dw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,uw=e=>!Gy(e)&&e!==dw;const fw=(pw="undefined"!=typeof Uint8Array&&Uy(Uint8Array),e=>pw&&e instanceof pw);var pw;const mw=Wy("HTMLFormElement"),hw=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),gw=Wy("RegExp"),vw=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};cw(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const bw=Wy("AsyncFunction"),yw=(ww="function"==typeof setImmediate,xw=qy(dw.postMessage),ww?setImmediate:xw?(Sw=`axios@${Math.random()}`,kw=[],dw.addEventListener("message",({source:e,data:t})=>{e===dw&&t===Sw&&kw.length&&kw.shift()()},!1),e=>{kw.push(e),dw.postMessage(Sw,"*")}):e=>setTimeout(e));var ww,xw,Sw,kw;const Aw="undefined"!=typeof queueMicrotask?queueMicrotask.bind(dw):"undefined"!=typeof process&&process.nextTick||yw;var Ew={isArray:$y,isArrayBuffer:Hy,isBuffer:Ky,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||qy(e.append)&&("formdata"===(t=zy(e))||"object"===t&&qy(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Hy(e.buffer),t},isString:Zy,isNumber:Jy,isBoolean:e=>!0===e||!1===e,isObject:Yy,isPlainObject:Xy,isEmptyObject:e=>{if(!Yy(e)||Ky(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:aw,isRequest:ow,isResponse:sw,isHeaders:iw,isUndefined:Gy,isDate:Qy,isFile:ew,isBlob:tw,isRegExp:gw,isFunction:qy,isStream:e=>Yy(e)&&qy(e.pipe),isURLSearchParams:nw,isTypedArray:fw,isFileList:rw,forEach:cw,merge:function e(){const{caseless:t,skipUndefined:r}=uw(this)&&this||{},n={},a=(a,o)=>{const s=t&&lw(n,o)||o;Xy(n[s])&&Xy(a)?n[s]=e(n[s],a):Xy(a)?n[s]=e({},a):$y(a)?n[s]=a.slice():r&&Gy(a)||(n[s]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&cw(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(cw(t,(t,n)=>{r&&qy(t)?e[n]=Iy(t,r):e[n]=t},{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),e.prototype.constructor=e,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&&Uy(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:zy,kindOfTest:Wy,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($y(e))return e;let t=e.length;if(!Jy(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Fy]).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:mw,hasOwnProperty:hw,hasOwnProp:hw,reduceDescriptors:vw,freezeMethods:e=>{vw(e,(t,r)=>{if(qy(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];qy(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 $y(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:lw,global:dw,isContextDefined:uw,isSpecCompliantForm:function(e){return!!(e&&qy(e.append)&&"FormData"===e[Ly]&&e[Fy])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Yy(e)){if(t.indexOf(e)>=0)return;if(Ky(e))return e;if(!("toJSON"in e)){t[n]=e;const a=$y(e)?[]:{};return cw(e,(e,t)=>{const o=r(e,n+1);!Gy(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:bw,isThenable:e=>e&&(Yy(e)||qy(e))&&qy(e.then)&&qy(e.catch),setImmediate:yw,asap:Aw,isIterable:e=>null!=e&&qy(e[Fy])};function Cw(e,t,r,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status?a.status:null)}Ew.inherits(Cw,Error,{toJSON:function(){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:Ew.toJSONObject(this.config),code:this.code,status:this.status}}});const jw=Cw.prototype,Tw={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Tw[e]={value:e}}),Object.defineProperties(Cw,Tw),Object.defineProperty(jw,"isAxiosError",{value:!0}),Cw.from=(e,t,r,n,a,o)=>{const s=Object.create(jw);Ew.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const i=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return Cw.call(s,i,c,r,n,a),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function Nw(e){return Ew.isPlainObject(e)||Ew.isArray(e)}function _w(e){return Ew.endsWith(e,"[]")?e.slice(0,-2):e}function Rw(e,t,r){return e?e.concat(t).map(function(e,t){return e=_w(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Pw=Ew.toFlatObject(Ew,{},null,function(e){return/^is[A-Z]/.test(e)});function Ow(e,t,r){if(!Ew.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Ew.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ew.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,s=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Ew.isSpecCompliantForm(t);if(!Ew.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Ew.isDate(e))return e.toISOString();if(Ew.isBoolean(e))return e.toString();if(!i&&Ew.isBlob(e))throw new Cw("Blob is not supported. Use a Buffer instead.");return Ew.isArrayBuffer(e)||Ew.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(Ew.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Ew.isArray(e)&&function(e){return Ew.isArray(e)&&!e.some(Nw)}(e)||(Ew.isFileList(e)||Ew.endsWith(r,"[]"))&&(i=Ew.toArray(e)))return r=_w(r),i.forEach(function(e,n){!Ew.isUndefined(e)&&null!==e&&t.append(!0===s?Rw([r],n,o):null===s?r:r+"[]",c(e))}),!1;return!!Nw(e)||(t.append(Rw(a,r,o),c(e)),!1)}const d=[],u=Object.assign(Pw,{defaultVisitor:l,convertValue:c,isVisitable:Nw});if(!Ew.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Ew.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),Ew.forEach(r,function(r,o){!0===(!(Ew.isUndefined(r)||null===r)&&a.call(t,r,Ew.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Dw(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Iw(e,t){this._pairs=[],e&&Ow(e,this,t)}const Mw=Iw.prototype;function Uw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fw(e,t,r){if(!t)return e;const n=r&&r.encode||Uw;Ew.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let o;if(o=a?a(t,r):Ew.isURLSearchParams(t)?t.toString():new Iw(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Mw.append=function(e,t){this._pairs.push([e,t])},Mw.toString=function(e){const t=e?function(t){return e.call(this,t,Dw)}:Dw;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Lw{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){Ew.forEach(this.handlers,function(t){null!==t&&e(t)})}}var zw={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Bw={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Iw,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Ww="undefined"!=typeof window&&"undefined"!=typeof document,Vw="object"==typeof navigator&&navigator||void 0,$w=Ww&&(!Vw||["ReactNative","NativeScript","NS"].indexOf(Vw.product)<0),Gw="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Kw=Ww&&window.location.href||"http://localhost";var Hw={...Object.freeze({__proto__:null,hasBrowserEnv:Ww,hasStandardBrowserEnv:$w,hasStandardBrowserWebWorkerEnv:Gw,navigator:Vw,origin:Kw}),...Bw};function Zw(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&&Ew.isArray(n)?n.length:o,i)return Ew.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&Ew.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&Ew.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(Ew.isFormData(e)&&Ew.isFunction(e.entries)){const r={};return Ew.forEachEntry(e,(e,n)=>{t(function(e){return Ew.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const qw={transitional:zw,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=Ew.isObject(e);a&&Ew.isHTMLForm(e)&&(e=new FormData(e));if(Ew.isFormData(e))return n?JSON.stringify(Zw(e)):e;if(Ew.isArrayBuffer(e)||Ew.isBuffer(e)||Ew.isStream(e)||Ew.isFile(e)||Ew.isBlob(e)||Ew.isReadableStream(e))return e;if(Ew.isArrayBufferView(e))return e.buffer;if(Ew.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 Ow(e,new Hw.classes.URLSearchParams,{visitor:function(e,t,r,n){return Hw.isNode&&Ew.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Ew.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ow(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(Ew.isString(e))try{return(t||JSON.parse)(e),Ew.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||qw.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Ew.isResponse(e)||Ew.isReadableStream(e))return e;if(e&&Ew.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 Cw.from(e,Cw.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:Hw.classes.FormData,Blob:Hw.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ew.forEach(["delete","get","head","post","put","patch"],e=>{qw.headers[e]={}});const Jw=Ew.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 Yw=Symbol("internals");function Xw(e){return e&&String(e).trim().toLowerCase()}function Qw(e){return!1===e||null==e?e:Ew.isArray(e)?e.map(Qw):String(e)}function ex(e,t,r,n,a){return Ew.isFunction(n)?n.call(this,t,r):(a&&(t=r),Ew.isString(t)?Ew.isString(n)?-1!==t.indexOf(n):Ew.isRegExp(n)?n.test(t):void 0:void 0)}let tx=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=Xw(t);if(!a)throw new Error("header name must be a non-empty string");const o=Ew.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Qw(e))}const o=(e,t)=>Ew.forEach(e,(e,r)=>a(e,r,t));if(Ew.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Ew.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]&&Jw[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(Ew.isObject(e)&&Ew.isIterable(e)){let r,n,a={};for(const t of e){if(!Ew.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?Ew.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=Xw(e)){const r=Ew.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(Ew.isFunction(t))return t.call(this,e,r);if(Ew.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Xw(e)){const r=Ew.findKey(this,e);return!(!r||void 0===this[r]||t&&!ex(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=Xw(e)){const a=Ew.findKey(r,e);!a||t&&!ex(0,r[a],a,t)||(delete r[a],n=!0)}}return Ew.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&&!ex(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return Ew.forEach(this,(n,a)=>{const o=Ew.findKey(r,a);if(o)return t[o]=Qw(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]=Qw(n),r[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ew.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Ew.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[Yw]=this[Yw]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Xw(e);t[n]||(!function(e,t){const r=Ew.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 Ew.isArray(e)?e.forEach(n):n(e),this}};function rx(e,t){const r=this||qw,n=t||r,a=tx.from(n.headers);let o=n.data;return Ew.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function nx(e){return!(!e||!e.__CANCEL__)}function ax(e,t,r){Cw.call(this,null==e?"canceled":e,Cw.ERR_CANCELED,t,r),this.name="CanceledError"}function ox(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Cw("Request failed with status code "+r.status,[Cw.ERR_BAD_REQUEST,Cw.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}tx.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ew.reduceDescriptors(tx.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Ew.freezeMethods(tx),Ew.inherits(ax,Cw,{__CANCEL__:!0});const sx=(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)},ix=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},cx=e=>(...t)=>Ew.asap(()=>e(...t));var lx=Hw.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Hw.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Hw.origin),Hw.navigator&&/(msie|trident)/i.test(Hw.navigator.userAgent)):()=>!0,dx=Hw.hasStandardBrowserEnv?{write(e,t,r,n,a,o){const s=[e+"="+encodeURIComponent(t)];Ew.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),Ew.isString(n)&&s.push("path="+n),Ew.isString(a)&&s.push("domain="+a),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function ux(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 fx=e=>e instanceof tx?{...e}:e;function px(e,t){t=t||{};const r={};function n(e,t,r,n){return Ew.isPlainObject(e)&&Ew.isPlainObject(t)?Ew.merge.call({caseless:n},e,t):Ew.isPlainObject(t)?Ew.merge({},t):Ew.isArray(t)?t.slice():t}function a(e,t,r,a){return Ew.isUndefined(t)?Ew.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!Ew.isUndefined(t))return n(void 0,t)}function s(e,t){return Ew.isUndefined(t)?Ew.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(fx(e),fx(t),0,!0)};return Ew.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,s=o(e[n],t[n],n);Ew.isUndefined(s)&&o!==i||(r[n]=s)}),r}var mx=e=>{const t=px({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:s,auth:i}=t;if(t.headers=s=tx.from(s),t.url=Fw(ux(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&s.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),Ew.isFormData(r))if(Hw.hasStandardBrowserEnv||Hw.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Ew.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(Hw.hasStandardBrowserEnv&&(n&&Ew.isFunction(n)&&(n=n(t)),n||!1!==n&&lx(t.url))){const e=a&&o&&dx.read(o);e&&s.set(a,e)}return t};var hx="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=mx(e);let a=n.data;const o=tx.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=tx.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());ox(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 Cw("Request aborted",Cw.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=new Cw(t&&t.message?t.message:"Network Error",Cw.ERR_NETWORK,e,h);n.event=t||null,r(n),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||zw;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Cw(t,a.clarifyTimeoutError?Cw.ETIMEDOUT:Cw.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&Ew.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),Ew.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=sx(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([i,l]=sx(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(s=t=>{h&&(r(!t||t.type?new ax(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===Hw.protocols.indexOf(v)?r(new Cw("Unsupported protocol "+v+":",Cw.ERR_BAD_REQUEST,e)):h.send(a||null)})};const gx=(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 Cw?t:new ax(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Cw(`timeout ${t} of ms exceeded`,Cw.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=()=>Ew.asap(s),i}},vx=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},bx=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()}},yx=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of bx(e))yield*vx(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:wx}=Ew,xx=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ew.global),{ReadableStream:Sx,TextEncoder:kx}=Ew.global,Ax=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ex=e=>{e=Ew.merge.call({skipUndefined:!0},xx,e);const{fetch:t,Request:r,Response:n}=e,a=t?wx(t):"function"==typeof fetch,o=wx(r),s=wx(n);if(!a)return!1;const i=a&&wx(Sx),c=a&&("function"==typeof kx?(l=new kx,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&i&&Ax(()=>{let e=!1;const t=new r(Hw.origin,{body:new Sx,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&i&&Ax(()=>Ew.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 Cw(`Response type '${e}' is not supported`,Cw.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=Ew.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Ew.isBlob(e))return e.size;if(Ew.isSpecCompliantForm(e)){const t=new r(Hw.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ew.isArrayBufferView(e)||Ew.isArrayBuffer(e)?e.byteLength:(Ew.isURLSearchParams(e)&&(e+=""),Ew.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:w}=mx(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let S=gx([c,l&&l.toAbortSignal()],m),k=null;const A=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(Ew.isFormData(i)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=ix(E,sx(cx(g)));i=yx(t.body,65536,e,r)}}Ew.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,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?x(k,w):x(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&A)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=Ew.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&ix(t,sx(cx(h),!0))||[];l=new n(yx(l.body,65536,r,()=>{a&&a(),A&&A()}),e)}v=v||"text";let C=await f[Ew.findKey(f,v)||"text"](l,e);return!m&&A&&A(),await new Promise((t,r)=>{ox(t,r,{data:C,headers:tx.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(A&&A(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Cw("Network Error",Cw.ERR_NETWORK,e,k),{cause:t.cause||t});throw Cw.from(t,t&&t.code,e,k)}}},Cx=new Map,jx=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=Cx;for(;c--;)s=o[c],i=l.get(s),void 0===i&&l.set(s,i=c?new Map:Ex(t)),l=i;return i};jx();const Tx={http:null,xhr:hx,fetch:{get:jx}};Ew.forEach(Tx,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Nx=e=>`- ${e}`,_x=e=>Ew.isFunction(e)||null===e||!1===e;var Rx=(e,t)=>{e=Ew.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,!_x(n)&&(a=Tx[(r=String(n)).toLowerCase()],void 0===a))throw new Cw(`Unknown adapter '${r}'`);if(a&&(Ew.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"));throw new Cw("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(Nx).join("\n"):" "+Nx(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return a};function Px(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ax(null,e)}function Ox(e){Px(e),e.headers=tx.from(e.headers),e.data=rx.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Rx(e.adapter||qw.adapter,e)(e).then(function(t){return Px(e),t.data=rx.call(e,e.transformResponse,t),t.headers=tx.from(t.headers),t},function(t){return nx(t)||(Px(e),t&&t.response&&(t.response.data=rx.call(e,e.transformResponse,t.response),t.response.headers=tx.from(t.response.headers))),Promise.reject(t)})}const Dx="1.12.2",Ix={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ix[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Mx={};Ix.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Dx+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Cw(n(a," has been removed"+(t?" in "+t:"")),Cw.ERR_DEPRECATED);return t&&!Mx[a]&&(Mx[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)}},Ix.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Ux={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Cw("options must be an object",Cw.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 Cw("option "+o+" must be "+r,Cw.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Cw("Unknown option "+o,Cw.ERR_BAD_OPTION)}},validators:Ix};const Fx=Ux.validators;let Lx=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Lw,response:new Lw}}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=px(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Ux.assertOptions(r,{silentJSONParsing:Fx.transitional(Fx.boolean),forcedJSONParsing:Fx.transitional(Fx.boolean),clarifyTimeoutError:Fx.transitional(Fx.boolean)},!1),null!=n&&(Ew.isFunction(n)?t.paramsSerializer={serialize:n}:Ux.assertOptions(n,{encode:Fx.function,serialize:Fx.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ux.assertOptions(t,{baseUrl:Fx.spelling("baseURL"),withXsrfToken:Fx.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&Ew.merge(a.common,a[t.method]);a&&Ew.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=tx.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=[Ox.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=Ox.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 Fw(ux((e=px(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Ew.forEach(["delete","get","head","options"],function(e){Lx.prototype[e]=function(t,r){return this.request(px(r||{},{method:e,url:t,data:(r||{}).data}))}}),Ew.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(px(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Lx.prototype[e]=t(),Lx.prototype[e+"Form"]=t(!0)});const zx={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};Object.entries(zx).forEach(([e,t])=>{zx[t]=e});const Bx=function e(t){const r=new Lx(t),n=Iy(Lx.prototype.request,r);return Ew.extend(n,Lx.prototype,r,{allOwnKeys:!0}),Ew.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(px(t,r))},n}(qw);Bx.Axios=Lx,Bx.CanceledError=ax,Bx.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 ax(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}}},Bx.isCancel=nx,Bx.VERSION=Dx,Bx.toFormData=Ow,Bx.AxiosError=Cw,Bx.Cancel=Bx.CanceledError,Bx.all=function(e){return Promise.all(e)},Bx.spread=function(e){return function(t){return e.apply(null,t)}},Bx.isAxiosError=function(e){return Ew.isObject(e)&&!0===e.isAxiosError},Bx.mergeConfig=px,Bx.AxiosHeaders=tx,Bx.formToJSON=e=>Zw(Ew.isHTMLForm(e)?new FormData(e):e),Bx.getAdapter=Rx,Bx.HttpStatusCode=zx,Bx.default=Bx;const{Axios:Wx,AxiosError:Vx,CanceledError:$x,isCancel:Gx,CancelToken:Kx,VERSION:Hx,all:Zx,Cancel:qx,isAxiosError:Jx,spread:Yx,toFormData:Xx,AxiosHeaders:Qx,HttpStatusCode:eS,formToJSON:tS,getAdapter:rS,mergeConfig:nS}=Bx;const aS=new class{constructor(e={}){this.client=Bx.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=S();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 oS(){const e=ae(),r=ne(e=>e.auth),n=ne(e=>e.os),{serverUrl:a,orgId:o,auth:s}=n,{resetCurrentWorkspace:i,currentWorkspace:l}=Ey(),f=t.useCallback(async()=>{e.auth(d());try{const t=await aS.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(u()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(u()),c(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,o,s,e]),m=t.useCallback(async()=>{try{s?.callbacks?.onSignOut&&"function"==typeof s.callbacks.onSignOut&&await s.callbacks.onSignOut(),e.auth(p()),i(),x()}catch(e){c(e,{component:"useSaaSAuth",action:"signOut"}),x()}},[e,i,s?.callbacks?.onSignOut]),h=t.useCallback(e=>{l?Cy.openWorkspaceSettings(e):c(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[l]);return t.useMemo(()=>({user:r.session?.user,session:r.session,isLoading:r.isLoading,isAuthenticated:r.isAuthenticated,isRedirecting:r.isRedirecting,status:r.status,signIn:f,signOut:m,openWorkspaceSettings:h}),[r,f,m,h])}function sS(){const e=t.useContext(de);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])}}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:w,error:x,config:S,success:k,message:A}=(()=>{const e=ne(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 _y(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 _y(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(Py).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&l&&(h(!0),v(!0)),x&&v(!0)},[k,l,x]);const E={...Py[s||f],...i},C=Ft({resolver:Fa(Ry),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{c&&C.setFocus("name")},[c,C]);const j=C.formState.isValid&&!w;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:hc("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($p,{className:"h-24 w-24 rounded-lg"}),e.jsx($p,{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($p,{className:"h-4 w-16"}),e.jsx($p,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($p,{className:"h-4 w-16"}),e.jsx($p,{className:"h-10 w-full"})]}),e.jsx($p,{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(Dy,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(Ke,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(async e=>{try{const t=await b(e);t.success?(r?.(),C.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":w,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(Oy,{screen:S?.screen?.register}),e.jsx(au,{control:C.control,name:"name",render:({field:t})=>e.jsxs(iu,{className:o,children:[e.jsx(cu,{children:E.nameLabel}),e.jsx(lu,{children:e.jsx(fu,{...t})}),e.jsx(du,{}),e.jsx(uu,{})]})}),e.jsx(au,{control:C.control,name:"email",render:({field:t})=>e.jsxs(iu,{className:o,children:[e.jsx(cu,{children:E.emailLabel}),e.jsx(lu,{children:e.jsx(fu,{...t})}),e.jsx(du,{}),e.jsx(uu,{})]})}),e.jsx(kc,{type:"submit",disabled:!j,className:o,children:w?E.submittingText:E.submitText})]}),g&&x&&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:"❗"}),x]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(kc,{type:"button",onClick:()=>{v(!1),C.reset()},className:o,children:"Try Again"})})]}),g&&m&&A&&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(Oy,{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=Ny,exports.WhenAuthenticated=e=>{const{children:t}=e,{status:r}=oS();return r!==h.authenticated?null:t},exports.WhenRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=oS();return n.includes(a?.role??"")?t:r||null},exports.WhenUnauthenticated=e=>{const{children:t}=e,{status:r}=oS();return r===h.authenticated?null:t},exports.WhenUserFeatureDisabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=sS();return n(r)?null:t},exports.WhenUserFeatureEnabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=sS();return n(r)?t:null},exports.WhenWorkspaceFeatureDisabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=Ey(),a=n?.features?.[r];return a?null:t},exports.WhenWorkspaceFeatureEnabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=Ey(),a=n?.features?.[r];return a?t:null},exports.WhenWorkspaceRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=oS(),{currentWorkspace:o}=Ey(),s=o?.users.find(e=>e._id===a?.id);return s&&n.includes(s?.role??"")?t:r||null},exports.WorkspaceSwitcher=Sy,exports.createSDKError=function(e,t,r,n){return new s(e,t,r,n)},exports.errorHandler=i,exports.eventEmitter=ie,exports.handleError=c,exports.useSaaSAuth=oS,exports.useSaaSSettings=tp,exports.useSaaSWorkspaces=Ey,exports.useUserAttributes=function(){const e=t.useContext(de);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=sS;
35
+ */function ei(){return Ys||(Ys=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};Qs.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())}()),Qs}function ti(){return Xs||(Xs=1,"production"===process.env.NODE_ENV?Zs.exports=qs():Zs.exports=ei()),Zs.exports}var ri=ti();function ni(){return()=>{}}var ai="Avatar",[oi]=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}\``)}]},Os(o,...r)]}(ai),[si,ii]=oi(ai),ci=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...o}=t,[s,i]=a.useState("idle");return e.jsx(si,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:e.jsx(Hs.span,{...o,ref:r})})});ci.displayName=ai;var li="AvatarImage",di=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:o,onLoadingStatusChange:s=()=>{},...i}=t,c=ii(li,n),l=function(e,{referrerPolicy:t,crossOrigin:r}){const n=ri.useSyncExternalStore(ni,()=>!0,()=>!1),o=a.useRef(null),s=n?(o.current||(o.current=new window.Image),o.current):null,[i,c]=a.useState(()=>pi(s,e));return Ds(()=>{c(pi(s,e))},[s,e]),Ds(()=>{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=Ps(e=>{s(e),c.onImageLoadingStatusChange(e)});return Ds(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e.jsx(Hs.img,{...i,ref:r,src:o}):null});di.displayName=li;var ui="AvatarFallback",fi=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:o,...s}=t,i=ii(ui,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(Hs.span,{...s,ref:r}):null});function pi(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}fi.displayName=ui;var mi=ci,hi=di,gi=fi;function vi(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=vi(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function yi(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=vi(e))&&(n&&(n+=" "),n+=t);return n}const bi=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),wi="-",xi=[],Si=e=>{const t=Ai(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Ei(e);const r=e.split(wi),n=""===r[0]&&r.length>1?1:0;return ki(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||xi}return r[e]||xi}}},ki=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=ki(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const s=0===t?e.join(wi):e.slice(t).join(wi),i=o.length;for(let e=0;e<i;e++){const t=o[e];if(t.validator(s))return t.classGroupId}},Ei=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})(),Ai=e=>{const{theme:t,classGroups:r}=e;return Ci(r,t)},Ci=(e,t)=>{const r=bi();for(const n in e){const a=e[n];ji(a,r,n,t)}return r},ji=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];Ti(a,t,r,n)}},Ti=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?Ri(e,t,r,n):Ni(e,t,r,n):_i(e,t,r)},_i=(e,t,r)=>{(""===e?t:Oi(t,e)).classGroupId=r},Ni=(e,t,r,n)=>{Pi(e)?ji(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},Ri=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,s]=a[e];ji(s,Oi(t,o),r,n)}},Oi=(e,t)=>{let r=e;const n=t.split(wi),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=bi(),r.nextPart.set(t,a)),r=a}return r},Pi=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,Di=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)}}},Ii=[],Ui=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Mi=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 Ui(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)):Ui(Ii,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},zi=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}},Fi=/\s+/,Li=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Li(e[n]))&&(r&&(r+=" "),r+=t);return r},$i=(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(Fi);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,y=v+h;if(s.indexOf(y)>-1)continue;s.push(y);const b=a(h,m);for(let e=0;e<b.length;++e){const t=b[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:Di(e.cacheSize),parseClassName:Mi(e),sortModifiers:zi(e),...Si(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=Li(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Wi=[],Bi=e=>{const t=t=>t[e]||Wi;return t.isThemeGetter=!0,t},Vi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gi=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ki=/^\d+\/\d+$/,Hi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zi=/\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$/,Ji=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xi=e=>Ki.test(e),Qi=e=>!!e&&!Number.isNaN(Number(e)),ec=e=>!!e&&Number.isInteger(Number(e)),tc=e=>e.endsWith("%")&&Qi(e.slice(0,-1)),rc=e=>Hi.test(e),nc=()=>!0,ac=e=>Zi.test(e)&&!Ji.test(e),oc=()=>!1,sc=e=>qi.test(e),ic=e=>Yi.test(e),cc=e=>!dc(e)&&!gc(e),lc=e=>kc(e,jc,oc),dc=e=>Vi.test(e),uc=e=>kc(e,Tc,ac),fc=e=>kc(e,_c,Qi),pc=e=>kc(e,Ac,oc),mc=e=>kc(e,Cc,ic),hc=e=>kc(e,Rc,sc),gc=e=>Gi.test(e),vc=e=>Ec(e,Tc),yc=e=>Ec(e,Nc),bc=e=>Ec(e,Ac),wc=e=>Ec(e,jc),xc=e=>Ec(e,Cc),Sc=e=>Ec(e,Rc,!0),kc=(e,t,r)=>{const n=Vi.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Ec=(e,t,r=!1)=>{const n=Gi.exec(e);return!!n&&(n[1]?t(n[1]):r)},Ac=e=>"position"===e||"percentage"===e,Cc=e=>"image"===e||"url"===e,jc=e=>"length"===e||"size"===e||"bg-size"===e,Tc=e=>"length"===e,_c=e=>"number"===e,Nc=e=>"family-name"===e,Rc=e=>"shadow"===e,Oc=$i(()=>{const e=Bi("color"),t=Bi("font"),r=Bi("text"),n=Bi("font-weight"),a=Bi("tracking"),o=Bi("leading"),s=Bi("breakpoint"),i=Bi("container"),c=Bi("spacing"),l=Bi("radius"),d=Bi("shadow"),u=Bi("inset-shadow"),f=Bi("text-shadow"),p=Bi("drop-shadow"),m=Bi("blur"),h=Bi("perspective"),g=Bi("aspect"),v=Bi("ease"),y=Bi("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",gc,dc],w=()=>[gc,dc,c],x=()=>[Xi,"full","auto",...w()],S=()=>[ec,"none","subgrid",gc,dc],k=()=>["auto",{span:["full",ec,gc,dc]},ec,gc,dc],E=()=>[ec,"auto",gc,dc],A=()=>["auto","min","max","fr",gc,dc],C=()=>["auto",...w()],j=()=>[Xi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],T=()=>[e,gc,dc],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",bc,pc,{position:[gc,dc]}],N=()=>["auto","cover","contain",wc,lc,{size:[gc,dc]}],R=()=>[tc,vc,uc],O=()=>["","none","full",l,gc,dc],P=()=>["",Qi,vc,uc],D=()=>[Qi,tc,bc,pc],I=()=>["","none",m,gc,dc],U=()=>["none",Qi,gc,dc],M=()=>["none",Qi,gc,dc],z=()=>[Qi,gc,dc],F=()=>[Xi,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rc],breakpoint:[rc],color:[nc],container:[rc],"drop-shadow":[rc],ease:["in","out","in-out"],font:[cc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rc],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rc],shadow:[rc],spacing:["px",Qi],text:[rc],"text-shadow":[rc],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xi,dc,gc,g]}],container:["container"],columns:[{columns:[Qi,dc,gc,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:b()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[ec,"auto",gc,dc]}],basis:[{basis:[Xi,"full","auto",i,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qi,Xi,"auto","initial","none",dc]}],grow:[{grow:["",Qi,gc,dc]}],shrink:[{shrink:["",Qi,gc,dc]}],order:[{order:[ec,"first","last","none",gc,dc]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:j()}],w:[{w:[i,"screen",...j()]}],"min-w":[{"min-w":[i,"screen","none",...j()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...j()]}],h:[{h:["screen","lh",...j()]}],"min-h":[{"min-h":["screen","lh","none",...j()]}],"max-h":[{"max-h":["screen","lh",...j()]}],"font-size":[{text:["base",r,vc,uc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,gc,fc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",tc,dc]}],"font-family":[{font:[yc,dc,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,gc,dc]}],"line-clamp":[{"line-clamp":[Qi,"none",gc,fc]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",gc,dc]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",gc,dc]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Qi,"from-font","auto",gc,uc]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[Qi,"auto",gc,dc]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gc,dc]}],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",gc,dc]}],"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:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ec,gc,dc],radial:["",gc,dc],conic:[ec,gc,dc]},xc,mc]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],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:P()}],"border-w-x":[{"border-x":P()}],"border-w-y":[{"border-y":P()}],"border-w-s":[{"border-s":P()}],"border-w-e":[{"border-e":P()}],"border-w-t":[{"border-t":P()}],"border-w-r":[{"border-r":P()}],"border-w-b":[{"border-b":P()}],"border-w-l":[{"border-l":P()}],"divide-x":[{"divide-x":P()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":P()}],"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:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Qi,gc,dc]}],"outline-w":[{outline:["",Qi,vc,uc]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",d,Sc,hc]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,Sc,hc]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[Qi,uc]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",f,Sc,hc]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[Qi,gc,dc]}],"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":[Qi]}],"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":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"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":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"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":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"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":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"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":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"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":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"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":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[gc,dc]}],"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":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"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":[Qi]}],"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":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"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:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",gc,dc]}],filter:[{filter:["","none",gc,dc]}],blur:[{blur:I()}],brightness:[{brightness:[Qi,gc,dc]}],contrast:[{contrast:[Qi,gc,dc]}],"drop-shadow":[{"drop-shadow":["","none",p,Sc,hc]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",Qi,gc,dc]}],"hue-rotate":[{"hue-rotate":[Qi,gc,dc]}],invert:[{invert:["",Qi,gc,dc]}],saturate:[{saturate:[Qi,gc,dc]}],sepia:[{sepia:["",Qi,gc,dc]}],"backdrop-filter":[{"backdrop-filter":["","none",gc,dc]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[Qi,gc,dc]}],"backdrop-contrast":[{"backdrop-contrast":[Qi,gc,dc]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qi,gc,dc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qi,gc,dc]}],"backdrop-invert":[{"backdrop-invert":["",Qi,gc,dc]}],"backdrop-opacity":[{"backdrop-opacity":[Qi,gc,dc]}],"backdrop-saturate":[{"backdrop-saturate":[Qi,gc,dc]}],"backdrop-sepia":[{"backdrop-sepia":["",Qi,gc,dc]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",gc,dc]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qi,"initial",gc,dc]}],ease:[{ease:["linear","initial",v,gc,dc]}],delay:[{delay:[Qi,gc,dc]}],animate:[{animate:["none",y,gc,dc]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,gc,dc]}],"perspective-origin":[{"perspective-origin":b()}],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:z()}],"skew-x":[{"skew-x":z()}],"skew-y":[{"skew-y":z()}],transform:[{transform:[gc,dc,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:F()}],"translate-x":[{"translate-x":F()}],"translate-y":[{"translate-y":F()}],"translate-z":[{"translate-z":F()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"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",gc,dc]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gc,dc]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[Qi,vc,uc,fc]}],stroke:[{stroke:["none",...T()]}],"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 Pc(...e){return Oc(yi(e))}const Dc=a.forwardRef(({className:t,...r},n)=>e.jsx(mi,{ref:n,className:Pc("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));Dc.displayName=mi.displayName;const Ic=a.forwardRef(({className:t,...r},n)=>e.jsx(hi,{ref:n,className:Pc("aspect-square h-full w-full",t),...r}));Ic.displayName=hi.displayName;const Uc=a.forwardRef(({className:t,...r},n)=>e.jsx(gi,{ref:n,className:Pc("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));Uc.displayName=gi.displayName;const Mc=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,zc=yi,Fc=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return zc(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=Mc(t)||Mc(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 zc(e,s,c,null==r?void 0:r.class,null==r?void 0:r.className)},Lc=Fc("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"}}),$c=a.forwardRef(({className:t,variant:r,progress:n,size:o,startIcon:s,endIcon:i,asChild:c=!1,...l},d)=>{const u=c?Ws:"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:Pc(Lc({variant:r,size:o,withIcon:null!=n||null!=s||null!=i,className:t})),ref:d,...l,children:[n&&e.jsx(ao,{size:f,className:"animate-spin"}),s&&a.cloneElement(s,{size:f}),l.children,i&&a.cloneElement(i,{size:f})]})});function Wc(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Bc(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}\``)}]},Vc(o,...r)]}function Vc(...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}$c.displayName="Button";var Gc=a[" useId ".trim().toString()]||(()=>{}),Kc=0;function Hc(e){const[t,r]=a.useState(Gc());return Ds(()=>{r(e=>e??String(Kc++))},[e]),e||(t?`radix-${t}`:"")}var Zc=a[" useInsertionEffect ".trim().toString()]||Ds;function Jc({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 Zc(()=>{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 qc(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?Us(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 Yc=Symbol("radix.slottable");function Xc(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Yc}var Qc=["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=qc(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Xc);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 el,tl="dismissableLayer.update",rl="dismissableLayer.pointerDownOutside",nl="dismissableLayer.focusOutside",al=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ol=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...d}=t,u=a.useContext(al),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Ms(r,e=>p(e)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=f?v.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=b,k=function(e,t=globalThis?.document){const r=Ps(e),n=a.useRef(!1),o=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){il(rl,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);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=Ps(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){il(nl,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=Ps(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=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(el=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),sl(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=el)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),sl())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(tl,e),()=>document.removeEventListener(tl,e)},[]),e.jsx(Qc.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...t.style},onFocusCapture:Wc(t.onFocusCapture,E.onFocusCapture),onBlurCapture:Wc(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:Wc(t.onPointerDownCapture,k.onPointerDownCapture)})});ol.displayName="DismissableLayer";function sl(){const e=new CustomEvent(tl);document.dispatchEvent(e)}function il(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(al),o=a.useRef(null),s=Ms(r,o);return a.useEffect(()=>{const e=o.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Qc.div,{...t,ref:s})}).displayName="DismissableLayerBranch";var cl="focusScope.autoFocusOnMount",ll="focusScope.autoFocusOnUnmount",dl={bubbles:!1,cancelable:!0},ul=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...c}=t,[l,d]=a.useState(null),u=Ps(s),f=Ps(i),p=a.useRef(null),m=Ms(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:hl(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||hl(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&hl(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){gl.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(cl,dl);l.addEventListener(cl,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(hl(n,{select:t}),document.activeElement!==r)return}((e=fl(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&hl(l))}return()=>{l.removeEventListener(cl,u),setTimeout(()=>{const e=new CustomEvent(ll,dl);l.addEventListener(ll,f),l.dispatchEvent(e),e.defaultPrevented||hl(t??document.body,{select:!0}),l.removeEventListener(ll,f),gl.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=fl(e),r=pl(t,e),n=pl(t.reverse(),e);return[r,n]}(t);a&&o?e.shiftKey||r!==o?e.shiftKey&&r===a&&(e.preventDefault(),n&&hl(o,{select:!0})):(e.preventDefault(),n&&hl(a,{select:!0})):r===t&&e.preventDefault()}},[n,o,h.paused]);return e.jsx(Qc.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function fl(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 pl(e,t){for(const r of e)if(!ml(r,{upTo:t}))return r}function ml(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 hl(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()}}ul.displayName="FocusScope";var gl=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=vl(e,t),e.unshift(t)},remove(t){e=vl(e,t),e[0]?.resume()}}}();function vl(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var yl=a.forwardRef((t,n)=>{const{container:o,...s}=t,[i,c]=a.useState(!1);Ds(()=>c(!0),[]);const l=o||i&&globalThis?.document?.body;return l?r.createPortal(e.jsx(Qc.div,{...s,ref:n}),l):null});yl.displayName="Portal";var bl=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=wl(n.current);s.current="mounted"===c?e:"none"},[c]),Ds(()=>{const t=n.current,r=o.current;if(r!==e){const n=s.current,a=wl(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]),Ds(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const s=wl(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=wl(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=Ms(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 wl(e){return e?.animationName||"none"}bl.displayName="Presence";var xl=0;function Sl(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kl()),document.body.insertAdjacentElement("beforeend",e[1]??kl()),xl++,()=>{1===xl&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),xl--}},[])}function kl(){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 El=function(){return El=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},El.apply(this,arguments)};function Al(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 Cl="right-scroll-bar-position",jl="width-before-scroll-bar";function Tl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var _l="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,Nl=new WeakMap;function Rl(e,r){var n,a,o,s=(n=null,a=function(t){return e.forEach(function(e){return Tl(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 _l(function(){var t=Nl.get(s);if(t){var r=new Set(t),n=new Set(e),a=s.current;r.forEach(function(e){n.has(e)||Tl(e,null)}),n.forEach(function(e){r.has(e)||Tl(e,a)})}Nl.set(s,e)},[e]),s}function Ol(e){return e}var Pl=function(e){var t=e.sideCar,r=Al(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,El({},r))};Pl.isSideCarExport=!0;var Dl=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Ol);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=El({async:!0,ssr:!1},e),t}(),Il=function(){},Ul=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:Il,onWheelCapture:Il,onTouchMoveCapture:Il}),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,y=e.as,b=void 0===y?"div":y,w=e.gapMode,x=Al(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Rl([r,t]),E=El(El({},x),o);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:Dl,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:w}),i?a.cloneElement(a.Children.only(c),El(El({},E),{ref:k})):a.createElement(b,El({},E,{className:l,ref:k}),c))});Ul.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ul.classNames={fullWidth:jl,zeroRight:Cl};function Ml(){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 zl=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Ml())&&(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)}}},Fl=function(){var e,t=(e=zl(),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}},Ll={left:0,top:0,right:0,gap:0},$l=function(e){return parseInt(e||"",10)||0},Wl=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Ll;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[$l(r),$l(n),$l(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])}},Bl=Fl(),Vl="data-scroll-locked",Gl=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(Vl,"] {\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(Cl," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(jl," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(Cl," .").concat(Cl," {\n right: 0 ").concat(n,";\n }\n \n .").concat(jl," .").concat(jl," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Vl,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Kl=function(){var e=parseInt(document.body.getAttribute(Vl)||"0",10);return isFinite(e)?e:0},Hl=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(Vl,(Kl()+1).toString()),function(){var e=Kl()-1;e<=0?document.body.removeAttribute(Vl):document.body.setAttribute(Vl,e.toString())}},[]);var s=a.useMemo(function(){return Wl(o)},[o]);return a.createElement(Bl,{styles:Gl(s,!t,o,r?"":"!important")})},Zl=!1;if("undefined"!=typeof window)try{var Jl=Object.defineProperty({},"passive",{get:function(){return Zl=!0,!0}});window.addEventListener("test",Jl,Jl),window.removeEventListener("test",Jl,Jl)}catch(e){Zl=!1}var ql=!!Zl&&{passive:!1},Yl=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])},Xl=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Ql(e,n)){var a=ed(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Ql=function(e,t){return"v"===e?function(e){return Yl(e,"overflowY")}(t):function(e){return Yl(e,"overflowX")}(t)},ed=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},td=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rd=function(e){return[e.deltaX,e.deltaY]},nd=function(e){return e&&"current"in e?e.current:e},ad=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},od=0,sd=[];function id(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var cd,ld=(cd=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),o=a.useState(od++)[0],s=a.useState(Fl)[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(nd),!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=td(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=Xl(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Xl(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=ed(e,s),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Ql(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(sd.length&&sd[sd.length-1]===s){var n="deltaY"in r?rd(r):td(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var o=(i.current.shards||[]).map(nd).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:id(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=td(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,rd(t),t.target,c(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,td(t),t.target,c(t,e.lockRef.current))},[]);a.useEffect(function(){return sd.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,ql),document.addEventListener("touchmove",l,ql),document.addEventListener("touchstart",u,ql),function(){sd=sd.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,ql),document.removeEventListener("touchmove",l,ql),document.removeEventListener("touchstart",u,ql)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(s,{styles:ad(o)}):null,m?a.createElement(Hl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Dl.useMedium(cd),Pl),dd=a.forwardRef(function(e,t){return a.createElement(Ul,El({},e,{ref:t,sideCar:ld}))});dd.classNames=Ul.classNames;var ud=new WeakMap,fd=new WeakMap,pd={},md=0,hd=function(e){return e&&(e.host||hd(e.parentNode))},gd=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=hd(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]);pd[r]||(pd[r]=new WeakMap);var o=pd[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=(ud.get(e)||0)+1,l=(o.get(e)||0)+1;ud.set(e,c),o.set(e,l),s.push(e),1===c&&a&&fd.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(),md++,function(){s.forEach(function(e){var t=ud.get(e)-1,a=o.get(e)-1;ud.set(e,t),o.set(e,a),t||(fd.has(e)||e.removeAttribute(n),fd.delete(e)),a||e.removeAttribute(r)}),--md||(ud=new WeakMap,ud=new WeakMap,fd=new WeakMap,pd={})}},vd=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"))),gd(n,a,r,"aria-hidden")):function(){return null}};function yd(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?Us(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 bd=Symbol("radix.slottable");function wd(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===bd}var xd="Dialog",[Sd,kd]=Bc(xd),[Ed,Ad]=Sd(xd),Cd=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]=Jc({prop:o,defaultProp:s??!1,onChange:i,caller:xd});return e.jsx(Ed,{scope:r,triggerRef:l,contentRef:d,contentId:Hc(),titleId:Hc(),descriptionId:Hc(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};Cd.displayName=xd;var jd="DialogTrigger",Td=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ad(jd,n),s=Ms(r,o.triggerRef);return e.jsx(Qc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Zd(o.open),...a,ref:s,onClick:Wc(t.onClick,o.onOpenToggle)})});Td.displayName=jd;var _d="DialogPortal",[Nd,Rd]=Sd(_d,{forceMount:void 0}),Od=t=>{const{__scopeDialog:r,forceMount:n,children:o,container:s}=t,i=Ad(_d,r);return e.jsx(Nd,{scope:r,forceMount:n,children:a.Children.map(o,t=>e.jsx(bl,{present:n||i.open,children:e.jsx(yl,{asChild:!0,container:s,children:t})}))})};Od.displayName=_d;var Pd="DialogOverlay",Dd=a.forwardRef((t,r)=>{const n=Rd(Pd,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Ad(Pd,t.__scopeDialog);return s.modal?e.jsx(bl,{present:a||s.open,children:e.jsx(Ud,{...o,ref:r})}):null});Dd.displayName=Pd;var Id=function(t){const r=yd(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(wd);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"),Ud=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ad(Pd,n);return e.jsx(dd,{as:Id,allowPinchZoom:!0,shards:[o.contentRef],children:e.jsx(Qc.div,{"data-state":Zd(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Md="DialogContent",zd=a.forwardRef((t,r)=>{const n=Rd(Md,t.__scopeDialog),{forceMount:a=n.forceMount,...o}=t,s=Ad(Md,t.__scopeDialog);return e.jsx(bl,{present:a||s.open,children:s.modal?e.jsx(Fd,{...o,ref:r}):e.jsx(Ld,{...o,ref:r})})});zd.displayName=Md;var Fd=a.forwardRef((t,r)=>{const n=Ad(Md,t.__scopeDialog),o=a.useRef(null),s=Ms(r,n.contentRef,o);return a.useEffect(()=>{const e=o.current;if(e)return vd(e)},[]),e.jsx($d,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wc(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Wc(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Wc(t.onFocusOutside,e=>e.preventDefault())})}),Ld=a.forwardRef((t,r)=>{const n=Ad(Md,t.__scopeDialog),o=a.useRef(!1),s=a.useRef(!1);return e.jsx($d,{...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()}})}),$d=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,...c}=t,l=Ad(Md,n),d=a.useRef(null),u=Ms(r,d);return Sl(),e.jsxs(e.Fragment,{children:[e.jsx(ul,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:i,children:e.jsx(ol,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Zd(l.open),...c,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Xd,{titleId:l.titleId}),e.jsx(Qd,{contentRef:d,descriptionId:l.descriptionId})]})]})}),Wd="DialogTitle",Bd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ad(Wd,n);return e.jsx(Qc.h2,{id:o.titleId,...a,ref:r})});Bd.displayName=Wd;var Vd="DialogDescription",Gd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ad(Vd,n);return e.jsx(Qc.p,{id:o.descriptionId,...a,ref:r})});Gd.displayName=Vd;var Kd="DialogClose",Hd=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,o=Ad(Kd,n);return e.jsx(Qc.button,{type:"button",...a,ref:r,onClick:Wc(t.onClick,()=>o.onOpenChange(!1))})});function Zd(e){return e?"open":"closed"}Hd.displayName=Kd;var Jd="DialogTitleWarning",[qd,Yd]=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}\``)}]}(Jd,{contentName:Md,titleName:Wd,docsSlug:"dialog"}),Xd=({titleId:e})=>{const t=Yd(Jd),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},Qd=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Yd("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},eu=Cd,tu=Td,ru=Od,nu=Dd,au=zd,ou=Bd,su=Gd,iu=Hd;function cu(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 lu=["color"],du=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=cu(e,lu);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"}))}),uu=["color"],fu=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=cu(e,uu);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"}))}),pu=["color"],mu=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=cu(e,pu);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"}))}),hu=["color"],gu=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,o=cu(e,hu);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 vu=eu,yu=tu,bu=ru,wu=a.forwardRef(({className:t,...r},n)=>e.jsx(nu,{ref:n,className:Pc("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}));wu.displayName=nu.displayName;const xu=a.forwardRef(({className:t,children:r,...n},o)=>{const{container:s}=a.useContext(ce);return e.jsxs(bu,{container:s,children:[e.jsx(wu,{}),e.jsxs(au,{ref:o,className:Pc("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(iu,{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(mu,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});xu.displayName=au.displayName;const Su=({className:t,...r})=>e.jsx("div",{className:Pc("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});Su.displayName="DialogHeader";const ku=a.forwardRef(({className:t,...r},n)=>e.jsx(ou,{ref:n,className:Pc("text-lg font-semibold leading-none tracking-tight",t),...r}));ku.displayName=ou.displayName;const Eu=a.forwardRef(({className:t,...r},n)=>e.jsx(su,{ref:n,className:Pc("text-sm text-muted-foreground",t),...r}));Eu.displayName=su.displayName;var Au=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=$s(`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}},{}),Cu=a.forwardRef((t,r)=>e.jsx(Au.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Cu.displayName="Label";var ju=Cu;const Tu=Fc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_u=a.forwardRef(({className:t,...r},n)=>e.jsx(ju,{ref:n,className:Pc(Tu(),t),...r}));_u.displayName=ju.displayName;const Nu=He,Ru=a.createContext({}),Ou=({...t})=>e.jsx(Ru.Provider,{value:{name:t.name},children:e.jsx(tt,{...t})}),Pu=()=>{const e=a.useContext(Ru),t=a.useContext(Du),{getFieldState:r,formState:n}=Ke(),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}},Du=a.createContext({}),Iu=a.forwardRef(({className:t,...r},n)=>{const o=a.useId();return e.jsx(Du.Provider,{value:{id:o},children:e.jsx("div",{ref:n,className:Pc("space-y-2",t),...r})})});Iu.displayName="FormItem";const Uu=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:o}=Pu();return e.jsx(_u,{ref:n,className:Pc(a&&"text-destructive",t),htmlFor:o,...r})});Uu.displayName="FormLabel";const Mu=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:s}=Pu();return e.jsx(Ws,{ref:r,id:a,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...t})});Mu.displayName="FormControl";const zu=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=Pu();return e.jsx("p",{ref:n,id:a,className:Pc("text-sm text-muted-foreground",t),...r})});zu.displayName="FormDescription";const Fu=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:o,formMessageId:s}=Pu(),i=o?String(o?.message):r;return i?e.jsx("p",{ref:a,id:s,className:Pc("text-sm font-medium text-destructive",t),...n,children:i}):null});Fu.displayName="FormMessage";const Lu=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:Pc("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 $u(t){const r=Wu(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Vu);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 Wu(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?Us(t,e):e),a.cloneElement(r,o)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Lu.displayName="Input";var Bu=Symbol("radix.slottable");function Vu(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Bu}function Gu(r){const n=r+"CollectionProvider",[a,o]=Bc(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=$u(l),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,o=Ms(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=$u(f),h=t.forwardRef((r,n)=>{const{scope:a,children:o,...s}=r,c=t.useRef(null),l=Ms(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 Ku=a.createContext(void 0);function Hu(e){const t=a.useContext(Ku);return e||t||"ltr"}var Zu="rovingFocusGroup.onEntryFocus",Ju={bubbles:!1,cancelable:!0},qu="RovingFocusGroup",[Yu,Xu,Qu]=Gu(qu),[ef,tf]=Bc(qu,[Qu]),[rf,nf]=ef(qu),af=a.forwardRef((t,r)=>e.jsx(Yu.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Yu.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(of,{...t,ref:r})})}));af.displayName=qu;var of=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=Ms(r,m),g=Hu(i),[v,y]=Jc({prop:c,defaultProp:l??null,onChange:d,caller:qu}),[b,w]=a.useState(!1),x=Ps(u),S=Xu(n),k=a.useRef(!1),[E,A]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Zu,x),()=>e.removeEventListener(Zu,x)},[x]),e.jsx(rf,{scope:n,orientation:o,dir:g,loop:s,currentTabStopId:v,onItemFocus:a.useCallback(e=>y(e),[y]),onItemShiftTab:a.useCallback(()=>w(!0),[]),onFocusableItemAdd:a.useCallback(()=>A(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>A(e=>e-1),[]),children:e.jsx(Qc.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:Wc(t.onMouseDown,()=>{k.current=!0}),onFocus:Wc(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!b){const t=new CustomEvent(Zu,Ju);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);df([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:Wc(t.onBlur,()=>w(!1))})})}),sf="RovingFocusGroupItem",cf=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:s=!1,tabStopId:i,children:c,...l}=t,d=Hc(),u=i||d,f=nf(sf,n),p=f.currentTabStopId===u,m=Xu(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return a.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),e.jsx(Yu.ItemSlot,{scope:n,id:u,focusable:o,active:s,children:e.jsx(Qc.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:Wc(t.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:Wc(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Wc(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:lf[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(()=>df(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});cf.displayName=sf;var lf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function df(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 uf=af,ff=cf;function pf(e){const[t,r]=a.useState(void 0);return Ds(()=>{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 mf(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 hf="Radio",[gf,vf]=Bc(hf),[yf,bf]=gf(hf),wf=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=Ms(r,e=>m(e)),g=a.useRef(!1),v=!p||(u||!!p.closest("form"));return e.jsxs(yf,{scope:n,checked:s,disabled:c,children:[e.jsx(Qc.button,{type:"button",role:"radio","aria-checked":s,"data-state":Ef(s),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onClick:Wc(t.onClick,e=>{s||d?.(),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&e.jsx(kf,{control:p,bubbles:!g.current,name:o,value:l,checked:s,required:i,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});wf.displayName=hf;var xf="RadioIndicator",Sf=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...o}=t,s=bf(xf,n);return e.jsx(bl,{present:a||s.checked,children:e.jsx(Qc.span,{"data-state":Ef(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:r})})});Sf.displayName=xf;var kf=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Ms(c,i),d=mf(n),u=pf(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(Qc.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 Ef(e){return e?"checked":"unchecked"}kf.displayName="RadioBubbleInput";var Af=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Cf="RadioGroup",[jf]=Bc(Cf,[tf,vf]),Tf=tf(),_f=vf(),[Nf,Rf]=jf(Cf),Of=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=Tf(n),h=Hu(d),[g,v]=Jc({prop:s,defaultProp:o??null,onChange:f,caller:Cf});return e.jsx(Nf,{scope:n,name:a,required:i,disabled:c,value:g,onValueChange:v,children:e.jsx(uf,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:e.jsx(Qc.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});Of.displayName=Cf;var Pf="RadioGroupItem",Df=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:o,...s}=t,i=Rf(Pf,n),c=i.disabled||o,l=Tf(n),d=_f(n),u=a.useRef(null),f=Ms(r,u),p=i.value===s.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Af.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(ff,{asChild:!0,...l,focusable:!c,active:p,children:e.jsx(wf,{disabled:c,required:i.required,checked:p,...d,...s,name:i.name,ref:f,onCheck:()=>i.onValueChange(s.value),onKeyDown:Wc(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Wc(s.onFocus,()=>{m.current&&u.current?.click()})})})});Df.displayName=Pf;var If=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,o=_f(n);return e.jsx(Sf,{...o,...a,ref:r})});If.displayName="RadioGroupIndicator";var Uf=Of,Mf=Df,zf=If;const Ff=a.forwardRef(({className:t,...r},n)=>e.jsx(Uf,{className:Pc("grid gap-2",t),...r,ref:n}));Ff.displayName=Uf.displayName;const Lf=a.forwardRef(({className:t,...r},n)=>e.jsx(Mf,{ref:n,className:Pc("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(zf,{className:"flex items-center justify-center",children:e.jsx(fu,{className:"h-3.5 w-3.5 fill-primary"})})}));function $f(e,[t,r]){return Math.min(r,Math.max(t,e))}Lf.displayName=Mf.displayName;var Wf="ScrollArea",[Bf]=Bc(Wf),[Vf,Gf]=Bf(Wf),Kf=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,y]=a.useState(null),[b,w]=a.useState(0),[x,S]=a.useState(0),[k,E]=a.useState(!1),[A,C]=a.useState(!1),j=Ms(r,e=>d(e)),T=Hu(s);return e.jsx(Vf,{scope:n,type:o,dir:T,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:E,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:S,children:e.jsx(Qc.div,{dir:T,...c,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":x+"px",...t.style}})})});Kf.displayName=Wf;var Hf="ScrollAreaViewport",Zf=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:o,nonce:s,...i}=t,c=Gf(Hf,n),l=Ms(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(Qc.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})})]})});Zf.displayName=Hf;var Jf="ScrollAreaScrollbar",qf=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=Gf(Jf,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(Yf,{...o,ref:r,forceMount:n}):"scroll"===s.type?e.jsx(Xf,{...o,ref:r,forceMount:n}):"auto"===s.type?e.jsx(Qf,{...o,ref:r,forceMount:n}):"always"===s.type?e.jsx(ep,{...o,ref:r}):null});qf.displayName=Jf;var Yf=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=Gf(Jf,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(bl,{present:n||i,children:e.jsx(Qf,{"data-state":i?"visible":"hidden",...o,ref:r})})}),Xf=a.forwardRef((t,r)=>{const{forceMount:n,...o}=t,s=Gf(Jf,t.__scopeScrollArea),i="horizontal"===t.orientation,c=bp(()=>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(bl,{present:n||"hidden"!==l,children:e.jsx(ep,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:Wc(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Wc(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Qf=a.forwardRef((t,r)=>{const n=Gf(Jf,t.__scopeScrollArea),{forceMount:o,...s}=t,[i,c]=a.useState(!1),l="horizontal"===t.orientation,d=bp(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;c(l?e:t)}},10);return wp(n.viewport,d),wp(n.content,d),e.jsx(bl,{present:o||i,children:e.jsx(ep,{"data-state":i?"visible":"hidden",...s,ref:r})})}),ep=a.forwardRef((t,r)=>{const{orientation:n="vertical",...o}=t,s=Gf(Jf,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=pp(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=mp(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 gp([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===n?e.jsx(tp,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=hp(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(rp,{...f,ref:r,onThumbPositionChange:()=>{if(s.viewport&&i.current){const e=hp(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}),tp=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=Gf(Jf,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Ms(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(op,{"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":mp(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),vp(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:fp(c.paddingLeft),paddingEnd:fp(c.paddingRight)}})}})}),rp=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:o,...s}=t,i=Gf(Jf,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Ms(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(op,{"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":mp(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),vp(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:fp(c.paddingTop),paddingEnd:fp(c.paddingBottom)}})}})}),[np,ap]=Bf(Jf),op=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=Gf(Jf,n),[g,v]=a.useState(null),y=Ms(r,e=>v(e)),b=a.useRef(null),w=a.useRef(""),x=h.viewport,S=o.content-o.viewport,k=Ps(f),E=Ps(d),A=bp(p,10);function C(e){if(b.current){const t=e.clientX-b.current.left,r=e.clientY-b.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})},[x,g,S,k]),a.useEffect(E,[o,E]),wp(g,A),wp(h.content,A),e.jsx(np,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:Ps(i),onThumbPointerUp:Ps(c),onThumbPositionChange:E,onThumbPointerDown:Ps(l),children:e.jsx(Qc.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:Wc(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:Wc(t.onPointerMove,C),onPointerUp:Wc(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),sp="ScrollAreaThumb",ip=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,o=ap(sp,t.__scopeScrollArea);return e.jsx(bl,{present:n||o.hasThumb,children:e.jsx(cp,{ref:r,...a})})}),cp=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:o,...s}=t,i=Gf(sp,n),c=ap(sp,n),{onThumbPositionChange:l}=c,d=Ms(r,e=>c.onThumbChange(e)),u=a.useRef(void 0),f=bp(()=>{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=yp(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,l]),e.jsx(Qc.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:Wc(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:Wc(t.onPointerUp,c.onThumbPointerUp)})});ip.displayName=sp;var lp="ScrollAreaCorner",dp=a.forwardRef((t,r)=>{const n=Gf(lp,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(up,{...t,ref:r}):null});dp.displayName=lp;var up=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...o}=t,s=Gf(lp,n),[i,c]=a.useState(0),[l,d]=a.useState(0),u=Boolean(i&&l);return wp(s.scrollbarX,()=>{const e=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(e),d(e)}),wp(s.scrollbarY,()=>{const e=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(e),c(e)}),u?e.jsx(Qc.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 fp(e){return e?parseInt(e,10):0}function pp(e,t){const r=e/t;return isNaN(r)?0:r}function mp(e){const t=pp(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function hp(e,t,r="ltr"){const n=mp(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,s=t.content-t.viewport,i=o-n,c=$f(e,"ltr"===r?[0,s]:[-1*s,0]);return gp([0,s],[0,i])(c)}function gp(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 vp(e,t){return e>0&&e<t}var yp=(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 bp(e,t){const r=Ps(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 wp(e,t){const r=Ps(t);Ds(()=>{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 xp=Kf,Sp=Zf,kp=dp;const Ep=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(xp,{ref:a,className:Pc("relative overflow-hidden",t),...n,children:[e.jsx(Sp,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Ap,{}),e.jsx(kp,{})]}));Ep.displayName=xp.displayName;const Ap=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(qf,{ref:a,orientation:r,className:Pc("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(ip,{className:Pc("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Ap.displayName=qf.displayName;var Cp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=$s(`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}},{}),jp="horizontal",Tp=["horizontal","vertical"],_p=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=jp,...o}=t,s=function(e){return Tp.includes(e)}(a)?a:jp,i=n?{role:"none"}:{"aria-orientation":"vertical"===s?s:void 0,role:"separator"};return e.jsx(Cp.div,{"data-orientation":s,...i,...o,ref:r})});_p.displayName="Separator";var Np=_p;const Rp=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},o)=>e.jsx(Np,{ref:o,decorative:n,orientation:r,className:Pc("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));function Op(){const e=ae(),r=ne(e=>e.os),{serverUrl:n,version:a,orgId:o,settings:s}=r,i=t.useRef(!1),c=t.useCallback(async()=>{if(i.current)return s||null;if(s)return s;if(!n||!a||!o)return null;i.current=!0;try{const t=k(),r=await fetch(`${n}/api/${a}/public/${o}/settings`,{headers:t});if(!r.ok)throw new Error("Failed to fetch settings");const s=await r.json();return e.os(P(s)),s}catch(e){return console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[n,a,o,s,e]);return t.useEffect(()=>{n&&a&&o&&!s&&!i.current&&c()},[n,a,o]),t.useMemo(()=>({settings:s,getSettings:c}),[s,c])}Rp.displayName=Np.displayName;var Pp=Symbol("radix.slottable");var Dp="AlertDialog",[Ip]=Bc(Dp,[kd]),Up=kd(),Mp=t=>{const{__scopeAlertDialog:r,...n}=t,a=Up(r);return e.jsx(eu,{...a,...n,modal:!0})};Mp.displayName=Dp;var zp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Up(n);return e.jsx(tu,{...o,...a,ref:r})});zp.displayName="AlertDialogTrigger";var Fp=t=>{const{__scopeAlertDialog:r,...n}=t,a=Up(r);return e.jsx(ru,{...a,...n})};Fp.displayName="AlertDialogPortal";var Lp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Up(n);return e.jsx(nu,{...o,...a,ref:r})});Lp.displayName="AlertDialogOverlay";var $p="AlertDialogContent",[Wp,Bp]=Ip($p),Vp=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=Pp,r}("AlertDialogContent"),Gp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:o,...s}=t,i=Up(n),c=a.useRef(null),l=Ms(r,c),d=a.useRef(null);return e.jsx(qd,{contentName:$p,titleName:Kp,docsSlug:"alert-dialog",children:e.jsx(Wp,{scope:n,cancelRef:d,children:e.jsxs(au,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Wc(s.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(Vp,{children:o}),e.jsx(Qp,{contentRef:c})]})})})});Gp.displayName=$p;var Kp="AlertDialogTitle",Hp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Up(n);return e.jsx(ou,{...o,...a,ref:r})});Hp.displayName=Kp;var Zp="AlertDialogDescription",Jp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Up(n);return e.jsx(su,{...o,...a,ref:r})});Jp.displayName=Zp;var qp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,o=Up(n);return e.jsx(iu,{...o,...a,ref:r})});qp.displayName="AlertDialogAction";var Yp="AlertDialogCancel",Xp=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:o}=Bp(Yp,n),s=Up(n),i=Ms(r,o);return e.jsx(iu,{...s,...a,ref:i})});Xp.displayName=Yp;var Qp=({contentRef:e})=>{const t=`\`${$p}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${$p}\` by passing a \`${Zp}\` 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 \`${$p}\`. 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},em=Lp,tm=Gp,rm=qp,nm=Xp,am=Hp,om=Jp;const sm=Mp,im=zp,cm=Fp,lm=a.forwardRef(({className:t,...r},n)=>e.jsx(em,{className:Pc("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}));lm.displayName=em.displayName;const dm=a.forwardRef(({className:t,...r},n)=>{const{container:o}=a.useContext(ce);return e.jsxs(cm,{container:o,children:[e.jsx(lm,{}),e.jsx(tm,{ref:n,className:Pc("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})]})});dm.displayName=tm.displayName;const um=({className:t,...r})=>e.jsx("div",{className:Pc("flex flex-col space-y-2 text-center sm:text-left",t),...r});um.displayName="AlertDialogHeader";const fm=({className:t,...r})=>e.jsx("div",{className:Pc("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});fm.displayName="AlertDialogFooter";const pm=a.forwardRef(({className:t,...r},n)=>e.jsx(am,{ref:n,className:Pc("text-lg font-semibold",t),...r}));pm.displayName=am.displayName;const mm=a.forwardRef(({className:t,...r},n)=>e.jsx(om,{ref:n,className:Pc("text-sm text-muted-foreground",t),...r}));mm.displayName=om.displayName;const hm=a.forwardRef(({className:t,...r},n)=>e.jsx(rm,{ref:n,className:Pc(Lc(),t),...r}));hm.displayName=rm.displayName;const gm=a.forwardRef(({className:t,...r},n)=>e.jsx(nm,{ref:n,className:Pc(Lc({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));gm.displayName=nm.displayName;const vm="saas-workspace-current",ym=()=>g(vm),bm=(e,t)=>!!e&&t.some(t=>t._id===e);function wm(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 xm({className:t,...r}){return e.jsx("div",{className:Pc("animate-pulse rounded-md bg-primary/10",t),...r})}function Sm(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(xm,{className:"h-10 w-full"}),e.jsx(xm,{className:"h-10 w-full"}),e.jsx(xm,{className:"h-10 w-full"})]})}const km=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:o}=ow(),s=ne(e=>e.auth.session?.user||null);if(!r)return e.jsx(Sm,{});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(sm,{children:[e.jsx(im,{asChild:!0,children:e.jsxs($c,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(dm,{children:[e.jsxs(um,{children:[e.jsx(pm,{children:"Are you absolutely sure?"}),e.jsxs(mm,{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(fm,{children:[e.jsx(gm,{disabled:n,children:"Cancel"}),e.jsx(hm,{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(ao,{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 Em="Switch",[Am]=Bc(Em),[Cm,jm]=Am(Em),Tm=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=Ms(r,e=>h(e)),v=a.useRef(!1),y=!m||(f||!!m.closest("form")),[b,w]=Jc({prop:s,defaultProp:i??!1,onChange:u,caller:Em});return e.jsxs(Cm,{scope:n,checked:b,disabled:l,children:[e.jsx(Qc.button,{type:"button",role:"switch","aria-checked":b,"aria-required":c,"data-state":Om(b),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:Wc(t.onClick,e=>{w(e=>!e),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),y&&e.jsx(Rm,{control:m,bubbles:!v.current,name:o,value:d,checked:b,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Tm.displayName=Em;var _m="SwitchThumb",Nm=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,o=jm(_m,n);return e.jsx(Qc.span,{"data-state":Om(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});Nm.displayName=_m;var Rm=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:o=!0,...s},i)=>{const c=a.useRef(null),l=Ms(c,i),d=mf(n),u=pf(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 Om(e){return e?"checked":"unchecked"}Rm.displayName="SwitchBubbleInput";var Pm=Tm,Dm=Nm;const Im=a.forwardRef(({className:t,...r},n)=>e.jsx(Pm,{className:Pc("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(Dm,{className:Pc("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")})}));Im.displayName=Pm.displayName;const Um=({workspaceId:r})=>{const[n,a]=t.useState({}),{allFeatures:o,updateFeature:s,getWorkspace:i}=ow(),[c,l]=t.useState(null),d=ne(e=>e.auth.session?.user||null);if(t.useEffect(()=>{i(r).then(l)},[r]),!c)return e.jsx(Sm,{});const u=wm(c,d?.id??null);return e.jsx("div",{children:e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!u&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!o.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),o.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:o.map(t=>{const r=c?.features?.[t.slug];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})]}),e.jsx(Im,{disabled:n[t.slug]||!u,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(!c)return;a(r=>({...r,[e]:t}));const r=await s(c._id,e,t);l(r),a(t=>({...t,[e]:!1}))}(t.slug,e)})]},t._id)})})]})})};function Mm(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 zm=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],Fm=({workspace:r})=>{const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState(),{updateWorkspace:l}=ow(),d=ne(e=>e.auth.session?.user||null),u=Mt({resolver:Ka(ms({name:$o().min(2,{message:"Workspace name must be at least 2 characters."}),image:$o().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Sm,{});const f=wm(r,d?.id??null);return e.jsxs("div",{children:[!f&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Nu,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(async function(e){a(!0);try{await l(r,e)}catch(e){console.error("Failed to update workspace:",e)}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Ou,{control:u.control,name:"name",render:({field:t})=>e.jsxs(Iu,{children:[e.jsx(Uu,{children:"Name"}),e.jsx(Mu,{children:e.jsx(Lu,{placeholder:"My Awesome Workspace",...t,disabled:!f})}),e.jsx(Fu,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(_u,{className:"text-sm font-medium",children:"Icon"}),e.jsx(zu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(Ff,{value:o,disabled:!f,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(Lf,{value:"emoji",id:"emoji"}),e.jsxs(_u,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(lo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Lf,{value:"url",id:"url"}),e.jsxs(_u,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(no,{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&&u.watch("image")?.trim()&&e.jsx("img",{src:u.watch("image")||void 0,alt:"Workspace preview"})]})]}),f&&e.jsx(Ep,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:zm.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),u.setValue("image",Mm(e))})(t),disabled:!f,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(Ou,{control:u.control,name:"image",render:({field:t})=>e.jsxs(Iu,{children:[e.jsx(Uu,{children:"Image URL"}),e.jsx(Mu,{children:e.jsx(Lu,{placeholder:"https://example.com/image.png",...t,disabled:!f})}),e.jsx(zu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(Fu,{})]})}),u.watch("image")&&u.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:u.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:f&&e.jsx($c,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var Lm=.999,$m=/[\\\/_+.#"@\[\(\{&]/,Wm=/[\\\/_+.#"@\[\(\{&]/g,Bm=/[\s-]/,Vm=/[\s-]/g;function Gm(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=Gm(e,t,r,n,p+1,o+1,s))>m&&(p===a?c*=1:$m.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Wm))&&a>0&&(c*=Math.pow(Lm,d.length))):Bm.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(Vm))&&a>0&&(c*=Math.pow(Lm,u.length))):(c*=.17,a>0&&(c*=Math.pow(Lm,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=Gm(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 Km(e){return e.toLowerCase().replace(Vm," ")}function Hm(e,t,r){return Gm(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Km(e),Km(t),0,0,{})}var Zm='[cmdk-group=""]',Jm='[cmdk-group-items=""]',qm='[cmdk-item=""]',Ym=`${qm}:not([aria-disabled="true"])`,Xm="cmdk-item-select",Qm="data-value",eh=(e,t,r)=>Hm(e,t,r),th=a.createContext(void 0),rh=()=>a.useContext(th),nh=a.createContext(void 0),ah=()=>a.useContext(nh),oh=a.createContext(void 0),sh=a.forwardRef((e,t)=>{let r=wh(()=>{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=wh(()=>new Set),o=wh(()=>new Map),s=wh(()=>new Map),i=wh(()=>new Set),c=yh(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=Hc(),w=Hc(),x=Hc(),S=a.useRef(null),k=kh();bh(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,E.emit()}},[u]),bh(()=>{k(6,N)},[]);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)_(),j(),k(1,T);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,E.emit()}),n||k(5,N),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())}}),[]),A=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,C(t,n)),k(2,()=>{j(),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,()=>{_(),j(),r.current.value||T(),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&&T(),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:b,inputId:x,labelId:w,listInnerRef:S}),[]);function C(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:eh;return e?o(e,r.current.search,t):0}function j(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),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(Jm);t?t.appendChild(e.parentElement===t?e:e.closest(`${Jm} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${Jm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Zm}[${Qm}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function T(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Qm);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=C(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 N(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Zm))?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(`${qm}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Ym))||[])}function P(e){let t=O()[e];t&&E.setState("value",t.getAttribute(Qm))}function D(e){var t;let r=R(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&E.setState("value",o.getAttribute(Qm))}function I(e){let t,r=R(),n=null==r?void 0:r.closest(Zm);for(;n&&!t;)n=e>0?gh(n,Zm):vh(n,Zm),t=null==n?void 0:n.querySelector(Ym);t?E.setState("value",t.getAttribute(Qm)):D(e)}let U=()=>P(O().length-1),M=e=>{e.preventDefault(),e.metaKey?U():e.altKey?I(1):D(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):D(-1)};return a.createElement(Qc.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":v&&e.ctrlKey&&M(e);break;case"ArrowDown":M(e);break;case"p":case"k":v&&e.ctrlKey&&z(e);break;case"ArrowUp":z(e);break;case"Home":e.preventDefault(),P(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(Xm);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:Ah},l),Eh(e,e=>a.createElement(nh.Provider,{value:E},a.createElement(th.Provider,{value:A},e))))}),ih=a.forwardRef((e,t)=>{var r,n;let o=Hc(),s=a.useRef(null),i=a.useContext(oh),c=rh(),l=yh(e),d=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;bh(()=>{if(!d)return c.item(o,null==i?void 0:i.id)},[d]);let u=Sh(o,s,[e.value,e.children,s],e.keywords),f=ah(),p=xh(e=>e.value&&e.value===u.current),m=xh(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(Xm,h),()=>t.removeEventListener(Xm,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:x,...S}=e;return a.createElement(Qc.div,{ref:Us(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)}),ch=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:o,...s}=e,i=Hc(),c=a.useRef(null),l=a.useRef(null),d=Hc(),u=rh(),f=xh(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));bh(()=>u.group(i),[]),Sh(i,c,[e.value,e.heading,l]);let p=a.useMemo(()=>({id:i,forceMount:o}),[o]);return a.createElement(Qc.div,{ref:Us(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),Eh(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(oh.Provider,{value:p},e))))}),lh=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,o=a.useRef(null),s=xh(e=>!e.search);return r||s?a.createElement(Qc.div,{ref:Us(o,t),...n,"cmdk-separator":"",role:"separator"}):null}),dh=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,o=null!=e.value,s=ah(),i=xh(e=>e.search),c=xh(e=>e.selectedItemId),l=rh();return a.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),a.createElement(Qc.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)}})}),uh=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...o}=e,s=a.useRef(null),i=a.useRef(null),c=xh(e=>e.selectedItemId),l=rh();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(Qc.div,{ref:Us(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:l.listId},Eh(e,e=>a.createElement("div",{ref:Us(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),fh=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:o,contentClassName:s,container:i,...c}=e;return a.createElement(eu,{open:r,onOpenChange:n},a.createElement(ru,{container:i},a.createElement(nu,{"cmdk-overlay":"",className:o}),a.createElement(au,{"aria-label":e.label,"cmdk-dialog":"",className:s},a.createElement(sh,{ref:t,...c}))))}),ph=a.forwardRef((e,t)=>xh(e=>0===e.filtered.count)?a.createElement(Qc.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mh=a.forwardRef((e,t)=>{let{progress:r,children:n,label:o="Loading...",...s}=e;return a.createElement(Qc.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Eh(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),hh=Object.assign(sh,{List:uh,Item:ih,Input:dh,Group:ch,Separator:lh,Dialog:fh,Empty:ph,Loading:mh});function gh(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function vh(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function yh(e){let t=a.useRef(e);return bh(()=>{t.current=e}),t}var bh="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function wh(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function xh(e){let t=ah(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Sh(e,t,r,n=[]){let o=a.useRef(),s=rh();return bh(()=>{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(Qm,i),o.current=i}),o}var kh=()=>{let[e,t]=a.useState(),r=wh(()=>new Map);return bh(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Eh({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 Ah={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ch=a.forwardRef(({className:t,...r},n)=>e.jsx(hh,{ref:n,className:Pc("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Ch.displayName=hh.displayName;const jh=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(gu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(hh.Input,{ref:n,className:Pc("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})]}));jh.displayName=hh.Input.displayName;const Th=a.forwardRef(({className:t,...r},n)=>e.jsx(hh.List,{ref:n,className:Pc("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));Th.displayName=hh.List.displayName;a.forwardRef((t,r)=>e.jsx(hh.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=hh.Empty.displayName;const _h=a.forwardRef(({className:t,...r},n)=>e.jsx(hh.Group,{ref:n,className:Pc("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}));_h.displayName=hh.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(hh.Separator,{ref:n,className:Pc("-mx-1 h-px bg-border",t),...r})).displayName=hh.Separator.displayName;const Nh=a.forwardRef(({className:t,...r},n)=>e.jsx(hh.Item,{ref:n,className:Pc("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}));Nh.displayName=hh.Item.displayName;const Rh=["top","right","bottom","left"],Oh=Math.min,Ph=Math.max,Dh=Math.round,Ih=Math.floor,Uh=e=>({x:e,y:e}),Mh={left:"right",right:"left",bottom:"top",top:"bottom"},zh={start:"end",end:"start"};function Fh(e,t,r){return Ph(e,Oh(t,r))}function Lh(e,t){return"function"==typeof e?e(t):e}function $h(e){return e.split("-")[0]}function Wh(e){return e.split("-")[1]}function Bh(e){return"x"===e?"y":"x"}function Vh(e){return"y"===e?"height":"width"}const Gh=new Set(["top","bottom"]);function Kh(e){return Gh.has($h(e))?"y":"x"}function Hh(e){return Bh(Kh(e))}function Zh(e){return e.replace(/start|end/g,e=>zh[e])}const Jh=["left","right"],qh=["right","left"],Yh=["top","bottom"],Xh=["bottom","top"];function Qh(e,t,r,n){const a=Wh(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?qh:Jh:t?Jh:qh;case"left":case"right":return t?Yh:Xh;default:return[]}}($h(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Zh)))),o}function eg(e){return e.replace(/left|right|bottom|top/g,e=>Mh[e])}function tg(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function rg(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function ng(e,t,r){let{reference:n,floating:a}=e;const o=Kh(t),s=Hh(t),i=Vh(s),c=$h(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(Wh(t)){case"start":p[s]-=f*(r&&l?-1:1);break;case"end":p[s]+=f*(r&&l?-1:1)}return p}async function ag(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}=Lh(t,e),m=tg(p),h=i[f?"floating"===u?"reference":"floating":u],g=rg(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(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,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(i.floating)),b=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=rg(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:y,strategy:c}):v);return{top:(g.top-w.top+m.top)/b.y,bottom:(w.bottom-g.bottom+m.bottom)/b.y,left:(g.left-w.left+m.left)/b.x,right:(w.right-g.right+m.right)/b.x}}function og(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function sg(e){return Rh.some(t=>e[t]>=0)}const ig=new Set(["left","top"]);function cg(){return"undefined"!=typeof window}function lg(e){return fg(e)?(e.nodeName||"").toLowerCase():"#document"}function dg(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function ug(e){var t;return null==(t=(fg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function fg(e){return!!cg()&&(e instanceof Node||e instanceof dg(e).Node)}function pg(e){return!!cg()&&(e instanceof Element||e instanceof dg(e).Element)}function mg(e){return!!cg()&&(e instanceof HTMLElement||e instanceof dg(e).HTMLElement)}function hg(e){return!(!cg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof dg(e).ShadowRoot)}const gg=new Set(["inline","contents"]);function vg(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=_g(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!gg.has(a)}const yg=new Set(["table","td","th"]);function bg(e){return yg.has(lg(e))}const wg=[":popover-open",":modal"];function xg(e){return wg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Sg=["transform","translate","scale","rotate","perspective"],kg=["transform","translate","scale","rotate","perspective","filter"],Eg=["paint","layout","strict","content"];function Ag(e){const t=Cg(),r=pg(e)?_g(e):e;return Sg.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||kg.some(e=>(r.willChange||"").includes(e))||Eg.some(e=>(r.contain||"").includes(e))}function Cg(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const jg=new Set(["html","body","#document"]);function Tg(e){return jg.has(lg(e))}function _g(e){return dg(e).getComputedStyle(e)}function Ng(e){return pg(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rg(e){if("html"===lg(e))return e;const t=e.assignedSlot||e.parentNode||hg(e)&&e.host||ug(e);return hg(t)?t.host:t}function Og(e){const t=Rg(e);return Tg(t)?e.ownerDocument?e.ownerDocument.body:e.body:mg(t)&&vg(t)?t:Og(t)}function Pg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=Og(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),s=dg(a);if(o){const e=Dg(s);return t.concat(s,s.visualViewport||[],vg(a)?a:[],e&&r?Pg(e):[])}return t.concat(a,Pg(a,[],r))}function Dg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ig(e){const t=_g(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=mg(e),o=a?e.offsetWidth:r,s=a?e.offsetHeight:n,i=Dh(r)!==o||Dh(n)!==s;return i&&(r=o,n=s),{width:r,height:n,$:i}}function Ug(e){return pg(e)?e:e.contextElement}function Mg(e){const t=Ug(e);if(!mg(t))return Uh(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Ig(t);let s=(o?Dh(r.width):r.width)/n,i=(o?Dh(r.height):r.height)/a;return s&&Number.isFinite(s)||(s=1),i&&Number.isFinite(i)||(i=1),{x:s,y:i}}const zg=Uh(0);function Fg(e){const t=dg(e);return Cg()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:zg}function Lg(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=Ug(e);let s=Uh(1);t&&(n?pg(n)&&(s=Mg(n)):s=Mg(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==dg(e))&&t}(o,r,n)?Fg(o):Uh(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=dg(o),t=n&&pg(n)?dg(n):n;let r=e,a=Dg(r);for(;a&&n&&t!==r;){const e=Mg(a),t=a.getBoundingClientRect(),n=_g(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=dg(a),a=Dg(r)}}return rg({width:d,height:u,x:c,y:l})}function $g(e,t){const r=Ng(e).scrollLeft;return t?t.left+r:Lg(ug(e)).left+r}function Wg(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-$g(e,r),y:r.top+t.scrollTop}}const Bg=new Set(["absolute","fixed"]);function Vg(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=dg(e),n=ug(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=Cg();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,c=a.offsetTop)}const l=$g(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=ug(e),r=Ng(e),n=e.ownerDocument.body,a=Ph(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Ph(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+$g(e);const i=-r.scrollTop;return"rtl"===_g(n).direction&&(s+=Ph(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:s,y:i}}(ug(e));else if(pg(t))n=function(e,t){const r=Lg(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=mg(e)?Mg(e):Uh(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=Fg(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return rg(n)}function Gg(e,t){const r=Rg(e);return!(r===t||!pg(r)||Tg(r))&&("fixed"===_g(r).position||Gg(r,t))}function Kg(e,t,r){const n=mg(t),a=ug(t),o="fixed"===r,s=Lg(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const c=Uh(0);function l(){c.x=$g(a)}if(n||!n&&!o)if(("body"!==lg(t)||vg(a))&&(i=Ng(t)),n){const e=Lg(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?Uh(0):Wg(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 Hg(e){return"static"===_g(e).position}function Zg(e,t){if(!mg(e)||"fixed"===_g(e).position)return null;if(t)return t(e);let r=e.offsetParent;return ug(e)===r&&(r=r.ownerDocument.body),r}function Jg(e,t){const r=dg(e);if(xg(e))return r;if(!mg(e)){let t=Rg(e);for(;t&&!Tg(t);){if(pg(t)&&!Hg(t))return t;t=Rg(t)}return r}let n=Zg(e,t);for(;n&&bg(n)&&Hg(n);)n=Zg(n,t);return n&&Tg(n)&&Hg(n)&&!Ag(n)?r:n||function(e){let t=Rg(e);for(;mg(t)&&!Tg(t);){if(Ag(t))return t;if(xg(t))return null;t=Rg(t)}return null}(e)||r}const qg={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,s=ug(n),i=!!t&&xg(t.floating);if(n===s||i&&o)return r;let c={scrollLeft:0,scrollTop:0},l=Uh(1);const d=Uh(0),u=mg(n);if((u||!u&&!o)&&(("body"!==lg(n)||vg(s))&&(c=Ng(n)),mg(n))){const e=Lg(n);l=Mg(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!s||u||o?Uh(0):Wg(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:ug,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?xg(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Pg(e,[],!1).filter(e=>pg(e)&&"body"!==lg(e)),a=null;const o="fixed"===_g(e).position;let s=o?Rg(e):e;for(;pg(s)&&!Tg(s);){const t=_g(s),r=Ag(s);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&Bg.has(a.position)||vg(s)&&!r&&Gg(e,s))?n=n.filter(e=>e!==s):a=t,s=Rg(s)}return t.set(e,n),n}(t,this._c):[].concat(r),n],s=o[0],i=o.reduce((e,r)=>{const n=Vg(t,r,a);return e.top=Ph(n.top,e.top),e.right=Oh(n.right,e.right),e.bottom=Oh(n.bottom,e.bottom),e.left=Ph(n.left,e.left),e},Vg(t,s,a));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}},getOffsetParent:Jg,getElementRects:async function(e){const t=this.getOffsetParent||Jg,r=this.getDimensions,n=await r(e.floating);return{reference:Kg(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}=Ig(e);return{width:t,height:r}},getScale:Mg,isElement:pg,isRTL:function(e){return"rtl"===_g(e).direction}};function Yg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xg(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=Ug(e),d=a||o?[...l?Pg(l):[],...Pg(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=ug(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:-Ih(u)+"px "+-Ih(a.clientWidth-(d+f))+"px "+-Ih(a.clientHeight-(u+p))+"px "+-Ih(d)+"px",threshold:Ph(0,Oh(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||Yg(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?Lg(e):null;return c&&function t(){const n=Lg(e);h&&!Yg(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 Qg=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=$h(r),i=Wh(r),c="y"===Kh(r),l=ig.has(s)?-1:1,d=o&&c?-1:1,u=Lh(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}}}}},ev=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}=Lh(e,t),l={x:r,y:n},d=await ag(t,c),u=Kh($h(a)),f=Bh(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=Fh(p+d["y"===f?"top":"left"],p,p-d[e])}if(s){const e="y"===u?"bottom":"right";m=Fh(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}}}}}},tv=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}=Lh(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=$h(a),y=Kh(i),b=$h(i)===i,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(b||!h?[eg(i)]:function(e){const t=eg(e);return[Zh(e),t,Zh(t)]}(i)),S="none"!==m;!f&&S&&x.push(...Qh(i,h,m,w));const k=[i,...x],E=await ag(t,g),A=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&A.push(E[v]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Wh(e),a=Hh(e),o=Vh(a);let s="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=eg(s)),[s,eg(s)]}(a,s,w);A.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:a,overflows:A}],!A.every(e=>e<=0)){var j,T;const e=((null==(j=o.flip)?void 0:j.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==Kh(t))||C.every(e=>Kh(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(T=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:T.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=C.filter(e=>{if(S){const t=Kh(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},rv=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:s,elements:i}=t,{apply:c=()=>{},...l}=Lh(e,t),d=await ag(t,l),u=$h(a),f=Wh(a),p="y"===Kh(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 y=h-d.top-d.bottom,b=m-d.left-d.right,w=Oh(h-d[g],y),x=Oh(m-d[v],b),S=!t.middlewareData.shift;let k=w,E=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(E=b),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=Ph(d.left,0),t=Ph(d.right,0),r=Ph(d.top,0),n=Ph(d.bottom,0);p?E=m-2*(0!==e||0!==t?e+t:Ph(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Ph(d.top,d.bottom))}await c({...t,availableWidth:E,availableHeight:k});const A=await s.getDimensions(i.floating);return m!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}},nv=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=Lh(e,t);switch(n){case"referenceHidden":{const e=og(await ag(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:sg(e)}}}case"escaped":{const e=og(await ag(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:sg(e)}}}default:return{}}}}},av=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}=Lh(e,t)||{};if(null==l)return{};const u=tg(d),f={x:r,y:n},p=Hh(a),m=Vh(p),h=await s.getDimensions(l),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=f[p]-o.reference[p],S=await(null==s.getOffsetParent?void 0:s.getOffsetParent(l));let k=S?S[b]:0;k&&await(null==s.isElement?void 0:s.isElement(S))||(k=i.floating[b]||o.floating[m]);const E=w/2-x/2,A=k/2-h[m]/2-1,C=Oh(u[v],A),j=Oh(u[y],A),T=C,_=k-h[m]-j,N=k/2-h[m]/2+E,R=Fh(T,N,_),O=!c.arrow&&null!=Wh(a)&&N!==R&&o.reference[m]/2-(N<T?C:j)-h[m]/2<0,P=O?N<T?N-T:N-_:0;return{[p]:f[p]+P,data:{[p]:R,centerOffset:N-R-P,...O&&{alignmentOffset:P}},reset:O}}}),ov=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}=Lh(e,t),d={x:r,y:n},u=Kh(a),f=Bh(u);let p=d[f],m=d[u];const h=Lh(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,y;const e="y"===f?"width":"height",t=ig.has($h(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==(y=s.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},sv=(e,t,r)=>{const n=new Map,a={platform:qg,...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}=ng(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:y,reset:b}=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],...y}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(l=!0===b.rects?await s.getElementRects({reference:e,floating:t,strategy:a}):b.rects),({x:d,y:u}=ng(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var iv="undefined"!=typeof document?t.useLayoutEffect:function(){};function cv(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(!cv(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)&&!cv(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function lv(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function dv(e,t){const r=lv(e);return Math.round(t*r)/r}function uv(e){const t=a.useRef(e);return iv(()=>{t.current=e}),t}const fv=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?av({element:r.current,padding:n}).fn(t):{}:r?av({element:r,padding:n}).fn(t):{};var a}}),pv=(e,t)=>({...Qg(e),options:[e,t]}),mv=(e,t)=>({...ev(e),options:[e,t]}),hv=(e,t)=>({...ov(e),options:[e,t]}),gv=(e,t)=>({...tv(e),options:[e,t]}),vv=(e,t)=>({...rv(e),options:[e,t]}),yv=(e,t)=>({...nv(e),options:[e,t]}),bv=(e,t)=>({...fv(e),options:[e,t]});var wv=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:o=5,...s}=t;return e.jsx(Qc.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"})})});wv.displayName="Arrow";var xv=wv,Sv="Popper",[kv,Ev]=Bc(Sv),[Av,Cv]=kv(Sv),jv=t=>{const{__scopePopper:r,children:n}=t,[o,s]=a.useState(null);return e.jsx(Av,{scope:r,anchor:o,onAnchorChange:s,children:n})};jv.displayName=Sv;var Tv="PopperAnchor",_v=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:o,...s}=t,i=Cv(Tv,n),c=a.useRef(null),l=Ms(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(Qc.div,{...s,ref:l})});_v.displayName=Tv;var Nv="PopperContent",[Rv,Ov]=kv(Nv),Pv=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,...y}=t,b=Cv(Nv,n),[w,x]=a.useState(null),S=Ms(r,e=>x(e)),[k,E]=a.useState(null),A=pf(k),C=A?.width??0,j=A?.height??0,T=s+("center"!==c?"-"+c:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},N=Array.isArray(f)?f:[f],R=N.length>0,O={padding:_,boundary:N.filter(Mv),altBoundary:R},{refs:P,floatingStyles:D,placement:I,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);cv(m,n)||h(n);const[g,v]=a.useState(null),[y,b]=a.useState(null),w=a.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),x=a.useCallback(e=>{e!==A.current&&(A.current=e,b(e))},[]),S=i||g,k=c||y,E=a.useRef(null),A=a.useRef(null),C=a.useRef(f),j=null!=d,T=uv(d),_=uv(s),N=uv(u),R=a.useCallback(()=>{if(!E.current||!A.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),sv(E.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==N.current};O.current&&!cv(C.current,t)&&(C.current=t,o.flushSync(()=>{p(t)}))})},[m,t,r,_,N]);iv(()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const O=a.useRef(!1);iv(()=>(O.current=!0,()=>{O.current=!1}),[]),iv(()=>{if(S&&(E.current=S),k&&(A.current=k),S&&k){if(T.current)return T.current(S,k,R);R()}},[S,k,R,T,j]);const P=a.useMemo(()=>({reference:E,floating:A,setReference:w,setFloating:x}),[w,x]),D=a.useMemo(()=>({reference:S,floating:k}),[S,k]),I=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=dv(D.floating,f.x),n=dv(D.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...lv(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,D.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:P,elements:D,floatingStyles:I}),[f,R,P,D,I])}({strategy:"fixed",placement:T,whileElementsMounted:(...e)=>Xg(...e,{animationFrame:"always"===g}),elements:{reference:b.anchor},middleware:[pv({mainAxis:i+j,alignmentAxis:l}),u&&mv({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?hv():void 0,...O}),u&&gv({...O}),vv({...O,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&&bv({element:k,padding:d}),zv({arrowWidth:C,arrowHeight:j}),h&&yv({strategy:"referenceHidden",...O})]}),[z,F]=Fv(I),L=Ps(v);Ds(()=>{U&&L?.()},[U,L]);const $=M.arrow?.x,W=M.arrow?.y,B=0!==M.arrow?.centerOffset,[V,G]=a.useState();return Ds(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),e.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:U?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(Rv,{scope:n,placedSide:z,onArrowChange:E,arrowX:$,arrowY:W,shouldHideArrow:B,children:e.jsx(Qc.div,{"data-side":z,"data-align":F,...y,ref:S,style:{...y.style,animation:U?void 0:"none"}})})})});Pv.displayName=Nv;var Dv="PopperArrow",Iv={top:"bottom",right:"left",bottom:"top",left:"right"},Uv=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,o=Ov(Dv,n),s=Iv[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(xv,{...a,ref:r,style:{...a.style,display:"block"}})})});function Mv(e){return null!==e}Uv.displayName=Dv;var zv=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]=Fv(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 Fv(e){const[t,r="center"]=e.split("-");return[t,r]}var Lv=jv,$v=_v,Wv=Pv,Bv=Uv;function Vv(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?Us(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 Gv=Symbol("radix.slottable");function Kv(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Gv}var Hv="Popover",[Zv]=Bc(Hv,[Ev]),Jv=Ev(),[qv,Yv]=Zv(Hv),Xv=t=>{const{__scopePopover:r,children:n,open:o,defaultOpen:s,onOpenChange:i,modal:c=!1}=t,l=Jv(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=Jc({prop:o,defaultProp:s??!1,onChange:i,caller:Hv});return e.jsx(Lv,{...l,children:e.jsx(qv,{scope:r,contentId:Hc(),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})})};Xv.displayName=Hv;var Qv="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...o}=t,s=Yv(Qv,n),i=Jv(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=s;return a.useEffect(()=>(c(),()=>l()),[c,l]),e.jsx($v,{...i,...o,ref:r})}).displayName=Qv;var ey="PopoverTrigger",ty=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=Yv(ey,n),s=Jv(n),i=Ms(r,o.triggerRef),c=e.jsx(Qc.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":py(o.open),...a,ref:i,onClick:Wc(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:e.jsx($v,{asChild:!0,...s,children:c})});ty.displayName=ey;var ry="PopoverPortal",[ny,ay]=Zv(ry,{forceMount:void 0}),oy=t=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=t,s=Yv(ry,r);return e.jsx(ny,{scope:r,forceMount:n,children:e.jsx(bl,{present:n||s.open,children:e.jsx(yl,{asChild:!0,container:o,children:a})})})};oy.displayName=ry;var sy="PopoverContent",iy=a.forwardRef((t,r)=>{const n=ay(sy,t.__scopePopover),{forceMount:a=n.forceMount,...o}=t,s=Yv(sy,t.__scopePopover);return e.jsx(bl,{present:a||s.open,children:s.modal?e.jsx(ly,{...o,ref:r}):e.jsx(dy,{...o,ref:r})})});iy.displayName=sy;var cy=function(t){const r=Vv(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Kv);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"),ly=a.forwardRef((t,r)=>{const n=Yv(sy,t.__scopePopover),o=a.useRef(null),s=Ms(r,o),i=a.useRef(!1);return a.useEffect(()=>{const e=o.current;if(e)return vd(e)},[]),e.jsx(dd,{as:cy,allowPinchZoom:!0,children:e.jsx(uy,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Wc(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Wc(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:Wc(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),dy=a.forwardRef((t,r)=>{const n=Yv(sy,t.__scopePopover),o=a.useRef(!1),s=a.useRef(!1);return e.jsx(uy,{...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()}})}),uy=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=Yv(sy,n),m=Jv(n);return Sl(),e.jsx(ul,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:s,children:e.jsx(ol,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(Wv,{"data-state":py(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)"}})})})}),fy="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=Yv(fy,n);return e.jsx(Qc.button,{type:"button",...a,ref:r,onClick:Wc(t.onClick,()=>o.onOpenChange(!1))})}).displayName=fy;function py(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,o=Jv(n);return e.jsx(Bv,{...o,...a,ref:r})}).displayName="PopoverArrow";var my=oy,hy=iy;const gy=Xv,vy=ty,yy=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...o},s)=>{const{container:i}=a.useContext(ce);return e.jsx(my,{container:i,children:e.jsx(hy,{ref:s,align:r,sideOffset:n,className:Pc("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})})});yy.displayName=hy.displayName;const by={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"},wy={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"},xy=[{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=wy[e.code]||"USD",r=by[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 Sy(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=xy.find(e=>e.value==n);return e.jsxs(gy,{open:o,onOpenChange:s,children:[e.jsx(vy,{asChild:!0,children:e.jsxs($c,{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(ro,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(yy,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Ch,{children:[e.jsx(jh,{placeholder:"Choose country..."}),e.jsx(Th,{children:e.jsx(_h,{children:xy.map(t=>e.jsxs(Nh,{className:Pc("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(to,{className:Pc("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 ky=xy.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),Ey=Array.from(new Set(ky.map(e=>e.value))).map(e=>ky.find(t=>t.value===e)).filter(e=>void 0!==e);function Ay(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=Ey.find(e=>e.value==n);return e.jsxs(gy,{open:o,onOpenChange:s,children:[e.jsx(vy,{asChild:!0,children:e.jsxs($c,{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(ro,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(yy,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Ch,{children:[e.jsx(jh,{placeholder:"Choose currency..."}),e.jsx(Th,{children:e.jsx(_h,{children:Ey.map(t=>e.jsxs(Nh,{className:Pc("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(to,{className:Pc("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 Cy=[{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:"🇮🇱"}];Cy=Cy.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),Cy.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const jy=Cy.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 Ty(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=jy.find(e=>e.value==n);return e.jsxs(gy,{open:o,onOpenChange:s,children:[e.jsx(vy,{asChild:!0,children:e.jsxs($c,{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(ro,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(yy,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Ch,{children:[e.jsx(jh,{placeholder:"Choose timezone..."}),e.jsx(Th,{children:e.jsx(_h,{children:jy.map(t=>e.jsxs(Nh,{className:Pc("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(to,{className:Pc("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 _y=[{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 Ny(r){const[n,a]=t.useState(r.value||""),[o,s]=t.useState(!1),i=_y.find(e=>e.value==n);return e.jsxs(gy,{open:o,onOpenChange:s,children:[e.jsx(vy,{asChild:!0,children:e.jsxs($c,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[i?.text||"Choose timezone",e.jsx(ro,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(yy,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Ch,{children:[e.jsx(jh,{placeholder:"Choose timezone..."}),e.jsx(Th,{children:e.jsx(_h,{children:_y.map(t=>e.jsxs(Nh,{className:Pc("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(to,{className:Pc("mr-2 h-4 w-4 text-green-400",n===t.value?"opacity-100":"opacity-0")}),String(t.text).trim()]},t.value))})})]})})]})}const Ry=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=ow(),[o,s]=t.useState(!1),[i,c]=t.useState(),[l,d]=t.useState(0),u=Mt({resolver:Ka(ms({name:$o().min(2,{message:"Name must be at least 2 characters."}),country:$o().optional(),timezone:$o().optional(),language:$o().optional(),currency:$o().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),u.setValue("name",e.name),u.setValue("country",e.country),u.setValue("timezone",e.timezone),u.setValue("language",e.language),u.setValue("currency",e.currency)})},[l]),i?e.jsxs("div",{children:[e.jsx("div",{className:"space-y-4",children:e.jsx(Nu,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(async function(e){s(!0),await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),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(Lu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Ou,{disabled:o,control:u.control,name:"name",render:({field:t})=>e.jsxs(Iu,{children:[e.jsx(Uu,{children:"Name"}),e.jsx(Mu,{children:e.jsx(Lu,{...t})}),e.jsx(Fu,{})]})}),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(Ty,{value:u.getValues("language"),onChange:e=>{u.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(Sy,{value:u.getValues("country"),onChange:e=>{u.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(Ay,{value:u.getValues("currency"),onChange:e=>{u.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(Ny,{value:u.getValues("timezone"),onChange:e=>{u.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx($c,{type:"submit",progress:o,disabled:o,children:"Save"}),e.jsx($c,{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(Sm,{})};function Oy(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?Us(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 Py=Symbol("radix.slottable");function Dy(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Py}var Iy=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(Qc.span,{...t,ref:r,style:{...Iy,...t.style}})).displayName="VisuallyHidden";var Uy=[" ","Enter","ArrowUp","ArrowDown"],My=[" ","Enter"],zy="Select",[Fy,Ly,$y]=Gu(zy),[Wy]=Bc(zy,[$y,Ev]),By=Ev(),[Vy,Gy]=Wy(zy),[Ky,Hy]=Wy(zy),Zy=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=By(r),[y,b]=a.useState(null),[w,x]=a.useState(null),[S,k]=a.useState(!1),E=Hu(u),[A,C]=Jc({prop:o,defaultProp:s??!1,onChange:i,caller:zy}),[j,T]=Jc({prop:c,defaultProp:l,onChange:d,caller:zy}),_=a.useRef(null),N=!y||(g||!!y.closest("form")),[R,O]=a.useState(new Set),P=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(Lv,{...v,children:e.jsxs(Vy,{required:h,scope:r,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Hc(),value:j,onValueChange:T,open:A,onOpenChange:C,dir:E,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(Fy.Provider,{scope:r,children:e.jsx(Ky,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{O(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{O(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),N?e.jsxs(Ob,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:j,onChange:e=>T(e.target.value),disabled:m,form:g,children:[void 0===j?e.jsx("option",{value:""}):null,Array.from(R)]},P):null]})})};Zy.displayName=zy;var Jy="SelectTrigger",qy=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:o=!1,...s}=t,i=By(n),c=Gy(Jy,n),l=c.disabled||o,d=Ms(r,c.onTriggerChange),u=Ly(n),f=a.useRef("touch"),[p,m,h]=Db(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=Ib(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($v,{asChild:!0,...i,children:e.jsx(Qc.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":Pb(c.value)?"":void 0,...s,ref:d,onClick:Wc(s.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Wc(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:Wc(s.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Uy.includes(e.key)&&(g(),e.preventDefault())})})})});qy.displayName=Jy;var Yy="SelectValue",Xy=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:o,children:s,placeholder:i="",...c}=t,l=Gy(Yy,n),{onValueNodeHasChildrenChange:d}=l,u=void 0!==s,f=Ms(r,l.onValueNodeChange);return Ds(()=>{d(u)},[d,u]),e.jsx(Qc.span,{...c,ref:f,style:{pointerEvents:"none"},children:Pb(l.value)?e.jsx(e.Fragment,{children:i}):s})});Xy.displayName=Yy;var Qy=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...o}=t;return e.jsx(Qc.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});Qy.displayName="SelectIcon";var eb=t=>e.jsx(yl,{asChild:!0,...t});eb.displayName="SelectPortal";var tb="SelectContent",rb=a.forwardRef((t,r)=>{const n=Gy(tb,t.__scopeSelect),[s,i]=a.useState();if(Ds(()=>{i(new DocumentFragment)},[]),!n.open){const r=s;return r?o.createPortal(e.jsx(ab,{scope:t.__scopeSelect,children:e.jsx(Fy.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(ib,{...t,ref:r})});rb.displayName=tb;var nb=10,[ab,ob]=Wy(tb),sb=function(t){const r=Oy(t),n=a.forwardRef((t,n)=>{const{children:o,...s}=t,i=a.Children.toArray(o),c=i.find(Dy);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"),ib=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:y,...b}=t,w=Gy(tb,n),[x,S]=a.useState(null),[k,E]=a.useState(null),A=Ms(r,e=>S(e)),[C,j]=a.useState(null),[T,_]=a.useState(null),N=Ly(n),[R,O]=a.useState(!1),P=a.useRef(!1);a.useEffect(()=>{if(x)return vd(x)},[x]),Sl();const D=a.useCallback(e=>{const[t,...r]=N().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}},[N,k]),I=a.useCallback(()=>D([C,x]),[D,C,x]);a.useEffect(()=>{R&&I()},[R,I]);const{onOpenChange:U,triggerPointerDownPosRef:M}=w;a.useEffect(()=>{if(x){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():x.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})}}},[x,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[z,F]=Db(e=>{const t=N().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Ib(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!P.current&&!r;(void 0!==w.value&&w.value===t||n)&&(j(e),n&&(P.current=!0))},[w.value]),$=a.useCallback(()=>x?.focus(),[x]),W=a.useCallback((e,t,r)=>{const n=!P.current&&!r;(void 0!==w.value&&w.value===t||n)&&_(e)},[w.value]),B="popper"===o?lb:cb,V=B===lb?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return e.jsx(ab,{scope:n,content:x,viewport:k,onViewportChange:E,itemRefCallback:L,selectedItem:C,onItemLeave:$,itemTextRefCallback:W,focusSelectedItem:I,selectedItemText:T,position:o,isPositioned:R,searchRef:z,children:e.jsx(dd,{as:sb,allowPinchZoom:!0,children:e.jsx(ul,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Wc(s,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(ol,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:e.jsx(B,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...V,onPlaced:()=>O(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Wc(b.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||F(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});ib.displayName="SelectContentImpl";var cb=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:o,...s}=t,i=Gy(tb,n),c=ob(tb,n),[l,d]=a.useState(null),[u,f]=a.useState(null),p=Ms(r,e=>f(e)),m=Ly(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=c,x=a.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&v&&y&&b){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=b.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-nb,u=$f(o,[nb,Math.max(nb,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-nb,u=$f(o,[nb,Math.max(nb,d-c)]);l.style.minWidth=i+"px",l.style.right=u+"px"}const a=m(),s=window.innerHeight-2*nb,c=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),S=window.getComputedStyle(v),k=parseInt(S.paddingTop,10),E=parseInt(S.paddingBottom,10),A=e.top+e.height/2-nb,C=s-A,j=y.offsetHeight/2,T=f+p+(y.offsetTop+j),_=w-T;if(T<=A){const e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-v.offsetTop-v.offsetHeight,r=T+Math.max(C,j+(e?E:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;l.style.top="0px";const t=Math.max(A,f+v.offsetTop+(e?k:0)+j)+_;l.style.height=t+"px",v.scrollTop=T-A+v.offsetTop}l.style.margin=`${nb}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=s+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,v,y,b,i.dir,o]);Ds(()=>x(),[x]);const[S,k]=a.useState();Ds(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const E=a.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return e.jsx(db,{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(Qc.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});cb.displayName="SelectItemAlignedPosition";var lb=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=nb,...s}=t,i=By(n);return e.jsx(Wv,{...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)"}})});lb.displayName="SelectPopperPosition";var[db,ub]=Wy(tb,{}),fb="SelectViewport",pb=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:o,...s}=t,i=ob(fb,n),c=ub(fb,n),l=Ms(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(Fy.Slot,{scope:n,children:e.jsx(Qc.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Wc(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*nb,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})})})]})});pb.displayName=fb;var mb="SelectGroup",[hb,gb]=Wy(mb);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=Hc();return e.jsx(hb,{scope:n,id:o,children:e.jsx(Qc.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=mb;var vb="SelectLabel",yb=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=gb(vb,n);return e.jsx(Qc.div,{id:o.id,...a,ref:r})});yb.displayName=vb;var bb="SelectItem",[wb,xb]=Wy(bb),Sb=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:o,disabled:s=!1,textValue:i,...c}=t,l=Gy(bb,n),d=ob(bb,n),u=l.value===o,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Ms(r,e=>d.itemRefCallback?.(e,o,s)),v=Hc(),y=a.useRef("touch"),b=()=>{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(wb,{scope:n,value:o,disabled:s,textId:v,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(Fy.ItemSlot,{scope:n,value:o,disabled:s,textValue:f,children:e.jsx(Qc.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:Wc(c.onFocus,()=>h(!0)),onBlur:Wc(c.onBlur,()=>h(!1)),onClick:Wc(c.onClick,()=>{"mouse"!==y.current&&b()}),onPointerUp:Wc(c.onPointerUp,()=>{"mouse"===y.current&&b()}),onPointerDown:Wc(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:Wc(c.onPointerMove,e=>{y.current=e.pointerType,s?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Wc(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Wc(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(My.includes(e.key)&&b()," "===e.key&&e.preventDefault())})})})})});Sb.displayName=bb;var kb="SelectItemText",Eb=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:s,style:i,...c}=t,l=Gy(kb,n),d=ob(kb,n),u=xb(kb,n),f=Hy(kb,n),[p,m]=a.useState(null),h=Ms(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:y,onNativeOptionRemove:b}=f;return Ds(()=>(y(v),()=>b(v)),[y,b,v]),e.jsxs(e.Fragment,{children:[e.jsx(Qc.span,{id:u.textId,...c,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?o.createPortal(c.children,l.valueNode):null]})});Eb.displayName=kb;var Ab="SelectItemIndicator",Cb=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return xb(Ab,n).isSelected?e.jsx(Qc.span,{"aria-hidden":!0,...a,ref:r}):null});Cb.displayName=Ab;var jb="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=ob(jb,t.__scopeSelect),o=ub(jb,t.__scopeSelect),[s,i]=a.useState(!1),c=Ms(r,o.onScrollButtonChange);return Ds(()=>{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(_b,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=jb;var Tb="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=ob(Tb,t.__scopeSelect),o=ub(Tb,t.__scopeSelect),[s,i]=a.useState(!1),c=Ms(r,o.onScrollButtonChange);return Ds(()=>{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(_b,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=Tb;var _b=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:o,...s}=t,i=ob("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]),Ds(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e.jsx(Qc.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:Wc(s.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:Wc(s.onPointerMove,()=>{i.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:Wc(s.onPointerLeave,()=>{d()})})}),Nb=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Qc.div,{"aria-hidden":!0,...a,ref:r})});Nb.displayName="SelectSeparator";var Rb="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,o=By(n),s=Gy(Rb,n),i=ob(Rb,n);return s.open&&"popper"===i.position?e.jsx(Bv,{...o,...a,ref:r}):null}).displayName=Rb;var Ob=a.forwardRef(({__scopeSelect:t,value:r,...n},o)=>{const s=a.useRef(null),i=Ms(o,s),c=mf(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(Qc.select,{...n,style:{...Iy,...n.style},ref:i,defaultValue:r})});function Pb(e){return""===e||void 0===e}function Db(e){const t=Ps(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 Ib(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}Ob.displayName="SelectBubbleInput";var Ub=qy,Mb=Qy,zb=eb,Fb=rb,Lb=pb,$b=yb,Wb=Sb,Bb=Eb,Vb=Cb,Gb=Nb;const Kb=Zy,Hb=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Ub,{ref:a,className:Pc("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(Mb,{asChild:!0,children:e.jsx(du,{className:"h-4 w-4 opacity-50"})})]}));Hb.displayName=Ub.displayName;const Zb=a.forwardRef(({className:t,children:r,position:n="popper",...o},s)=>{const{container:i}=a.useContext(ce);return e.jsx(zb,{container:i,children:e.jsx(Fb,{ref:s,className:Pc("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(Lb,{className:Pc("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Zb.displayName=Fb.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx($b,{ref:n,className:Pc("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=$b.displayName;const Jb=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Wb,{ref:a,className:Pc("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(Vb,{children:e.jsx(fu,{className:"h-4 w-4"})})}),e.jsx(Bb,{children:r})]}));Jb.displayName=Wb.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Gb,{ref:n,className:Pc("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=Gb.displayName;const qb=({workspace:r})=>{const n=ne(e=>e.auth.session?.user||null),[a,o]=t.useState(0),[s,i]=t.useState(!1),[l,d]=t.useState([]),{getUsers:u,removeUser:f,updateUser:p}=ow(),{settings:m}=Op();t.useEffect(()=>{r&&(i(!0),u(r._id).then(e=>{d(e)}).catch(e=>{console.error(e)}).finally(()=>{i(!1)}))},[r,a]);const h=()=>{o(e=>e+1)};if(s||!r)return e.jsx(Sm,{});const g=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},v=l.map(e=>({...e,...g(e.user)})),y=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,b="admin"===y,w=(m?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(l.length??0);return e.jsxs("div",{children:[!b&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),b&&e.jsxs("div",{className:"mb-4",children:[w&&e.jsx(Yb,{onInvite:h,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:[l.length," member",1!==l.length?"s":""]})}),e.jsx("div",{children:e.jsx($c,{variant:"ghost",size:"sm",onClick:h,progress:s,startIcon:e.jsx(so,{}),children:"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:v.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.jsx("div",{children:e.jsxs(Kb,{disabled:o||!b||s,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,o=e,void(wm(r,a)?c(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}}):p(n,a,{role:o}).then(()=>{h()}).catch(e=>{c(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:o}})}));var n,a,o},children:[e.jsx(Hb,{children:e.jsx(Xy,{placeholder:"Select a role"})}),e.jsx(Zb,{children:r?.roles.map(t=>e.jsx(Jb,{value:t,children:t},t))})]})}),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&&b&&e.jsx($c,{variant:"destructive",size:"sm",startIcon:e.jsx(po,{}),onClick:()=>{var e;e=t.id,wm(r,e)?c(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):f(r._id,e).then(()=>{h()}).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 Yb({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}=ow(),[g,v]=t.useState(null),{settings:y}=Op(),b=y?.workspace.roles??g?.roles??[];t.useEffect(()=>{n&&h(n).then(v)},[n]);const w=()=>{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(_u,{children:"Invite member by email"}),e.jsx(Lu,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(_u,{children:"Role"}),e.jsxs(Kb,{value:s,onValueChange:i,children:[e.jsx(Hb,{children:e.jsx(Xy,{placeholder:"Select a role"})}),e.jsx(Zb,{children:b.map(t=>e.jsx(Jb,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx($c,{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(()=>{w()},6e3)})):u("Invalid email address format")},disabled:c||!a||!s,children:c?"Inviting...":`Invite as ${s}`})})]})}const Xb=({workspace:t,section:r,setSection:n})=>{const a=ne(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:Pc("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(Qb,{title:"Account",children:e.jsx(ew,{activeSection:r,icon:e.jsx(ho,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(Qb,{title:"Workspace",children:[e.jsx(ew,{activeSection:r,icon:e.jsx(co,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(ew,{activeSection:r,icon:e.jsx(go,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(ew,{activeSection:r,icon:e.jsx(uo,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),o&&e.jsx(ew,{activeSection:r,icon:e.jsx(mo,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function Qb({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 ew({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e.jsxs("button",{className:Pc("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 tw=({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,y=c||m;if(!r)return null;const b=e.jsx($c,{variant:"outline",size:"icon",children:e.jsx(co,{className:"h-4 w-4"})});return e.jsxs(vu,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[l&&e.jsx(yu,{asChild:!0,children:d||b}),e.jsxs(xu,{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(Eu,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(Xb,{workspace:r,section:v,setSection:y}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(ku,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===v&&"Account","general"===v&&"Workspace Settings","users"===v&&"Workspace Members","features"===v&&"Workspace Features","danger"===v&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===v&&e.jsx(Ry,{workspace:r}),"general"===v&&e.jsx(Fm,{workspace:r}),"users"===v&&e.jsx(qb,{workspace:r}),"features"===v&&e.jsx(Um,{workspaceId:r._id?.toString()}),"danger"===v&&e.jsx(km,{workspace:r})]})]})]})]})};function rw(r){const{workspaces:n,currentWorkspace:a,loading:o,refreshing:s}=ne(e=>e.workspaces),i=ne(e=>e.auth.session?.user),{settings:c}=Op(),[l,d]=t.useState(!1),[u,f]=t.useState(0),[p,m]=t.useState(""),{fetchWorkspaces:h,getFeatures:g,refreshWorkspaces:v,setCurrentWorkspace:y,workspaces:b}=ow(),w=o||s;t.useEffect(()=>{0===b.length?(h(),g()):g()},[]),t.useEffect(()=>{u>0&&v()},[u]);const x=b.length>0?b:n,S=x.filter(e=>e._id!==a?._id).filter(e=>e.name.toLowerCase().includes(p.toLowerCase())),k=c?.workspace.maxWorkspaces??Number.MAX_VALUE,E=x?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===i?.id?.toString()).length,A=k>(E??0);return e.jsxs(vu,{open:l,onOpenChange:d,children:[e.jsx(yu,{children:r.trigger?.(w,a)}),e.jsxs(xu,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(Su,{children:[e.jsxs(ku,{className:"flex items-center gap-2",children:[e.jsx(eo,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(Eu,{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(nw,{workspace:a,isCurrentWorkspace:!0,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>d(!1),setCurrentWorkspace:y,setOpen:d,workspacesToUse:x}),e.jsx(Rp,{}),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($c,{progress:s,disabled:s,variant:"ghost",onClick:function(){f(e=>e+1)},startIcon:e.jsx(so,{}),children:s?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(io,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(Lu,{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(ao,{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(eo,{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(Ep,{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(nw,{workspace:t,isCurrentWorkspace:n,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>d(!1),setCurrentWorkspace:y,setOpen:d,workspacesToUse:x},t._id)})})})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx(Rp,{}),e.jsx(aw,{onCreated:()=>{h()}})]})]})]})]})}function nw(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:Pc("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(Dc,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(Ic,{src:n.image&&n.image.trim()?n.image:void 0})}),e.jsx(Uc,{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(go,{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($c,{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(tw,{workspace:n,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(s[e])}}})]})]});var u}function aw(r){const[n,a]=t.useState(!1),[o,s]=t.useState("emoji"),[i,c]=t.useState("🏢"),[l,d]=t.useState(!1),{createWorkspace:u}=ow(),f=Mt({resolver:Ka(ms({name:$o().min(2,{message:"Workspace name must be at least 2 characters."}),image:$o().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(vu,{open:n,onOpenChange:a,children:[e.jsx(yu,{asChild:!0,children:e.jsxs($c,{className:"w-full rounded-none",children:[e.jsx(oo,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(xu,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(Su,{children:[e.jsx(ku,{children:"Create New Workspace"}),e.jsx(Eu,{children:"Create a new workspace to get started."})]}),e.jsx(Nu,{...f,children:e.jsxs("form",{onSubmit:f.handleSubmit(async function(e){let t="";if("emoji"===o)t=Mm(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(Ou,{control:f.control,name:"name",render:({field:t})=>e.jsxs(Iu,{children:[e.jsx(Uu,{children:"Workspace Name"}),e.jsx(Mu,{children:e.jsx(Lu,{placeholder:"My Awesome Workspace",...t})}),e.jsx(Fu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(_u,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(zu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(Ff,{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(Lf,{value:"emoji",id:"emoji"}),e.jsxs(_u,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(lo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(Lf,{value:"url",id:"url"}),e.jsxs(_u,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(no,{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(Ep,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:zm.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),f.setValue("image",Mm(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(Ou,{control:f.control,name:"image",render:({field:t})=>e.jsxs(Iu,{children:[e.jsx(Uu,{children:"Image URL"}),e.jsx(Mu,{children:e.jsx(Lu,{placeholder:"https://example.com/image.png",...t})}),e.jsx(zu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(Fu,{})]})}),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($c,{type:"button",variant:"outline",onClick:()=>{a(!1),f.reset(),c("🏢"),s("emoji")},disabled:l,children:"Cancel"}),e.jsx($c,{type:"submit",disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(ao,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const ow=()=>{const e=ae(),r=ne(e=>e.os),n=t.useMemo(()=>new fe(r),[r]),a=ne(e=>e.workspaces),o=ne(e=>e.auth.session?.user),s=t.useCallback(t=>{if(t._id!==a.currentWorkspace?._id&&t){const r=a.currentWorkspace;e.workspaces(B(t)),ie.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=ym();if(e.workspaces(G(!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(V())},[e]),l=t.useRef(!1),d=t.useRef(!1),u=t.useCallback(async()=>{if(!a.loading&&!l.current){l.current=!0,e.workspaces(K(!0)),e.workspaces(H(null));try{const t=await n.getWorkspaces();if(e.workspaces($(t)),t.length>0){const e=ym();if(e&&bm(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(H(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(K(!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(Z(!0));try{const t=await n.getWorkspaces();e.workspaces($(t))}catch(e){}finally{e.workspaces(Z(!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($([...a.workspaces,o])),ie.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($(a.workspaces.map(e=>e._id===t._id?o:e))),ie.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(W(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]),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&&ie.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]),b=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&wm(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;ie.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]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&wm(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&&ie.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]),x=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return ie.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]),E=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(!wm(r,o.id))throw new Error("Only the workspace creator can delete the workspace");const s=await n.deleteWorkspace(t);return e.workspaces($(a.workspaces.filter(e=>e._id!==t))),a.currentWorkspace?._id===t&&e.workspaces(V()),r&&ie.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:rw,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:y,removeUser:b,updateUser:w,getProfile:S,updateUserProfile:x,deleteWorkspace:E}};const sw=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)})}},iw=({children:r})=>{const{currentWorkspace:n}=ow(),[a,o]=t.useState(!1),[s,i]=t.useState("profile");return t.useEffect(()=>{const e=sw.getState();o(e.open),i(e.section);return sw.subscribe((e,t)=>{o(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&e.jsx(tw,{workspace:n,open:a,onOpenChange:e=>{e||sw.closeSettings()},section:s,onSectionChange:e=>{sw.setSection(e)},showTrigger:!1})]})},cw=(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).`)},lw=t.memo(({serverUrl:r,version:n,orgId:a,auth:o,children:s})=>{cw(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(()=>(ie.setCallbacks(d?{handleEvent:d}:null),()=>{ie.setCallbacks(null)}),[d]),e.jsx(l,{children:e.jsx(re,{children:e.jsx(oe,{callbacks:c,children:e.jsx(le,{children:e.jsx(se,{config:i,auth:o,children:e.jsx(ue,{children:e.jsx(iw,{children:s})})})})})})})});lw.displayName="SaaSOSProvider";let dw=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await fetch(`${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 fetch(`${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 uw=ms({name:$o().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:$o().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)")}),fw={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 pw({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 mw({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 hw(e,t){return function(){return e.apply(t,arguments)}}const{toString:gw}=Object.prototype,{getPrototypeOf:vw}=Object,{iterator:yw,toStringTag:bw}=Symbol,ww=(xw=Object.create(null),e=>{const t=gw.call(e);return xw[t]||(xw[t]=t.slice(8,-1).toLowerCase())});var xw;const Sw=e=>(e=e.toLowerCase(),t=>ww(t)===e),kw=e=>t=>typeof t===e,{isArray:Ew}=Array,Aw=kw("undefined");function Cw(e){return null!==e&&!Aw(e)&&null!==e.constructor&&!Aw(e.constructor)&&_w(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const jw=Sw("ArrayBuffer");const Tw=kw("string"),_w=kw("function"),Nw=kw("number"),Rw=e=>null!==e&&"object"==typeof e,Ow=e=>{if("object"!==ww(e))return!1;const t=vw(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||bw in e||yw in e)},Pw=Sw("Date"),Dw=Sw("File"),Iw=Sw("Blob"),Uw=Sw("FileList"),Mw=Sw("URLSearchParams"),[zw,Fw,Lw,$w]=["ReadableStream","Request","Response","Headers"].map(Sw);function Ww(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Ew(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Cw(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 Bw(e,t){if(Cw(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 Vw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Gw=e=>!Aw(e)&&e!==Vw;const Kw=(Hw="undefined"!=typeof Uint8Array&&vw(Uint8Array),e=>Hw&&e instanceof Hw);var Hw;const Zw=Sw("HTMLFormElement"),Jw=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),qw=Sw("RegExp"),Yw=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ww(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Xw=Sw("AsyncFunction"),Qw=(ex="function"==typeof setImmediate,tx=_w(Vw.postMessage),ex?setImmediate:tx?(rx=`axios@${Math.random()}`,nx=[],Vw.addEventListener("message",({source:e,data:t})=>{e===Vw&&t===rx&&nx.length&&nx.shift()()},!1),e=>{nx.push(e),Vw.postMessage(rx,"*")}):e=>setTimeout(e));var ex,tx,rx,nx;const ax="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Vw):"undefined"!=typeof process&&process.nextTick||Qw;var ox={isArray:Ew,isArrayBuffer:jw,isBuffer:Cw,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||_w(e.append)&&("formdata"===(t=ww(e))||"object"===t&&_w(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&jw(e.buffer),t},isString:Tw,isNumber:Nw,isBoolean:e=>!0===e||!1===e,isObject:Rw,isPlainObject:Ow,isEmptyObject:e=>{if(!Rw(e)||Cw(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:zw,isRequest:Fw,isResponse:Lw,isHeaders:$w,isUndefined:Aw,isDate:Pw,isFile:Dw,isBlob:Iw,isRegExp:qw,isFunction:_w,isStream:e=>Rw(e)&&_w(e.pipe),isURLSearchParams:Mw,isTypedArray:Kw,isFileList:Uw,forEach:Ww,merge:function e(){const{caseless:t,skipUndefined:r}=Gw(this)&&this||{},n={},a=(a,o)=>{const s=t&&Bw(n,o)||o;Ow(n[s])&&Ow(a)?n[s]=e(n[s],a):Ow(a)?n[s]=e({},a):Ew(a)?n[s]=a.slice():r&&Aw(a)||(n[s]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Ww(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Ww(t,(t,n)=>{r&&_w(t)?e[n]=hw(t,r):e[n]=t},{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),e.prototype.constructor=e,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&&vw(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:ww,kindOfTest:Sw,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(Ew(e))return e;let t=e.length;if(!Nw(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[yw]).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:Zw,hasOwnProperty:Jw,hasOwnProp:Jw,reduceDescriptors:Yw,freezeMethods:e=>{Yw(e,(t,r)=>{if(_w(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];_w(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 Ew(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:Bw,global:Vw,isContextDefined:Gw,isSpecCompliantForm:function(e){return!!(e&&_w(e.append)&&"FormData"===e[bw]&&e[yw])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Rw(e)){if(t.indexOf(e)>=0)return;if(Cw(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Ew(e)?[]:{};return Ww(e,(e,t)=>{const o=r(e,n+1);!Aw(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Xw,isThenable:e=>e&&(Rw(e)||_w(e))&&_w(e.then)&&_w(e.catch),setImmediate:Qw,asap:ax,isIterable:e=>null!=e&&_w(e[yw])};function sx(e,t,r,n,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status?a.status:null)}ox.inherits(sx,Error,{toJSON:function(){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:ox.toJSONObject(this.config),code:this.code,status:this.status}}});const ix=sx.prototype,cx={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{cx[e]={value:e}}),Object.defineProperties(sx,cx),Object.defineProperty(ix,"isAxiosError",{value:!0}),sx.from=(e,t,r,n,a,o)=>{const s=Object.create(ix);ox.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const i=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return sx.call(s,i,c,r,n,a),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",o&&Object.assign(s,o),s};function lx(e){return ox.isPlainObject(e)||ox.isArray(e)}function dx(e){return ox.endsWith(e,"[]")?e.slice(0,-2):e}function ux(e,t,r){return e?e.concat(t).map(function(e,t){return e=dx(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const fx=ox.toFlatObject(ox,{},null,function(e){return/^is[A-Z]/.test(e)});function px(e,t,r){if(!ox.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=ox.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ox.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,s=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ox.isSpecCompliantForm(t);if(!ox.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ox.isDate(e))return e.toISOString();if(ox.isBoolean(e))return e.toString();if(!i&&ox.isBlob(e))throw new sx("Blob is not supported. Use a Buffer instead.");return ox.isArrayBuffer(e)||ox.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(ox.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ox.isArray(e)&&function(e){return ox.isArray(e)&&!e.some(lx)}(e)||(ox.isFileList(e)||ox.endsWith(r,"[]"))&&(i=ox.toArray(e)))return r=dx(r),i.forEach(function(e,n){!ox.isUndefined(e)&&null!==e&&t.append(!0===s?ux([r],n,o):null===s?r:r+"[]",c(e))}),!1;return!!lx(e)||(t.append(ux(a,r,o),c(e)),!1)}const d=[],u=Object.assign(fx,{defaultVisitor:l,convertValue:c,isVisitable:lx});if(!ox.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ox.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),ox.forEach(r,function(r,o){!0===(!(ox.isUndefined(r)||null===r)&&a.call(t,r,ox.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function mx(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function hx(e,t){this._pairs=[],e&&px(e,this,t)}const gx=hx.prototype;function vx(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yx(e,t,r){if(!t)return e;const n=r&&r.encode||vx;ox.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let o;if(o=a?a(t,r):ox.isURLSearchParams(t)?t.toString():new hx(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}gx.append=function(e,t){this._pairs.push([e,t])},gx.toString=function(e){const t=e?function(t){return e.call(this,t,mx)}:mx;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class bx{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){ox.forEach(this.handlers,function(t){null!==t&&e(t)})}}var wx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xx={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:hx,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Sx="undefined"!=typeof window&&"undefined"!=typeof document,kx="object"==typeof navigator&&navigator||void 0,Ex=Sx&&(!kx||["ReactNative","NativeScript","NS"].indexOf(kx.product)<0),Ax="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Cx=Sx&&window.location.href||"http://localhost";var jx={...Object.freeze({__proto__:null,hasBrowserEnv:Sx,hasStandardBrowserEnv:Ex,hasStandardBrowserWebWorkerEnv:Ax,navigator:kx,origin:Cx}),...xx};function Tx(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&&ox.isArray(n)?n.length:o,i)return ox.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&ox.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&ox.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(ox.isFormData(e)&&ox.isFunction(e.entries)){const r={};return ox.forEachEntry(e,(e,n)=>{t(function(e){return ox.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const _x={transitional:wx,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=ox.isObject(e);a&&ox.isHTMLForm(e)&&(e=new FormData(e));if(ox.isFormData(e))return n?JSON.stringify(Tx(e)):e;if(ox.isArrayBuffer(e)||ox.isBuffer(e)||ox.isStream(e)||ox.isFile(e)||ox.isBlob(e)||ox.isReadableStream(e))return e;if(ox.isArrayBufferView(e))return e.buffer;if(ox.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 px(e,new jx.classes.URLSearchParams,{visitor:function(e,t,r,n){return jx.isNode&&ox.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=ox.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return px(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(ox.isString(e))try{return(t||JSON.parse)(e),ox.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||_x.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ox.isResponse(e)||ox.isReadableStream(e))return e;if(e&&ox.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 sx.from(e,sx.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:jx.classes.FormData,Blob:jx.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ox.forEach(["delete","get","head","post","put","patch"],e=>{_x.headers[e]={}});const Nx=ox.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 Rx=Symbol("internals");function Ox(e){return e&&String(e).trim().toLowerCase()}function Px(e){return!1===e||null==e?e:ox.isArray(e)?e.map(Px):String(e)}function Dx(e,t,r,n,a){return ox.isFunction(n)?n.call(this,t,r):(a&&(t=r),ox.isString(t)?ox.isString(n)?-1!==t.indexOf(n):ox.isRegExp(n)?n.test(t):void 0:void 0)}let Ix=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=Ox(t);if(!a)throw new Error("header name must be a non-empty string");const o=ox.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Px(e))}const o=(e,t)=>ox.forEach(e,(e,r)=>a(e,r,t));if(ox.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ox.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]&&Nx[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(ox.isObject(e)&&ox.isIterable(e)){let r,n,a={};for(const t of e){if(!ox.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?ox.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=Ox(e)){const r=ox.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(ox.isFunction(t))return t.call(this,e,r);if(ox.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ox(e)){const r=ox.findKey(this,e);return!(!r||void 0===this[r]||t&&!Dx(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=Ox(e)){const a=ox.findKey(r,e);!a||t&&!Dx(0,r[a],a,t)||(delete r[a],n=!0)}}return ox.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&&!Dx(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return ox.forEach(this,(n,a)=>{const o=ox.findKey(r,a);if(o)return t[o]=Px(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]=Px(n),r[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ox.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&ox.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[Rx]=this[Rx]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Ox(e);t[n]||(!function(e,t){const r=ox.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 ox.isArray(e)?e.forEach(n):n(e),this}};function Ux(e,t){const r=this||_x,n=t||r,a=Ix.from(n.headers);let o=n.data;return ox.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function Mx(e){return!(!e||!e.__CANCEL__)}function zx(e,t,r){sx.call(this,null==e?"canceled":e,sx.ERR_CANCELED,t,r),this.name="CanceledError"}function Fx(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new sx("Request failed with status code "+r.status,[sx.ERR_BAD_REQUEST,sx.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}Ix.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ox.reduceDescriptors(Ix.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),ox.freezeMethods(Ix),ox.inherits(zx,sx,{__CANCEL__:!0});const Lx=(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)},$x=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Wx=e=>(...t)=>ox.asap(()=>e(...t));var Bx=jx.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,jx.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(jx.origin),jx.navigator&&/(msie|trident)/i.test(jx.navigator.userAgent)):()=>!0,Vx=jx.hasStandardBrowserEnv?{write(e,t,r,n,a,o,s){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];ox.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),ox.isString(n)&&i.push(`path=${n}`),ox.isString(a)&&i.push(`domain=${a}`),!0===o&&i.push("secure"),ox.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 Gx(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 Kx=e=>e instanceof Ix?{...e}:e;function Hx(e,t){t=t||{};const r={};function n(e,t,r,n){return ox.isPlainObject(e)&&ox.isPlainObject(t)?ox.merge.call({caseless:n},e,t):ox.isPlainObject(t)?ox.merge({},t):ox.isArray(t)?t.slice():t}function a(e,t,r,a){return ox.isUndefined(t)?ox.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!ox.isUndefined(t))return n(void 0,t)}function s(e,t){return ox.isUndefined(t)?ox.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(Kx(e),Kx(t),0,!0)};return ox.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,s=o(e[n],t[n],n);ox.isUndefined(s)&&o!==i||(r[n]=s)}),r}var Zx=e=>{const t=Hx({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:s,auth:i}=t;if(t.headers=s=Ix.from(s),t.url=yx(Gx(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&s.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),ox.isFormData(r))if(jx.hasStandardBrowserEnv||jx.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(ox.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(jx.hasStandardBrowserEnv&&(n&&ox.isFunction(n)&&(n=n(t)),n||!1!==n&&Bx(t.url))){const e=a&&o&&Vx.read(o);e&&s.set(a,e)}return t};var Jx="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Zx(e);let a=n.data;const o=Ix.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=Ix.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Fx(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 sx("Request aborted",sx.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=new sx(t&&t.message?t.message:"Network Error",sx.ERR_NETWORK,e,h);n.event=t||null,r(n),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||wx;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new sx(t,a.clarifyTimeoutError?sx.ETIMEDOUT:sx.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&ox.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),ox.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=Lx(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([i,l]=Lx(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(s=t=>{h&&(r(!t||t.type?new zx(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===jx.protocols.indexOf(v)?r(new sx("Unsupported protocol "+v+":",sx.ERR_BAD_REQUEST,e)):h.send(a||null)})};const qx=(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 sx?t:new zx(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new sx(`timeout ${t} of ms exceeded`,sx.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=()=>ox.asap(s),i}},Yx=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},Xx=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()}},Qx=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Xx(e))yield*Yx(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:eS}=ox,tS=(({Request:e,Response:t})=>({Request:e,Response:t}))(ox.global),{ReadableStream:rS,TextEncoder:nS}=ox.global,aS=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},oS=e=>{e=ox.merge.call({skipUndefined:!0},tS,e);const{fetch:t,Request:r,Response:n}=e,a=t?eS(t):"function"==typeof fetch,o=eS(r),s=eS(n);if(!a)return!1;const i=a&&eS(rS),c=a&&("function"==typeof nS?(l=new nS,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&i&&aS(()=>{let e=!1;const t=new r(jx.origin,{body:new rS,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&i&&aS(()=>ox.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 sx(`Response type '${e}' is not supported`,sx.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=ox.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(ox.isBlob(e))return e.size;if(ox.isSpecCompliantForm(e)){const t=new r(jx.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ox.isArrayBufferView(e)||ox.isArrayBuffer(e)?e.byteLength:(ox.isURLSearchParams(e)&&(e+=""),ox.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:y,withCredentials:b="same-origin",fetchOptions:w}=Zx(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let S=qx([c,l&&l.toAbortSignal()],m),k=null;const E=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let A;try{if(g&&d&&"get"!==s&&"head"!==s&&0!==(A=await p(y,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(ox.isFormData(i)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=$x(A,Lx(Wx(g)));i=Qx(t.body,65536,e,r)}}ox.isString(b)||(b=b?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:S,method:s.toUpperCase(),headers:y.normalize().toJSON(),body:i,duplex:"half",credentials:t?b:void 0};k=o&&new r(a,c);let l=await(o?x(k,w):x(a,c));const m=u&&("stream"===v||"response"===v);if(u&&(h||m&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=ox.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&$x(t,Lx(Wx(h),!0))||[];l=new n(Qx(l.body,65536,r,()=>{a&&a(),E&&E()}),e)}v=v||"text";let C=await f[ox.findKey(f,v)||"text"](l,e);return!m&&E&&E(),await new Promise((t,r)=>{Fx(t,r,{data:C,headers:Ix.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 sx("Network Error",sx.ERR_NETWORK,e,k),{cause:t.cause||t});throw sx.from(t,t&&t.code,e,k)}}},sS=new Map,iS=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=sS;for(;c--;)s=o[c],i=l.get(s),void 0===i&&l.set(s,i=c?new Map:oS(t)),l=i;return i};iS();const cS={http:null,xhr:Jx,fetch:{get:iS}};ox.forEach(cS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const lS=e=>`- ${e}`,dS=e=>ox.isFunction(e)||null===e||!1===e;var uS={getAdapter:function(e,t){e=ox.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,!dS(n)&&(a=cS[(r=String(n)).toLowerCase()],void 0===a))throw new sx(`Unknown adapter '${r}'`);if(a&&(ox.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"));throw new sx("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(lS).join("\n"):" "+lS(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return a},adapters:cS};function fS(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new zx(null,e)}function pS(e){fS(e),e.headers=Ix.from(e.headers),e.data=Ux.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return uS.getAdapter(e.adapter||_x.adapter,e)(e).then(function(t){return fS(e),t.data=Ux.call(e,e.transformResponse,t),t.headers=Ix.from(t.headers),t},function(t){return Mx(t)||(fS(e),t&&t.response&&(t.response.data=Ux.call(e,e.transformResponse,t.response),t.response.headers=Ix.from(t.response.headers))),Promise.reject(t)})}const mS="1.13.2",hS={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{hS[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const gS={};hS.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 sx(n(a," has been removed"+(t?" in "+t:"")),sx.ERR_DEPRECATED);return t&&!gS[a]&&(gS[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)}},hS.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var vS={assertOptions:function(e,t,r){if("object"!=typeof e)throw new sx("options must be an object",sx.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 sx("option "+o+" must be "+r,sx.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new sx("Unknown option "+o,sx.ERR_BAD_OPTION)}},validators:hS};const yS=vS.validators;let bS=class{constructor(e){this.defaults=e||{},this.interceptors={request:new bx,response:new bx}}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=Hx(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&vS.assertOptions(r,{silentJSONParsing:yS.transitional(yS.boolean),forcedJSONParsing:yS.transitional(yS.boolean),clarifyTimeoutError:yS.transitional(yS.boolean)},!1),null!=n&&(ox.isFunction(n)?t.paramsSerializer={serialize:n}:vS.assertOptions(n,{encode:yS.function,serialize:yS.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),vS.assertOptions(t,{baseUrl:yS.spelling("baseURL"),withXsrfToken:yS.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&ox.merge(a.common,a[t.method]);a&&ox.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=Ix.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=[pS.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=pS.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 yx(Gx((e=Hx(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ox.forEach(["delete","get","head","options"],function(e){bS.prototype[e]=function(t,r){return this.request(Hx(r||{},{method:e,url:t,data:(r||{}).data}))}}),ox.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(Hx(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}bS.prototype[e]=t(),bS.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 xS=function e(t){const r=new bS(t),n=hw(bS.prototype.request,r);return ox.extend(n,bS.prototype,r,{allOwnKeys:!0}),ox.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Hx(t,r))},n}(_x);xS.Axios=bS,xS.CanceledError=zx,xS.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 zx(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}}},xS.isCancel=Mx,xS.VERSION=mS,xS.toFormData=px,xS.AxiosError=sx,xS.Cancel=xS.CanceledError,xS.all=function(e){return Promise.all(e)},xS.spread=function(e){return function(t){return e.apply(null,t)}},xS.isAxiosError=function(e){return ox.isObject(e)&&!0===e.isAxiosError},xS.mergeConfig=Hx,xS.AxiosHeaders=Ix,xS.formToJSON=e=>Tx(ox.isHTMLForm(e)?new FormData(e):e),xS.getAdapter=uS.getAdapter,xS.HttpStatusCode=wS,xS.default=xS;const{Axios:SS,AxiosError:kS,CanceledError:ES,isCancel:AS,CancelToken:CS,VERSION:jS,all:TS,Cancel:_S,isAxiosError:NS,spread:RS,toFormData:OS,AxiosHeaders:PS,HttpStatusCode:DS,formToJSON:IS,getAdapter:US,mergeConfig:MS}=xS;const zS=new class{constructor(e={}){this.client=xS.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=S();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 FS(){const e=ae(),r=ne(e=>e.auth),n=ne(e=>e.os),{serverUrl:a,orgId:o,auth:s}=n,{resetCurrentWorkspace:i,currentWorkspace:l}=ow(),f=t.useCallback(async()=>{e.auth(d());try{const t=await zS.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(u()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(u()),c(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,o,s,e]),m=t.useCallback(async()=>{try{s?.callbacks?.onSignOut&&"function"==typeof s.callbacks.onSignOut&&await s.callbacks.onSignOut(),e.auth(p()),i(),x()}catch(e){c(e,{component:"useSaaSAuth",action:"signOut"}),x()}},[e,i,s?.callbacks?.onSignOut]),h=t.useCallback(e=>{l?sw.openWorkspaceSettings(e):c(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[l]);return t.useMemo(()=>({user:r.session?.user,session:r.session,isLoading:r.isLoading,isAuthenticated:r.isAuthenticated,isRedirecting:r.isRedirecting,status:r.status,signIn:f,signOut:m,openWorkspaceSettings:h}),[r,f,m,h])}function LS(){const e=t.useContext(de);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])}}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:y,isLoading:b,isSubmitting:w,error:x,config:S,success:k,message:E}=(()=>{const e=ne(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 dw(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 dw(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(fw).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&l&&(h(!0),v(!0)),x&&v(!0)},[k,l,x]);const A={...fw[s||f],...i},C=Mt({resolver:Ka(uw),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{c&&C.setFocus("name")},[c,C]);const j=C.formState.isValid&&!w;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:b?e.jsxs("div",{className:Pc("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(xm,{className:"h-24 w-24 rounded-lg"}),e.jsx(xm,{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(xm,{className:"h-4 w-16"}),e.jsx(xm,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(xm,{className:"h-4 w-16"}),e.jsx(xm,{className:"h-10 w-full"})]}),e.jsx(xm,{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(mw,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(He,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(async e=>{try{const t=await y(e);t.success?(r?.(),C.reset(),l&&h(!0),v(!0)):(n?.(t.message),v(!0))}catch(e){n?.(e instanceof Error?e.message:A.errorMessage),v(!0)}}),className:a,noValidate:!0,"aria-busy":w,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(pw,{screen:S?.screen?.register}),e.jsx(Ou,{control:C.control,name:"name",render:({field:t})=>e.jsxs(Iu,{className:o,children:[e.jsx(Uu,{children:A.nameLabel}),e.jsx(Mu,{children:e.jsx(Lu,{...t})}),e.jsx(zu,{}),e.jsx(Fu,{})]})}),e.jsx(Ou,{control:C.control,name:"email",render:({field:t})=>e.jsxs(Iu,{className:o,children:[e.jsx(Uu,{children:A.emailLabel}),e.jsx(Mu,{children:e.jsx(Lu,{...t})}),e.jsx(zu,{}),e.jsx(Fu,{})]})}),e.jsx($c,{type:"submit",disabled:!j,className:o,children:w?A.submittingText:A.submitText})]}),g&&x&&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:"❗"}),x]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx($c,{type:"button",onClick:()=>{v(!1),C.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(pw,{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=lw,exports.WhenAuthenticated=e=>{const{children:t}=e,{status:r}=FS();return r!==h.authenticated?null:t},exports.WhenRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=FS();return n.includes(a?.role??"")?t:r||null},exports.WhenUnauthenticated=e=>{const{children:t}=e,{status:r}=FS();return r===h.authenticated?null:t},exports.WhenUserFeatureDisabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=LS();return n(r)?null:t},exports.WhenUserFeatureEnabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=LS();return n(r)?t:null},exports.WhenWorkspaceFeatureDisabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=ow(),a=n?.features?.[r];return a?null:t},exports.WhenWorkspaceFeatureEnabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=ow(),a=n?.features?.[r];return a?t:null},exports.WhenWorkspaceRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=FS(),{currentWorkspace:o}=ow(),s=o?.users.find(e=>e._id===a?.id);return s&&n.includes(s?.role??"")?t:r||null},exports.WorkspaceSwitcher=rw,exports.createSDKError=function(e,t,r,n){return new s(e,t,r,n)},exports.errorHandler=i,exports.eventEmitter=ie,exports.handleError=c,exports.useSaaSAuth=FS,exports.useSaaSSettings=Op,exports.useSaaSWorkspaces=ow,exports.useUserAttributes=function(){const e=t.useContext(de);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=LS;
36
36
  //# sourceMappingURL=index.js.map