@buildbase/sdk 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,36 @@
1
- import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as a,useReducer as i,useMemo as s,useCallback as c,useEffect as l,forwardRef as d,createElement as u,useState as f,useRef as m,useLayoutEffect as p}from"react";import*as h from"react-dom";import b from"react-dom";var g;!function(e){e.V1="v1"}(g||(g={}));const v=e=>({type:"SET_SESSION",payload:e});function w({name:t,initialState:n,reducer:r,initializer:c}){const l=a(null),d=a(null),u=a(null),f=o.memo(({children:t})=>{const[o,a]=i(r,n,c||(e=>e)),f=s(()=>({state:o,dispatch:a}),[o,a]);return e(u.Provider,{value:f,children:e(l.Provider,{value:o,children:e(d.Provider,{value:a,children:t})})})});f.displayName=t+"Provider";const m=()=>{const e=o.useContext(l);if(null===e)throw Error(`use${t}State must be used within a ${t}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e};return{Provider:f,useContext:()=>{const e=o.useContext(u);if(!e)throw Error(`use${t}Context must be used within a ${t}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useState:m,useDispatch:()=>{const e=o.useContext(d);if(null===e)throw Error(`use${t}Dispatch must be used within a ${t}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useSelector:(e,t)=>{const n=m(),r=e||(e=>e),a=o.useRef(r),i=o.useRef(t),c=o.useRef(void 0),l=o.useRef(n);return e&&(a.current=r),t&&(i.current=t),s(()=>{const e=a.current(n);return void 0!==c.current&&(i.current?i.current(c.current,e):Object.is(c.current,e))&&l.current===n?c.current:(c.current=e,l.current=n,e)},[n])}}}var y;function x(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(e){return null}}function A(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(e){}}function S(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(e){}}!function(e){e.loading="loading",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(y||(y={}));const k="code",T="saas-session-id";function C(){S(T)}function N(){if("undefined"==typeof window)return null;try{return x(T)}catch(e){return null}}function E(){const e=N(),t={};return e&&(t["x-session-id"]=e),t}function P(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const M=()=>({session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:y.unauthenticated}),{Provider:O,useState:R,useDispatch:_}=w({name:"Auth",initialState:M(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,isLoading:!0,isAuthenticated:!1,isRedirecting:!0,status:y.authenticating};case"AUTHENTICATION_FAILED":return{...e,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:y.unauthenticated};case"SET_SESSION":{const r=t.payload;return n=r.sessionId,A(T,n),{...e,session:r,isAuthenticated:!0,isRedirecting:!1,isLoading:!1,status:y.authenticated}}case"REMOVE_SESSION":return C(),{...e,session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:y.unauthenticated};default:return e}var n},initializer:M}),D=O,I=R,U=_,F=e=>({type:"SET_SETTINGS",payload:e}),j=()=>({serverUrl:"",version:g.V1,orgId:"",settings:null}),{Provider:L,useState:B,useDispatch:$}=w({name:"OS",initialState:j(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return j();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),z=L,G=B,Z=$,W=e=>({type:"SET_WORKSPACES",payload:e}),K=e=>({type:"SET_LOADING",payload:e}),V=e=>({type:"SET_ERROR",payload:e}),H=e=>({type:"SET_REFRESHING",payload:e}),J="saas-workspace-current",{Provider:q,useState:Y,useDispatch:X}=w({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(n=t.payload.t)?A(J,n):S(J),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return S(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 n}}),Q=q,ee=Y,te=X,ne=o.memo(({children:t})=>e(z,{children:e(D,{children:e(Q,{children:t})})}));function re(e,t){const n=G(),r=I(),a=ee(),i=s(()=>({os:n,auth:r,workspaces:a}),[n,r,a]),c=e||(e=>e),l=o.useRef(c),d=o.useRef(t),u=o.useRef(void 0),f=o.useRef(i);return e&&(l.current=c),s(()=>{const e=l.current(i);return void 0!==u.current&&(d.current?d.current(u.current,e):Object.is(u.current,e))&&f.current===i?u.current:(u.current=e,f.current=i,e)},[i])}function oe(){const e=U(),t=Z(),n=te();return s(()=>({auth:e,os:t,workspaces:n}),[e,t,n])}ne.displayName="SDKContextProvider";const ae=o.memo(({children:n,callbacks:r})=>{const a=oe(),i=re(e=>e.auth),d=re(e=>e.os),u=o.useRef(!1),f=o.useRef(null),m=s(()=>r,[r]),p=c(async e=>{try{if(m?.handleAuthentication){const{sessionId:t}=await m.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw Error("Invalid sessionId received from authentication callback");const n=d,{serverUrl:r,version:o,orgId:i}=n;if(!r||!o||!i)throw Error("OS configuration is not available");const s=await fetch(`${r}/api/${o}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}});if(!s.ok)throw Error("Failed to fetch user profile");let c;try{c=await s.json()}catch(e){throw Error("Failed to parse user profile response")}const l=P({id:c.t||c.id,name:c.name||"",org:i,email:c.email||"",emailVerified:!0,clientId:n.auth?.clientId||"",role:c.role||"",image:c.image},t);a.auth(v(l)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(k),window.history.replaceState({},"",e.toString())}catch(e){}}()}}catch(e){throw a.auth({type:"AUTHENTICATION_FAILED"}),e}},[a,m,d]);return l(()=>{if("undefined"==typeof window)return;if(i.isAuthenticated)return;const e=N();e&&(async()=>{try{const{serverUrl:t,version:n,orgId:r}=d;if(!t||!n||!r)return;const o=await fetch(`${t}/api/${n}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"}});if(!o.ok)return void C();let i;try{i=await o.json()}catch(e){return void C()}const s=P({id:i.t||i.id,name:i.name||"",org:r,email:i.email||"",emailVerified:!0,clientId:d.auth?.clientId||"",role:i.role||"",image:i.image},e);a.auth(v(s))}catch(e){C()}})()},[i.isAuthenticated,a,d]),l(()=>{const e=function(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(k)}catch(e){return null}}();if(!e)return;if(u.current||f.current===e)return;const{serverUrl:t,version:n,orgId:r}=d;t&&n&&r&&(u.current=!0,f.current=e,p(e).then(()=>{f.current=null}).catch(e=>{f.current=null}).finally(()=>{u.current=!1}))},[p,d.serverUrl,d.version,d.orgId]),e(t,{children:n})});ae.displayName="AuthProviderWrapper";const ie=o.memo(({config:n,auth:r,children:a})=>{const i=oe(),s=re(e=>e.os),c=o.useMemo(()=>({clientId:r?.clientId||"",redirectUrl:r?.redirectUrl||"",callbacks:r?.callbacks}),[r?.clientId,r?.redirectUrl,r?.callbacks]);l(()=>{i.os((e=>({type:"SET_SAAS_OS_CONFIG",payload:e}))({...n,auth:c}))},[n,c,i]),l(()=>{const{serverUrl:e,version:t,orgId:n,settings:r}=s;e&&t&&n&&!r&&(async()=>{try{const r=E(),o=await fetch(`${e}/api/${t}/public/${n}/settings`,{headers:r});if(o.ok){const e=await o.json();i.os(F(e))}}catch(e){}})()},[s.serverUrl,s.version,s.orgId,s.settings,i]);const d=o.useMemo(()=>a,[a]);return e(t,{children:d})});ie.displayName="ContextConfigProvider";const se=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(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,n){await this.emit("workspace:user-added",{userId:e,workspace:t,role:n})}async emitWorkspaceUserRemoved(e,t,n){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:n})}async emitWorkspaceUserRoleChanged(e,t,n,r){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:n,newRole:r})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}},ce=a({container:null,setContainer:()=>{}}),le=o.memo(({children:t})=>{const[r,a]=o.useState(null),i=o.useMemo(()=>({container:r,setContainer:a}),[r]),s=o.useMemo(()=>t,[t]);return n(ce.Provider,{value:i,children:[s,e("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});le.displayName="PortalProvider";const de=o.memo(({serverUrl:t,version:n,orgId:r,auth:a,children:i})=>{((e,t,n)=>{if(t!==g.V1)throw Error(`Invalid version: "${t}". Only "${g.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!n||"string"!=typeof n)throw Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(n))throw Error(`Invalid orgId: "${n}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)})(t,n,r);const s=o.useMemo(()=>({serverUrl:t,version:n,orgId:r}),[t,n,r]),c=o.useMemo(()=>a?.callbacks,[a?.callbacks]),d=o.useMemo(()=>a?.callbacks?.handleEvent,[a?.callbacks]);return l(()=>(se.setCallbacks(d?{handleEvent:d}:null),()=>{se.setCallbacks(null)}),[d]),e(ne,{children:e(ae,{callbacks:c,children:e(le,{children:e(ie,{config:s,auth:a,children:i})})})})});de.displayName="SaaSOSProvider";var ue=e=>"checkbox"===e.type,fe=e=>e instanceof Date,me=e=>null==e;const pe=e=>"object"==typeof e;var he=e=>!me(e)&&!Array.isArray(e)&&pe(e)&&!fe(e),be=e=>he(e)&&e.target?ue(e.target)?e.target.checked:e.target.value:e,ge=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),ve="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function we(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(ve&&(e instanceof Blob||r)||!n&&!he(e))return e;if(t=n?[]:Object.create(Object.getPrototypeOf(e)),n||(e=>{const t=e.constructor&&e.constructor.prototype;return he(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=we(e[n]));else t=e}return t}var ye=e=>/^\w*$/.test(e),xe=e=>void 0===e,Ae=e=>Array.isArray(e)?e.filter(Boolean):[],Se=e=>Ae(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ke=(e,t,n)=>{if(!t||!he(e))return n;const r=(ye(t)?[t]:Se(t)).reduce((e,t)=>me(e)?e:e[t],e);return xe(r)||r===e?xe(e[t])?n:e[t]:r},Te=e=>"boolean"==typeof e,Ce=(e,t,n)=>{let r=-1;const o=ye(t)?[t]:Se(t),a=o.length,i=a-1;for(;++r<a;){const t=o[r];let a=n;if(r!==i){const n=e[t];a=he(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=a,e=e[t]}};const Ne="blur",Ee="onChange",Pe="onSubmit",Me="all",Oe="pattern",Re="required",_e=o.createContext(null);_e.displayName="HookFormContext";const De=()=>o.useContext(_e),Ie=e=>{const{children:t,...n}=e;return o.createElement(_e.Provider,{value:n},t)};var Ue=(e,t,n,r=!0)=>{const o={defaultValues:t.o};for(const a in e)Object.defineProperty(o,a,{get:()=>{const o=a;return t.i[o]!==Me&&(t.i[o]=!r||Me),n&&(n[o]=!0),e[o]}});return o};const Fe="undefined"!=typeof window?o.useLayoutEffect:o.useEffect;var je=e=>"string"==typeof e,Le=(e,t,n,r,o)=>je(e)?(r&&t.watch.add(e),ke(n,e,o)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),ke(n,e))):(r&&(t.watchAll=!0),n),Be=e=>me(e)||!pe(e);function $e(e,t,n=new WeakSet){if(Be(e)||Be(t))return e===t;if(fe(e)&&fe(t))return e.getTime()===t.getTime();const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const a of r){const r=e[a];if(!o.includes(a))return!1;if("ref"!==a){const e=t[a];if(fe(r)&&fe(e)||he(r)&&he(e)||Array.isArray(r)&&Array.isArray(e)?!$e(r,e,n):r!==e)return!1}}return!0}const ze=e=>e.render(function(e){const t=De(),{name:n,disabled:r,control:a=t.control,shouldUnregister:i,defaultValue:s}=e,c=ge(a.l.array,n),l=o.useMemo(()=>ke(a.u,n,ke(a.o,n,s)),[a,n,s]),d=function(e){const t=De(),{control:n=t.control,name:r,defaultValue:a,disabled:i,exact:s,compute:c}=e||{},l=o.useRef(a),d=o.useRef(c),u=o.useRef(void 0);d.current=c;const f=o.useMemo(()=>n.v(r,l.current),[n,r]),[m,p]=o.useState(d.current?d.current(f):f);return Fe(()=>n.A({name:r,formState:{values:!0},exact:s,callback:e=>{if(!i){const t=Le(r,n.l,e.values||n.u,!1,l.current);if(d.current){const e=d.current(t);$e(e,u.current)||(p(e),u.current=e)}else p(t)}}}),[n,i,r,s]),o.useEffect(()=>n.S()),m}({control:a,name:n,defaultValue:l,exact:!0}),u=function(e){const t=De(),{control:n=t.control,disabled:r,name:a,exact:i}=e||{},[s,c]=o.useState(n.k),l=o.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Fe(()=>n.A({name:a,formState:l.current,exact:i,callback:e=>{!r&&c({...n.k,...e})}}),[a,r,i]),o.useEffect(()=>{l.current.isValid&&n.T(!0)},[n]),o.useMemo(()=>Ue(s,n,l.current,!1),[s,n])}({control:a,name:n,exact:!0}),f=o.useRef(e),m=o.useRef(a.register(n,{...e.rules,value:d,...Te(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const p=o.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ke(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!ke(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ke(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ke(u.validatingFields,n)},error:{enumerable:!0,get:()=>ke(u.errors,n)}}),[u,n]),h=o.useCallback(e=>m.current.onChange({target:{value:be(e),name:n},type:"change"}),[n]),b=o.useCallback(()=>m.current.onBlur({target:{value:ke(a.u,n),name:n},type:Ne}),[n,a.u]),g=o.useCallback(e=>{const t=ke(a.C,n);t&&e&&(t.N.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[a.C,n]),v=o.useMemo(()=>({name:n,value:d,...Te(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:b,ref:g}),[n,r,u.disabled,h,b,g,d]);return o.useEffect(()=>{const e=a.P.shouldUnregister||i;a.register(n,{...f.current.rules,...Te(f.current.disabled)?{disabled:f.current.disabled}:{}});const t=(e,t)=>{const n=ke(a.C,e);n&&n.N&&(n.N.mount=t)};if(t(n,!0),e){const e=we(ke(a.P.defaultValues,n));Ce(a.o,n,e),xe(ke(a.u,n))&&Ce(a.u,n,e)}return!c&&a.register(n),()=>{(c?e&&!a.M.action:e)?a.unregister(n):t(n,!1)}},[n,a,c,i]),o.useEffect(()=>{a.O({disabled:r,name:n})},[r,n,a]),o.useMemo(()=>({field:v,formState:u,fieldState:p}),[v,u,p])}(e));var Ge=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Ze=e=>Array.isArray(e)?e:[e],We=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},Ke=e=>he(e)&&!Object.keys(e).length,Ve=e=>"file"===e.type,He=e=>"function"==typeof e,Je=e=>{if(!ve)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},qe=e=>"select-multiple"===e.type,Ye=e=>"radio"===e.type,Xe=e=>Je(e)&&e.isConnected;function Qe(e,t){const n=Array.isArray(t)?t:ye(t)?[t]:Se(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;n>r;)e=xe(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1,a=n[o];return r&&delete r[a],0!==o&&(he(r)&&Ke(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!xe(e[t]))return!1;return!0}(r))&&Qe(e,n.slice(0,-1)),e}var et=e=>{for(const t in e)if(He(e[t]))return!0;return!1};function tt(e,t={}){const n=Array.isArray(e);if(he(e)||n)for(const n in e)Array.isArray(e[n])||he(e[n])&&!et(e[n])?(t[n]=Array.isArray(e[n])?[]:{},tt(e[n],t[n])):me(e[n])||(t[n]=!0);return t}function nt(e,t,n){const r=Array.isArray(e);if(he(e)||r)for(const r in e)Array.isArray(e[r])||he(e[r])&&!et(e[r])?xe(t)||Be(n[r])?n[r]=Array.isArray(e[r])?tt(e[r],[]):{...tt(e[r])}:nt(e[r],me(t)?{}:t[r],n[r]):n[r]=!$e(e[r],t[r]);return n}var rt=(e,t)=>nt(e,t,tt(t));const ot={value:!1,isValid:!1},at={value:!0,isValid:!0};var it=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&&!xe(e[0].attributes.value)?xe(e[0].value)||""===e[0].value?at:{value:e[0].value,isValid:!0}:at:ot}return ot},st=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>xe(e)?e:t?""===e?NaN:e?+e:e:n&&je(e)?new Date(e):r?r(e):e;const ct={isValid:!1,value:null};var lt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,ct):ct;function dt(e){const t=e.ref;return Ve(t)?t.files:Ye(t)?lt(e.refs).value:qe(t)?[...t.selectedOptions].map(({value:e})=>e):ue(t)?it(e.refs).value:st(xe(t.value)?e.ref.value:t.value,e)}var ut=e=>e instanceof RegExp,ft=e=>xe(e)?e:ut(e)?e.source:he(e)?ut(e.value)?e.value.source:e.value:e,mt=e=>({isOnSubmit:!e||e===Pe,isOnBlur:"onBlur"===e,isOnChange:e===Ee,isOnAll:e===Me,isOnTouch:"onTouched"===e});const pt="AsyncFunction";var ht=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===pt||he(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===pt)),bt=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const gt=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=ke(e,o);if(n){const{N:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],o)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(gt(a,t))break}else if(he(a)&&gt(a,t))break}}};function vt(e,t,n){const r=ke(e,n);if(r||ye(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),a=ke(t,r),i=ke(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(i&&i.type)return{name:r,error:i};if(i&&i.root&&i.root.type)return{name:r+".root",error:i.root};o.pop()}return{name:n}}var wt=(e,t,n)=>{const r=Ze(ke(e,n));return Ce(r,"root",t[n]),Ce(e,n,r),e},yt=e=>je(e);function xt(e,t,n="validate"){if(yt(e)||Array.isArray(e)&&e.every(yt)||Te(e)&&!e)return{type:n,message:yt(e)?e:"",ref:t}}var At=e=>he(e)&&!ut(e)?e:{value:e,message:""},St=async(e,t,n,r,o,a)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:m,validate:p,name:h,valueAsNumber:b,mount:g}=e.N,v=ke(n,h);if(!g||t.has(h))return{};const w=s?s[0]:i,y=e=>{o&&w.reportValidity&&(w.setCustomValidity(Te(e)?"":e||""),w.reportValidity())},x={},A=Ye(i),S=ue(i),k=A||S,T=(b||Ve(i))&&xe(i.value)&&xe(v)||Je(i)&&""===i.value||""===v||Array.isArray(v)&&!v.length,C=Ge.bind(null,h,r,x),N=(e,t,n,r="maxLength",o="minLength")=>{const a=e?t:n;x[h]={type:e?r:o,message:a,ref:i,...C(e?r:o,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!k&&(T||me(v))||Te(v)&&!v||S&&!it(s).isValid||A&&!lt(s).isValid)){const{value:e,message:t}=yt(c)?{value:!!c,message:c}:At(c);if(e&&(x[h]={type:Re,message:t,ref:w,...C(Re,t)},!r))return y(t),x}if(!(T||me(u)&&me(f))){let e,t;const n=At(f),o=At(u);if(me(v)||isNaN(v)){const r=i.valueAsDate||new Date(v),a=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;je(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),je(o.value)&&v&&(t=s?a(v)<a(o.value):c?v<o.value:r<new Date(o.value))}else{const r=i.valueAsNumber||(v?+v:v);me(n.value)||(e=r>n.value),me(o.value)||(t=r<o.value)}if((e||t)&&(N(!!e,n.message,o.message,"max","min"),!r))return y(x[h].message),x}if((l||d)&&!T&&(je(v)||a&&Array.isArray(v))){const e=At(l),t=At(d),n=!me(e.value)&&v.length>+e.value,o=!me(t.value)&&v.length<+t.value;if((n||o)&&(N(n,e.message,t.message),!r))return y(x[h].message),x}if(m&&!T&&je(v)){const{value:e,message:t}=At(m);if(ut(e)&&!v.match(e)&&(x[h]={type:Oe,message:t,ref:i,...C(Oe,t)},!r))return y(t),x}if(p)if(He(p)){const e=xt(await p(v,n),w);if(e&&(x[h]={...e,...C("validate",e.message)},!r))return y(e.message),x}else if(he(p)){let e={};for(const t in p){if(!Ke(e)&&!r)break;const o=xt(await p[t](v,n),w,t);o&&(e={...o,...C(t,o.message)},y(o.message),r&&(x[h]=e))}if(!Ke(e)&&(x[h]={ref:w,...e},!r))return x}return y(!0),x};const kt={mode:Pe,reValidateMode:Ee,shouldFocusError:!0};function Tt(e={}){const t=o.useRef(void 0),n=o.useRef(void 0),[r,a]=o.useState({isDirty:!1,isValidating:!1,isLoading:He(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:He(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:n,...o}=function(e={}){let t,n={...kt,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},o={},a=(he(n.defaultValues)||he(n.values))&&we(n.defaultValues||n.values)||{},i=n.shouldUnregister?{}:we(a),s={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:We(),state:We()},m=n.criteriaMode===Me,p=async e=>{if(!n.disabled&&(d.isValid||u.isValid||e)){const e=n.resolver?Ke((await v()).errors):await w(o,!0);e!==r.isValid&&f.state.next({isValid:e})}},h=(e,t)=>{!n.disabled&&(d.isValidating||d.validatingFields||u.isValidating||u.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?Ce(r.validatingFields,e,t):Qe(r.validatingFields,e))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Ke(r.validatingFields)}))},b=(e,t,n,r)=>{const c=ke(o,e);if(c){const o=ke(i,e,xe(n)?ke(a,e):n);xe(o)||r&&r.defaultChecked||t?Ce(i,e,t?o:dt(c.N)):A(e,o),s.mount&&p()}},g=(e,t,o,i,s)=>{let c=!1,l=!1;const m={name:e};if(!n.disabled){if(!o||i){(d.isDirty||u.isDirty)&&(l=r.isDirty,r.isDirty=m.isDirty=y(),c=l!==m.isDirty);const n=$e(ke(a,e),t);l=!!ke(r.dirtyFields,e),n?Qe(r.dirtyFields,e):Ce(r.dirtyFields,e,!0),m.dirtyFields=r.dirtyFields,c=c||(d.dirtyFields||u.dirtyFields)&&l!==!n}if(o){const t=ke(r.touchedFields,e);t||(Ce(r.touchedFields,e,o),m.touchedFields=r.touchedFields,c=c||(d.touchedFields||u.touchedFields)&&t!==o)}c&&s&&f.state.next(m)}return c?m:{}},v=async e=>{h(e,!0);const t=await n.resolver(i,n.context,((e,t,n,r)=>{const o={};for(const n of e){const e=ke(t,n);e&&Ce(o,n,e.N)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}})(e||c.mount,o,n.criteriaMode,n.shouldUseNativeValidation));return h(e),t},w=async(e,t,o={valid:!0})=>{for(const a in e){const s=e[a];if(s){const{N:e,...l}=s;if(e){const l=c.array.has(e.name),u=s.N&&ht(s.N);u&&d.validatingFields&&h([a],!0);const f=await St(s,c.disabled,i,m,n.shouldUseNativeValidation&&!t,l);if(u&&d.validatingFields&&h([a]),f[e.name]&&(o.valid=!1,t))break;!t&&(ke(f,e.name)?l?wt(r.errors,f,e.name):Ce(r.errors,e.name,f[e.name]):Qe(r.errors,e.name))}!Ke(l)&&await w(l,t,o)}}return o.valid},y=(e,t)=>!n.disabled&&(e&&t&&Ce(i,e,t),!$e(E(),a)),x=(e,t,n)=>Le(e,c,{...s.mount?i:xe(t)?a:je(e)?{[e]:t}:t},n,t),A=(e,t,n={})=>{const r=ke(o,e);let a=t;if(r){const n=r.N;n&&(!n.disabled&&Ce(i,e,st(t,n)),a=Je(n.ref)&&me(t)?"":t,qe(n.ref)?[...n.ref.options].forEach(e=>e.selected=a.includes(e.value)):n.refs?ue(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(e.checked=Array.isArray(a)?!!a.find(t=>t===e.value):a===e.value||!!a)}):n.refs.forEach(e=>e.checked=e.value===a):Ve(n.ref)?n.ref.value="":(n.ref.value=a,n.ref.type||f.state.next({name:e,values:we(i)})))}(n.shouldDirty||n.shouldTouch)&&g(e,a,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&N(e)},S=(e,t,n)=>{for(const r in t){if(!t.hasOwnProperty(r))return;const a=t[r],i=e+"."+r,s=ke(o,i);(c.array.has(e)||he(a)||s&&!s.N)&&!fe(a)?S(i,a,n):A(i,a,n)}},k=(e,t,n={})=>{const l=ke(o,e),m=c.array.has(e),p=we(t);Ce(i,e,p),m?(f.array.next({name:e,values:we(i)}),(d.isDirty||d.dirtyFields||u.isDirty||u.dirtyFields)&&n.shouldDirty&&f.state.next({name:e,dirtyFields:rt(a,i),isDirty:y(e,p)})):!l||l.N||me(p)?A(e,p,n):S(e,p,n),bt(e,c)&&f.state.next({...r,name:e}),f.state.next({name:s.mount?e:void 0,values:we(i)})},T=async e=>{s.mount=!0;const a=e.target;let b=a.name,y=!0;const x=ke(o,b),A=e=>{y=Number.isNaN(e)||fe(e)&&isNaN(e.getTime())||$e(e,ke(i,b,e))},S=mt(n.mode),k=mt(n.reValidateMode);if(x){let s,T;const C=a.type?dt(x.N):be(e),E=e.type===Ne||"focusout"===e.type,P=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(x.N)&&!n.resolver&&!ke(r.errors,b)&&!x.N.deps||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(E,ke(r.touchedFields,b),r.isSubmitted,k,S),M=bt(b,c,E);Ce(i,b,C),E?a&&a.readOnly||(x.N.onBlur&&x.N.onBlur(e),t&&t(0)):x.N.onChange&&x.N.onChange(e);const O=g(b,C,E),R=!Ke(O)||M;if(!E&&f.state.next({name:b,type:e.type,values:we(i)}),P)return(d.isValid||u.isValid)&&("onBlur"===n.mode?E&&p():E||p()),R&&f.state.next({name:b,...M?{}:O});if(!E&&M&&f.state.next({...r}),n.resolver){const{errors:e}=await v([b]);if(A(C),y){const t=vt(r.errors,o,b),n=vt(e,o,t.name||b);s=n.error,b=n.name,T=Ke(e)}}else h([b],!0),s=(await St(x,c.disabled,i,m,n.shouldUseNativeValidation))[b],h([b]),A(C),y&&(s?T=!1:(d.isValid||u.isValid)&&(T=await w(o,!0)));y&&(x.N.deps&&N(x.N.deps),((e,o,a,i)=>{const s=ke(r.errors,e),c=(d.isValid||u.isValid)&&Te(o)&&r.isValid!==o;var m;if(n.delayError&&a?(m=()=>((e,t)=>{Ce(r.errors,e,t),f.state.next({errors:r.errors})})(e,a),t=e=>{clearTimeout(l),l=setTimeout(m,e)},t(n.delayError)):(clearTimeout(l),t=null,a?Ce(r.errors,e,a):Qe(r.errors,e)),(a?!$e(s,a):s)||!Ke(i)||c){const t={...i,...c&&Te(o)?{isValid:o}:{},errors:r.errors,name:e};r={...r,...t},f.state.next(t)}})(b,T,s,O))}},C=(e,t)=>{if(ke(r.errors,t)&&e.focus)return e.focus(),1},N=async(e,t={})=>{let a,i;const s=Ze(e);if(n.resolver){const t=await(async e=>{const{errors:t}=await v(e);if(e)for(const n of e){const e=ke(t,n);e?Ce(r.errors,n,e):Qe(r.errors,n)}else r.errors=t;return t})(xe(e)?e:s);a=Ke(t),i=e?!s.some(e=>ke(t,e)):a}else e?(i=(await Promise.all(s.map(async e=>{const t=ke(o,e);return await w(t&&t.N?{[e]:t}:t)}))).every(Boolean),(i||r.isValid)&&p()):i=a=await w(o);return f.state.next({...!je(e)||(d.isValid||u.isValid)&&a!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:a}:{},errors:r.errors}),t.shouldFocus&&!i&&gt(o,C,e?s:c.mount),i},E=e=>{const t={...s.mount?i:a};return xe(e)?t:je(e)?ke(t,e):e.map(e=>ke(t,e))},P=(e,t)=>({invalid:!!ke((t||r).errors,e),isDirty:!!ke((t||r).dirtyFields,e),error:ke((t||r).errors,e),isValidating:!!ke(r.validatingFields,e),isTouched:!!ke((t||r).touchedFields,e)}),M=(e,t,n)=>{const a=(ke(o,e,{N:{}}).N||{}).ref,i=ke(r.errors,e)||{},{ref:s,message:c,type:l,...d}=i;Ce(r.errors,e,{...d,...t,ref:a}),f.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&a&&a.focus&&a.focus()},O=e=>f.state.subscribe({next:t=>{var n,o,s;n=e.name,o=t.name,s=e.exact,n&&o&&n!==o&&!Ze(n).some(e=>e&&(s?e===o:e.startsWith(o)||o.startsWith(e)))||!((e,t,n,r)=>{n(e);const{name:o,...a}=e;return Ke(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||Me))})(t,e.formState||d,L,e.reRenderRoot)||e.callback({values:{...i},...r,...t,defaultValues:a})}}).unsubscribe,R=(e,t={})=>{for(const s of e?Ze(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(Qe(o,s),Qe(i,s)),!t.keepError&&Qe(r.errors,s),!t.keepDirty&&Qe(r.dirtyFields,s),!t.keepTouched&&Qe(r.touchedFields,s),!t.keepIsValidating&&Qe(r.validatingFields,s),!n.shouldUnregister&&!t.keepDefaultValue&&Qe(a,s);f.state.next({values:we(i)}),f.state.next({...r,...t.keepDirty?{isDirty:y()}:{}}),!t.keepIsValid&&p()},_=({disabled:e,name:t})=>{(Te(e)&&s.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},D=(e,t={})=>{let r=ke(o,e);const i=Te(t.disabled)||Te(n.disabled);return Ce(o,e,{...r||{},N:{...r&&r.N?r.N:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),r?_({disabled:Te(t.disabled)?t.disabled:n.disabled,name:e}):b(e,!0,t.value),{...i?{disabled:t.disabled||n.disabled}:{},...n.progressive?{required:!!t.required,min:ft(t.min),max:ft(t.max),minLength:ft(t.minLength),maxLength:ft(t.maxLength),pattern:ft(t.pattern)}:{},name:e,onChange:T,onBlur:T,ref:i=>{if(i){D(e,t),r=ke(o,e);const n=xe(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>Ye(e)||ue(e))(n),c=r.N.refs||[];if(s?c.find(e=>e===n):n===r.N.ref)return;Ce(o,e,{N:{...r.N,...s?{refs:[...c.filter(Xe),n,...Array.isArray(ke(a,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),b(e,!1,void 0,n)}else r=ke(o,e,{}),r.N&&(r.N.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!ge(c.array,e)||!s.action)&&c.unMount.add(e)}}},I=()=>n.shouldFocusError&&gt(o,C,c.mount),U=(e,t)=>async a=>{let s;a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let l=we(i);if(f.state.next({isSubmitting:!0}),n.resolver){const{errors:e,values:t}=await v();r.errors=e,l=we(t)}else await w(o);if(c.disabled.size)for(const e of c.disabled)Qe(l,e);if(Qe(r.errors,"root"),Ke(r.errors)){f.state.next({errors:{}});try{await e(l,a)}catch(e){s=e}}else t&&await t({...r.errors},a),I(),setTimeout(I);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ke(r.errors)&&!s,submitCount:r.submitCount+1,errors:r.errors}),s)throw s},F=(e,t={})=>{const l=e?we(e):a,u=we(l),m=Ke(e),p=m?a:u;if(t.keepDefaultValues||(a=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(rt(a,i))]);for(const t of Array.from(e))ke(r.dirtyFields,t)?Ce(p,t,ke(i,t)):k(t,ke(p,t))}else{if(ve&&xe(e))for(const e of c.mount){const t=ke(o,e);if(t&&t.N){const e=Array.isArray(t.N.refs)?t.N.refs[0]:t.N.ref;if(Je(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)k(e,ke(p,e));else o={}}i=n.shouldUnregister?t.keepDefaultValues?we(a):{}:we(p),f.array.next({values:{...p}}),f.state.next({values:{...p}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!n.shouldUnregister,f.state.next({submitCount:t.keepSubmitCount?r.submitCount:0,isDirty:!m&&(t.keepDirty?r.isDirty:!(!t.keepDefaultValues||$e(e,a))),isSubmitted:!!t.keepIsSubmitted&&r.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&i?rt(a,i):r.dirtyFields:t.keepDefaultValues&&e?rt(a,e):t.keepDirty?r.dirtyFields:{},touchedFields:t.keepTouched?r.touchedFields:{},errors:t.keepErrors?r.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&r.isSubmitSuccessful,isSubmitting:!1,defaultValues:a})},j=(e,t)=>F(He(e)?e(i):e,t),L=e=>{r={...r,...e}},B={control:{register:D,unregister:R,getFieldState:P,handleSubmit:U,setError:M,A:O,R:v,_:I,v:x,D:y,T:p,I:(e,t=[],c,l,m=!0,p=!0)=>{if(l&&c&&!n.disabled){if(s.action=!0,p&&Array.isArray(ke(o,e))){const t=c(ke(o,e),l.argA,l.argB);m&&Ce(o,e,t)}if(p&&Array.isArray(ke(r.errors,e))){const t=c(ke(r.errors,e),l.argA,l.argB);m&&Ce(r.errors,e,t),((e,t)=>{!Ae(ke(e,t)).length&&Qe(e,t)})(r.errors,e)}if((d.touchedFields||u.touchedFields)&&p&&Array.isArray(ke(r.touchedFields,e))){const t=c(ke(r.touchedFields,e),l.argA,l.argB);m&&Ce(r.touchedFields,e,t)}(d.dirtyFields||u.dirtyFields)&&(r.dirtyFields=rt(a,i)),f.state.next({name:e,isDirty:y(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ce(i,e,t)},O:_,U:e=>{r.errors=e,f.state.next({errors:r.errors,isValid:!1})},F:e=>Ae(ke(s.mount?i:a,e,n.shouldUnregister?ke(a,e,[]):[])),j:F,L:()=>He(n.defaultValues)&&n.defaultValues().then(e=>{j(e,n.resetOptions),f.state.next({isLoading:!1})}),S:()=>{for(const e of c.unMount){const t=ke(o,e);t&&(t.N.refs?t.N.refs.every(e=>!Xe(e)):!Xe(t.N.ref))&&R(e)}c.unMount=new Set},B:e=>{Te(e)&&(f.state.next({disabled:e}),gt(o,(t,n)=>{const r=ke(o,n);r&&(t.disabled=r.N.disabled||e,Array.isArray(r.N.refs)&&r.N.refs.forEach(t=>{t.disabled=r.N.disabled||e}))},0,!1))},G:f,i:d,get C(){return o},get u(){return i},get M(){return s},set M(e){s=e},get o(){return a},get l(){return c},set l(e){c=e},get k(){return r},get P(){return n},set P(e){n={...n,...e}}},subscribe:e=>(s.mount=!0,u={...u,...e.formState},O({...e,formState:u})),trigger:N,register:D,handleSubmit:U,watch:(e,t)=>He(e)?f.state.subscribe({next:n=>"values"in n&&e(x(void 0,t),n)}):x(e,t,!0),setValue:k,getValues:E,reset:j,resetField:(e,t={})=>{ke(o,e)&&(xe(t.defaultValue)?k(e,we(ke(a,e))):(k(e,t.defaultValue),Ce(a,e,we(t.defaultValue))),t.keepTouched||Qe(r.touchedFields,e),t.keepDirty||(Qe(r.dirtyFields,e),r.isDirty=t.defaultValue?y(e,we(ke(a,e))):y()),t.keepError||(Qe(r.errors,e),d.isValid&&p()),f.state.next({...r}))},clearErrors:e=>{e&&Ze(e).forEach(e=>Qe(r.errors,e)),f.state.next({errors:e?r.errors:{}})},unregister:R,setError:M,setFocus:(e,t={})=>{const n=ke(o,e),r=n&&n.N;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&He(e.select)&&e.select())}},getFieldState:P};return{...B,formControl:B}}(e);t.current={...o,formState:r}}const i=t.current.control;return i.P=e,Fe(()=>{const e=i.A({formState:i.i,callback:()=>a({...i.k}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),i.k.isReady=!0,e},[i]),o.useEffect(()=>i.B(e.disabled),[i,e.disabled]),o.useEffect(()=>{e.mode&&(i.P.mode=e.mode),e.reValidateMode&&(i.P.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),o.useEffect(()=>{e.errors&&(i.U(e.errors),i._())},[i,e.errors]),o.useEffect(()=>{e.shouldUnregister&&i.G.state.next({values:i.v()})},[i,e.shouldUnregister]),o.useEffect(()=>{if(i.i.isDirty){const e=i.D();e!==r.isDirty&&i.G.state.next({isDirty:e})}},[i,r.isDirty]),o.useEffect(()=>{e.values&&!$e(e.values,n.current)?(i.j(e.values,{keepFieldsRef:!0,...i.P.resetOptions}),n.current=e.values,a(e=>({...e}))):i.L()},[i,e.values]),o.useEffect(()=>{i.M.mount||(i.T(),i.M.mount=!0),i.M.watch&&(i.M.watch=!1,i.G.state.next({...i.k})),i.S()}),t.current.formState=Ue(r,i),t.current}const Ct=(e,t,n)=>{if(e&&"reportValidity"in e){const r=ke(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Nt=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Ct(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>Ct(t,n,e))}},Et=(e,t)=>{t.shouldUseNativeValidation&&Nt(e,t);const n={};for(const r in e){const o=ke(t.fields,r),a=Object.assign(e[r]||{},{ref:o&&o.ref});if(Pt(t.names||Object.keys(e),r)){const e=Object.assign({},ke(n,r));Ce(e,"root",a),Ce(n,r,e)}else Ce(n,r,a)}return n},Pt=(e,t)=>{const n=Mt(t);return e.some(e=>Mt(e).match(`^${n}\\.\\d+`))};function Mt(e){return e.replace(/\]|\[/g,"")}function Ot(e,t,n){function r(n,r){var o;Object.defineProperty(n,"Z",{value:n.Z??{},enumerable:!1}),(o=n.Z).traits??(o.traits=new Set),n.Z.traits.add(e),t(n,r);for(const e in i.prototype)e in n||Object.defineProperty(n,e,{value:i.prototype[e].bind(n)});n.Z.constr=i,n.Z.def=r}const o=n?.Parent??Object;class a extends o{}function i(e){var t;const o=n?.Parent?new a:this;r(o,e),(t=o.Z).deferred??(t.deferred=[]);for(const e of o.Z.deferred)e();return o}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?.Z?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Rt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _t extends Error{constructor(e){super("Encountered unidirectional transform during encode: "+e),this.name="ZodEncodeError"}}const Dt={};function It(e){return Dt}function Ut(e,t){return"bigint"==typeof t?t.toString():t}function Ft(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function jt(e){return null==e}function Lt(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Bt=Symbol("evaluating");function $t(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Bt)return void 0===r&&(r=Bt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function zt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Gt(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Zt(e){return JSON.stringify(e)}const Wt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Kt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Vt=Ft(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function Ht(e){if(!1===Kt(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==Kt(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function Jt(e){return Ht(e)?{...e}:Array.isArray(e)?[...e]:e}const qt=new Set(["string","number","symbol"]);function Yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xt(e,t,n){const r=new e.Z.constr(t??e.Z.def);return t&&!n?.parent||(r.Z.parent=e),r}function Qt(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 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 en(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function tn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nn(e){return"string"==typeof e?e:e?.message}function rn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=nn(e.inst?.Z.def?.error?.(e))??nn(t?.error?.(e))??nn(n.customError?.(e))??nn(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function on(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function an(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const sn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"Z",{value:e.Z,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ut,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cn=Ot("$ZodError",sn),ln=Ot("$ZodError",sn,{Parent:Error}),dn=e=>(t,n,r,o)=>{const a=r?Object.assign(r,{async:!1}):{async:!1},i=t.Z.run({value:n,issues:[]},a);if(i instanceof Promise)throw new Rt;if(i.issues.length){const t=new(o?.Err??e)(i.issues.map(e=>rn(e,a,It())));throw Wt(t,o?.callee),t}return i.value},un=dn(ln),fn=e=>async(t,n,r,o)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let i=t.Z.run({value:n,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(o?.Err??e)(i.issues.map(e=>rn(e,a,It())));throw Wt(t,o?.callee),t}return i.value},mn=fn(ln),pn=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},a=t.Z.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Rt;return a.issues.length?{success:!1,error:new(e??cn)(a.issues.map(e=>rn(e,o,It())))}:{success:!0,data:a.value}},hn=pn(ln),bn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let a=t.Z.run({value:n,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>rn(e,o,It())))}:{success:!0,data:a.value}},gn=bn(ln),vn=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return dn(e)(t,n,o)},wn=e=>(t,n,r)=>dn(e)(t,n,r),yn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return fn(e)(t,n,o)},xn=e=>async(t,n,r)=>fn(e)(t,n,r),An=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return pn(e)(t,n,o)},Sn=e=>(t,n,r)=>pn(e)(t,n,r),kn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bn(e)(t,n,o)},Tn=e=>async(t,n,r)=>bn(e)(t,n,r),Cn=/^[cC][^\s-]{8,}$/,Nn=/^[0-9a-z]+$/,En=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pn=/^[0-9a-vA-V]{20}$/,Mn=/^[A-Za-z0-9]{27}$/,On=/^[a-zA-Z0-9_-]{21}$/,Rn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_n=/^([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})$/,Dn=e=>e?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)$/,In=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Un=/^(?:(?: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])$/,Fn=/^(([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}|:))$/,jn=/^((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])$/,Ln=/^(([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])$/,Bn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$n=/^[A-Za-z0-9_-]*$/,zn=/^(?=.{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])?)*\.?$/,Gn=/^\+(?:[0-9]){6,14}[0-9]$/,Zn="(?:(?:\\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])))",Wn=RegExp(`^${Zn}$`);function Kn(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 Vn=/^[^A-Z]*$/,Hn=/^[^a-z]*$/,Jn=Ot("$ZodCheck",(e,t)=>{var n;e.Z??(e.Z={}),e.Z.def=t,(n=e.Z).onattach??(n.onattach=[])}),qn=Ot("$ZodCheckMaxLength",(e,t)=>{var n;Jn.init(e,t),(n=e.Z.def).when??(n.when=e=>{const t=e.value;return!jt(t)&&void 0!==t.length}),e.Z.onattach.push(e=>{const n=e.Z.bag.maximum??1/0;t.maximum<n&&(e.Z.bag.maximum=t.maximum)}),e.Z.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=on(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Yn=Ot("$ZodCheckMinLength",(e,t)=>{var n;Jn.init(e,t),(n=e.Z.def).when??(n.when=e=>{const t=e.value;return!jt(t)&&void 0!==t.length}),e.Z.onattach.push(e=>{const n=e.Z.bag.minimum??-1/0;t.minimum>n&&(e.Z.bag.minimum=t.minimum)}),e.Z.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=on(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xn=Ot("$ZodCheckLengthEquals",(e,t)=>{var n;Jn.init(e,t),(n=e.Z.def).when??(n.when=e=>{const t=e.value;return!jt(t)&&void 0!==t.length}),e.Z.onattach.push(e=>{const n=e.Z.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e.Z.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const a=on(r),i=o>t.length;n.issues.push({origin:a,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qn=Ot("$ZodCheckStringFormat",(e,t)=>{var n,r;Jn.init(e,t),e.Z.onattach.push(e=>{const n=e.Z.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e.Z).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e.Z).check??(r.check=()=>{})}),er=Ot("$ZodCheckRegex",(e,t)=>{Qn.init(e,t),e.Z.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tr=Ot("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Vn),Qn.init(e,t)}),nr=Ot("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Hn),Qn.init(e,t)}),rr=Ot("$ZodCheckIncludes",(e,t)=>{Jn.init(e,t);const n=Yt(t.includes),r=RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e.Z.onattach.push(e=>{const t=e.Z.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e.Z.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),or=Ot("$ZodCheckStartsWith",(e,t)=>{Jn.init(e,t);const n=RegExp(`^${Yt(t.prefix)}.*`);t.pattern??(t.pattern=n),e.Z.onattach.push(e=>{const t=e.Z.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e.Z.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ar=Ot("$ZodCheckEndsWith",(e,t)=>{Jn.init(e,t);const n=RegExp(`.*${Yt(t.suffix)}$`);t.pattern??(t.pattern=n),e.Z.onattach.push(e=>{const t=e.Z.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e.Z.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ir=Ot("$ZodCheckOverwrite",(e,t)=>{Jn.init(e,t),e.Z.check=e=>{e.value=t.tx(e.value)}});class sr{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),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>" "+e)].join("\n"))}}const cr={major:4,minor:1,patch:8},lr=Ot("$ZodType",(e,t)=>{var n;e??(e={}),e.Z.def=t,e.Z.bag=e.Z.bag||{},e.Z.version=cr;const r=[...e.Z.def.checks??[]];e.Z.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t.Z.onattach)n(e);if(0===r.length)(n=e.Z).deferred??(n.deferred=[]),e.Z.deferred?.push(()=>{e.Z.run=e.Z.parse});else{const t=(e,t,n)=>{let r,o=en(e);for(const a of t){if(a.Z.def.when){if(!a.Z.def.when(e))continue}else if(o)continue;const t=e.issues.length,i=a.Z.check(e);if(i instanceof Promise&&!1===n?.async)throw new Rt;if(r||i instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await i,e.issues.length!==t&&(o||(o=en(e,t)))});else{if(e.issues.length===t)continue;o||(o=en(e,t))}}return r?r.then(()=>e):e},n=(n,o,a)=>{if(en(n))return n.aborted=!0,n;const i=t(o,r,a);if(i instanceof Promise){if(!1===a.async)throw new Rt;return i.then(t=>e.Z.parse(t,a))}return e.Z.parse(i,a)};e.Z.run=(o,a)=>{if(a.skipChecks)return e.Z.parse(o,a);if("backward"===a.direction){const t=e.Z.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,o,a)):n(t,o,a)}const i=e.Z.parse(o,a);if(i instanceof Promise){if(!1===a.async)throw new Rt;return i.then(e=>t(e,r,a))}return t(i,r,a)}}e["~standard"]={validate:t=>{try{const n=hn(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return gn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),dr=Ot("$ZodString",(e,t)=>{var n;lr.init(e,t),e.Z.pattern=[...e?.Z.bag?.patterns??[]].pop()??(n=e.Z.bag,RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e.Z.parse=(n,r)=>{if(t.coerce)try{n.value=n.value+""}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ur=Ot("$ZodStringFormat",(e,t)=>{Qn.init(e,t),dr.init(e,t)}),fr=Ot("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_n),ur.init(e,t)}),mr=Ot("$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 Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Dn(e))}else t.pattern??(t.pattern=Dn());ur.init(e,t)}),pr=Ot("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=In),ur.init(e,t)}),hr=Ot("$ZodURL",(e,t)=>{ur.init(e,t),e.Z.check=n=>{try{const r=n.value.trim(),o=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:zn.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),br=Ot("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ur.init(e,t)}),gr=Ot("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=On),ur.init(e,t)}),vr=Ot("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Cn),ur.init(e,t)}),wr=Ot("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nn),ur.init(e,t)}),yr=Ot("$ZodULID",(e,t)=>{t.pattern??(t.pattern=En),ur.init(e,t)}),xr=Ot("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Pn),ur.init(e,t)}),Ar=Ot("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mn),ur.init(e,t)}),Sr=Ot("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Kn({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return RegExp(`^${Zn}T(?:${r})$`)}(t)),ur.init(e,t)}),kr=Ot("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Wn),ur.init(e,t)}),Tr=Ot("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${Kn(t)}$`)),ur.init(e,t)}),Cr=Ot("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Rn),ur.init(e,t)}),Nr=Ot("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Un),ur.init(e,t),e.Z.onattach.push(e=>{e.Z.bag.format="ipv4"})}),Er=Ot("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Fn),ur.init(e,t),e.Z.onattach.push(e=>{e.Z.bag.format="ipv6"}),e.Z.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Pr=Ot("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=jn),ur.init(e,t)}),Mr=Ot("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ln),ur.init(e,t),e.Z.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw Error();const[e,t]=r;if(!t)throw Error();const n=+t;if(""+n!==t)throw Error();if(0>n||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Or(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Rr=Ot("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bn),ur.init(e,t),e.Z.onattach.push(e=>{e.Z.bag.contentEncoding="base64"}),e.Z.check=n=>{Or(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),_r=Ot("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$n),ur.init(e,t),e.Z.onattach.push(e=>{e.Z.bag.contentEncoding="base64url"}),e.Z.check=n=>{(function(e){if(!$n.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Or(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Dr=Ot("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Gn),ur.init(e,t)}),Ir=Ot("$ZodJWT",(e,t)=>{ur.init(e,t),e.Z.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ur=Ot("$ZodUnknown",(e,t)=>{lr.init(e,t),e.Z.parse=e=>e}),Fr=Ot("$ZodNever",(e,t)=>{lr.init(e,t),e.Z.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function jr(e,t,n){e.issues.length&&t.issues.push(...tn(n,e.issues)),t.value[n]=e.value}const Lr=Ot("$ZodArray",(e,t)=>{lr.init(e,t),e.Z.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const a=[];for(let e=0;e<o.length;e++){const i=o[e],s=t.element.Z.run({value:i,issues:[]},r);s instanceof Promise?a.push(s.then(t=>jr(t,n,e))):jr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Br(e,t,n,r){e.issues.length&&t.issues.push(...tn(n,e.issues)),void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function $r(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?.Z?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter(e=>"optional"===r[e].Z.optin&&"optional"===r[e].Z.optout));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function zr(e,t,n,r,o,a){const i=[],s=o.keySet,c=o.catchall.Z,l=c.def.type;for(const o of Object.keys(t)){if(s.has(o))continue;if("never"===l){i.push(o);continue}const a=c.run({value:t[o],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Br(e,n,o,t))):Br(a,n,o,t)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Gr=Ot("$ZodObject",(e,t)=>{lr.init(e,t);const n=Ft(()=>$r(t));$t(e.Z,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t].Z;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const r=Kt,o=t.catchall;let a;e.Z.parse=(t,i)=>{a??(a=n.value);const s=t.value;if(!r(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=a.shape;for(const e of a.keys){const n=l[e].Z.run({value:s[e],issues:[]},i);n instanceof Promise?c.push(n.then(n=>Br(n,t,e,s))):Br(n,t,e,s)}return o?zr(c,s,t,i,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Zr=Ot("$ZodObjectJIT",(e,t)=>{Gr.init(e,t);const n=e.Z.parse,r=Ft(()=>$r(t));let o;const a=Kt,i=!Dt.jitless,s=i&&Vt.value,c=t.catchall;let l;e.Z.parse=(d,u)=>{l??(l=r.value);const f=d.value;return a(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(o||(o=(e=>{const t=new sr(["shape","payload","ctx"]),n=r.value,o=e=>{const t=Zt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const a=Object.create(null);let i=0;for(const e of n.keys)a[e]="key_"+i++;t.write("const newResult = {};");for(const e of n.keys){const n=a[e],r=Zt(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${r}, ...iss.path] : [${r}]\n })));\n }\n \n \n if (${n}.value === undefined) {\n if (${r} in input) {\n newResult[${r}] = undefined;\n }\n } else {\n newResult[${r}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=o(d,u),c?zr([],f,d,u,l,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function Wr(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const o=e.filter(e=>!en(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>rn(e,r,It())))}),t)}const Kr=Ot("$ZodUnion",(e,t)=>{lr.init(e,t),$t(e.Z,"optin",()=>t.options.some(e=>"optional"===e.Z.optin)?"optional":void 0),$t(e.Z,"optout",()=>t.options.some(e=>"optional"===e.Z.optout)?"optional":void 0),$t(e.Z,"values",()=>{if(t.options.every(e=>e.Z.values))return new Set(t.options.flatMap(e=>Array.from(e.Z.values)))}),$t(e.Z,"pattern",()=>{if(t.options.every(e=>e.Z.pattern)){const e=t.options.map(e=>e.Z.pattern);return RegExp(`^(${e.map(e=>Lt(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0].Z.run;e.Z.parse=(o,a)=>{if(n)return r(o,a);let i=!1;const s=[];for(const e of t.options){const t=e.Z.run({value:o.value,issues:[]},a);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>Wr(t,o,e,a)):Wr(s,o,e,a)}}),Vr=Ot("$ZodIntersection",(e,t)=>{lr.init(e,t),e.Z.parse=(e,n)=>{const r=e.value,o=t.left.Z.run({value:r,issues:[]},n),a=t.right.Z.run({value:r,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([t,n])=>Jr(e,t,n)):Jr(e,o,a)}});function Hr(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(Ht(e)&&Ht(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),o={...e,...t};for(const n of r){const r=Hr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};o[n]=r.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=Hr(e[r],t[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Jr(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),en(e))return e;const r=Hr(t.value,n.value);if(!r.valid)throw Error("Unmergable intersection. Error path: "+JSON.stringify(r.mergeErrorPath));return e.value=r.data,e}const qr=Ot("$ZodEnum",(e,t)=>{lr.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e),n=Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t);return n}(t.entries),r=new Set(n);e.Z.values=r,e.Z.pattern=RegExp(`^(${n.filter(e=>qt.has(typeof e)).map(e=>"string"==typeof e?Yt(e):e.toString()).join("|")})$`),e.Z.parse=(t,o)=>{const a=t.value;return r.has(a)||t.issues.push({code:"invalid_value",values:n,input:a,inst:e}),t}}),Yr=Ot("$ZodTransform",(e,t)=>{lr.init(e,t),e.Z.parse=(n,r)=>{if("backward"===r.direction)throw new _t(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n));if(o instanceof Promise)throw new Rt;return n.value=o,n}});function Xr(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Qr=Ot("$ZodOptional",(e,t)=>{lr.init(e,t),e.Z.optin="optional",e.Z.optout="optional",$t(e.Z,"values",()=>t.innerType.Z.values?new Set([...t.innerType.Z.values,void 0]):void 0),$t(e.Z,"pattern",()=>{const e=t.innerType.Z.pattern;return e?RegExp(`^(${Lt(e.source)})?$`):void 0}),e.Z.parse=(e,n)=>{if("optional"===t.innerType.Z.optin){const r=t.innerType.Z.run(e,n);return r instanceof Promise?r.then(t=>Xr(t,e.value)):Xr(r,e.value)}return void 0===e.value?e:t.innerType.Z.run(e,n)}}),eo=Ot("$ZodNullable",(e,t)=>{lr.init(e,t),$t(e.Z,"optin",()=>t.innerType.Z.optin),$t(e.Z,"optout",()=>t.innerType.Z.optout),$t(e.Z,"pattern",()=>{const e=t.innerType.Z.pattern;return e?RegExp(`^(${Lt(e.source)}|null)$`):void 0}),$t(e.Z,"values",()=>t.innerType.Z.values?new Set([...t.innerType.Z.values,null]):void 0),e.Z.parse=(e,n)=>null===e.value?e:t.innerType.Z.run(e,n)}),to=Ot("$ZodDefault",(e,t)=>{lr.init(e,t),e.Z.optin="optional",$t(e.Z,"values",()=>t.innerType.Z.values),e.Z.parse=(e,n)=>{if("backward"===n.direction)return t.innerType.Z.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType.Z.run(e,n);return r instanceof Promise?r.then(e=>no(e,t)):no(r,t)}});function no(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const ro=Ot("$ZodPrefault",(e,t)=>{lr.init(e,t),e.Z.optin="optional",$t(e.Z,"values",()=>t.innerType.Z.values),e.Z.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType.Z.run(e,n))}),oo=Ot("$ZodNonOptional",(e,t)=>{lr.init(e,t),$t(e.Z,"values",()=>{const e=t.innerType.Z.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e.Z.parse=(n,r)=>{const o=t.innerType.Z.run(n,r);return o instanceof Promise?o.then(t=>ao(t,e)):ao(o,e)}});function ao(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 io=Ot("$ZodCatch",(e,t)=>{lr.init(e,t),$t(e.Z,"optin",()=>t.innerType.Z.optin),$t(e.Z,"optout",()=>t.innerType.Z.optout),$t(e.Z,"values",()=>t.innerType.Z.values),e.Z.parse=(e,n)=>{if("backward"===n.direction)return t.innerType.Z.run(e,n);const r=t.innerType.Z.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>rn(e,n,It()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>rn(e,n,It()))},input:e.value}),e.issues=[]),e)}}),so=Ot("$ZodPipe",(e,t)=>{lr.init(e,t),$t(e.Z,"values",()=>t.in.Z.values),$t(e.Z,"optin",()=>t.in.Z.optin),$t(e.Z,"optout",()=>t.out.Z.optout),$t(e.Z,"propValues",()=>t.in.Z.propValues),e.Z.parse=(e,n)=>{if("backward"===n.direction){const r=t.out.Z.run(e,n);return r instanceof Promise?r.then(e=>co(e,t.in,n)):co(r,t.in,n)}const r=t.in.Z.run(e,n);return r instanceof Promise?r.then(e=>co(e,t.out,n)):co(r,t.out,n)}});function co(e,t,n){return e.issues.length?(e.aborted=!0,e):t.Z.run({value:e.value,issues:e.issues},n)}const lo=Ot("$ZodReadonly",(e,t)=>{lr.init(e,t),$t(e.Z,"propValues",()=>t.innerType.Z.propValues),$t(e.Z,"values",()=>t.innerType.Z.values),$t(e.Z,"optin",()=>t.innerType.Z.optin),$t(e.Z,"optout",()=>t.innerType.Z.optout),e.Z.parse=(e,n)=>{if("backward"===n.direction)return t.innerType.Z.run(e,n);const r=t.innerType.Z.run(e,n);return r instanceof Promise?r.then(uo):uo(r)}});function uo(e){return e.value=Object.freeze(e.value),e}const fo=Ot("$ZodCustom",(e,t)=>{Jn.init(e,t),lr.init(e,t),e.Z.parse=(e,t)=>e,e.Z.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>mo(t,n,r,e));mo(o,n,r,e)}});function mo(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r.Z.def.path??[]],continue:!r.Z.def.abort};r.Z.def.params&&(e.params=r.Z.def.params),t.issues.push(an(e))}}class po{constructor(){this.W=new WeakMap,this.K=new Map}add(e,...t){const n=t[0];if(this.W.set(e,n),n&&"object"==typeof n&&"id"in n){if(this.K.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this.K.set(n.id,e)}return this}clear(){return this.W=new WeakMap,this.K=new Map,this}remove(e){const t=this.W.get(e);return t&&"object"==typeof t&&"id"in t&&this.K.delete(t.id),this.W.delete(e),this}get(e){const t=e.Z.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this.W.get(e)};return Object.keys(r).length?r:void 0}return this.W.get(e)}has(e){return this.W.has(e)}}function ho(){return new po}const bo=ho();function go(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Qt(t)})}function vo(e,t){return new qn({check:"max_length",...Qt(t),maximum:e})}function wo(e,t){return new Yn({check:"min_length",...Qt(t),minimum:e})}function yo(e,t){return new Xn({check:"length_equals",...Qt(t),length:e})}function xo(e){return new ir({check:"overwrite",tx:e})}function Ao(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function So(e,t){for(var n={};e.length;){var r=e[0],o=r.code,a=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[i]={message:s.message,type:s.code}}else n[i]={message:a,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[i].types,l=c&&c[r.code];n[i]=Ge(i,t,n,o,l?[].concat(l,r.message):r.message)}e.shift()}return n}function ko(e,t){for(var n={};e.length;){var r=e[0],o=r.code,a=r.message,i=r.path.join(".");if(!n[i])if("invalid_union"===r.code&&r.errors.length>0){var s=r.errors[0][0];n[i]={message:s.message,type:s.code}}else n[i]={message:a,type:o};if("invalid_union"===r.code&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=n[i].types,l=c&&c[r.code];n[i]=Ge(i,t,n,o,l?[].concat(l,r.message):r.message)}e.shift()}return n}function To(e,t,n){if(void 0===n&&(n={}),function(e){return"V"in e&&"object"==typeof e.V&&"typeName"in e.V}(e))return function(r,o,a){try{return Promise.resolve(Ao(function(){return Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then(function(e){return a.shouldUseNativeValidation&&Nt({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:Et(So(e.errors,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"Z"in e&&"object"==typeof e.Z}(e))return function(r,o,a){try{return Promise.resolve(Ao(function(){return Promise.resolve(("sync"===n.mode?un:mn)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&Nt({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof cn}(e))return{values:{},errors:Et(ko(e.issues,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error("Invalid input: not a Zod schema")}function Co(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;o>t;t++)e[t]&&(n=Co(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function No(){for(var e,t,n=0,r="",o=arguments.length;o>n;n++)(e=arguments[n])&&(t=Co(e))&&(r&&(r+=" "),r+=t);return r}const Eo=e=>{const t=Ro(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),Po(n,t)||Oo(e)},getConflictingClassGroupIds:(e,t)=>{const o=n[e]||[];return t&&r[e]?[...o,...r[e]]:o}}},Po=(e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Po(e.slice(1),r):void 0;if(o)return o;if(0===t.validators.length)return;const a=e.join("-");return t.validators.find(({validator:e})=>e(a))?.classGroupId},Mo=/^\[(.+)\]$/,Oo=e=>{if(Mo.test(e)){const t=Mo.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ro=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const e in n)_o(n[e],r,e,t);return r},_o=(e,t,n,r)=>{e.forEach(e=>{if("string"!=typeof e)return"function"==typeof e?Io(e)?void _o(e(r),t,n,r):void t.validators.push({validator:e,classGroupId:n}):void Object.entries(e).forEach(([e,o])=>{_o(o,Do(t,e),n,r)});(""===e?t:Do(t,e)).classGroupId=n})},Do=(e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Io=e=>e.isThemeGetter,Uo=e=>{if(1>e)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(o,a)=>{n.set(o,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=r.get(e))?(o(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):o(e,t)}}},Fo=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,a=0;for(let i=0;i<e.length;i++){let s=e[i];if(0===r&&0===o){if(":"===s){t.push(e.slice(a,i)),a=i+1;continue}if("/"===s){n=i;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const i=0===t.length?e:e.substring(a),s=jo(i);return{modifiers:t,hasImportantModifier:s!==i,baseClassName:s,maybePostfixModifierPosition:n&&n>a?n-a:void 0}};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0}}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},jo=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,Lo=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return e=>{if(1>=e.length)return e;const n=[];let r=[];return e.forEach(e=>{"["===e[0]||t[e]?(n.push(...r.sort(),e),r=[]):r.push(e)}),n.push(...r.sort()),n}},Bo=/\s+/;function $o(){let e,t,n=0,r="";for(;arguments.length>n;)(e=arguments[n++])&&(t=zo(e))&&(r&&(r+=" "),r+=t);return r}const zo=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=zo(e[r]))&&(n&&(n+=" "),n+=t);return n};function Go(e,...t){let n,r,o,a=function(s){const c=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:Uo(e.cacheSize),parseClassName:Fo(e),sortModifiers:Lo(e),...Eo(e)}))(c),r=n.cache.get,o=n.cache.set,a=i,i(s)};function i(e){const t=r(e);if(t)return t;const a=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:a}=t,i=[],s=e.trim().split(Bo);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:m}=n(t);if(l){c=t+(c.length>0?" "+c:c);continue}let p=!!m,h=r(p?f.substring(0,m):f);if(!h){if(!p){c=t+(c.length>0?" "+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?" "+c:c);continue}p=!1}const b=a(d).join(":"),g=u?b+"!":b,v=g+h;if(i.includes(v))continue;i.push(v);const w=o(h,p);for(let e=0;e<w.length;++e){const t=w[e];i.push(g+t)}c=t+(c.length>0?" "+c:c)}return c})(e,n);return o(e,a),a}return function(){return a($o.apply(null,arguments))}}const Zo=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Wo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ko=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vo=/^\d+\/\d+$/,Ho=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jo=/\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$/,qo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Yo=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Xo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qo=e=>Vo.test(e),ea=e=>!!e&&!Number.isNaN(+e),ta=e=>!!e&&Number.isInteger(+e),na=e=>e.endsWith("%")&&ea(e.slice(0,-1)),ra=e=>Ho.test(e),oa=()=>!0,aa=e=>Jo.test(e)&&!qo.test(e),ia=()=>!1,sa=e=>Yo.test(e),ca=e=>Xo.test(e),la=e=>!ua(e)&&!ga(e),da=e=>ka(e,Ea,ia),ua=e=>Wo.test(e),fa=e=>ka(e,Pa,aa),ma=e=>ka(e,Ma,ea),pa=e=>ka(e,Ca,ia),ha=e=>ka(e,Na,ca),ba=e=>ka(e,Ra,sa),ga=e=>Ko.test(e),va=e=>Ta(e,Pa),wa=e=>Ta(e,Oa),ya=e=>Ta(e,Ca),xa=e=>Ta(e,Ea),Aa=e=>Ta(e,Na),Sa=e=>Ta(e,Ra,!0),ka=(e,t,n)=>{const r=Wo.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},Ta=(e,t,n=!1)=>{const r=Ko.exec(e);return!!r&&(r[1]?t(r[1]):n)},Ca=e=>"position"===e||"percentage"===e,Na=e=>"image"===e||"url"===e,Ea=e=>"length"===e||"size"===e||"bg-size"===e,Pa=e=>"length"===e,Ma=e=>"number"===e,Oa=e=>"family-name"===e,Ra=e=>"shadow"===e,_a=Go(()=>{const e=Zo("color"),t=Zo("font"),n=Zo("text"),r=Zo("font-weight"),o=Zo("tracking"),a=Zo("leading"),i=Zo("breakpoint"),s=Zo("container"),c=Zo("spacing"),l=Zo("radius"),d=Zo("shadow"),u=Zo("inset-shadow"),f=Zo("text-shadow"),m=Zo("drop-shadow"),p=Zo("blur"),h=Zo("perspective"),b=Zo("aspect"),g=Zo("ease"),v=Zo("animate"),w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ga,ua],y=()=>[ga,ua,c],x=()=>[Qo,"full","auto",...y()],A=()=>[ta,"none","subgrid",ga,ua],S=()=>["auto",{span:["full",ta,ga,ua]},ta,ga,ua],k=()=>[ta,"auto",ga,ua],T=()=>["auto","min","max","fr",ga,ua],C=()=>["auto",...y()],N=()=>[Qo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],E=()=>[e,ga,ua],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ya,pa,{position:[ga,ua]}],M=()=>["auto","cover","contain",xa,da,{size:[ga,ua]}],O=()=>[na,va,fa],R=()=>["","none","full",l,ga,ua],_=()=>["",ea,va,fa],D=()=>[ea,na,ya,pa],I=()=>["","none",p,ga,ua],U=()=>["none",ea,ga,ua],F=()=>["none",ea,ga,ua],j=()=>[ea,ga,ua],L=()=>[Qo,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ra],breakpoint:[ra],color:[oa],container:[ra],"drop-shadow":[ra],ease:["in","out","in-out"],font:[la],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ra],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ra],shadow:[ra],spacing:["px",ea],text:[ra],"text-shadow":[ra],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Qo,ua,ga,b]}],container:["container"],columns:[{columns:[ea,ua,ga,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],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:[ta,"auto",ga,ua]}],basis:[{basis:[Qo,"full","auto",s,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ea,Qo,"auto","initial","none",ua]}],grow:[{grow:["",ea,ga,ua]}],shrink:[{shrink:["",ea,ga,ua]}],order:[{order:[ta,"first","last","none",ga,ua]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"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:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],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":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],w:[{w:[s,"screen",...N()]}],"min-w":[{"min-w":[s,"screen","none",...N()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",n,va,fa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ga,ma]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",na,ua]}],"font-family":[{font:[wa,ua,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:[o,ga,ua]}],"line-clamp":[{"line-clamp":[ea,"none",ga,ma]}],leading:[{leading:[a,...y()]}],"list-image":[{"list-image":["none",ga,ua]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ga,ua]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[ea,"from-font","auto",ga,fa]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[ea,"auto",ga,ua]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ga,ua]}],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",ga,ua]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ta,ga,ua],radial:["",ga,ua],conic:[ta,ga,ua]},Aa,ha]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"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:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[ea,ga,ua]}],"outline-w":[{outline:["",ea,va,fa]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",d,Sa,ba]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",u,Sa,ba]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[ea,fa]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",f,Sa,ba]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[ea,ga,ua]}],"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":[ea]}],"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":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"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":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"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":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"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":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"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":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"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":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"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":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[ga,ua]}],"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":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"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":[ea]}],"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":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ga,ua]}],filter:[{filter:["","none",ga,ua]}],blur:[{blur:I()}],brightness:[{brightness:[ea,ga,ua]}],contrast:[{contrast:[ea,ga,ua]}],"drop-shadow":[{"drop-shadow":["","none",m,Sa,ba]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",ea,ga,ua]}],"hue-rotate":[{"hue-rotate":[ea,ga,ua]}],invert:[{invert:["",ea,ga,ua]}],saturate:[{saturate:[ea,ga,ua]}],sepia:[{sepia:["",ea,ga,ua]}],"backdrop-filter":[{"backdrop-filter":["","none",ga,ua]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[ea,ga,ua]}],"backdrop-contrast":[{"backdrop-contrast":[ea,ga,ua]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ea,ga,ua]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ea,ga,ua]}],"backdrop-invert":[{"backdrop-invert":["",ea,ga,ua]}],"backdrop-opacity":[{"backdrop-opacity":[ea,ga,ua]}],"backdrop-saturate":[{"backdrop-saturate":[ea,ga,ua]}],"backdrop-sepia":[{"backdrop-sepia":["",ea,ga,ua]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ga,ua]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ea,"initial",ga,ua]}],ease:[{ease:["linear","initial",g,ga,ua]}],delay:[{delay:[ea,ga,ua]}],animate:[{animate:["none",v,ga,ua]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,ga,ua]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:U()}],"rotate-x":[{"rotate-x":U()}],"rotate-y":[{"rotate-y":U()}],"rotate-z":[{"rotate-z":U()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:j()}],"skew-x":[{"skew-x":j()}],"skew-y":[{"skew-y":j()}],transform:[{transform:[ga,ua,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"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:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"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",ga,ua]}],"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":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"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",ga,ua]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[ea,va,fa,ma]}],stroke:[{stroke:["none",...E()]}],"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 Da(...e){return _a(No(e))}function Ia(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ua(...e){return t=>{let n=!1;const r=e.map(e=>{const r=Ia(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Ia(e[t],null)}}}}function Fa(...e){return r.useCallback(Ua(...e),e)}function ja(t){const n=Ba(t),o=r.forwardRef((t,o)=>{const{children:a,...i}=t,s=r.Children.toArray(a),c=s.find(za);if(c){const t=c.props.children,a=s.map(e=>e===c?r.Children.count(t)>1?r.Children.only(null):r.isValidElement(t)?t.props.children:null:e);return e(n,{...i,ref:o,children:r.isValidElement(t)?r.cloneElement(t,void 0,a):null})}return e(n,{...i,ref:o,children:a})});return o.displayName=t+".Slot",o}var La=ja("Slot");function Ba(e){const t=r.forwardRef((e,t)=>{const{children:n,...o}=e;if(r.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}(n),a=function(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{const t=a(...e);return o(...e),t}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}(o,n.props);return n.type!==r.Fragment&&(a.ref=t?Ua(t,e):e),r.cloneElement(n,a)}return r.Children.count(n)>1?r.Children.only(null):null});return t.displayName=e+".SlotClone",t}var $a=Symbol("radix.slottable");function za(e){return r.isValidElement(e)&&"function"==typeof e.type&&"H"in e.type&&e.type.H===$a}const Ga=e=>"boolean"==typeof e?""+e:0===e?"0":e,Za=No,Wa=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return Za(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:o,defaultVariants:a}=t,i=Object.keys(o).map(e=>{const t=null==n?void 0:n[e],r=null==a?void 0:a[e];if(null===t)return null;const i=Ga(t)||Ga(r);return o[e][i]}),s=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e},{}),c=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...a,...s}[t]):{...a,...s}[t]===n})?[...e,n,r]:e},[]);return Za(e,i,c,null==n?void 0:n.class,null==n?void 0:n.className)},Ka=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Va=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ha=(...e)=>e.filter((e,t,n)=>!!e&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Ja=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var qa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ya=d(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:a,iconNode:i,...s},c)=>u("svg",{ref:c,...qa,width:t,height:t,stroke:e,strokeWidth:r?24*+n/+t:n,className:Ha("lucide",o),...!a&&!Ja(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>u(e,t)),...Array.isArray(a)?a:[a]])),Xa=(e,t)=>{const n=d(({className:n,...r},o)=>u(Ya,{ref:o,iconNode:t,className:Ha("lucide-"+Ka(Va(e)),"lucide-"+e,n),...r}));return n.displayName=Va(e),n},Qa=Xa("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"}]]),ei=Xa("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),ti=Xa("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),ni=Xa("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"}]]),ri=Xa("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),oi=Xa("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ai=Xa("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"}]]),ii=Xa("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),si=Xa("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"}]]),ci=Xa("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"}]]),li=Xa("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),di=Xa("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"}]]),ui=Xa("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"}]]),fi=Xa("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"}]]),mi=Xa("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"}]]),pi=Xa("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"}]]),hi=Wa("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"}}),bi=r.forwardRef(({className:t,variant:o,progress:a,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?La:"button",m=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return n(f,{disabled:a||d.disabled,className:Da(hi({variant:o,size:i,withIcon:null!=a||null!=s||null!=c,className:t})),ref:u,...d,children:[a&&e(ri,{size:m,className:"animate-spin"}),s&&r.cloneElement(s,{size:m}),d.children,c&&r.cloneElement(c,{size:m})]})});bi.displayName="Button";var gi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,n)=>{const o=ja("Primitive."+n),a=r.forwardRef((t,r)=>{const{asChild:a,...i}=t,s=a?o:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e(s,{...i,ref:r})});return a.displayName="Primitive."+n,{...t,[n]:a}},{}),vi=r.forwardRef((t,n)=>e(gi.label,{...t,ref:n,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));vi.displayName="Label";var wi=vi;const yi=Wa("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xi=r.forwardRef(({className:t,...n},r)=>e(wi,{ref:r,className:Da(yi(),t),...n}));xi.displayName=wi.displayName;const Ai=Ie,Si=r.createContext({}),ki=({...t})=>e(Si.Provider,{value:{name:t.name},children:e(ze,{...t})}),Ti=()=>{const e=r.useContext(Si),t=r.useContext(Ci),{getFieldState:n,formState:o}=De(),a=n(e.name,o);if(!e)throw Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:i+"-form-item",formDescriptionId:i+"-form-item-description",formMessageId:i+"-form-item-message",...a}},Ci=r.createContext({}),Ni=r.forwardRef(({className:t,...n},o)=>{const a=r.useId();return e(Ci.Provider,{value:{id:a},children:e("div",{ref:o,className:Da("space-y-2",t),...n})})});Ni.displayName="FormItem";const Ei=r.forwardRef(({className:t,...n},r)=>{const{error:o,formItemId:a}=Ti();return e(xi,{ref:r,className:Da(o&&"text-destructive",t),htmlFor:a,...n})});Ei.displayName="FormLabel";const Pi=r.forwardRef(({...t},n)=>{const{error:r,formItemId:o,formDescriptionId:a,formMessageId:i}=Ti();return e(La,{ref:n,id:o,"aria-describedby":r?`${a} ${i}`:""+a,"aria-invalid":!!r,...t})});Pi.displayName="FormControl";const Mi=r.forwardRef(({className:t,...n},r)=>{const{formDescriptionId:o}=Ti();return e("p",{ref:r,id:o,className:Da("text-sm text-muted-foreground",t),...n})});Mi.displayName="FormDescription";const Oi=r.forwardRef(({className:t,children:n,...r},o)=>{const{error:a,formMessageId:i}=Ti(),s=a?a?.message+"":n;return s?e("p",{ref:o,id:i,className:Da("text-sm font-medium text-destructive",t),...r,children:s}):null});Oi.displayName="FormMessage";const Ri=r.forwardRef(({className:t,type:n,...r},o)=>e("input",{type:n,className:Da("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:o,...r}));function _i({className:t,...n}){return e("div",{className:Da("animate-pulse rounded-md bg-primary/10",t),...n})}Ri.displayName="Input";let Di=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 Error("Failed to fetch beta form configuration: "+e.statusText);return e.json()}async submitBetaUser(e){const t=e?.context??{},n=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),r=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),o=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),a=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0),i=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:n,language:r,timezone:o,currency:a}})});if(!i.ok)throw Error("Failed to submit beta user request: "+i.statusText);return i.json()}};const Ii=Ot("ZodISODateTime",(e,t)=>{Sr.init(e,t),ns.init(e,t)}),Ui=Ot("ZodISODate",(e,t)=>{kr.init(e,t),ns.init(e,t)}),Fi=Ot("ZodISOTime",(e,t)=>{Tr.init(e,t),ns.init(e,t)}),ji=Ot("ZodISODuration",(e,t)=>{Cr.init(e,t),ns.init(e,t)}),Li=Ot("ZodError",(e,t)=>{cn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},r={J:[]},o=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>o({issues:e}));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)r.J.push(n(t));else{let e=r,o=0;for(;o<t.path.length;){const r=t.path[o];o===t.path.length-1?(e[r]=e[r]||{J:[]},e[r].J.push(n(t))):e[r]=e[r]||{J:[]},e=e[r],o++}}};return o(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ut,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ut,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Bi=dn(Li),$i=fn(Li),zi=pn(Li),Gi=bn(Li),Zi=vn(Li),Wi=wn(Li),Ki=yn(Li),Vi=xn(Li),Hi=An(Li),Ji=Sn(Li),qi=kn(Li),Yi=Tn(Li),Xi=Ot("ZodType",(e,t)=>(lr.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"V",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{Z:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,n)=>Xt(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>Bi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>zi(e,t,n),e.parseAsync=async(t,n)=>$i(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Gi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Zi(e,t,n),e.decode=(t,n)=>Wi(e,t,n),e.encodeAsync=async(t,n)=>Ki(e,t,n),e.decodeAsync=async(t,n)=>Vi(e,t,n),e.safeEncode=(t,n)=>Hi(e,t,n),e.safeDecode=(t,n)=>Ji(e,t,n),e.safeEncodeAsync=async(t,n)=>qi(e,t,n),e.safeDecodeAsync=async(t,n)=>Yi(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new Gs({type:"custom",check:"custom",fn:t,...Qt(n)})}(0,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new Jn({check:"custom",...Qt(void 0)});return t.Z.check=e,t}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(an(e,n.value,t.Z.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t.Z.def.abort),n.issues.push(an(r))}},e(n.value,n)));return t}(t)),e.overwrite=t=>e.check(xo(t)),e.optional=()=>_s(e),e.nullable=()=>Is(e),e.nullish=()=>_s(Is(e)),e.nonoptional=t=>function(e,t){return new js({type:"nonoptional",innerType:e,...Qt(t)})}(e,t),e.array=()=>new Ts({type:"array",element:e,...Qt(void 0)}),e.or=t=>function(e){return new Es({type:"union",options:e,...Qt(void 0)})}([e,t]),e.and=t=>new Ps({type:"intersection",left:e,right:t}),e.transform=t=>$s(e,new Os({type:"transform",transform:t})),e.default=t=>{return n=t,new Us({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():Jt(n)}});var n},e.prefault=t=>{return n=t,new Fs({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():Jt(n)}});var n},e.catch=t=>{return new Ls({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>$s(e,t),e.readonly=()=>new zs({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return bo.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>bo.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return bo.get(e);const n=e.clone();return bo.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Qi=Ot("_ZodString",(e,t)=>{dr.init(e,t),Xi.init(e,t);const n=e.Z.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new er({check:"string_format",format:"regex",...Qt(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new rr({check:"string_format",format:"includes",...Qt(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new or({check:"string_format",format:"starts_with",...Qt(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new ar({check:"string_format",format:"ends_with",...Qt(t),suffix:e})}(...t)),e.min=(...t)=>e.check(wo(...t)),e.max=(...t)=>e.check(vo(...t)),e.length=(...t)=>e.check(yo(...t)),e.nonempty=(...t)=>e.check(wo(1,...t)),e.lowercase=t=>e.check(function(e){return new tr({check:"string_format",format:"lowercase",...Qt(e)})}(t)),e.uppercase=t=>e.check(function(e){return new nr({check:"string_format",format:"uppercase",...Qt(e)})}(t)),e.trim=()=>e.check(xo(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return xo(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(xo(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(xo(e=>e.toUpperCase()))}),es=Ot("ZodString",(e,t)=>{dr.init(e,t),Qi.init(e,t),e.email=t=>e.check(function(e,t){return new rs({type:"string",format:"email",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.url=t=>e.check(function(e,t){return new is({type:"string",format:"url",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.jwt=t=>e.check(function(e,t){return new xs({type:"string",format:"jwt",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.emoji=t=>e.check(function(e,t){return new ss({type:"string",format:"emoji",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.guid=t=>e.check(go(os,t)),e.uuid=t=>e.check(function(e,t){return new as({type:"string",format:"uuid",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.uuidv4=t=>e.check(function(e,t){return new as({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Qt(t)})}(0,t)),e.uuidv6=t=>e.check(function(e,t){return new as({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Qt(t)})}(0,t)),e.uuidv7=t=>e.check(function(e,t){return new as({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Qt(t)})}(0,t)),e.nanoid=t=>e.check(function(e,t){return new cs({type:"string",format:"nanoid",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.guid=t=>e.check(go(os,t)),e.cuid=t=>e.check(function(e,t){return new ls({type:"string",format:"cuid",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.cuid2=t=>e.check(function(e,t){return new ds({type:"string",format:"cuid2",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.ulid=t=>e.check(function(e,t){return new us({type:"string",format:"ulid",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.base64=t=>e.check(function(e,t){return new vs({type:"string",format:"base64",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.base64url=t=>e.check(function(e,t){return new ws({type:"string",format:"base64url",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.xid=t=>e.check(function(e,t){return new fs({type:"string",format:"xid",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.ksuid=t=>e.check(function(e,t){return new ms({type:"string",format:"ksuid",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.ipv4=t=>e.check(function(e,t){return new ps({type:"string",format:"ipv4",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.ipv6=t=>e.check(function(e,t){return new hs({type:"string",format:"ipv6",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.cidrv4=t=>e.check(function(e,t){return new bs({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.cidrv6=t=>e.check(function(e,t){return new gs({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.e164=t=>e.check(function(e,t){return new ys({type:"string",format:"e164",check:"string_format",abort:!1,...Qt(t)})}(0,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new Ii({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Qt(t)})}(0,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new Ui({type:"string",format:"date",check:"string_format",...Qt(t)})}(0,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new Fi({type:"string",format:"time",check:"string_format",precision:null,...Qt(t)})}(0,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new ji({type:"string",format:"duration",check:"string_format",...Qt(t)})}(0,e)}(t))});function ts(e){return function(e,t){return new es({type:"string",...Qt(t)})}(0,e)}const ns=Ot("ZodStringFormat",(e,t)=>{ur.init(e,t),Qi.init(e,t)}),rs=Ot("ZodEmail",(e,t)=>{pr.init(e,t),ns.init(e,t)}),os=Ot("ZodGUID",(e,t)=>{fr.init(e,t),ns.init(e,t)}),as=Ot("ZodUUID",(e,t)=>{mr.init(e,t),ns.init(e,t)}),is=Ot("ZodURL",(e,t)=>{hr.init(e,t),ns.init(e,t)}),ss=Ot("ZodEmoji",(e,t)=>{br.init(e,t),ns.init(e,t)}),cs=Ot("ZodNanoID",(e,t)=>{gr.init(e,t),ns.init(e,t)}),ls=Ot("ZodCUID",(e,t)=>{vr.init(e,t),ns.init(e,t)}),ds=Ot("ZodCUID2",(e,t)=>{wr.init(e,t),ns.init(e,t)}),us=Ot("ZodULID",(e,t)=>{yr.init(e,t),ns.init(e,t)}),fs=Ot("ZodXID",(e,t)=>{xr.init(e,t),ns.init(e,t)}),ms=Ot("ZodKSUID",(e,t)=>{Ar.init(e,t),ns.init(e,t)}),ps=Ot("ZodIPv4",(e,t)=>{Nr.init(e,t),ns.init(e,t)}),hs=Ot("ZodIPv6",(e,t)=>{Er.init(e,t),ns.init(e,t)}),bs=Ot("ZodCIDRv4",(e,t)=>{Pr.init(e,t),ns.init(e,t)}),gs=Ot("ZodCIDRv6",(e,t)=>{Mr.init(e,t),ns.init(e,t)}),vs=Ot("ZodBase64",(e,t)=>{Rr.init(e,t),ns.init(e,t)}),ws=Ot("ZodBase64URL",(e,t)=>{_r.init(e,t),ns.init(e,t)}),ys=Ot("ZodE164",(e,t)=>{Dr.init(e,t),ns.init(e,t)}),xs=Ot("ZodJWT",(e,t)=>{Ir.init(e,t),ns.init(e,t)}),As=Ot("ZodUnknown",(e,t)=>{Ur.init(e,t),Xi.init(e,t)});function Ss(){return new As({type:"unknown"})}const ks=Ot("ZodNever",(e,t)=>{Fr.init(e,t),Xi.init(e,t)}),Ts=Ot("ZodArray",(e,t)=>{Lr.init(e,t),Xi.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(wo(t,n)),e.nonempty=t=>e.check(wo(1,t)),e.max=(t,n)=>e.check(vo(t,n)),e.length=(t,n)=>e.check(yo(t,n)),e.unwrap=()=>e.element}),Cs=Ot("ZodObject",(e,t)=>{Zr.init(e,t),Xi.init(e,t),$t(e,"shape",()=>t.shape),e.keyof=()=>function(e){const t=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ms({type:"enum",entries:t,...Qt(void 0)})}(Object.keys(e.Z.def.shape)),e.catchall=t=>e.clone({...e.Z.def,catchall:t}),e.passthrough=()=>e.clone({...e.Z.def,catchall:Ss()}),e.loose=()=>e.clone({...e.Z.def,catchall:Ss()}),e.strict=()=>e.clone({...e.Z.def,catchall:function(e,t){return new ks({type:"never",...Qt(t)})}(0,undefined)}),e.strip=()=>e.clone({...e.Z.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Ht(t))throw Error("Invalid input to extend: expected a plain object");const n=e.Z.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Gt(e.Z.def,{get shape(){const n={...e.Z.def.shape,...t};return zt(this,"shape",n),n},checks:[]});return Xt(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!Ht(t))throw Error("Invalid input to safeExtend: expected a plain object");const n={...e.Z.def,get shape(){const n={...e.Z.def.shape,...t};return zt(this,"shape",n),n},checks:e.Z.def.checks};return Xt(e,n)}(e,t),e.merge=t=>function(e,t){const n=Gt(e.Z.def,{get shape(){const n={...e.Z.def.shape,...t.Z.def.shape};return zt(this,"shape",n),n},get catchall(){return t.Z.def.catchall},checks:[]});return Xt(e,n)}(e,t),e.pick=t=>function(e,t){const n=e.Z.def;return Xt(e,Gt(e.Z.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return zt(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e.Z.def,r=Gt(e.Z.def,{get shape(){const r={...e.Z.def.shape};for(const e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return zt(this,"shape",r),r},checks:[]});return Xt(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const r=Gt(t.Z.def,{get shape(){const r=t.Z.def.shape,o={...r};if(n)for(const t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)o[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return zt(this,"shape",o),o},checks:[]});return Xt(t,r)}(Rs,e,t[0]),e.required=(...t)=>function(e,t,n){const r=Gt(t.Z.def,{get shape(){const r=t.Z.def.shape,o={...r};if(n)for(const t in n){if(!(t in o))throw Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)o[t]=new e({type:"nonoptional",innerType:r[t]});return zt(this,"shape",o),o},checks:[]});return Xt(t,r)}(js,e,t[0])});function Ns(e,t){const n={type:"object",get shape(){var t;return zt(this,"shape",e?Object.create(Object.getPrototypeOf(t=e),Object.getOwnPropertyDescriptors(t)):{}),this.shape},...Qt(t)};return new Cs(n)}const Es=Ot("ZodUnion",(e,t)=>{Kr.init(e,t),Xi.init(e,t),e.options=t.options}),Ps=Ot("ZodIntersection",(e,t)=>{Vr.init(e,t),Xi.init(e,t)}),Ms=Ot("ZodEnum",(e,t)=>{qr.init(e,t),Xi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const o={};for(const r of e){if(!n.has(r))throw Error(`Key ${r} not found in enum`);o[r]=t.entries[r]}return new Ms({...t,checks:[],...Qt(r),entries:o})},e.exclude=(e,r)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw Error(`Key ${t} not found in enum`);delete o[t]}return new Ms({...t,checks:[],...Qt(r),entries:o})}}),Os=Ot("ZodTransform",(e,t)=>{Yr.init(e,t),Xi.init(e,t),e.Z.parse=(n,r)=>{if("backward"===r.direction)throw new _t(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(an(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(an(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n)):(n.value=o,n)}}),Rs=Ot("ZodOptional",(e,t)=>{Qr.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType});function _s(e){return new Rs({type:"optional",innerType:e})}const Ds=Ot("ZodNullable",(e,t)=>{eo.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType});function Is(e){return new Ds({type:"nullable",innerType:e})}const Us=Ot("ZodDefault",(e,t)=>{to.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType,e.removeDefault=e.unwrap}),Fs=Ot("ZodPrefault",(e,t)=>{ro.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType}),js=Ot("ZodNonOptional",(e,t)=>{oo.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType}),Ls=Ot("ZodCatch",(e,t)=>{io.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType,e.removeCatch=e.unwrap}),Bs=Ot("ZodPipe",(e,t)=>{so.init(e,t),Xi.init(e,t),e.in=t.in,e.out=t.out});function $s(e,t){return new Bs({type:"pipe",in:e,out:t})}const zs=Ot("ZodReadonly",(e,t)=>{lo.init(e,t),Xi.init(e,t),e.unwrap=()=>e.Z.def.innerType}),Gs=Ot("ZodCustom",(e,t)=>{fo.init(e,t),Xi.init(e,t)}),Zs=Ns({name:ts().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:ts().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)")}),Ws={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:"오류가 발생했습니다"}},Ks=({onSuccess:r,onError:o,className:a="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:d={},autoFocus:u=!0,showSuccessMessage:m=!0,hideLogo:p=!1,hideTitles:h=!1})=>{const[b,g]=f("en"),[v,w]=f(!1),[y,x]=f(!1),{submitBetaForm:A,isLoading:S,isSubmitting:k,error:T,config:C,success:N,message:E}=(()=>{const e=re(e=>e.os),[t,n]=f(null),[r,o]=f(!0),[a,i]=f(!1),[s,d]=f(null),[u,m]=f(!1),[p,h]=f(null);return l(()=>{(async()=>{o(!0);const t=new Di(e),r=await t.fetchConfig();n(r),o(!1)})()},[e]),{isLoading:r,isSubmitting:a,config:t,error:s,success:u,message:p,submitBetaForm:c(async t=>{if(!e){const e="SaaS OS context is not initialized";return d(e),{success:!1,message:e}}try{i(!0),d(null),m(!1),h(null);const n=new Di(e),r=await n.submitBetaUser({name:t.name||"",email:t.email}),o="success"===r.status;return m(o),h(r.message),{success:o,message:r.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return d(t),m(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();l(()=>{g((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Ws).indexOf(e)?e:"en"})())},[]),l(()=>{N&&m&&(w(!0),x(!0)),T&&x(!0)},[N,m,T]);const P={...Ws[s||b],...d},M=Tt({resolver:To(Zs),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});l(()=>{u&&M.setFocus("name")},[u,M]);const O=M.formState.isValid&&!k;return e("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:n("div",S?{className:Da("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(_i,{className:"h-24 w-24 rounded-lg"}),e(_i,{className:"h-6 w-32"}),n("div",{className:"w-full space-y-4",children:[n("div",{className:"space-y-2",children:[e(_i,{className:"h-4 w-16"}),e(_i,{className:"h-10 w-full"})]}),n("div",{className:"space-y-2",children:[e(_i,{className:"h-4 w-16"}),e(_i,{className:"h-10 w-full"})]}),e(_i,{className:"h-10 w-full"})]})]}:{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!p&&n("div",{className:"flex flex-col items-center justify-center w-full",children:[C?.logo&&e(Hs,{logo:C?.logo}),C?.name&&e("div",{children:C?.name})]}),e(Ie,{...M,children:n("form",{onSubmit:M.handleSubmit(async e=>{try{const t=await A(e);t.success?(r?.(),M.reset(),m&&w(!0),x(!0)):(o?.(t.message),x(!0))}catch(e){o?.(e instanceof Error?e.message:P.errorMessage),x(!0)}}),className:a,noValidate:!0,"aria-busy":k,children:[!y&&n(t,{children:[!h&&C?.screen?.register&&e(Vs,{screen:C?.screen?.register}),e(ki,{control:M.control,name:"name",render:({field:t})=>n(Ni,{className:i,children:[e(Ei,{children:P.nameLabel}),e(Pi,{children:e(Ri,{...t})}),e(Mi,{}),e(Oi,{})]})}),e(ki,{control:M.control,name:"email",render:({field:t})=>n(Ni,{className:i,children:[e(Ei,{children:P.emailLabel}),e(Pi,{children:e(Ri,{...t})}),e(Mi,{}),e(Oi,{})]})}),e(bi,{type:"submit",disabled:!O,className:i,children:k?P.submittingText:P.submitText})]}),y&&T&&n("div",{className:"flex flex-col items-center justify-center w-full",children:[n("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),T]}),e("div",{className:"mt-4 flex justify-center",children:e(bi,{type:"button",onClick:()=>{x(!1),M.reset()},className:i,children:"Try Again"})})]}),y&&v&&E&&e("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:C?.screen?.thankYou&&e(Vs,{screen:C?.screen?.thankYou})})]})}),!y&&e("div",{children:n("div",{children:["By submitting this form, you consent to our"," ",e("a",{href:C?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e("a",{href:C?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function Vs({screen:t}){return n("div",{className:"flex flex-col items-center justify-center w-full",children:[e("p",{className:"text-2xl font-bold",children:t?.title}),e("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function Hs({logo:t}){return e("img","string"==typeof t?{src:t,alt:"Logo",className:"max-h-24"}:{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}function Js(e,t){return function(){return e.apply(t,arguments)}}const{toString:qs}=Object.prototype,{getPrototypeOf:Ys}=Object,{iterator:Xs,toStringTag:Qs}=Symbol,ec=(tc=Object.create(null),e=>{const t=qs.call(e);return tc[t]||(tc[t]=t.slice(8,-1).toLowerCase())});var tc;const nc=e=>(e=e.toLowerCase(),t=>ec(t)===e),rc=e=>t=>typeof t===e,{isArray:oc}=Array,ac=rc("undefined");function ic(e){return null!==e&&!ac(e)&&null!==e.constructor&&!ac(e.constructor)&&lc(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const sc=nc("ArrayBuffer"),cc=rc("string"),lc=rc("function"),dc=rc("number"),uc=e=>null!==e&&"object"==typeof e,fc=e=>{if("object"!==ec(e))return!1;const t=Ys(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Qs in e||Xs in e)},mc=nc("Date"),pc=nc("File"),hc=nc("Blob"),bc=nc("FileList"),gc=nc("URLSearchParams"),[vc,wc,yc,xc]=["ReadableStream","Request","Response","Headers"].map(nc);function Ac(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),oc(e))for(r=0,o=e.length;o>r;r++)t.call(null,e[r],r,e);else{if(ic(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length;let i;for(r=0;a>r;r++)i=o[r],t.call(null,e[i],i,e)}}function Sc(e,t){if(ic(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const kc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Tc=e=>!ac(e)&&e!==kc,Cc=(Nc="undefined"!=typeof Uint8Array&&Ys(Uint8Array),e=>Nc&&e instanceof Nc);var Nc;const Ec=nc("HTMLFormElement"),Pc=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Mc=nc("RegExp"),Oc=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ac(n,(n,o)=>{let a;!1!==(a=t(n,o,e))&&(r[o]=a||n)}),Object.defineProperties(e,r)},Rc=nc("AsyncFunction"),_c=(Dc="function"==typeof setImmediate,Ic=lc(kc.postMessage),Dc?setImmediate:Ic?(Uc="axios@"+Math.random(),Fc=[],kc.addEventListener("message",({source:e,data:t})=>{e===kc&&t===Uc&&Fc.length&&Fc.shift()()},!1),e=>{Fc.push(e),kc.postMessage(Uc,"*")}):e=>setTimeout(e));var Dc,Ic,Uc,Fc;const jc="undefined"!=typeof queueMicrotask?queueMicrotask.bind(kc):"undefined"!=typeof process&&process.nextTick||_c;var Lc={isArray:oc,isArrayBuffer:sc,isBuffer:ic,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||lc(e.append)&&("formdata"===(t=ec(e))||"object"===t&&lc(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&sc(e.buffer),t},isString:cc,isNumber:dc,isBoolean:e=>!0===e||!1===e,isObject:uc,isPlainObject:fc,isEmptyObject:e=>{if(!uc(e)||ic(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:vc,isRequest:wc,isResponse:yc,isHeaders:xc,isUndefined:ac,isDate:mc,isFile:pc,isBlob:hc,isRegExp:Mc,isFunction:lc,isStream:e=>uc(e)&&lc(e.pipe),isURLSearchParams:gc,isTypedArray:Cc,isFileList:bc,forEach:Ac,merge:function e(){const{caseless:t,skipUndefined:n}=Tc(this)&&this||{},r={},o=(o,a)=>{const i=t&&Sc(r,a)||a;fc(r[i])&&fc(o)?r[i]=e(r[i],o):fc(o)?r[i]=e({},o):oc(o)?r[i]=o.slice():n&&ac(o)||(r[i]=o)};for(let e=0,t=arguments.length;t>e;e++)arguments[e]&&Ac(arguments[e],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(Ac(t,(t,r)=>{n&&lc(t)?e[r]=Js(t,n):e[r]=t},{allOwnKeys:r}),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,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,a,i;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)i=o[a],r&&!r(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==n&&Ys(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:ec,kindOfTest:nc,endsWith:(e,t,n)=>{e+="",(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(oc(e))return e;let t=e.length;if(!dc(t))return null;const n=Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Xs]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:Ec,hasOwnProperty:Pc,hasOwnProp:Pc,reduceDescriptors:Oc,freezeMethods:e=>{Oc(e,(t,n)=>{if(lc(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];lc(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return oc(e)?r(e):r((e+"").split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Sc,global:kc,isContextDefined:Tc,isSpecCompliantForm:function(e){return!!(e&&lc(e.append)&&"FormData"===e[Qs]&&e[Xs])},toJSONObject:e=>{const t=[,,,,,,,,,,],n=(e,r)=>{if(uc(e)){if(t.indexOf(e)>=0)return;if(ic(e))return e;if(!("toJSON"in e)){t[r]=e;const o=oc(e)?[]:{};return Ac(e,(e,t)=>{const a=n(e,r+1);!ac(a)&&(o[t]=a)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Rc,isThenable:e=>e&&(uc(e)||lc(e))&&lc(e.then)&&lc(e.catch),setImmediate:_c,asap:jc,isIterable:e=>null!=e&&lc(e[Xs])};function Bc(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}Lc.inherits(Bc,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:Lc.toJSONObject(this.config),code:this.code,status:this.status}}});const $c=Bc.prototype,zc={};function Gc(e){return Lc.isPlainObject(e)||Lc.isArray(e)}function Zc(e){return Lc.endsWith(e,"[]")?e.slice(0,-2):e}function Wc(e,t,n){return e?e.concat(t).map(function(e,t){return e=Zc(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}["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=>{zc[e]={value:e}}),Object.defineProperties(Bc,zc),Object.defineProperty($c,"isAxiosError",{value:!0}),Bc.from=(e,t,n,r,o,a)=>{const i=Object.create($c);Lc.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const s=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return Bc.call(i,s,c,n,r,o),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",a&&Object.assign(i,a),i};const Kc=Lc.toFlatObject(Lc,{},null,function(e){return/^is[A-Z]/.test(e)});function Vc(e,t,n){if(!Lc.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Lc.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Lc.isUndefined(t[e])})).metaTokens,o=n.visitor||l,a=n.dots,i=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Lc.isSpecCompliantForm(t);if(!Lc.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Lc.isDate(e))return e.toISOString();if(Lc.isBoolean(e))return e.toString();if(!s&&Lc.isBlob(e))throw new Bc("Blob is not supported. Use a Buffer instead.");return Lc.isArrayBuffer(e)||Lc.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let s=e;if(e&&!o&&"object"==typeof e)if(Lc.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Lc.isArray(e)&&function(e){return Lc.isArray(e)&&!e.some(Gc)}(e)||(Lc.isFileList(e)||Lc.endsWith(n,"[]"))&&(s=Lc.toArray(e)))return n=Zc(n),s.forEach(function(e,r){!Lc.isUndefined(e)&&null!==e&&t.append(!0===i?Wc([n],r,a):null===i?n:n+"[]",c(e))}),!1;return!!Gc(e)||(t.append(Wc(o,n,a),c(e)),!1)}const d=[],u=Object.assign(Kc,{defaultVisitor:l,convertValue:c,isVisitable:Gc});if(!Lc.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Lc.isUndefined(n)){if(-1!==d.indexOf(n))throw Error("Circular reference detected in "+r.join("."));d.push(n),Lc.forEach(n,function(n,a){!0===(!(Lc.isUndefined(n)||null===n)&&o.call(t,n,Lc.isString(a)?a.trim():a,r,u))&&e(n,r?r.concat(a):[a])}),d.pop()}}(e),t}function Hc(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Jc(e,t){this.q=[],e&&Vc(e,this,t)}const qc=Jc.prototype;function Yc(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xc(e,t,n){if(!t)return e;const r=n&&n.encode||Yc;Lc.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let a;if(a=o?o(t,n):Lc.isURLSearchParams(t)?t.toString():new Jc(t,n).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}qc.append=function(e,t){this.q.push([e,t])},qc.toString=function(e){const t=e?function(t){return e.call(this,t,Hc)}:Hc;return this.q.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Qc{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Lc.forEach(this.handlers,function(t){null!==t&&e(t)})}}var el={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},tl={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Jc,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const nl="undefined"!=typeof window&&"undefined"!=typeof document,rl="object"==typeof navigator&&navigator||void 0,ol=nl&&(!rl||0>["ReactNative","NativeScript","NS"].indexOf(rl.product)),al="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,il=nl&&window.location.href||"http://localhost";var sl={...Object.freeze({__proto__:null,hasBrowserEnv:nl,hasStandardBrowserEnv:ol,hasStandardBrowserWebWorkerEnv:al,navigator:rl,origin:il}),...tl};function cl(e){function t(e,n,r,o){let a=e[o++];if("__proto__"===a)return!0;const i=Number.isFinite(+a),s=o>=e.length;return a=!a&&Lc.isArray(r)?r.length:a,s?(Lc.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!i):(r[a]&&Lc.isObject(r[a])||(r[a]=[]),t(e,n,r[a],o)&&Lc.isArray(r[a])&&(r[a]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let a;for(r=0;o>r;r++)a=n[r],t[a]=e[a];return t}(r[a])),!i)}if(Lc.isFormData(e)&&Lc.isFunction(e.entries)){const n={};return Lc.forEachEntry(e,(e,r)=>{t(function(e){return Lc.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const ll={transitional:el,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Lc.isObject(e);if(o&&Lc.isHTMLForm(e)&&(e=new FormData(e)),Lc.isFormData(e))return r?JSON.stringify(cl(e)):e;if(Lc.isArrayBuffer(e)||Lc.isBuffer(e)||Lc.isStream(e)||Lc.isFile(e)||Lc.isBlob(e)||Lc.isReadableStream(e))return e;if(Lc.isArrayBufferView(e))return e.buffer;if(Lc.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Vc(e,new sl.classes.URLSearchParams,{visitor:function(e,t,n,r){return sl.isNode&&Lc.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((a=Lc.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Vc(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e){if(Lc.isString(e))try{return(0,JSON.parse)(e),Lc.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ll.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Lc.isResponse(e)||Lc.isReadableStream(e))return e;if(e&&Lc.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Bc.from(e,Bc.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:sl.classes.FormData,Blob:sl.classes.Blob},validateStatus:function(e){return e>=200&&300>e},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Lc.forEach(["delete","get","head","post","put","patch"],e=>{ll.headers[e]={}});const dl=Lc.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"]),ul=Symbol("internals");function fl(e){return e&&(e+"").trim().toLowerCase()}function ml(e){return!1===e||null==e?e:Lc.isArray(e)?e.map(ml):e+""}function pl(e,t,n,r,o){return Lc.isFunction(r)?r.call(this,t,n):(o&&(t=n),Lc.isString(t)?Lc.isString(r)?-1!==t.indexOf(r):Lc.isRegExp(r)?r.test(t):void 0:void 0)}class hl{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=fl(t);if(!o)throw Error("header name must be a non-empty string");const a=Lc.findKey(r,o);(!a||void 0===r[a]||!0===n||void 0===n&&!1!==r[a])&&(r[a||t]=ml(e))}const a=(e,t)=>Lc.forEach(e,(e,n)=>o(e,n,t));if(Lc.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(Lc.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&dl[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Lc.isObject(e)&&Lc.isIterable(e)){let n,r,o={};for(const t of e){if(!Lc.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Lc.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}a(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=fl(e)){const n=Lc.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Lc.isFunction(t))return t.call(this,e,n);if(Lc.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fl(e)){const n=Lc.findKey(this,e);return!(!n||void 0===this[n]||t&&!pl(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=fl(e)){const o=Lc.findKey(n,e);!o||t&&!pl(0,n[o],o,t)||(delete n[o],r=!0)}}return Lc.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!pl(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Lc.forEach(this,(r,o)=>{const a=Lc.findKey(n,o);if(a)return t[a]=ml(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):(o+"").trim();i!==o&&delete t[o],t[i]=ml(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Lc.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Lc.isArray(n)?n.join(", "):n)}),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 n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ul]=this[ul]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=fl(e);t[r]||(function(e,t){const n=Lc.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Lc.isArray(e)?e.forEach(r):r(e),this}}function bl(e,t){const n=this||ll,r=t||n,o=hl.from(r.headers);let a=r.data;return Lc.forEach(e,function(e){a=e.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function gl(e){return!(!e||!e.Y)}function vl(e,t,n){Bc.call(this,null==e?"canceled":e,Bc.ERR_CANCELED,t,n),this.name="CanceledError"}function wl(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Bc("Request failed with status code "+n.status,[Bc.ERR_BAD_REQUEST,Bc.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}hl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Lc.reduceDescriptors(hl.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Lc.freezeMethods(hl),Lc.inherits(vl,Bc,{Y:!0});const yl=(e,t,n=3)=>{let r=0;const o=function(e,t){const n=Array(e=e||10),r=Array(e);let o,a=0,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=r[i];o||(o=c),n[a]=s,r[a]=c;let d=i,u=0;for(;d!==a;)u+=n[d++],d%=e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),t>c-o)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(n,a){let i,s,c=0,l=1e3/a;const d=(n,a=Date.now())=>{c=a,i=null,s&&(clearTimeout(s),s=null),(n=>{const a=n.loaded,i=n.lengthComputable?n.total:void 0,s=a-r,c=o(s);r=a,e({loaded:a,total:i,progress:i?a/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&i>=a?(i-a)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})})(...n)};return[(...e)=>{const t=Date.now(),n=t-c;l>n?(i=e,s||(s=setTimeout(()=>{s=null,d(i)},l-n))):d(e,t)},()=>i&&d(i)]}(0,n)},xl=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Al=e=>(...t)=>Lc.asap(()=>e(...t));var Sl=sl.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,sl.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(sl.origin),sl.navigator&&/(msie|trident)/i.test(sl.navigator.userAgent)):()=>!0,kl=sl.hasStandardBrowserEnv?{write(e,t,n,r,o,a){const i=[e+"="+encodeURIComponent(t)];Lc.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),Lc.isString(r)&&i.push("path="+r),Lc.isString(o)&&i.push("domain="+o),!0===a&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Tl(e,t,n){return!e||/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)&&0!=n?t:function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t)}const Cl=e=>e instanceof hl?{...e}:e;function Nl(e,t){t=t||{};const n={};function r(e,t,n,r){return Lc.isPlainObject(e)&&Lc.isPlainObject(t)?Lc.merge.call({caseless:r},e,t):Lc.isPlainObject(t)?Lc.merge({},t):Lc.isArray(t)?t.slice():t}function o(e,t,n,o){return Lc.isUndefined(t)?Lc.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function a(e,t){if(!Lc.isUndefined(t))return r(void 0,t)}function i(e,t){return Lc.isUndefined(t)?Lc.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,a){return a in t?r(n,o):a in e?r(void 0,n):void 0}const c={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,n)=>o(Cl(e),Cl(t),0,!0)};return Lc.forEach(Object.keys({...e,...t}),function(r){const a=c[r]||o,i=a(e[r],t[r],r);Lc.isUndefined(i)&&a!==s||(n[r]=i)}),n}var El=e=>{const t=Nl({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:a,headers:i,auth:s}=t;if(t.headers=i=hl.from(i),t.url=Xc(Tl(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Lc.isFormData(n))if(sl.hasStandardBrowserEnv||sl.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Lc.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(sl.hasStandardBrowserEnv&&(r&&Lc.isFunction(r)&&(r=r(t)),r||!1!==r&&Sl(t.url))){const e=o&&a&&kl.read(a);e&&i.set(o,e)}return t},Pl="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=El(e);let o=r.data;const a=hl.from(r.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:m}=r;function p(){l&&l(),d&&d(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function b(){if(!h)return;const r=hl.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());wl(function(e){t(e),p()},function(e){n(e),p()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout,"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(b)},h.onabort=function(){h&&(n(new Bc("Request aborted",Bc.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const r=new Bc(t&&t.message?t.message:"Network Error",Bc.ERR_NETWORK,e,h);r.event=t||null,n(r),h=null},h.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||el;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Bc(t,o.clarifyTimeoutError?Bc.ETIMEDOUT:Bc.ECONNABORTED,e,h)),h=null},void 0===o&&a.setContentType(null),"setRequestHeader"in h&&Lc.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),Lc.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),u&&"json"!==u&&(h.responseType=r.responseType),m&&([c,d]=yl(m,!0),h.addEventListener("progress",c)),f&&h.upload&&([s,l]=yl(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{h&&(n(!t||t.type?new vl(null,e,h):t),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===sl.protocols.indexOf(g)?n(new Bc("Unsupported protocol "+g+":",Bc.ERR_BAD_REQUEST,e)):h.send(o||null)})};const Ml=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Bc?t:new vl(t instanceof Error?t.message:t))}};let a=t&&setTimeout(()=>{a=null,o(new Bc(`timeout ${t} of ms exceeded`,Bc.ETIMEDOUT))},t);const i=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>Lc.asap(i),s}},Ol=function*(e,t){let n=e.byteLength;if(t>n)return void(yield e);let r,o=0;for(;n>o;)r=o+t,yield e.slice(o,r),o=r},Rl=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*Ol(n,t)}(e,t);let a,i=0,s=e=>{a||(a=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let a=r.byteLength;if(n){let e=i+=a;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})},{isFunction:_l}=Lc,Dl=(({Request:e,Response:t})=>({Request:e,Response:t}))(Lc.global),{ReadableStream:Il,TextEncoder:Ul}=Lc.global,Fl=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},jl=e=>{e=Lc.merge.call({skipUndefined:!0},Dl,e);const{fetch:t,Request:n,Response:r}=e,o=t?_l(t):"function"==typeof fetch,a=_l(n),i=_l(r);if(!o)return!1;const s=o&&_l(Il),c=o&&("function"==typeof Ul?(l=new Ul,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const d=a&&s&&Fl(()=>{let e=!1;const t=new n(sl.origin,{body:new Il,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&Fl(()=>Lc.isReadableStream(new r("").body)),f={stream:u&&(e=>e.body)};return o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Bc(`Response type '${e}' is not supported`,Bc.ERR_NOT_SUPPORT,n)})}),async e=>{let{url:o,method:i,data:s,signal:l,cancelToken:m,timeout:p,onDownloadProgress:h,onUploadProgress:b,responseType:g,headers:v,withCredentials:w="same-origin",fetchOptions:y}=El(e),x=t||fetch;g=g?(g+"").toLowerCase():"text";let A=Ml([l,m&&m.toAbortSignal()],p),S=null;const k=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let T;try{if(b&&d&&"get"!==i&&"head"!==i&&0!==(T=await(async(e,t)=>{const r=Lc.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Lc.isBlob(e))return e.size;if(Lc.isSpecCompliantForm(e)){const t=new n(sl.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Lc.isArrayBufferView(e)||Lc.isArrayBuffer(e)?e.byteLength:(Lc.isURLSearchParams(e)&&(e+=""),Lc.isString(e)?(await c(e)).byteLength:void 0)})(t):r})(v,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(Lc.isFormData(s)&&(e=t.headers.get("content-type"))&&v.setContentType(e),t.body){const[e,n]=xl(T,yl(Al(b)));s=Rl(t.body,65536,e,n)}}Lc.isString(w)||(w=w?"include":"omit");const t=a&&"credentials"in n.prototype,l={...y,signal:A,method:i.toUpperCase(),headers:v.normalize().toJSON(),body:s,duplex:"half",credentials:t?w:void 0};S=a&&new n(o,l);let m=await(a?x(S,y):x(o,l));const p=u&&("stream"===g||"response"===g);if(u&&(h||p&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=m[t]});const t=Lc.toFiniteNumber(m.headers.get("content-length")),[n,o]=h&&xl(t,yl(Al(h),!0))||[];m=new r(Rl(m.body,65536,n,()=>{o&&o(),k&&k()}),e)}g=g||"text";let C=await f[Lc.findKey(f,g)||"text"](m,e);return!p&&k&&k(),await new Promise((t,n)=>{wl(t,n,{data:C,headers:hl.from(m.headers),status:m.status,statusText:m.statusText,config:e,request:S})})}catch(t){if(k&&k(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Bc("Network Error",Bc.ERR_NETWORK,e,S),{cause:t.cause||t});throw Bc.from(t,t&&t.code,e,S)}}},Ll=new Map,Bl=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:o}=t,a=[r,o,n];let i,s,c=a.length,l=Ll;for(;c--;)i=a[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:jl(t)),l=s;return s};Bl();const $l={http:null,xhr:Pl,fetch:{get:Bl}};Lc.forEach($l,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const zl=e=>"- "+e,Gl=e=>Lc.isFunction(e)||null===e||!1===e;var Zl=(e,t)=>{e=Lc.isArray(e)?e:[e];const{length:n}=e;let r,o;const a={};for(let i=0;n>i;i++){let n;if(r=e[i],o=r,!Gl(r)&&(o=$l[(n=r+"").toLowerCase()],void 0===o))throw new Bc(`Unknown adapter '${n}'`);if(o&&(Lc.isFunction(o)||(o=o.get(t))))break;a[n||"#"+i]=o}if(!o){const e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Bc("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(zl).join("\n"):" "+zl(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function Wl(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new vl(null,e)}function Kl(e){return Wl(e),e.headers=hl.from(e.headers),e.data=bl.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Zl(e.adapter||ll.adapter,e)(e).then(function(t){return Wl(e),t.data=bl.call(e,e.transformResponse,t),t.headers=hl.from(t.headers),t},function(t){return gl(t)||(Wl(e),t&&t.response&&(t.response.data=bl.call(e,e.transformResponse,t.response),t.response.headers=hl.from(t.response.headers))),Promise.reject(t)})}const Vl="1.12.2",Hl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Hl[e]=function(n){return typeof n===e||"a"+(1>t?"n ":" ")+e}});const Jl={};Hl.transitional=function(e,t,n){return(r,o,a)=>{if(!1===e)throw new Bc(function(e,t){return"[Axios v"+Vl+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}(o," has been removed"+(t?" in "+t:"")),Bc.ERR_DEPRECATED);return t&&!Jl[o]&&(Jl[o]=!0),!e||e(r,o,a)}},Hl.spelling=function(e){return(e,t)=>!0};var ql={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Bc("options must be an object",Bc.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const a=r[o],i=t[a];if(i){const t=e[a],n=void 0===t||i(t,a,e);if(!0!==n)throw new Bc("option "+a+" must be "+n,Bc.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Bc("Unknown option "+a,Bc.ERR_BAD_OPTION)}},validators:Hl};const Yl=ql.validators;class Xl{constructor(e){this.defaults=e||{},this.interceptors={request:new Qc,response:new Qc}}async request(e,t){try{return await this.X(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!(e.stack+"").endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}X(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Nl(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ql.assertOptions(n,{silentJSONParsing:Yl.transitional(Yl.boolean),forcedJSONParsing:Yl.transitional(Yl.boolean),clarifyTimeoutError:Yl.transitional(Yl.boolean)},!1),null!=r&&(Lc.isFunction(r)?t.paramsSerializer={serialize:r}:ql.assertOptions(r,{encode:Yl.function,serialize:Yl.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ql.assertOptions(t,{baseUrl:Yl.spelling("baseURL"),withXsrfToken:Yl.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=o&&Lc.merge(o.common,o[t.method]);o&&Lc.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=hl.concat(a,o);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[Kl.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);d>u;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;d>u;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=Kl(f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;d>u;)l=l.then(c[u++],c[u++]);return l}getUri(e){return Xc(Tl((e=Nl(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}Lc.forEach(["delete","get","head","options"],function(e){Xl.prototype[e]=function(t,n){return this.request(Nl(n||{},{method:e,url:t,data:(n||{}).data}))}}),Lc.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Nl(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Xl.prototype[e]=t(),Xl.prototype[e+"Form"]=t(!0)});class Ql{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 n=this;this.promise.then(e=>{if(!n.ee)return;let t=n.ee.length;for(;t-- >0;)n.ee[t](e);n.ee=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new vl(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this.ee?this.ee.push(e):this.ee=[e]}unsubscribe(e){if(!this.ee)return;const t=this.ee.indexOf(e);-1!==t&&this.ee.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 e;return{token:new Ql(function(t){e=t}),cancel:e}}}const ed={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(ed).forEach(([e,t])=>{ed[t]=e});const td=function e(t){const n=new Xl(t),r=Js(Xl.prototype.request,n);return Lc.extend(r,Xl.prototype,n,{allOwnKeys:!0}),Lc.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Nl(t,n))},r}(ll);td.Axios=Xl,td.CanceledError=vl,td.CancelToken=Ql,td.isCancel=gl,td.VERSION=Vl,td.toFormData=Vc,td.AxiosError=Bc,td.Cancel=td.CanceledError,td.all=function(e){return Promise.all(e)},td.spread=function(e){return function(t){return e.apply(null,t)}},td.isAxiosError=function(e){return Lc.isObject(e)&&!0===e.isAxiosError},td.mergeConfig=Nl,td.AxiosHeaders=hl,td.formToJSON=e=>cl(Lc.isHTMLForm(e)?new FormData(e):e),td.getAdapter=Zl,td.HttpStatusCode=ed,td.default=td;const nd=new class{constructor(e={}){this.client=td.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=N();return t&&(e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const n=await this.client.get(e,t);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async post(e,t,n){const r=await this.client.post(e,t,n);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async put(e,t,n){const r=await this.client.put(e,t,n);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async delete(e,t){const n=await this.client.delete(e,t);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async patch(e,t,n){const r=await this.client.patch(e,t,n);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.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]}};class rd{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return E()}async getWorkspaces(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()});if(!e.ok)throw 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 Error("Failed to create workspace");return t.json()}async updateWorkspace(e,t){const n=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!n.ok)throw Error("Failed to update workspace");return n.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 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 Error("Failed to fetch workspace users");return t.json()}async addUser(e,t){const n=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(!n.ok){const e=await n.json();throw Error(e.message||"Failed to invite member")}return n.json()}async removeUser(e,t){const n=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()});if(!n.ok){const e=await n.json();throw Error(e.message||"Failed to remove user")}return n.json()}async updateUser(e,t,n){const r=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(n)});if(!r.ok){const e=await r.json();throw Error(e.message||"Failed to update user")}return r.json()}async getFeatures(){const e=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/features`,{headers:this.getAuthHeader()});if(!e.ok)throw Error("Failed to fetch features");return e.json()}async updateFeature(e,t,n){const r=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]:n}})});if(!r.ok)throw Error("Failed to update feature");return r.json()}async getWorkspace(e){const t=await fetch(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{headers:this.getAuthHeader()});if(!t.ok)throw 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 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 Error("Failed to update user profile");return t.json()}}const od=()=>x("saas-workspace-current"),ad=()=>{const e=oe(),t=re(e=>e.os),n=s(()=>new rd(t),[t]),r=re(e=>e.workspaces),a=re(e=>e.auth.session?.user),i=c(t=>{if(t.t!==r.currentWorkspace?.t&&t){const n=r.currentWorkspace;e.workspaces((e=>({type:"SET_CURRENT_WORKSPACE",payload:e}))(t)),se.emitWorkspaceChanged(t,n).catch(e=>{})}},[r.currentWorkspace,e]);l(()=>{if(!r.isInitialized){const t=od();if(e.workspaces({type:"SET_IS_INITIALIZED",payload:!0}),t){const e=r.workspaces.find(e=>e.t===t);if(e){if(e.t===r.currentWorkspace?.t)return;i(e)}}}},[r.isInitialized,r.workspaces,r.currentWorkspace,e,i]);const d=c(()=>{e.workspaces({type:"RESET_CURRENT_WORKSPACE"})},[e]),u=o.useRef(!1),f=o.useRef(!1),m=c(async()=>{if(!r.loading&&!u.current){u.current=!0,e.workspaces(K(!0)),e.workspaces(V(null));try{const o=await n.getWorkspaces();if(e.workspaces(W(o)),o.length>0){const e=od();if(e&&((t=e)&&o.some(e=>e.t===t))){const t=o.find(t=>t.t===e);t&&i(t)}else o.length>0&&(r.currentWorkspace||i(o[0]))}}catch(t){e.workspaces(V(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(K(!1)),u.current=!1}}var t},[n,r.loading,r.currentWorkspace,e,i]),p=c(async()=>{if(!r.refreshing&&!u.current){u.current=!0,e.workspaces(H(!0));try{const t=await n.getWorkspaces();e.workspaces(W(t))}catch(e){}finally{e.workspaces(H(!1)),u.current=!1}}},[n,r.refreshing,e]),h=c(async(t,o)=>{const a=await n.createWorkspace({name:t,image:o});e.workspaces(W([...r.workspaces,a])),se.emitWorkspaceCreated(a).catch(e=>{})},[n,r.workspaces,e]),b=c(async(t,o)=>{const a=await n.updateWorkspace(t.t,o);e.workspaces(W(r.workspaces.map(e=>e.t===t.t?a:e))),se.emitWorkspaceUpdated(a).catch(e=>{})},[n,r.workspaces,e]),g=c(async()=>{if(f.current)return r.allFeatures.length>0?r.allFeatures:null;if(r.allFeatures.length>0)return r.allFeatures;f.current=!0;try{const t=await n.getFeatures();return e.workspaces({type:"SET_ALL_FEATURES",payload:t}),t}catch(e){return null}finally{f.current=!1}},[n,e,r.allFeatures]),v=c(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);l(()=>{if(r.currentWorkspace?.t){const e=r.workspaces.find(e=>e.t===r.currentWorkspace?.t);if(e){if(e.t===r.currentWorkspace.t)return;i(e)}else if(r.workspaces.length>0){if(r.workspaces[0].t===r.currentWorkspace.t)return;i(r.workspaces[0])}}},[r.currentWorkspace?.t,r.workspaces,i]);const w=c(async e=>await n.getWorkspaceUsers(e),[n]),y=c(async(e,t,o)=>{const a=await n.addUser(e,{email:t,role:o}),i=r.workspaces.find(t=>t.t===e);return i&&se.emitWorkspaceUserAdded(a.userId,i,o).catch(e=>{}),a},[n,r.workspaces]),x=c(async(e,t)=>{const o=r.workspaces.find(t=>t.t===e);if(o&&("object"==typeof o.createdBy&&null!==o.createdBy?o.createdBy.t:o.createdBy)===t)throw Error("Cannot remove the workspace owner");const a=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user.t)===t),i=await n.removeUser(e,t);if(o&&a){const e=a.role;se.emitWorkspaceUserRemoved(i.userId,o,e).catch(e=>{})}return i},[n,r.workspaces]),A=c(async(e,t,o)=>{if(o.role){const n=r.workspaces.find(t=>t.t===e);if(n&&("object"==typeof n.createdBy&&null!==n.createdBy?n.createdBy.t:n.createdBy)===t)throw Error("Cannot change the role of the workspace owner")}let a;if(o.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user.t)===t);a=r?.role}const i=await n.updateUser(e,t,o);return o.role&&a&&a!==o.role&&se.emitWorkspaceUserRoleChanged(i.userId,i.workspace,a,o.role).catch(e=>{}),i},[n,r.workspaces]),S=c(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return se.emitUserUpdated(r,t||void 0).catch(e=>{}),r},[n]),k=c(async()=>await n.getProfile(),[n]),T=c(async e=>await n.getWorkspace(e),[n]),C=c(async t=>{if(!a)throw Error("User must be authenticated to delete a workspace");const o=r.workspaces.find(e=>e.t===t);if(!o)throw Error("Workspace not found");if(("object"==typeof o.createdBy&&null!==o.createdBy?o.createdBy.t:o.createdBy)!==a.id)throw Error("Only the workspace creator can delete the workspace");const i=await n.deleteWorkspace(t);return e.workspaces(W(r.workspaces.filter(e=>e.t!==t))),r.currentWorkspace?.t===t&&e.workspaces({type:"RESET_CURRENT_WORKSPACE"}),o&&se.emitWorkspaceDeleted(o).catch(e=>{}),i},[n,r.workspaces,r.currentWorkspace,e,a]);return{workspaces:r.workspaces,loading:r.loading,error:r.error,fetchWorkspaces:m,refreshWorkspaces:p,refreshing:r.refreshing,currentWorkspace:r.currentWorkspace,setCurrentWorkspace:i,resetCurrentWorkspace:d,createWorkspace:h,allFeatures:r.allFeatures,getFeatures:g,updateFeature:v,getWorkspace:T,switching:r.switching,updateWorkspace:b,getUsers:w,addUser:y,removeUser:x,updateUser:A,getProfile:k,updateUserProfile:S,deleteWorkspace:C}};function id(){const e=oe(),t=re(e=>e.auth),n=re(e=>e.os),{serverUrl:r,orgId:o,auth:a}=n,{resetCurrentWorkspace:i}=ad(),l=c(async()=>{e.auth({type:"AUTHENTICATION_STARTED"});try{const t=await nd.post(r+"/api/v1/auth/request",{orgId:o,clientId:a?.clientId,redirect:{success:a?.redirectUrl||window.location.href,error:a?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth({type:"AUTHENTICATION_FAILED"}),Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth({type:"AUTHENTICATION_FAILED"}),t}},[r,o,a,e]),d=c(async()=>{try{a?.callbacks?.onSignOut&&"function"==typeof a.callbacks.onSignOut&&await a.callbacks.onSignOut(),e.auth({type:"REMOVE_SESSION"}),i(),C()}catch(e){C()}},[e,i,a?.callbacks?.onSignOut]);return s(()=>({user:t.session?.user,session:t.session,isLoading:t.isLoading,isAuthenticated:t.isAuthenticated,isRedirecting:t.isRedirecting,status:t.status,signIn:l,signOut:d}),[t,l,d])}const sd=e=>{const{children:t}=e,{status:n}=id();return n!==y.authenticated?null:t},cd=e=>{const{children:t}=e,{status:n}=id();return n===y.authenticated?null:t},ld=e=>{const{children:t,fallback:n,roles:r}=e,{user:o}=id();return r.includes(o?.role??"")?t:n||null},dd=e=>{const{children:t,fallback:n,roles:r}=e,{user:o}=id(),{currentWorkspace:a}=ad(),i=a?.users.find(e=>e.t===o?.id);return i&&r.includes(i?.role??"")?t:n||null},ud=e=>{const{children:t,slug:n}=e,{currentWorkspace:r}=ad(),o=r?.features?.[n];return o?t:null},fd=e=>{const{children:t,slug:n}=e,{currentWorkspace:r}=ad(),o=r?.features?.[n];return o?null:t};function md(){const e=oe(),t=re(e=>e.os),{serverUrl:n,version:r,orgId:o,settings:a}=t,i=m(!1),d=c(async()=>{if(i.current)return a||null;if(a)return a;if(!n||!r||!o)return null;i.current=!0;try{const t=E(),a=await fetch(`${n}/api/${r}/public/${o}/settings`,{headers:t});if(!a.ok)throw Error("Failed to fetch settings");const i=await a.json();return e.os(F(i)),i}catch(e){return null}finally{i.current=!1}},[n,r,o,a,e]);return l(()=>{n&&r&&o&&!a&&!i.current&&d()},[n,r,o]),s(()=>({settings:a,getSettings:d}),[a,d])}function pd(t,n=[]){let o=[];const a=()=>{const e=o.map(e=>r.createContext(e));return function(n){const o=n?.[t]||e;return r.useMemo(()=>({["__scope"+t]:{...n,[t]:o}}),[n,o])}};return a.scopeName=t,[function(n,a){const i=r.createContext(a),s=o.length;o=[...o,a];const c=n=>{const{scope:o,children:a,...c}=n,l=o?.[t]?.[s]||i,d=r.useMemo(()=>c,Object.values(c));return e(l.Provider,{value:d,children:a})};return c.displayName=n+"Provider",[c,function(e,o){const c=o?.[t]?.[s]||i,l=r.useContext(c);if(l)return l;if(void 0!==a)return a;throw Error(`\`${e}\` must be used within \`${n}\``)}]},hd(a,...n)]}function hd(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const o=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)["__scope"+r]}),{});return r.useMemo(()=>({["__scope"+t.scopeName]:o}),[o])}};return n.scopeName=t.scopeName,n}function bd(e){const t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...e)=>t.current?.(...e),[])}var gd,vd=globalThis?.document?r.useLayoutEffect:()=>{},wd={exports:{}},yd={};function xd(){if(gd)return yd;gd=1;var e=o,t="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,r=e.useEffect,a=e.useLayoutEffect,i=e.useDebugValue;function s(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}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 o=t(),c=n({inst:{value:o,getSnapshot:t}}),l=c[0].inst,d=c[1];return a(function(){l.value=o,l.getSnapshot=t,s(l)&&d({inst:l})},[e,o,t]),r(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(o),o};return yd.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,yd}var Ad,Sd,kd={};function Td(){return Ad||(Ad=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 t=o,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useState,a=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(o,d){c||void 0===t.startTransition||(c=!0);var u=d();if(!l){var f=d();n(u,f)||(l=!0)}var m=(f=r({inst:{value:u,getSnapshot:d}}))[0].inst,p=f[1];return i(function(){m.value=u,m.getSnapshot=d,e(m)&&p({inst:m})},[o,u,d]),a(function(){return e(m)&&p({inst:m}),o(function(){e(m)&&p({inst:m})})},[o]),s(u),u};kd.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),kd}function Cd(){return Sd||(Sd=1,"production"===process.env.NODE_ENV?wd.exports=xd():wd.exports=Td()),wd.exports}var Nd=Cd();function Ed(){return()=>{}}var Pd="Avatar",[Md,Od]=pd(Pd),[Rd,_d]=Md(Pd),Dd=r.forwardRef((t,n)=>{const{te:o,...a}=t,[i,s]=r.useState("idle");return e(Rd,{scope:o,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:e(gi.span,{...a,ref:n})})});Dd.displayName=Pd;var Id="AvatarImage",Ud=r.forwardRef((t,n)=>{const{te:o,src:a,onLoadingStatusChange:i=()=>{},...s}=t,c=_d(Id,o),l=function(e,{referrerPolicy:t,crossOrigin:n}){const o=Nd.useSyncExternalStore(Ed,()=>!0,()=>!1),a=r.useRef(null),i=o?(a.current||(a.current=new window.Image),a.current):null,[s,c]=r.useState(()=>Ld(i,e));return vd(()=>{c(Ld(i,e))},[i,e]),vd(()=>{const e=e=>()=>{c(e)};if(!i)return;const r=e("loaded"),o=e("error");return i.addEventListener("load",r),i.addEventListener("error",o),t&&(i.referrerPolicy=t),"string"==typeof n&&(i.crossOrigin=n),()=>{i.removeEventListener("load",r),i.removeEventListener("error",o)}},[i,n,t]),s}(a,s),d=bd(e=>{i(e),c.onImageLoadingStatusChange(e)});return vd(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e(gi.img,{...s,ref:n,src:a}):null});Ud.displayName=Id;var Fd="AvatarFallback",jd=r.forwardRef((t,n)=>{const{te:o,delayMs:a,...i}=t,s=_d(Fd,o),[c,l]=r.useState(void 0===a);return r.useEffect(()=>{if(void 0!==a){const e=window.setTimeout(()=>l(!0),a);return()=>window.clearTimeout(e)}},[a]),c&&"loaded"!==s.imageLoadingStatus?e(gi.span,{...i,ref:n}):null});function Ld(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}jd.displayName=Fd;var Bd=Dd,$d=Ud,zd=jd;const Gd=r.forwardRef(({className:t,...n},r)=>e(Bd,{ref:r,className:Da("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...n}));Gd.displayName=Bd.displayName;const Zd=r.forwardRef(({className:t,...n},r)=>e($d,{ref:r,className:Da("aspect-square h-full w-full",t),...n}));Zd.displayName=$d.displayName;const Wd=r.forwardRef(({className:t,...n},r)=>e(zd,{ref:r,className:Da("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...n}));function Kd(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}Wd.displayName=zd.displayName;var Vd=r.useId||(()=>{}),Hd=0;function Jd(e){const[t,n]=r.useState(Vd());return vd(()=>{n(e=>e??Hd+++"")},[e]),e||(t?"radix-"+t:"")}var qd=r.useInsertionEffect||vd;function Yd({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[a,i,s]=function({defaultProp:e,onChange:t}){const[n,o]=r.useState(e),a=r.useRef(n),i=r.useRef(t);return qd(()=>{i.current=t},[t]),r.useEffect(()=>{a.current!==n&&(i.current?.(n),a.current=n)},[n,a]),[n,o,i]}({defaultProp:t,onChange:n}),c=void 0!==e,l=c?e:a;{const t=r.useRef(void 0!==e);r.useEffect(()=>{t.current,t.current=c},[c,o])}const d=r.useCallback(t=>{if(c){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else i(t)},[c,e,i,s]);return[l,d]}var Xd,Qd="dismissableLayer.update",eu=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),tu=r.forwardRef((t,n)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=t,u=r.useContext(eu),[f,m]=r.useState(null),p=f?.ownerDocument??globalThis?.document,[,h]=r.useState({}),b=Fa(n,e=>m(e)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=g.indexOf(v),y=f?g.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,A=y>=w,S=function(e,t=globalThis?.document){const n=bd(e),o=r.useRef(!1),a=r.useRef(()=>{});return r.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let r=function(){ru("dismissableLayer.pointerDownOutside",n,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",a.current),a.current=r,t.addEventListener("click",a.current,{once:!0})):r()}else t.removeEventListener("click",a.current);o.current=!1},r=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(r),t.removeEventListener("pointerdown",e),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}(e=>{const t=e.target,n=[...u.branches].some(e=>e.contains(t));A&&!n&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},p),k=function(e,t=globalThis?.document){const n=bd(e),o=r.useRef(!1);return r.useEffect(()=>{const e=e=>{e.target&&!o.current&&ru("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},p);return function(e,t=globalThis?.document){const n=bd(e);r.useEffect(()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===u.layers.size-1&&(a?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},p),r.useEffect(()=>{if(f)return o&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Xd=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),nu(),()=>{o&&1===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Xd)}},[f,p,o,u]),r.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),nu())},[f,u]),r.useEffect(()=>{const e=()=>h({});return document.addEventListener(Qd,e),()=>document.removeEventListener(Qd,e)},[]),e(gi.div,{...d,ref:b,style:{pointerEvents:x?A?"auto":"none":void 0,...t.style},onFocusCapture:Kd(t.onFocusCapture,k.onFocusCapture),onBlurCapture:Kd(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Kd(t.onPointerDownCapture,S.onPointerDownCapture)})});function nu(){const e=new CustomEvent(Qd);document.dispatchEvent(e)}function ru(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&h.flushSync(()=>e.dispatchEvent(t))}(o,a):o.dispatchEvent(a)}tu.displayName="DismissableLayer",r.forwardRef((t,n)=>{const o=r.useContext(eu),a=r.useRef(null),i=Fa(n,a);return r.useEffect(()=>{const e=a.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}},[o.branches]),e(gi.div,{...t,ref:i})}).displayName="DismissableLayerBranch";var ou="focusScope.autoFocusOnMount",au="focusScope.autoFocusOnUnmount",iu={bubbles:!1,cancelable:!0},su=r.forwardRef((t,n)=>{const{loop:o=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=t,[l,d]=r.useState(null),u=bd(i),f=bd(s),m=r.useRef(null),p=Fa(n,e=>d(e)),h=r.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;r.useEffect(()=>{if(a){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?m.current=t:uu(m.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||uu(m.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&uu(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[a,l,h.paused]),r.useEffect(()=>{if(l){fu.add(h);const e=document.activeElement;if(!l.contains(e)){const t=new CustomEvent(ou,iu);l.addEventListener(ou,u),l.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(uu(r,{select:t}),document.activeElement!==n)return}(cu(l).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&uu(l))}return()=>{l.removeEventListener(ou,u),setTimeout(()=>{const t=new CustomEvent(au,iu);l.addEventListener(au,f),l.dispatchEvent(t),t.defaultPrevented||uu(e??document.body,{select:!0}),l.removeEventListener(au,f),fu.remove(h)},0)}}},[l,u,f,h]);const b=r.useCallback(e=>{if(!o&&!a)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[r,a]=function(e){const t=cu(e);return[lu(t,e),lu(t.reverse(),e)]}(t);r&&a?e.shiftKey||n!==a?e.shiftKey&&n===r&&(e.preventDefault(),o&&uu(a,{select:!0})):(e.preventDefault(),o&&uu(r,{select:!0})):n===t&&e.preventDefault()}},[o,a,h.paused]);return e(gi.div,{tabIndex:-1,...c,ref:p,onKeyDown:b})});function cu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t||0>e.tabIndex?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});for(;n.nextNode();)t.push(n.currentNode);return t}function lu(e,t){for(const n of e)if(!du(n,{upTo:t}))return n}function du(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 uu(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}su.displayName="FocusScope";var fu=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=mu(e,t),e.unshift(t)},remove(t){e=mu(e,t),e[0]?.resume()}}}();function mu(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var pu=r.forwardRef((t,n)=>{const{container:o,...a}=t,[i,s]=r.useState(!1);vd(()=>s(!0),[]);const c=o||i&&globalThis?.document?.body;return c?b.createPortal(e(gi.div,{...a,ref:n}),c):null});pu.displayName="Portal";var hu=e=>{const{present:t,children:n}=e,o=function(e){const[t,n]=r.useState(),o=r.useRef(null),a=r.useRef(e),i=r.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return r.useReducer((e,n)=>t[e][n]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect(()=>{const e=bu(o.current);i.current="mounted"===c?e:"none"},[c]),vd(()=>{const t=o.current,n=a.current;if(n!==e){const r=i.current,o=bu(t);l(e?"MOUNT":"none"===o||"none"===t?.display?"UNMOUNT":n&&r!==o?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),vd(()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,r=r=>{const i=bu(o.current).includes(CSS.escape(r.animationName));if(r.target===t&&i&&(l("ANIMATION_END"),!a.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(i.current=bu(o.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",r),t.addEventListener("animationend",r),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",r),t.removeEventListener("animationend",r)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:r.useCallback(e=>{o.current=e?getComputedStyle(e):null,n(e)},[])}}(t),a="function"==typeof n?n({present:o.isPresent}):r.Children.only(n),i=Fa(o.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}(a));return"function"==typeof n||o.isPresent?r.cloneElement(a,{ref:i}):null};function bu(e){return e?.animationName||"none"}hu.displayName="Presence";var gu=0;function vu(){r.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??wu()),document.body.insertAdjacentElement("beforeend",e[1]??wu()),gu++,()=>{1===gu&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gu--}},[])}function wu(){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 yu=function(){return yu=Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},yu.apply(this,arguments)};function xu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Au="right-scroll-bar-position",Su="width-before-scroll-bar";function ku(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Tu="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,Cu=new WeakMap;function Nu(e){return e}var Eu=function(e){var t=e.sideCar,n=xu(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw Error("Sidecar medium not found");return r.createElement(o,yu({},n))};Eu.isSideCarExport=!0;var Pu=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Nu);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:null},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter(function(e){return e!==o})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),n={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),n}}}}}();return t.options=yu({async:!0,ssr:!1},e),t}(),Mu=function(){},Ou=r.forwardRef(function(e,t){var n=r.useRef(null),o=r.useState({onScrollCapture:Mu,onWheelCapture:Mu,onTouchMoveCapture:Mu}),a=o[0],i=o[1],s=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,m=e.shards,p=e.sideCar,h=e.noRelative,b=e.noIsolation,g=e.inert,v=e.allowPinchZoom,w=e.as,y=void 0===w?"div":w,x=e.gapMode,A=xu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=function(e){var t,n,r=(t=function(t){return e.forEach(function(e){return ku(e,t)})},(n=f(function(){return{value:null,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0]).callback=t,n.facade);return Tu(function(){var t=Cu.get(r);if(t){var n=new Set(t),o=new Set(e),a=r.current;n.forEach(function(e){o.has(e)||ku(e,null)}),o.forEach(function(e){n.has(e)||ku(e,a)})}Cu.set(r,e)},[e]),r}([n,t]),T=yu(yu({},A),a);return r.createElement(r.Fragment,null,u&&r.createElement(S,{sideCar:Pu,removeScrollBar:d,shards:m,noRelative:h,noIsolation:b,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:x}),s?r.cloneElement(r.Children.only(c),yu(yu({},T),{ref:k})):r.createElement(y,yu({},T,{className:l,ref:k}),c))});Ou.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ou.classNames={fullWidth:Su,zeroRight:Au};var Ru=function(){var e,t,n,o=(t=0,n=null,e={add:function(e){var r,o;0==t&&(n=function(){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}())&&(o=e,(r=n).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),t++},remove:function(){! --t&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}},function(t,n){r.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])});return function(e){var t=e.styles,n=e.dynamic;return o(t,n),null}},_u={left:0,top:0,right:0,gap:0},Du=function(e){return parseInt(e||"",10)||0},Iu=Ru(),Uu="data-scroll-locked",Fu=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return void 0===n&&(n="margin"),"\n .with-scroll-bars-hidden {\n overflow: hidden ".concat(r,";\n padding-right: ").concat(s,"px ").concat(r,";\n }\n body[").concat(Uu,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Au," {\n right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Su," {\n margin-right: ").concat(s,"px ").concat(r,";\n }\n \n .").concat(Au," .").concat(Au," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Su," .").concat(Su," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(Uu,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},ju=function(){var e=parseInt(document.body.getAttribute(Uu)||"0",10);return isFinite(e)?e:0},Lu=function(e){var t=e.noRelative,n=e.noImportant,o=e.gapMode,a=void 0===o?"margin":o;r.useEffect(function(){return document.body.setAttribute(Uu,""+(ju()+1)),function(){var e=ju()-1;e>0?document.body.setAttribute(Uu,e.toString()):document.body.removeAttribute(Uu)}},[]);var i=r.useMemo(function(){return function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return _u;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[Du(n),Du(r),Du(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}}(a)},[a]);return r.createElement(Iu,{styles:Fu(i,!t,a,n?"":"!important")})},Bu=!1;if("undefined"!=typeof window)try{var $u=Object.defineProperty({},"passive",{get:function(){return Bu=!0,!0}});window.addEventListener("test",$u,$u),window.removeEventListener("test",$u,$u)}catch(e){Bu=!1}var zu=!!Bu&&{passive:!1},Gu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},Zu=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),Wu(e,r)){var o=Ku(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Wu=function(e,t){return"v"===e?function(e){return Gu(e,"overflowY")}(t):function(e){return Gu(e,"overflowX")}(t)},Ku=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Vu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hu=function(e){return[e.deltaX,e.deltaY]},Ju=function(e){return e&&"current"in e?e.current:e},qu=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Yu=0,Xu=[];function Qu(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ef,tf=(ef=function(e){var t=r.useRef([]),n=r.useRef([0,0]),o=r.useRef(),a=r.useState(Yu++)[0],i=r.useState(Ru)[0],s=r.useRef(e);r.useEffect(function(){s.current=e},[e]),r.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;a>o;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Ju),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=r.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var r,a=Vu(e),i=n.current,c="deltaX"in e?e.deltaX:i[0]-a[0],l="deltaY"in e?e.deltaY:i[1]-a[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=Zu(u,d);if(!f)return!0;if(f?r=u:(r="v"===u?"h":"v",f=Zu(u,d)),!f)return!1;if(!o.current&&"changedTouches"in e&&(c||l)&&(o.current=r),!r)return!0;var m=o.current||r;return function(e,t,n,r){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),a=o*r,i=n.target,s=t.contains(i),c=!1,l=a>0,d=0,u=0;do{if(!i)break;var f=Ku(e,i),m=f[0],p=f[1]-f[2]-o*m;(m||p)&&Wu(e,i)&&(d+=p,u+=m);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&1>Math.abs(d)||!l&&1>Math.abs(u))&&(c=!0),c}(m,t,e,"h"===m?c:l)},[]),l=r.useCallback(function(e){var n=e;if(Xu.length&&Xu[Xu.length-1]===i){var r="deltaY"in n?Hu(n):Vu(n),o=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&(t=e.delta,o=r,t[0]===o[0]&&t[1]===o[1]);var t,o})[0];if(o&&o.should)n.cancelable&&n.preventDefault();else if(!o){var a=(s.current.shards||[]).map(Ju).filter(Boolean).filter(function(e){return e.contains(n.target)});(a.length>0?c(n,a[0]):!s.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),d=r.useCallback(function(e,n,r,o){var a={name:e,delta:n,target:r,should:o,shadowParent:Qu(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=r.useCallback(function(e){n.current=Vu(e),o.current=void 0},[]),f=r.useCallback(function(t){d(t.type,Hu(t),t.target,c(t,e.lockRef.current))},[]),m=r.useCallback(function(t){d(t.type,Vu(t),t.target,c(t,e.lockRef.current))},[]);r.useEffect(function(){return Xu.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,zu),document.addEventListener("touchmove",l,zu),document.addEventListener("touchstart",u,zu),function(){Xu=Xu.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,zu),document.removeEventListener("touchmove",l,zu),document.removeEventListener("touchstart",u,zu)}},[]);var p=e.removeScrollBar,h=e.inert;return r.createElement(r.Fragment,null,h?r.createElement(i,{styles:qu(a)}):null,p?r.createElement(Lu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Pu.useMedium(ef),Eu),nf=r.forwardRef(function(e,t){return r.createElement(Ou,yu({},e,{ref:t,sideCar:tf}))});nf.classNames=Ou.classNames;var rf=new WeakMap,of=new WeakMap,af={},sf=0,cf=function(e){return e&&(e.host||cf(e.parentNode))},lf=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),function(e,t,n,r){var o=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=cf(t);return n&&e.contains(n)?n:null}).filter(function(e){return!!e})}(t,Array.isArray(e)?e:[e]);af[n]||(af[n]=new WeakMap);var a=af[n],i=[],s=new Set,c=new Set(o),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};o.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(r),o=null!==t&&"false"!==t,c=(rf.get(e)||0)+1,l=(a.get(e)||0)+1;rf.set(e,c),a.set(e,l),i.push(e),1===c&&o&&of.set(e,!0),1===l&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}catch(e){}})};return d(t),s.clear(),sf++,function(){i.forEach(function(e){var t=rf.get(e)-1,o=a.get(e)-1;rf.set(e,t),a.set(e,o),t||(of.has(e)||e.removeAttribute(r),of.delete(e)),o||e.removeAttribute(n)}),--sf||(rf=new WeakMap,rf=new WeakMap,of=new WeakMap,af={})}}(r,o,n,"aria-hidden")):function(){return null}},df="Dialog",[uf,ff]=pd(df),[mf,pf]=uf(df),hf=t=>{const{ne:n,children:o,open:a,defaultOpen:i,onOpenChange:s,modal:c=!0}=t,l=r.useRef(null),d=r.useRef(null),[u,f]=Yd({prop:a,defaultProp:i??!1,onChange:s,caller:df});return e(mf,{scope:n,triggerRef:l,contentRef:d,contentId:Jd(),titleId:Jd(),descriptionId:Jd(),open:u,onOpenChange:f,onOpenToggle:r.useCallback(()=>f(e=>!e),[f]),modal:c,children:o})};hf.displayName=df;var bf="DialogTrigger",gf=r.forwardRef((t,n)=>{const{ne:r,...o}=t,a=pf(bf,r),i=Fa(n,a.triggerRef);return e(gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Ff(a.open),...o,ref:i,onClick:Kd(t.onClick,a.onOpenToggle)})});gf.displayName=bf;var vf="DialogPortal",[wf,yf]=uf(vf,{forceMount:void 0}),xf=t=>{const{ne:n,forceMount:o,children:a,container:i}=t,s=pf(vf,n);return e(wf,{scope:n,forceMount:o,children:r.Children.map(a,t=>e(hu,{present:o||s.open,children:e(pu,{asChild:!0,container:i,children:t})}))})};xf.displayName=vf;var Af="DialogOverlay",Sf=r.forwardRef((t,n)=>{const r=yf(Af,t.ne),{forceMount:o=r.forceMount,...a}=t,i=pf(Af,t.ne);return i.modal?e(hu,{present:o||i.open,children:e(Tf,{...a,ref:n})}):null});Sf.displayName=Af;var kf=ja("DialogOverlay.RemoveScroll"),Tf=r.forwardRef((t,n)=>{const{ne:r,...o}=t,a=pf(Af,r);return e(nf,{as:kf,allowPinchZoom:!0,shards:[a.contentRef],children:e(gi.div,{"data-state":Ff(a.open),...o,ref:n,style:{pointerEvents:"auto",...o.style}})})}),Cf="DialogContent",Nf=r.forwardRef((t,n)=>{const r=yf(Cf,t.ne),{forceMount:o=r.forceMount,...a}=t,i=pf(Cf,t.ne);return e(hu,{present:o||i.open,children:i.modal?e(Ef,{...a,ref:n}):e(Pf,{...a,ref:n})})});Nf.displayName=Cf;var Ef=r.forwardRef((t,n)=>{const o=pf(Cf,t.ne),a=r.useRef(null),i=Fa(n,o.contentRef,a);return r.useEffect(()=>{const e=a.current;if(e)return lf(e)},[]),e(Mf,{...t,ref:i,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kd(t.onCloseAutoFocus,e=>{e.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:Kd(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:Kd(t.onFocusOutside,e=>e.preventDefault())})}),Pf=r.forwardRef((t,n)=>{const o=pf(Cf,t.ne),a=r.useRef(!1),i=r.useRef(!1);return e(Mf,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(a.current||o.triggerRef.current?.focus(),e.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(a.current=!0,"pointerdown"===e.detail.originalEvent.type&&(i.current=!0));const n=e.target,r=o.triggerRef.current?.contains(n);r&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&i.current&&e.preventDefault()}})}),Mf=r.forwardRef((o,a)=>{const{ne:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=o,u=pf(Cf,i),f=r.useRef(null),m=Fa(a,f);return vu(),n(t,{children:[e(su,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:e(tu,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Ff(u.open),...d,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),n(t,{children:[e($f,{titleId:u.titleId}),e(zf,{contentRef:f,descriptionId:u.descriptionId})]})]})}),Of="DialogTitle",Rf=r.forwardRef((t,n)=>{const{ne:r,...o}=t,a=pf(Of,r);return e(gi.h2,{id:a.titleId,...o,ref:n})});Rf.displayName=Of;var _f="DialogDescription",Df=r.forwardRef((t,n)=>{const{ne:r,...o}=t,a=pf(_f,r);return e(gi.p,{id:a.descriptionId,...o,ref:n})});Df.displayName=_f;var If="DialogClose",Uf=r.forwardRef((t,n)=>{const{ne:r,...o}=t,a=pf(If,r);return e(gi.button,{type:"button",...o,ref:n,onClick:Kd(t.onClick,()=>a.onOpenChange(!1))})});function Ff(e){return e?"open":"closed"}Uf.displayName=If;var jf="DialogTitleWarning",[Lf,Bf]=function(t,n){const o=r.createContext(n),a=t=>{const{children:n,...a}=t,i=r.useMemo(()=>a,Object.values(a));return e(o.Provider,{value:i,children:n})};return a.displayName=t+"Provider",[a,function(e){return r.useContext(o)||n}]}(jf,{contentName:Cf,titleName:Of,docsSlug:"dialog"}),$f=({titleId:e})=>{const t=Bf(jf),n=`\`${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 r.useEffect(()=>{e&&document.getElementById(e)},[n,e]),null},zf=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Bf("DialogDescriptionWarning").contentName}}.`;return r.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");t&&n&&document.getElementById(t)},[n,e,t]),null},Gf=hf,Zf=gf,Wf=xf,Kf=Sf,Vf=Nf,Hf=Rf,Jf=Df,qf=Uf;function Yf(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],0>t.indexOf(n)&&(o[n]=e[n]);return o}var Xf=["color"],Qf=d(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Yf(e,Xf);return u("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),u("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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),em=["color"],tm=d(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Yf(e,em);return u("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),u("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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),nm=["color"],rm=d(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Yf(e,nm);return u("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),u("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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),om=["color"],am=d(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Yf(e,om);return u("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),u("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:r,fillRule:"evenodd",clipRule:"evenodd"}))});const im=Gf,sm=Zf,cm=Wf,lm=r.forwardRef(({className:t,...n},r)=>e(Kf,{ref:r,className:Da("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),...n}));lm.displayName=Kf.displayName;const dm=r.forwardRef(({className:t,children:o,...a},i)=>{const{container:s}=r.useContext(ce);return n(cm,{container:s,children:[e(lm,{}),n(Vf,{ref:i,className:Da("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),...a,children:[o,n(qf,{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(rm,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"Close"})]})]})]})});dm.displayName=Vf.displayName;const um=({className:t,...n})=>e("div",{className:Da("flex flex-col space-y-1.5 text-center sm:text-left",t),...n});um.displayName="DialogHeader";const fm=r.forwardRef(({className:t,...n},r)=>e(Hf,{ref:r,className:Da("text-lg font-semibold leading-none tracking-tight",t),...n}));fm.displayName=Hf.displayName;const mm=r.forwardRef(({className:t,...n},r)=>e(Jf,{ref:r,className:Da("text-sm text-muted-foreground",t),...n}));function pm(t){const n=t+"CollectionProvider",[r,a]=pd(n),[i,s]=r(n,{collectionRef:{current:null},itemMap:new Map}),c=t=>{const{scope:n,children:r}=t,a=o.useRef(null),s=o.useRef(new Map).current;return e(i,{scope:n,itemMap:s,collectionRef:a,children:r})};c.displayName=n;const l=t+"CollectionSlot",d=ja(l),u=o.forwardRef((t,n)=>{const{scope:r,children:o}=t,a=Fa(n,s(l,r).collectionRef);return e(d,{ref:a,children:o})});u.displayName=l;const f=t+"CollectionItemSlot",m="data-radix-collection-item",p=ja(f),h=o.forwardRef((t,n)=>{const{scope:r,children:a,...i}=t,c=o.useRef(null),l=Fa(n,c),d=s(f,r);return o.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),e(p,{[m]:"",ref:l,children:a})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(e){const n=s(t+"CollectionConsumer",e),r=o.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${m}]`)),r=Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current));return r},[n.collectionRef,n.itemMap]);return r},a]}mm.displayName=Jf.displayName;var hm=r.createContext(void 0);function bm(e){const t=r.useContext(hm);return e||t||"ltr"}var gm="rovingFocusGroup.onEntryFocus",vm={bubbles:!1,cancelable:!0},wm="RovingFocusGroup",[ym,xm,Am]=pm(wm),[Sm,km]=pd(wm,[Am]),[Tm,Cm]=Sm(wm),Nm=r.forwardRef((t,n)=>e(ym.Provider,{scope:t.re,children:e(ym.Slot,{scope:t.re,children:e(Em,{...t,ref:n})})}));Nm.displayName=wm;var Em=r.forwardRef((t,n)=>{const{re:o,orientation:a,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...m}=t,p=r.useRef(null),h=Fa(n,p),b=bm(s),[g,v]=Yd({prop:c,defaultProp:l??null,onChange:d,caller:wm}),[w,y]=r.useState(!1),x=bd(u),A=xm(o),S=r.useRef(!1),[k,T]=r.useState(0);return r.useEffect(()=>{const e=p.current;if(e)return e.addEventListener(gm,x),()=>e.removeEventListener(gm,x)},[x]),e(Tm,{scope:o,orientation:a,dir:b,loop:i,currentTabStopId:g,onItemFocus:r.useCallback(e=>v(e),[v]),onItemShiftTab:r.useCallback(()=>y(!0),[]),onFocusableItemAdd:r.useCallback(()=>T(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>T(e=>e-1),[]),children:e(gi.div,{tabIndex:w||0===k?-1:0,"data-orientation":a,...m,ref:h,style:{outline:"none",...t.style},onMouseDown:Kd(t.onMouseDown,()=>{S.current=!0}),onFocus:Kd(t.onFocus,e=>{const t=!S.current;if(e.target===e.currentTarget&&t&&!w){const t=new CustomEvent(gm,vm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=A().filter(e=>e.focusable);Rm([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),f)}}S.current=!1}),onBlur:Kd(t.onBlur,()=>y(!1))})})}),Pm="RovingFocusGroupItem",Mm=r.forwardRef((t,n)=>{const{re:o,focusable:a=!0,active:i=!1,tabStopId:s,children:c,...l}=t,d=Jd(),u=s||d,f=Cm(Pm,o),m=f.currentTabStopId===u,p=xm(o),{onFocusableItemAdd:h,onFocusableItemRemove:b,currentTabStopId:g}=f;return r.useEffect(()=>{if(a)return h(),()=>b()},[a,h,b]),e(ym.ItemSlot,{scope:o,id:u,focusable:a,active:i,children:e(gi.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...l,ref:n,onMouseDown:Kd(t.onMouseDown,e=>{a?f.onItemFocus(u):e.preventDefault()}),onFocus:Kd(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Kd(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:Om[r]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=p().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const a=o.indexOf(e.currentTarget);o=f.loop?(r=a+1,(n=o).map((e,t)=>n[(r+t)%n.length])):o.slice(a+1)}setTimeout(()=>Rm(o))}var n,r}),children:"function"==typeof c?c({isCurrentTabStop:m,hasTabStop:null!=g}):c})})});Mm.displayName=Pm;var Om={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Rm(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var _m=Nm,Dm=Mm;function Im(e){const[t,n]=r.useState(void 0);return vd(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}function Um(e){const t=r.useRef({value:e,previous:e});return r.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Fm="Radio",[jm,Lm]=pd(Fm),[Bm,$m]=jm(Fm),zm=r.forwardRef((t,o)=>{const{oe:a,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...m}=t,[p,h]=r.useState(null),b=Fa(o,e=>h(e)),g=r.useRef(!1),v=!p||f||!!p.closest("form");return n(Bm,{scope:a,checked:s,disabled:l,children:[e(gi.button,{type:"button",role:"radio","aria-checked":s,"data-state":Km(s),"data-disabled":l?"":void 0,disabled:l,value:d,...m,ref:b,onClick:Kd(t.onClick,e=>{s||u?.(),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&e(Wm,{control:p,bubbles:!g.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});zm.displayName=Fm;var Gm="RadioIndicator",Zm=r.forwardRef((t,n)=>{const{oe:r,forceMount:o,...a}=t,i=$m(Gm,r);return e(hu,{present:o||i.checked,children:e(gi.span,{"data-state":Km(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:n})})});Zm.displayName=Gm;var Wm=r.forwardRef(({oe:t,control:n,checked:o,bubbles:a=!0,...i},s)=>{const c=r.useRef(null),l=Fa(c,s),d=Um(o),u=Im(n);return r.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==o&&n){const t=new Event("click",{bubbles:a});n.call(e,o),e.dispatchEvent(t)}},[d,o,a]),e(gi.input,{type:"radio","aria-hidden":!0,defaultChecked:o,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Km(e){return e?"checked":"unchecked"}Wm.displayName="RadioBubbleInput";var Vm=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Hm="RadioGroup",[Jm,qm]=pd(Hm,[km,Lm]),Ym=km(),Xm=Lm(),[Qm,ep]=Jm(Hm),tp=r.forwardRef((t,n)=>{const{ae:r,name:o,defaultValue:a,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...m}=t,p=Ym(r),h=bm(d),[b,g]=Yd({prop:i,defaultProp:a??null,onChange:f,caller:Hm});return e(Qm,{scope:r,name:o,required:s,disabled:c,value:b,onValueChange:g,children:e(_m,{asChild:!0,...p,orientation:l,dir:h,loop:u,children:e(gi.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...m,ref:n})})})});tp.displayName=Hm;var np="RadioGroupItem",rp=r.forwardRef((t,n)=>{const{ae:o,disabled:a,...i}=t,s=ep(np,o),c=s.disabled||a,l=Ym(o),d=Xm(o),u=r.useRef(null),f=Fa(n,u),m=s.value===i.value,p=r.useRef(!1);return r.useEffect(()=>{const e=e=>{Vm.includes(e.key)&&(p.current=!0)},t=()=>p.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e(Dm,{asChild:!0,...l,focusable:!c,active:m,children:e(zm,{disabled:c,required:s.required,checked:m,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:Kd(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Kd(i.onFocus,()=>{p.current&&u.current?.click()})})})});rp.displayName=np;var op=r.forwardRef((t,n)=>{const{ae:r,...o}=t,a=Xm(r);return e(Zm,{...a,...o,ref:n})});op.displayName="RadioGroupIndicator";var ap=tp,ip=rp,sp=op;const cp=r.forwardRef(({className:t,...n},r)=>e(ap,{className:Da("grid gap-2",t),...n,ref:r}));cp.displayName=ap.displayName;const lp=r.forwardRef(({className:t,...n},r)=>e(ip,{ref:r,className:Da("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),...n,children:e(sp,{className:"flex items-center justify-center",children:e(tm,{className:"h-3.5 w-3.5 fill-primary"})})}));function dp(e,[t,n]){return Math.min(n,Math.max(t,e))}lp.displayName=ip.displayName;var up="ScrollArea",[fp,mp]=pd(up),[pp,hp]=fp(up),bp=r.forwardRef((t,n)=>{const{ie:o,type:a="hover",dir:i,scrollHideDelay:s=600,...c}=t,[l,d]=r.useState(null),[u,f]=r.useState(null),[m,p]=r.useState(null),[h,b]=r.useState(null),[g,v]=r.useState(null),[w,y]=r.useState(0),[x,A]=r.useState(0),[S,k]=r.useState(!1),[T,C]=r.useState(!1),N=Fa(n,e=>d(e)),E=bm(i);return e(pp,{scope:o,type:a,dir:E,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:f,content:m,onContentChange:p,scrollbarX:h,onScrollbarXChange:b,scrollbarXEnabled:S,onScrollbarXEnabledChange:k,scrollbarY:g,onScrollbarYChange:v,scrollbarYEnabled:T,onScrollbarYEnabledChange:C,onCornerWidthChange:y,onCornerHeightChange:A,children:e(gi.div,{dir:E,...c,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":x+"px",...t.style}})})});bp.displayName=up;var gp="ScrollAreaViewport",vp=r.forwardRef((o,a)=>{const{ie:i,children:s,nonce:c,...l}=o,d=hp(gp,i),u=Fa(a,r.useRef(null),d.onViewportChange);return n(t,{children:[e("style",{dangerouslySetInnerHTML:{se:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),e(gi.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...o.style},children:e("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});vp.displayName=gp;var wp="ScrollAreaScrollbar",yp=r.forwardRef((t,n)=>{const{forceMount:o,...a}=t,i=hp(wp,t.ie),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===t.orientation;return r.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?e(xp,{...a,ref:n,forceMount:o}):"scroll"===i.type?e(Ap,{...a,ref:n,forceMount:o}):"auto"===i.type?e(Sp,{...a,ref:n,forceMount:o}):"always"===i.type?e(kp,{...a,ref:n}):null});yp.displayName=wp;var xp=r.forwardRef((t,n)=>{const{forceMount:o,...a}=t,i=hp(wp,t.ie),[s,c]=r.useState(!1);return r.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const n=()=>{window.clearTimeout(t),c(!0)},r=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",r)}}},[i.scrollArea,i.scrollHideDelay]),e(hu,{present:o||s,children:e(Sp,{"data-state":s?"visible":"hidden",...a,ref:n})})}),Ap=r.forwardRef((t,n)=>{const{forceMount:o,...a}=t,i=hp(wp,t.ie),s="horizontal"===t.orientation,c=Gp(()=>d("SCROLL_END"),100),[l,d]=(u={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},r.useReducer((e,t)=>u[e][t]??e,"hidden"));var u;return r.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),r.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let n=e[t];const r=()=>{const r=e[t];n!==r&&(d("SCROLL"),c()),n=r};return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}},[i.viewport,s,d,c]),e(hu,{present:o||"hidden"!==l,children:e(kp,{"data-state":"hidden"===l?"hidden":"visible",...a,ref:n,onPointerEnter:Kd(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Kd(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Sp=r.forwardRef((t,n)=>{const o=hp(wp,t.ie),{forceMount:a,...i}=t,[s,c]=r.useState(!1),l="horizontal"===t.orientation,d=Gp(()=>{if(o.viewport){const e=o.viewport.offsetWidth<o.viewport.scrollWidth,t=o.viewport.offsetHeight<o.viewport.scrollHeight;c(l?e:t)}},10);return Zp(o.viewport,d),Zp(o.content,d),e(hu,{present:a||s,children:e(kp,{"data-state":s?"visible":"hidden",...i,ref:n})})}),kp=r.forwardRef((t,n)=>{const{orientation:o="vertical",...a}=t,i=hp(wp,t.ie),s=r.useRef(null),c=r.useRef(0),[l,d]=r.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Fp(l.viewport,l.content),f={...a,sizes:l,onSizesChange:d,hasThumb:!(0>=u||u>=1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function m(e,t){return function(e,t,n,r="ltr"){const o=jp(n),a=t||o/2,i=o-a,s=n.scrollbar.paddingStart+a,c=n.scrollbar.size-n.scrollbar.paddingEnd-i,l=n.content-n.viewport;return Bp([s,c],"ltr"===r?[0,l]:[-1*l,0])(e)}(e,c.current,l,t)}return"horizontal"===o?e(Tp,{...f,ref:n,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Lp(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=m(e,i.dir))}}):"vertical"===o?e(Cp,{...f,ref:n,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Lp(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=m(e))}}):null}),Tp=r.forwardRef((t,n)=>{const{sizes:o,onSizesChange:a,...i}=t,s=hp(wp,t.ie),[c,l]=r.useState(),d=r.useRef(null),u=Fa(n,d,s.onScrollbarXChange);return r.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e(Pp,{"data-orientation":"horizontal",...i,ref:u,sizes:o,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jp(o)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,n)=>{if(s.viewport){const r=s.viewport.scrollLeft+e.deltaX;t.onWheelScroll(r),$p(r,n)&&e.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&a({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Up(c.paddingLeft),paddingEnd:Up(c.paddingRight)}})}})}),Cp=r.forwardRef((t,n)=>{const{sizes:o,onSizesChange:a,...i}=t,s=hp(wp,t.ie),[c,l]=r.useState(),d=r.useRef(null),u=Fa(n,d,s.onScrollbarYChange);return r.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e(Pp,{"data-orientation":"vertical",...i,ref:u,sizes:o,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jp(o)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,n)=>{if(s.viewport){const r=s.viewport.scrollTop+e.deltaY;t.onWheelScroll(r),$p(r,n)&&e.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&a({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Up(c.paddingTop),paddingEnd:Up(c.paddingBottom)}})}})}),[Np,Ep]=fp(wp),Pp=r.forwardRef((t,n)=>{const{ie:o,sizes:a,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:m,...p}=t,h=hp(wp,o),[b,g]=r.useState(null),v=Fa(n,e=>g(e)),w=r.useRef(null),y=r.useRef(""),x=h.viewport,A=a.content-a.viewport,S=bd(f),k=bd(d),T=Gp(m,10);function C(e){if(w.current){const t=e.clientX-w.current.left,n=e.clientY-w.current.top;u({x:t,y:n})}}return r.useEffect(()=>{const e=e=>{const t=e.target,n=b?.contains(t);n&&S(e,A)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,b,A,S]),r.useEffect(k,[a,k]),Zp(b,T),Zp(h.content,T),e(Np,{scope:o,scrollbar:b,hasThumb:i,onThumbChange:bd(s),onThumbPointerUp:bd(c),onThumbPositionChange:k,onThumbPointerDown:bd(l),children:e(gi.div,{...p,ref:v,style:{position:"absolute",...p.style},onPointerDown:Kd(t.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),w.current=b.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e))}),onPointerMove:Kd(t.onPointerMove,C),onPointerUp:Kd(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,h.viewport&&(h.viewport.style.scrollBehavior=""),w.current=null})})})}),Mp="ScrollAreaThumb",Op=r.forwardRef((t,n)=>{const{forceMount:r,...o}=t,a=Ep(Mp,t.ie);return e(hu,{present:r||a.hasThumb,children:e(Rp,{ref:n,...o})})}),Rp=r.forwardRef((t,n)=>{const{ie:o,style:a,...i}=t,s=hp(Mp,o),c=Ep(Mp,o),{onThumbPositionChange:l}=c,d=Fa(n,e=>c.onThumbChange(e)),u=r.useRef(void 0),f=Gp(()=>{u.current&&(u.current(),u.current=void 0)},100);return r.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=zp(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),e(gi.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:Kd(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;c.onThumbPointerDown({x:n,y:r})}),onPointerUp:Kd(t.onPointerUp,c.onThumbPointerUp)})});Op.displayName=Mp;var _p="ScrollAreaCorner",Dp=r.forwardRef((t,n)=>{const r=hp(_p,t.ie),o=!(!r.scrollbarX||!r.scrollbarY);return"scroll"!==r.type&&o?e(Ip,{...t,ref:n}):null});Dp.displayName=_p;var Ip=r.forwardRef((t,n)=>{const{ie:o,...a}=t,i=hp(_p,o),[s,c]=r.useState(0),[l,d]=r.useState(0),u=!(!s||!l);return Zp(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),Zp(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?e(gi.div,{...a,ref:n,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...t.style}}):null});function Up(e){return e?parseInt(e,10):0}function Fp(e,t){const n=e/t;return isNaN(n)?0:n}function jp(e){const t=Fp(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Lp(e,t,n="ltr"){const r=jp(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-o,i=t.content-t.viewport,s=a-r,c=dp(e,"ltr"===n?[0,i]:[-1*i,0]);return Bp([0,i],[0,s])(c)}function Bp(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $p(e,t){return e>0&&t>e}var zp=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const a={left:e.scrollLeft,top:e.scrollTop},i=n.left!==a.left,s=n.top!==a.top;(i||s)&&t(),n=a,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Gp(e,t){const n=bd(e),o=r.useRef(0);return r.useEffect(()=>()=>window.clearTimeout(o.current),[]),r.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(n,t)},[n,t])}function Zp(e,t){const n=bd(t);vd(()=>{let t=0;if(e){const r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Wp=bp,Kp=vp,Vp=Dp;const Hp=r.forwardRef(({className:t,children:r,...o},a)=>n(Wp,{ref:a,className:Da("relative overflow-hidden",t),...o,children:[e(Kp,{className:"h-full w-full rounded-[inherit]",children:r}),e(Jp,{}),e(Vp,{})]}));Hp.displayName=Wp.displayName;const Jp=r.forwardRef(({className:t,orientation:n="vertical",...r},o)=>e(yp,{ref:o,orientation:n,className:Da("flex touch-none select-none transition-colors","vertical"===n&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===n&&"h-2.5 border-t border-t-transparent p-[1px]",t),...r,children:e(Op,{className:Da("relative rounded-full bg-border","vertical"===n&&"flex-1")})}));Jp.displayName=yp.displayName;var qp="horizontal",Yp=["horizontal","vertical"],Xp=r.forwardRef((t,n)=>{const{decorative:r,orientation:o=qp,...a}=t,i=function(e){return Yp.includes(e)}(o)?o:qp,s=r?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return e(gi.div,{"data-orientation":i,...s,...a,ref:n})});Xp.displayName="Separator";var Qp=Xp;const eh=r.forwardRef(({className:t,orientation:n="horizontal",decorative:r=!0,...o},a)=>e(Qp,{ref:a,decorative:r,orientation:n,className:Da("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",t),...o}));eh.displayName=Qp.displayName;var th="AlertDialog",[nh,rh]=pd(th,[ff]),oh=ff(),ah=t=>{const{ce:n,...r}=t,o=oh(n);return e(Gf,{...o,...r,modal:!0})};ah.displayName=th;var ih=r.forwardRef((t,n)=>{const{ce:r,...o}=t,a=oh(r);return e(Zf,{...a,...o,ref:n})});ih.displayName="AlertDialogTrigger";var sh=t=>{const{ce:n,...r}=t,o=oh(n);return e(Wf,{...o,...r})};sh.displayName="AlertDialogPortal";var ch=r.forwardRef((t,n)=>{const{ce:r,...o}=t,a=oh(r);return e(Kf,{...a,...o,ref:n})});ch.displayName="AlertDialogOverlay";var lh="AlertDialogContent",[dh,uh]=nh(lh),fh=function(){const n=({children:n})=>e(t,{children:n});return n.displayName="AlertDialogContent.Slottable",n.H=$a,n}(),mh=r.forwardRef((t,o)=>{const{ce:a,children:i,...s}=t,c=oh(a),l=r.useRef(null),d=Fa(o,l),u=r.useRef(null);return e(Lf,{contentName:lh,titleName:ph,docsSlug:"alert-dialog",children:e(dh,{scope:a,cancelRef:u,children:n(Vf,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:Kd(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e(fh,{children:i}),e(xh,{contentRef:l})]})})})});mh.displayName=lh;var ph="AlertDialogTitle",hh=r.forwardRef((t,n)=>{const{ce:r,...o}=t,a=oh(r);return e(Hf,{...a,...o,ref:n})});hh.displayName=ph;var bh="AlertDialogDescription",gh=r.forwardRef((t,n)=>{const{ce:r,...o}=t,a=oh(r);return e(Jf,{...a,...o,ref:n})});gh.displayName=bh;var vh=r.forwardRef((t,n)=>{const{ce:r,...o}=t,a=oh(r);return e(qf,{...a,...o,ref:n})});vh.displayName="AlertDialogAction";var wh="AlertDialogCancel",yh=r.forwardRef((t,n)=>{const{ce:r,...o}=t,{cancelRef:a}=uh(wh,r),i=oh(r),s=Fa(n,a);return e(qf,{...i,...o,ref:s})});yh.displayName=wh;var xh=({contentRef:e})=>{const t=`\`${lh}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${lh}\` by passing a \`${bh}\` 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 \`${lh}\`. 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 r.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))},[t,e]),null},Ah=ch,Sh=mh,kh=vh,Th=yh,Ch=hh,Nh=gh;const Eh=ah,Ph=ih,Mh=sh,Oh=r.forwardRef(({className:t,...n},r)=>e(Ah,{className:Da("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),...n,ref:r}));Oh.displayName=Ah.displayName;const Rh=r.forwardRef(({className:t,...o},a)=>{const{container:i}=r.useContext(ce);return n(Mh,{container:i,children:[e(Oh,{}),e(Sh,{ref:a,className:Da("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),...o})]})});Rh.displayName=Sh.displayName;const _h=({className:t,...n})=>e("div",{className:Da("flex flex-col space-y-2 text-center sm:text-left",t),...n});_h.displayName="AlertDialogHeader";const Dh=({className:t,...n})=>e("div",{className:Da("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n});Dh.displayName="AlertDialogFooter";const Ih=r.forwardRef(({className:t,...n},r)=>e(Ch,{ref:r,className:Da("text-lg font-semibold",t),...n}));Ih.displayName=Ch.displayName;const Uh=r.forwardRef(({className:t,...n},r)=>e(Nh,{ref:r,className:Da("text-sm text-muted-foreground",t),...n}));Uh.displayName=Nh.displayName;const Fh=r.forwardRef(({className:t,...n},r)=>e(kh,{ref:r,className:Da(hi(),t),...n}));Fh.displayName=kh.displayName;const jh=r.forwardRef(({className:t,...n},r)=>e(Th,{ref:r,className:Da(hi({variant:"outline"}),"mt-2 sm:mt-0",t),...n}));function Lh(){return n("div",{className:"space-y-3.5",children:[e(_i,{className:"h-10 w-full"}),e(_i,{className:"h-10 w-full"}),e(_i,{className:"h-10 w-full"})]})}jh.displayName=Th.displayName;const Bh=({workspace:t})=>{const[r,o]=f(!1),{deleteWorkspace:a}=ad(),i=re(e=>e.auth.session?.user||null);if(!t)return e(Lh,{});const s=t?.users.find(e=>("object"==typeof e&&null!==e?e.t:e)===i?.id)?.role;return"admin"===s?.toLowerCase()?n("div",{className:"space-y-4",children:[n("div",{children:[e("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),n("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("strong",{children:t.name})," and all of its data, including members, settings, and features."]})]}),n(Eh,{children:[e(Ph,{asChild:!0,children:n(bi,{variant:"destructive",disabled:r,children:[e(di,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),n(Rh,{children:[n(_h,{children:[e(Ih,{children:"Are you absolutely sure?"}),n(Uh,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e("strong",{children:t.name})," and all of its data."]})]}),n(Dh,{children:[e(jh,{children:"Cancel"}),e(Fh,{onClick:async()=>{o(!0);try{await a(t.t)}catch(e){alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:r?"Deleting...":"Delete Workspace"})]})]})]})]}):e("div",{className:"space-y-4",children:e("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var $h="Switch",[zh,Gh]=pd($h),[Zh,Wh]=zh($h),Kh=r.forwardRef((t,o)=>{const{le:a,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:m,...p}=t,[h,b]=r.useState(null),g=Fa(o,e=>b(e)),v=r.useRef(!1),w=!h||m||!!h.closest("form"),[y,x]=Yd({prop:s,defaultProp:c??!1,onChange:f,caller:$h});return n(Zh,{scope:a,checked:y,disabled:d,children:[e(gi.button,{type:"button",role:"switch","aria-checked":y,"aria-required":l,"data-state":qh(y),"data-disabled":d?"":void 0,disabled:d,value:u,...p,ref:g,onClick:Kd(t.onClick,e=>{x(e=>!e),w&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),w&&e(Jh,{control:h,bubbles:!v.current,name:i,value:u,checked:y,required:l,disabled:d,form:m,style:{transform:"translateX(-100%)"}})]})});Kh.displayName=$h;var Vh="SwitchThumb",Hh=r.forwardRef((t,n)=>{const{le:r,...o}=t,a=Wh(Vh,r);return e(gi.span,{"data-state":qh(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:n})});Hh.displayName=Vh;var Jh=r.forwardRef(({le:t,control:n,checked:o,bubbles:a=!0,...i},s)=>{const c=r.useRef(null),l=Fa(c,s),d=Um(o),u=Im(n);return r.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==o&&n){const t=new Event("click",{bubbles:a});n.call(e,o),e.dispatchEvent(t)}},[d,o,a]),e("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function qh(e){return e?"checked":"unchecked"}Jh.displayName="SwitchBubbleInput";var Yh=Kh,Xh=Hh;const Qh=r.forwardRef(({className:t,...n},r)=>e(Yh,{className:Da("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),...n,ref:r,children:e(Xh,{className:Da("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")})}));Qh.displayName=Yh.displayName;const eb=({workspaceId:t})=>{const[r,o]=f({}),{allFeatures:a,updateFeature:i,getWorkspace:s}=ad(),[c,d]=f(null),u=re(e=>e.auth.session?.user||null);if(l(()=>{s(t).then(d)},[t]),!c)return e(Lh,{});const m=c?.users.find(e=>("string"==typeof e?e:e.t)===u?.id)?.role,p="admin"===m?.toLowerCase();return e("div",{children:n("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&e("div",{className:"text-red-500",children:"Only workspace admin can change the features."}),!a.length&&e("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),a.length>0&&e("div",{className:"flex flex-col gap-y-3.5",children:a.map(t=>{const a=c?.features?.[t.slug];return n("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[n("div",{className:"flex gap-x-2 flex-col",children:[e("h3",{className:"font-medium text-ellipsis",children:t.name}),e("p",{className:"text-muted-foreground",children:t.description})]}),e(Qh,{disabled:r[t.slug]||!p,checked:a??t.defaultValue,onCheckedChange:e=>async function(e,t){if(!c)return;o(n=>({...n,[e]:t}));const n=await i(c.t,e,t);d(n),o(t=>({...t,[e]:!1}))}(t.slug,e)})]},t.t)})})]})})};function tb(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 nb=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],rb=({workspace:t})=>{const[r,o]=f(!1),[a,i]=f("emoji"),[s,c]=f(),{updateWorkspace:l}=ad(),d=re(e=>e.auth.session?.user||null),u=Tt({resolver:To(Ns({name:ts().min(2,{message:"Workspace name must be at least 2 characters."}),image:ts().optional()})),defaultValues:{name:t.name||"",image:t.image||""}});if(!t)return e(Lh,{});const m=t?.users.find(e=>("object"==typeof e&&null!==e?e.t:e)===d?.id)?.role,p="admin"===m?.toLowerCase();return n("div",{children:[!p&&e("div",{className:"text-red-500",children:"Only workspace admin can change the workspace settings."}),e(Ai,{...u,children:n("form",{onSubmit:u.handleSubmit(async function(e){o(!0);try{await l(t,e)}catch(e){}finally{o(!1)}}),className:"space-y-6",children:[e(ki,{control:u.control,name:"name",render:({field:t})=>n(Ni,{children:[e(Ei,{children:"Name"}),e(Pi,{children:e(Ri,{placeholder:"My Awesome Workspace",...t,disabled:!p})}),e(Oi,{})]})}),n("div",{className:"space-y-4",children:[n("div",{children:[e(xi,{className:"text-sm font-medium",children:"Icon"}),e(Mi,{children:"Choose an emoji or upload a custom image for your workspace."})]}),n(cp,{value:a,disabled:!p,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[n("div",{className:"flex items-center space-x-2",children:[e(lp,{value:"emoji",id:"emoji"}),n(xi,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e(ci,{className:"h-4 w-4"}),"Choose Emoji"]})]}),n("div",{className:"flex items-center space-x-2",children:[e(lp,{value:"url",id:"url"}),n(xi,{htmlFor:"url",className:"flex items-center gap-2",children:[e(ni,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===a&&n("div",{className:"space-y-3",children:[n("div",{className:"flex items-center gap-3",children:[e("span",{className:"text-sm font-medium",children:"Preview:"}),n("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&e("span",{className:"text-2xl",children:s}),!s&&e("img",{src:u.watch("image")})]})]}),e(Hp,{className:"h-32 w-full rounded-md border",children:e("div",{className:"p-4 grid grid-cols-8 gap-2",children:nb.map((t,n)=>e("button",{type:"button",onClick:()=>(e=>{c(e),u.setValue("image",tb(e))})(t),disabled:!p,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===t?"bg-primary text-primary-foreground":""),children:t},n))})})]}),"url"===a&&n("div",{className:"space-y-3",children:[e(ki,{control:u.control,name:"image",render:({field:t})=>n(Ni,{children:[e(Ei,{children:"Image URL"}),e(Pi,{children:e(Ri,{placeholder:"https://example.com/image.png",...t,disabled:!p})}),e(Mi,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e(Oi,{})]})}),u.watch("image")&&n("div",{className:"flex items-center gap-3",children:[e("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e("img",{src:u.watch("image"),className:"w-full h-full object-cover"})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:p&&e(bi,{type:"submit",disabled:r,progress:r,children:"Update Workspace"})})]})})]})};var ob=.999,ab=/[\\\/_+.#"@\[\(\{&]/,ib=/[\\\/_+.#"@\[\(\{&]/g,sb=/[\s-]/,cb=/[\s-]/g;function lb(e,t,n,r,o,a,i){if(a===t.length)return o===e.length?1:.99;var s=`${o},${a}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=r.charAt(a),m=n.indexOf(f,o),p=0;m>=0;)(c=lb(e,t,n,r,m+1,a+1,i))>p&&(m===o?c*=1:ab.test(e.charAt(m-1))?(c*=.8,(d=e.slice(o,m-1).match(ib))&&o>0&&(c*=Math.pow(ob,d.length))):sb.test(e.charAt(m-1))?(c*=.9,(u=e.slice(o,m-1).match(cb))&&o>0&&(c*=Math.pow(ob,u.length))):(c*=.17,o>0&&(c*=Math.pow(ob,m-o))),e.charAt(m)!==t.charAt(a)&&(c*=.9999)),(.1>c&&n.charAt(m-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(m-1)!==r.charAt(a))&&.1*(l=lb(e,t,n,r,m+1,a+2,i))>c&&(c=.1*l),c>p&&(p=c),m=n.indexOf(f,m+1);return i[s]=p,p}function db(e){return e.toLowerCase().replace(cb," ")}function ub(e,t,n){return lb(e=n&&n.length>0?e+" "+n.join(" "):e,t,db(e),db(t),0,0,{})}var fb='[cmdk-group=""]',mb='[cmdk-group-items=""]',pb='[cmdk-item=""]',hb=pb+':not([aria-disabled="true"])',bb="cmdk-item-select",gb="data-value",vb=(e,t,n)=>ub(e,t,n),wb=r.createContext(void 0),yb=()=>r.useContext(wb),xb=r.createContext(void 0),Ab=()=>r.useContext(xb),Sb=r.createContext(void 0),kb=r.forwardRef((e,t)=>{let n=jb(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=jb(()=>new Set),a=jb(()=>new Map),i=jb(()=>new Map),s=jb(()=>new Set),c=Ub(e),{label:l,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:h,disablePointerSelection:b=!1,vimBindings:g=!0,...v}=e,w=Jd(),y=Jd(),x=Jd(),A=r.useRef(null),S=$b();Fb(()=>{if(void 0!==u){let e=u.trim();n.current.value=e,k.emit()}},[u]),Fb(()=>{S(6,M)},[]);let k=r.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,a,i,s;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)P(),N(),S(1,E);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(o=document.getElementById(w))||o.focus()}if(S(7,()=>{var e;n.current.selectedItemId=null==(e=O())?void 0:e.id,k.emit()}),r||S(5,M),void 0!==(null==(a=c.current)?void 0:a.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}k.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),T=r.useMemo(()=>({value:(e,t,r)=>{var o;t!==(null==(o=i.current.get(e))?void 0:o.value)&&(i.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,()=>{N(),k.emit()}))},item:(e,t)=>(o.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),S(3,()=>{P(),N(),n.current.value||E(),k.emit()}),()=>{i.current.delete(e),o.current.delete(e),n.current.filtered.items.delete(e);let t=O();S(4,()=>{P(),(null==t?void 0:t.getAttribute("id"))===e&&E(),k.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{i.current.delete(e),a.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:w,inputId:x,labelId:y,listInnerRef:A}),[]);function C(e,t){var r,o;let a=null!=(o=null==(r=c.current)?void 0:r.filter)?o:vb;return e?a(e,n.current.search,t):0}function N(){if(!n.current.search||!1===c.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=a.current.get(n),o=0;r.forEach(t=>{let n=e.get(t);o=Math.max(n,o)}),t.push([n,o])});let r=A.current;R().sort((t,n)=>{var r,o;let a=t.getAttribute("id"),i=n.getAttribute("id");return(null!=(r=e.get(i))?r:0)-(null!=(o=e.get(a))?o:0)}).forEach(e=>{let t=e.closest(mb);t?t.appendChild(e.parentElement===t?e:e.closest(mb+" > *")):r.appendChild(e.parentElement===r?e:e.closest(mb+" > *"))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=A.current)?void 0:t.querySelector(`${fb}[${gb}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function E(){let e=R().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(gb);k.setState("value",t||void 0)}function P(){var e,t,r,s;if(!n.current.search||!1===c.current.shouldFilter)return void(n.current.filtered.count=o.current.size);n.current.filtered.groups=new Set;let l=0;for(let a of o.current){let o=C(null!=(t=null==(e=i.current.get(a))?void 0:e.value)?t:"",null!=(s=null==(r=i.current.get(a))?void 0:r.keywords)?s:[]);n.current.filtered.items.set(a,o),o>0&&l++}for(let[e,t]of a.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=l}function M(){var e,t,n;let r=O();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(fb))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function O(){var e;return null==(e=A.current)?void 0:e.querySelector(pb+'[aria-selected="true"]')}function R(){var e;return Array.from((null==(e=A.current)?void 0:e.querySelectorAll(hb))||[])}function _(e){let t=R()[e];t&&k.setState("value",t.getAttribute(gb))}function D(e){var t;let n=O(),r=R(),o=r.findIndex(e=>e===n),a=r[o+e];null!=(t=c.current)&&t.loop&&(a=0>o+e?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),a&&k.setState("value",a.getAttribute(gb))}function I(e){let t,n=O(),r=null==n?void 0:n.closest(fb);for(;r&&!t;)r=e>0?Db(r,fb):Ib(r,fb),t=null==r?void 0:r.querySelector(hb);t?k.setState("value",t.getAttribute(gb)):D(e)}let U=()=>_(R().length-1),F=e=>{e.preventDefault(),e.metaKey?U():e.altKey?I(1):D(1)},j=e=>{e.preventDefault(),e.metaKey?_(0):e.altKey?I(-1):D(-1)};return r.createElement(gi.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=v.onKeyDown)||t.call(v,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!n)switch(e.key){case"n":case"j":g&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":g&&e.ctrlKey&&j(e);break;case"ArrowUp":j(e);break;case"Home":e.preventDefault(),_(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=O();if(t){let e=new Event(bb);t.dispatchEvent(e)}}}}},r.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Gb},l),zb(e,e=>r.createElement(xb.Provider,{value:k},r.createElement(wb.Provider,{value:T},e))))}),Tb=r.forwardRef((e,t)=>{var n,o;let a=Jd(),i=r.useRef(null),s=r.useContext(Sb),c=yb(),l=Ub(e),d=null!=(o=null==(n=l.current)?void 0:n.forceMount)?o:null==s?void 0:s.forceMount;Fb(()=>{if(!d)return c.item(a,null==s?void 0:s.id)},[d]);let u=Bb(a,i,[e.value,e.children,i],e.keywords),f=Ab(),m=Lb(e=>e.value&&e.value===u.current),p=Lb(e=>!(!d&&!1!==c.filter())||!e.search||e.filtered.items.get(a)>0);function h(){var e,t;b(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function b(){f.setState("value",u.current,!0)}if(r.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(bb,h),()=>t.removeEventListener(bb,h)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:g,value:v,onSelect:w,forceMount:y,keywords:x,...A}=e;return r.createElement(gi.div,{ref:Ua(i,t),...A,id:a,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!m,"data-disabled":!!g,"data-selected":!!m,onPointerMove:g||c.getDisablePointerSelection()?void 0:b,onClick:g?void 0:h},e.children)}),Cb=r.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:a,...i}=e,s=Jd(),c=r.useRef(null),l=r.useRef(null),d=Jd(),u=yb(),f=Lb(e=>!(!a&&!1!==u.filter())||!e.search||e.filtered.groups.has(s));Fb(()=>u.group(s),[]),Bb(s,c,[e.value,e.heading,l]);let m=r.useMemo(()=>({id:s,forceMount:a}),[a]);return r.createElement(gi.div,{ref:Ua(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},n&&r.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),zb(e,e=>r.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},r.createElement(Sb.Provider,{value:m},e))))}),Nb=r.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,a=r.useRef(null),i=Lb(e=>!e.search);return n||i?r.createElement(gi.div,{ref:Ua(a,t),...o,"cmdk-separator":"",role:"separator"}):null}),Eb=r.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,a=null!=e.value,i=Ab(),s=Lb(e=>e.search),c=Lb(e=>e.selectedItemId),l=yb();return r.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),r.createElement(gi.input,{ref:t,...o,"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:a?e.value:s,onChange:e=>{a||i.setState("search",e.target.value),null==n||n(e.target.value)}})}),Pb=r.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...a}=e,i=r.useRef(null),s=r.useRef(null),c=Lb(e=>e.selectedItemId),l=yb();return r.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,n=i.current,r=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;n.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}},[]),r.createElement(gi.div,{ref:Ua(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":o,id:l.listId},zb(e,e=>r.createElement("div",{ref:Ua(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Mb=r.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:a,contentClassName:i,container:s,...c}=e;return r.createElement(Gf,{open:n,onOpenChange:o},r.createElement(Wf,{container:s},r.createElement(Kf,{"cmdk-overlay":"",className:a}),r.createElement(Vf,{"aria-label":e.label,"cmdk-dialog":"",className:i},r.createElement(kb,{ref:t,...c}))))}),Ob=r.forwardRef((e,t)=>Lb(e=>0===e.filtered.count)?r.createElement(gi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Rb=r.forwardRef((e,t)=>{let{progress:n,children:o,label:a="Loading...",...i}=e;return r.createElement(gi.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},zb(e,e=>r.createElement("div",{"aria-hidden":!0},e)))}),_b=Object.assign(kb,{List:Pb,Item:Tb,Input:Eb,Group:Cb,Separator:Nb,Dialog:Mb,Empty:Ob,Loading:Rb});function Db(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ib(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Ub(e){let t=r.useRef(e);return Fb(()=>{t.current=e}),t}var Fb="undefined"==typeof window?r.useEffect:r.useLayoutEffect;function jb(e){let t=r.useRef();return void 0===t.current&&(t.current=e()),t}function Lb(e){let t=Ab(),n=()=>e(t.snapshot());return r.useSyncExternalStore(t.subscribe,n,n)}function Bb(e,t,n,o=[]){let a=r.useRef(),i=yb();return Fb(()=>{var r;let s=(()=>{var e;for(let t of n){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():a.current}})(),c=o.map(e=>e.trim());i.value(e,s,c),null==(r=t.current)||r.setAttribute(gb,s),a.current=s}),a}var $b=()=>{let[e,t]=r.useState(),n=jb(()=>new Map);return Fb(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function zb({asChild:e,children:t},n){return e&&r.isValidElement(t)?r.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},n(t.props.children)):n(t)}var Gb={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Zb=r.forwardRef(({className:t,...n},r)=>e(_b,{ref:r,className:Da("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...n}));Zb.displayName=_b.displayName;const Wb=r.forwardRef(({className:t,...r},o)=>n("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e(am,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e(_b.Input,{ref:o,className:Da("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})]}));Wb.displayName=_b.Input.displayName;const Kb=r.forwardRef(({className:t,...n},r)=>e(_b.List,{ref:r,className:Da("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...n}));Kb.displayName=_b.List.displayName,r.forwardRef((t,n)=>e(_b.Empty,{ref:n,className:"py-6 text-center text-sm",...t})).displayName=_b.Empty.displayName;const Vb=r.forwardRef(({className:t,...n},r)=>e(_b.Group,{ref:r,className:Da("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),...n}));Vb.displayName=_b.Group.displayName,r.forwardRef(({className:t,...n},r)=>e(_b.Separator,{ref:r,className:Da("-mx-1 h-px bg-border",t),...n})).displayName=_b.Separator.displayName;const Hb=r.forwardRef(({className:t,...n},r)=>e(_b.Item,{ref:r,className:Da("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),...n}));Hb.displayName=_b.Item.displayName;const Jb=["top","right","bottom","left"],qb=Math.min,Yb=Math.max,Xb=Math.round,Qb=Math.floor,eg=e=>({x:e,y:e}),tg={left:"right",right:"left",bottom:"top",top:"bottom"},ng={start:"end",end:"start"};function rg(e,t,n){return Yb(e,qb(t,n))}function og(e,t){return"function"==typeof e?e(t):e}function ag(e){return e.split("-")[0]}function ig(e){return e.split("-")[1]}function sg(e){return"x"===e?"y":"x"}function cg(e){return"y"===e?"height":"width"}const lg=new Set(["top","bottom"]);function dg(e){return lg.has(ag(e))?"y":"x"}function ug(e){return sg(dg(e))}function fg(e){return e.replace(/start|end/g,e=>ng[e])}const mg=["left","right"],pg=["right","left"],hg=["top","bottom"],bg=["bottom","top"];function gg(e){return e.replace(/left|right|bottom|top/g,e=>tg[e])}function vg(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 wg(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function yg(e,t,n){let{reference:r,floating:o}=e;const a=dg(t),i=ug(t),s=cg(i),c=ag(t),l="y"===a,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-o.width,y:u};break;default:m={x:r.x,y:r.y}}switch(ig(t)){case"start":m[i]-=f*(n&&l?-1:1);break;case"end":m[i]+=f*(n&&l?-1:1)}return m}async function xg(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:a,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:m=0}=og(t,e),p=vg(m),h=s[f?"floating"===u?"reference":"floating":u],b=wg(await a.getClippingRect({element:null==(n=await(null==a.isElement?void 0:a.isElement(h)))||n?h:h.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),g="floating"===u?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,v=await(null==a.getOffsetParent?void 0:a.getOffsetParent(s.floating)),w=await(null==a.isElement?void 0:a.isElement(v))&&await(null==a.getScale?void 0:a.getScale(v))||{x:1,y:1},y=wg(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:v,strategy:c}):g);return{top:(b.top-y.top+p.top)/w.y,bottom:(y.bottom-b.bottom+p.bottom)/w.y,left:(b.left-y.left+p.left)/w.x,right:(y.right-b.right+p.right)/w.x}}function Ag(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 Jb.some(t=>e[t]>=0)}const kg=new Set(["left","top"]);function Tg(){return"undefined"!=typeof window}function Cg(e){return Pg(e)?(e.nodeName||"").toLowerCase():"#document"}function Ng(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Eg(e){var t;return null==(t=(Pg(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Pg(e){return!!Tg()&&(e instanceof Node||e instanceof Ng(e).Node)}function Mg(e){return!!Tg()&&(e instanceof Element||e instanceof Ng(e).Element)}function Og(e){return!!Tg()&&(e instanceof HTMLElement||e instanceof Ng(e).HTMLElement)}function Rg(e){return!(!Tg()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Ng(e).ShadowRoot)}const _g=new Set(["inline","contents"]);function Dg(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Kg(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!_g.has(o)}const Ig=new Set(["table","td","th"]);function Ug(e){return Ig.has(Cg(e))}const Fg=[":popover-open",":modal"];function jg(e){return Fg.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Lg=["transform","translate","scale","rotate","perspective"],Bg=["transform","translate","scale","rotate","perspective","filter"],$g=["paint","layout","strict","content"];function zg(e){const t=Gg(),n=Mg(e)?Kg(e):e;return Lg.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||Bg.some(e=>(n.willChange||"").includes(e))||$g.some(e=>(n.contain||"").includes(e))}function Gg(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Zg=new Set(["html","body","#document"]);function Wg(e){return Zg.has(Cg(e))}function Kg(e){return Ng(e).getComputedStyle(e)}function Vg(e){return Mg(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Hg(e){if("html"===Cg(e))return e;const t=e.assignedSlot||e.parentNode||Rg(e)&&e.host||Eg(e);return Rg(t)?t.host:t}function Jg(e){const t=Hg(e);return Wg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Og(t)&&Dg(t)?t:Jg(t)}function qg(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Jg(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),i=Ng(o);if(a){const e=Yg(i);return t.concat(i,i.visualViewport||[],Dg(o)?o:[],e&&n?qg(e):[])}return t.concat(o,qg(o,[],n))}function Yg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xg(e){const t=Kg(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Og(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,s=Xb(n)!==a||Xb(r)!==i;return s&&(n=a,r=i),{width:n,height:r,$:s}}function Qg(e){return Mg(e)?e:e.contextElement}function ev(e){const t=Qg(e);if(!Og(t))return eg(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=Xg(t);let i=(a?Xb(n.width):n.width)/r,s=(a?Xb(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const tv=eg(0);function nv(e){const t=Ng(e);return Gg()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:tv}function rv(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),a=Qg(e);let i=eg(1);t&&(r?Mg(r)&&(i=ev(r)):i=ev(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ng(e))&&t}(a,n,r)?nv(a):eg(0);let c=(o.left+s.x)/i.x,l=(o.top+s.y)/i.y,d=o.width/i.x,u=o.height/i.y;if(a){const e=Ng(a),t=r&&Mg(r)?Ng(r):r;let n=e,o=Yg(n);for(;o&&r&&t!==n;){const e=ev(o),t=o.getBoundingClientRect(),r=Kg(o),a=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=a,l+=i,n=Ng(o),o=Yg(n)}}return wg({width:d,height:u,x:c,y:l})}function ov(e,t){const n=Vg(e).scrollLeft;return t?t.left+n:rv(Eg(e)).left+n}function av(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ov(e,n),y:n.top+t.scrollTop}}const iv=new Set(["absolute","fixed"]);function sv(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Ng(e),r=Eg(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,s=0,c=0;if(o){a=o.width,i=o.height;const e=Gg();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,c=o.offsetTop)}const l=ov(r);if(l>0)l>25||(a+=l);else{const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(r.clientWidth-t.clientWidth-o);i>25||(a-=i)}return{width:a,height:i,x:s,y:c}}(e,n);else if("document"===t)r=function(e){const t=Eg(e),n=Vg(e),r=e.ownerDocument.body,o=Yb(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Yb(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ov(e);const s=-n.scrollTop;return"rtl"===Kg(r).direction&&(i+=Yb(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:s}}(Eg(e));else if(Mg(t))r=function(e,t){const n=rv(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=Og(e)?ev(e):eg(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(t,n);else{const n=nv(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wg(r)}function cv(e,t){const n=Hg(e);return!(n===t||!Mg(n)||Wg(n))&&("fixed"===Kg(n).position||cv(n,t))}function lv(e,t,n){const r=Og(t),o=Eg(t),a="fixed"===n,i=rv(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const c=eg(0);function l(){c.x=ov(o)}if(r||!r&&!a)if(("body"!==Cg(t)||Dg(o))&&(s=Vg(t)),r){const e=rv(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&l();a&&!r&&o&&l();const d=!o||r||a?eg(0):av(o,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function dv(e){return"static"===Kg(e).position}function uv(e,t){if(!Og(e)||"fixed"===Kg(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Eg(e)===n&&(n=n.ownerDocument.body),n}function fv(e,t){const n=Ng(e);if(jg(e))return n;if(!Og(e)){let t=Hg(e);for(;t&&!Wg(t);){if(Mg(t)&&!dv(t))return t;t=Hg(t)}return n}let r=uv(e,t);for(;r&&Ug(r)&&dv(r);)r=uv(r,t);return r&&Wg(r)&&dv(r)&&!zg(r)?n:r||function(e){let t=Hg(e);for(;Og(t)&&!Wg(t);){if(zg(t))return t;if(jg(t))return null;t=Hg(t)}return null}(e)||n}const mv={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a="fixed"===o,i=Eg(r),s=!!t&&jg(t.floating);if(r===i||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=eg(1);const d=eg(0),u=Og(r);if((u||!u&&!a)&&(("body"!==Cg(r)||Dg(i))&&(c=Vg(r)),Og(r))){const e=rv(r);l=ev(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}const f=!i||u||a?eg(0):av(i,c);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:n.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Eg,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a="clippingAncestors"===n?jg(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=qg(e,[],!1).filter(e=>Mg(e)&&"body"!==Cg(e)),o=null;const a="fixed"===Kg(e).position;let i=a?Hg(e):e;for(;Mg(i)&&!Wg(i);){const t=Kg(i),n=zg(i);n||"fixed"!==t.position||(o=null),(a?!n&&!o:!n&&"static"===t.position&&o&&iv.has(o.position)||Dg(i)&&!n&&cv(e,i))?r=r.filter(e=>e!==i):o=t,i=Hg(i)}return t.set(e,r),r}(t,this.ue):[].concat(n),i=[...a,r],s=i[0],c=i.reduce((e,n)=>{const r=sv(t,n,o);return e.top=Yb(r.top,e.top),e.right=qb(r.right,e.right),e.bottom=qb(r.bottom,e.bottom),e.left=Yb(r.left,e.left),e},sv(t,s,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:fv,getElementRects:async function(e){const t=this.getOffsetParent||fv,n=this.getDimensions,r=await n(e.floating);return{reference:lv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Xg(e);return{width:t,height:n}},getScale:ev,isElement:Mg,isRTL:function(e){return"rtl"===Kg(e).direction}};function pv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const hv=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:n,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),i=ag(n),s=ig(n),c="y"===dg(n),l=kg.has(i)?-1:1,d=a&&c?-1:1,u=og(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),c?{x:m*d,y:f*l}:{x:f*l,y:m*d}}(t,e);return i===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+c.x,y:a+c.y,data:{...c,placement:i}}}}},bv=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=og(e,t),l={x:n,y:r},d=await xg(t,c),u=dg(ag(o)),f=sg(u);let m=l[f],p=l[u];if(a){const e="y"===f?"bottom":"right";m=rg(m+d["y"===f?"top":"left"],m,m-d[e])}if(i){const e="y"===u?"bottom":"right";p=rg(p+d["y"===u?"top":"left"],p,p-d[e])}const h=s.fn({...t,[f]:m,[u]:p});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[u]:i}}}}}},gv=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...b}=og(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};const g=ag(o),v=dg(s),w=ag(s)===s,y=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(w||!h?[gg(s)]:function(e){const t=gg(e);return[fg(e),t,fg(t)]}(s)),A="none"!==p;!f&&A&&x.push(...function(e,t,n,r){const o=ig(e);let a=function(e,t,n){switch(e){case"top":case"bottom":return n?t?pg:mg:t?mg:pg;case"left":case"right":return t?hg:bg;default:return[]}}(ag(e),"start"===n,r);return o&&(a=a.map(e=>e+"-"+o),t&&(a=a.concat(a.map(fg)))),a}(s,h,p,y));const S=[s,...x],k=await xg(t,b),T=[];let C=(null==(r=a.flip)?void 0:r.overflows)||[];if(d&&T.push(k[g]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=ig(e),o=ug(e),a=cg(o);let i="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=gg(i)),[i,gg(i)]}(o,i,y);T.push(k[e[0]],k[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every(e=>0>=e)){var N,E;const e=((null==(N=a.flip)?void 0:N.index)||0)+1,t=S[e];if(t&&("alignment"!==u||v===dg(t)||C.every(e=>dg(e.placement)!==v||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(E=C.filter(e=>0>=e.overflows[0]).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:E.placement;if(!n)switch(m){case"bestFit":{var P;const e=null==(P=C.filter(e=>{if(A){const t=dg(e.placement);return t===v||"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:P[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},vv=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:i,elements:s}=t,{apply:c=()=>{},...l}=og(e,t),d=await xg(t,l),u=ag(o),f=ig(o),m="y"===dg(o),{width:p,height:h}=a.floating;let b,g;"top"===u||"bottom"===u?(b=u,g=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,b="end"===f?"top":"bottom");const v=h-d.top-d.bottom,w=p-d.left-d.right,y=qb(h-d[b],v),x=qb(p-d[g],w),A=!t.middlewareData.shift;let S=y,k=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(k=w),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(S=v),A&&!f){const e=Yb(d.left,0),t=Yb(d.right,0),n=Yb(d.top,0),r=Yb(d.bottom,0);m?k=p-2*(0!==e||0!==t?e+t:Yb(d.left,d.right)):S=h-2*(0!==n||0!==r?n+r:Yb(d.top,d.bottom))}await c({...t,availableWidth:k,availableHeight:S});const T=await i.getDimensions(s.floating);return p!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}},wv=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=og(e,t);switch(r){case"referenceHidden":{const e=Ag(await xg(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Sg(e)}}}case"escaped":{const e=Ag(await xg(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Sg(e)}}}default:return{}}}}},yv=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=og(e,t)||{};if(null==l)return{};const u=vg(d),f={x:n,y:r},m=ug(o),p=cg(m),h=await i.getDimensions(l),b="y"===m,g=b?"top":"left",v=b?"bottom":"right",w=b?"clientHeight":"clientWidth",y=a.reference[p]+a.reference[m]-f[m]-a.floating[p],x=f[m]-a.reference[m],A=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let S=A?A[w]:0;S&&await(null==i.isElement?void 0:i.isElement(A))||(S=s.floating[w]||a.floating[p]);const k=y/2-x/2,T=S/2-h[p]/2-1,C=qb(u[g],T),N=qb(u[v],T),E=C,P=S-h[p]-N,M=S/2-h[p]/2+k,O=rg(E,M,P),R=!c.arrow&&null!=ig(o)&&M!==O&&0>a.reference[p]/2-(E>M?C:N)-h[p]/2,_=R?E>M?M-E:M-P:0;return{[m]:f[m]+_,data:{[m]:O,centerOffset:M-O-_,...R&&{alignmentOffset:_}},reset:R}}}),xv=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=og(e,t),d={x:n,y:r},u=dg(o),f=sg(u);let m=d[f],p=d[u];const h=og(s,t),b="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+b.mainAxis,n=a.reference[f]+a.reference[e]-b.mainAxis;t>m?m=t:m>n&&(m=n)}if(l){var g,v;const e="y"===f?"width":"height",t=kg.has(ag(o)),n=a.reference[u]-a.floating[e]+(t&&(null==(g=i.offset)?void 0:g[u])||0)+(t?0:b.crossAxis),r=a.reference[u]+a.reference[e]+(t?0:(null==(v=i.offset)?void 0:v[u])||0)-(t?b.crossAxis:0);n>p?p=n:p>r&&(p=r)}return{[f]:m,[u]:p}}}},Av=(e,t,n)=>{const r=new Map,o={platform:mv,...n},a={...o.platform,ue:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=yg(l,r,c),f=r,m={},p=0;for(let n=0;n<s.length;n++){const{name:a,fn:h}=s[n],{x:b,y:g,data:v,reset:w}=await h({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:m,rects:l,platform:i,elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=g?g:u,m={...m,[a]:{...m[a],...v}},w&&50>=p&&(p++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(l=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:d,y:u}=yg(l,f,c))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:m}})(e,t,{...o,platform:a})};var Sv="undefined"!=typeof document?p:function(){};function kv(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 n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!kv(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||kv(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function Tv(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cv(e,t){const n=Tv(e);return Math.round(t*n)/n}function Nv(e){const t=r.useRef(e);return Sv(()=>{t.current=e}),t}const Ev=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?yv({element:n.current,padding:r}).fn(t):{}:n?yv({element:n,padding:r}).fn(t):{};var o}}),Pv=(e,t)=>({...hv(e),options:[e,t]}),Mv=(e,t)=>({...bv(e),options:[e,t]}),Ov=(e,t)=>({...xv(e),options:[e,t]}),Rv=(e,t)=>({...gv(e),options:[e,t]}),_v=(e,t)=>({...vv(e),options:[e,t]}),Dv=(e,t)=>({...wv(e),options:[e,t]}),Iv=(e,t)=>({...Ev(e),options:[e,t]});var Uv=r.forwardRef((t,n)=>{const{children:r,width:o=10,height:a=5,...i}=t;return e(gi.svg,{...i,ref:n,width:o,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:e("polygon",{points:"0,0 30,0 15,10"})})});Uv.displayName="Arrow";var Fv=Uv,jv="Popper",[Lv,Bv]=pd(jv),[$v,zv]=Lv(jv),Gv=t=>{const{fe:n,children:o}=t,[a,i]=r.useState(null);return e($v,{scope:n,anchor:a,onAnchorChange:i,children:o})};Gv.displayName=jv;var Zv="PopperAnchor",Wv=r.forwardRef((t,n)=>{const{fe:o,virtualRef:a,...i}=t,s=zv(Zv,o),c=r.useRef(null),l=Fa(n,c),d=r.useRef(null);return r.useEffect(()=>{const e=d.current;d.current=a?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),a?null:e(gi.div,{...i,ref:l})});Wv.displayName=Zv;var Kv="PopperContent",[Vv,Hv]=Lv(Kv),Jv=r.forwardRef((t,n)=>{const{fe:o,side:a="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:p=!1,updatePositionStrategy:b="optimized",onPlaced:g,...v}=t,w=zv(Kv,o),[y,x]=r.useState(null),A=Fa(n,e=>x(e)),[S,k]=r.useState(null),T=Im(S),C=T?.width??0,N=T?.height??0,E=a+("center"!==s?"-"+s:""),P="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},M=Array.isArray(u)?u:[u],O=M.length>0,R={padding:P,boundary:M.filter(Qv),altBoundary:O},{refs:_,floatingStyles:D,placement:I,isPositioned:U,middlewareData:F}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:a,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=r.useState(o);kv(m,o)||p(o);const[b,g]=r.useState(null),[v,w]=r.useState(null),y=r.useCallback(e=>{e!==k.current&&(k.current=e,g(e))},[]),x=r.useCallback(e=>{e!==T.current&&(T.current=e,w(e))},[]),A=i||b,S=s||v,k=r.useRef(null),T=r.useRef(null),C=r.useRef(u),N=null!=l,E=Nv(l),P=Nv(a),M=Nv(d),O=r.useCallback(()=>{if(!k.current||!T.current)return;const e={placement:t,strategy:n,middleware:m};P.current&&(e.platform=P.current),Av(k.current,T.current,e).then(e=>{const t={...e,isPositioned:!1!==M.current};R.current&&!kv(C.current,t)&&(C.current=t,h.flushSync(()=>{f(t)}))})},[m,t,n,P,M]);Sv(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const R=r.useRef(!1);Sv(()=>(R.current=!0,()=>{R.current=!1}),[]),Sv(()=>{if(A&&(k.current=A),S&&(T.current=S),A&&S){if(E.current)return E.current(A,S,O);O()}},[A,S,O,E,N]);const _=r.useMemo(()=>({reference:k,floating:T,setReference:y,setFloating:x}),[y,x]),D=r.useMemo(()=>({reference:A,floating:S}),[A,S]),I=r.useMemo(()=>{const e={position:n,left:0,top:0};if(!D.floating)return e;const t=Cv(D.floating,u.x),r=Cv(D.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...Tv(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,D.floating,u.x,u.y]);return r.useMemo(()=>({...u,update:O,refs:_,elements:D,floatingStyles:I}),[u,O,_,D,I])}({strategy:"fixed",placement:E,whileElementsMounted:(...e)=>function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,l=Qg(e),d=o||a?[...l?qg(l):[],...qg(t)]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)});const u=l&&s?function(e,t){let n,r=null;const o=Eg(e);function a(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),a();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:m}=l;if(s||t(),!f||!m)return;const p={rootMargin:-Qb(u)+"px "+-Qb(o.clientWidth-(d+f))+"px "+-Qb(o.clientHeight-(u+m))+"px "+-Qb(d)+"px",threshold:Yb(0,qb(1,c))||1};let h=!0;function b(t){const r=t[0].intersectionRatio;if(r!==c){if(!h)return i();r?i(!1,r):n=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==r||pv(l,e.getBoundingClientRect())||i(),h=!1}try{r=new IntersectionObserver(b,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(b,p)}r.observe(e)}(!0),a}(l,n):null;let f,m=-1,p=null;i&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let h=c?rv(e):null;return c&&function t(){const r=rv(e);h&&!pv(h,r)&&n(),h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=p)||e.disconnect(),p=null,c&&cancelAnimationFrame(f)}}(...e,{animationFrame:"always"===b}),elements:{reference:w.anchor},middleware:[Pv({mainAxis:i+N,alignmentAxis:c}),d&&Mv({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Ov():void 0,...R}),d&&Rv({...R}),_v({...R,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:a}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",n+"px"),i.setProperty("--radix-popper-available-height",r+"px"),i.setProperty("--radix-popper-anchor-width",o+"px"),i.setProperty("--radix-popper-anchor-height",a+"px")}}),S&&Iv({element:S,padding:l}),ew({arrowWidth:C,arrowHeight:N}),p&&Dv({strategy:"referenceHidden",...R})]}),[j,L]=tw(I),B=bd(g);vd(()=>{U&&B?.()},[U,B]);const $=F.arrow?.x,z=F.arrow?.y,G=0!==F.arrow?.centerOffset,[Z,W]=r.useState();return vd(()=>{y&&W(window.getComputedStyle(y).zIndex)},[y]),e("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:U?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e(Vv,{scope:o,placedSide:j,onArrowChange:k,arrowX:$,arrowY:z,shouldHideArrow:G,children:e(gi.div,{"data-side":j,"data-align":L,...v,ref:A,style:{...v.style,animation:U?void 0:"none"}})})})});Jv.displayName=Kv;var qv="PopperArrow",Yv={top:"bottom",right:"left",bottom:"top",left:"right"},Xv=r.forwardRef(function(t,n){const{fe:r,...o}=t,a=Hv(qv,r),i=Yv[a.placedSide];return e("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:e(Fv,{...o,ref:n,style:{...o.style,display:"block"}})})});function Qv(e){return null!==e}Xv.displayName=qv;var ew=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,a=0!==o.arrow?.centerOffset,i=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=tw(n),d={start:"0%",center:"50%",end:"100%"}[l],u=(o.arrow?.x??0)+i/2,f=(o.arrow?.y??0)+s/2;let m="",p="";return"bottom"===c?(m=a?d:u+"px",p=-s+"px"):"top"===c?(m=a?d:u+"px",p=r.floating.height+s+"px"):"right"===c?(m=-s+"px",p=a?d:f+"px"):"left"===c&&(m=r.floating.width+s+"px",p=a?d:f+"px"),{data:{x:m,y:p}}}});function tw(e){const[t,n="center"]=e.split("-");return[t,n]}var nw=Gv,rw=Wv,ow=Jv,aw=Xv,iw="Popover",[sw,cw]=pd(iw,[Bv]),lw=Bv(),[dw,uw]=sw(iw),fw=t=>{const{he:n,children:o,open:a,defaultOpen:i,onOpenChange:s,modal:c=!1}=t,l=lw(n),d=r.useRef(null),[u,f]=r.useState(!1),[m,p]=Yd({prop:a,defaultProp:i??!1,onChange:s,caller:iw});return e(nw,{...l,children:e(dw,{scope:n,contentId:Jd(),triggerRef:d,open:m,onOpenChange:p,onOpenToggle:r.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:u,onCustomAnchorAdd:r.useCallback(()=>f(!0),[]),onCustomAnchorRemove:r.useCallback(()=>f(!1),[]),modal:c,children:o})})};fw.displayName=iw;var mw="PopoverAnchor";r.forwardRef((t,n)=>{const{he:o,...a}=t,i=uw(mw,o),s=lw(o),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return r.useEffect(()=>(c(),()=>l()),[c,l]),e(rw,{...s,...a,ref:n})}).displayName=mw;var pw="PopoverTrigger",hw=r.forwardRef((t,n)=>{const{he:r,...o}=t,a=uw(pw,r),i=lw(r),s=Fa(n,a.triggerRef),c=e(gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Nw(a.open),...o,ref:s,onClick:Kd(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:e(rw,{asChild:!0,...i,children:c})});hw.displayName=pw;var bw="PopoverPortal",[gw,vw]=sw(bw,{forceMount:void 0}),ww=t=>{const{he:n,forceMount:r,children:o,container:a}=t,i=uw(bw,n);return e(gw,{scope:n,forceMount:r,children:e(hu,{present:r||i.open,children:e(pu,{asChild:!0,container:a,children:o})})})};ww.displayName=bw;var yw="PopoverContent",xw=r.forwardRef((t,n)=>{const r=vw(yw,t.he),{forceMount:o=r.forceMount,...a}=t,i=uw(yw,t.he);return e(hu,{present:o||i.open,children:i.modal?e(Sw,{...a,ref:n}):e(kw,{...a,ref:n})})});xw.displayName=yw;var Aw=ja("PopoverContent.RemoveScroll"),Sw=r.forwardRef((t,n)=>{const o=uw(yw,t.he),a=r.useRef(null),i=Fa(n,a),s=r.useRef(!1);return r.useEffect(()=>{const e=a.current;if(e)return lf(e)},[]),e(nf,{as:Aw,allowPinchZoom:!0,children:e(Tw,{...t,ref:i,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kd(t.onCloseAutoFocus,e=>{e.preventDefault(),s.current||o.triggerRef.current?.focus()}),onPointerDownOutside:Kd(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;s.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Kd(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),kw=r.forwardRef((t,n)=>{const o=uw(yw,t.he),a=r.useRef(!1),i=r.useRef(!1);return e(Tw,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(a.current||o.triggerRef.current?.focus(),e.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(a.current=!0,"pointerdown"===e.detail.originalEvent.type&&(i.current=!0));const n=e.target,r=o.triggerRef.current?.contains(n);r&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&i.current&&e.preventDefault()}})}),Tw=r.forwardRef((t,n)=>{const{he:r,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=t,m=uw(yw,r),p=lw(r);return vu(),e(su,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:i,children:e(tu,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:e(ow,{"data-state":Nw(m.open),role:"dialog",id:m.contentId,...p,...f,ref:n,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)"}})})})}),Cw="PopoverClose";function Nw(e){return e?"open":"closed"}r.forwardRef((t,n)=>{const{he:r,...o}=t,a=uw(Cw,r);return e(gi.button,{type:"button",...o,ref:n,onClick:Kd(t.onClick,()=>a.onOpenChange(!1))})}).displayName=Cw,r.forwardRef((t,n)=>{const{he:r,...o}=t,a=lw(r);return e(aw,{...a,...o,ref:n})}).displayName="PopoverArrow";var Ew=ww,Pw=xw;const Mw=fw,Ow=hw,Rw=r.forwardRef(({className:t,align:n="center",sideOffset:o=4,...a},i)=>{const{container:s}=r.useContext(ce);return e(Ew,{container:s,children:e(Pw,{ref:i,align:n,sideOffset:o,className:Da("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),...a})})});Rw.displayName=Pw.displayName;const _w={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"},Dw={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"},Iw=[{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=Dw[e.code]||"USD",n=_w[t]||"";return{value:e.code,flag:(r=e.code,r.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:n};var r});function Uw(t){const[r,o]=f(t.value||""),[a,i]=f(!1),s=Iw.find(e=>e.value==r);return n(Mw,{open:a,onOpenChange:i,children:[e(Ow,{asChild:!0,children:n(bi,{variant:"outline",role:"combobox","aria-expanded":a,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&n("div",{children:[(s.text+"").trim(),e("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&e("span",{className:"text-muted-foreground",children:"Choose country"}),e(ti,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e(Rw,{className:"p-0 overflow-hidden text-ellipsis",children:n(Zb,{children:[e(Wb,{placeholder:"Choose country..."}),e(Kb,{children:e(Vb,{children:Iw.map(a=>n(Hb,{className:Da("whitespace-nowrap text-left",{"text-green-500":r===a.value}),value:a.value,defaultValue:a.value,onSelect:e=>{const n=a.value;o(n),t.onChange&&"function"==typeof t.onChange&&t.onChange(n),i(!1)},children:[r===a.value&&e(ei,{className:Da("mr-2 h-4 w-4 text-green-400",r===a.value?"opacity-100":"opacity-0")}),(a.text+"").trim(),e("span",{className:"ml-2 text-xs text-muted-foreground",children:a.flag})]},a.value))})})]})})]})}const Fw=Iw.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),jw=Array.from(new Set(Fw.map(e=>e.value))).map(e=>Fw.find(t=>t.value===e)).filter(e=>void 0!==e);function Lw(t){const[r,o]=f(t.value||""),[a,i]=f(!1),s=jw.find(e=>e.value==r);return n(Mw,{open:a,onOpenChange:i,children:[e(Ow,{asChild:!0,children:n(bi,{variant:"outline",role:"combobox","aria-expanded":a,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&n("div",{children:[(s.text+"").trim(),e("span",{className:"ml-2 text-xs text-muted-foreground",children:s.icon})]}),!s&&e("span",{className:"text-muted-foreground",children:"Choose Currency"}),e(ti,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e(Rw,{className:"p-0 overflow-hidden text-ellipsis",children:n(Zb,{children:[e(Wb,{placeholder:"Choose currency..."}),e(Kb,{children:e(Vb,{children:jw.map(a=>n(Hb,{className:Da("whitespace-nowrap text-left",{"text-green-500":r===a.value}),value:a.value,defaultValue:a.value,onSelect:e=>{const n=a.value;o(n),t.onChange&&"function"==typeof t.onChange&&t.onChange(n),i(!1)},children:[r===a.value&&e(ei,{className:Da("mr-2 h-4 w-4 text-green-400",r===a.value?"opacity-100":"opacity-0")}),(a.text+"").trim(),e("span",{className:"ml-2 text-xs text-muted-foreground",children:a.icon})]},a.value))})})]})})]})}let Bw=[{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:"🇮🇱"}];Bw=Bw.filter((e,t,n)=>t===n.findIndex(t=>t.code===e.code&&t.label===e.label)),Bw.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const $w=Bw.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,n)=>t===n.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function zw(t){const[r,o]=f(t.value||""),[a,i]=f(!1),s=$w.find(e=>e.value==r);return n(Mw,{open:a,onOpenChange:i,children:[e(Ow,{asChild:!0,children:n(bi,{variant:"outline",role:"combobox","aria-expanded":a,className:"justify-between overflow-hidden text-ellipsis",children:[s&&n("div",{children:[(s.label+"").trim(),e("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&"Choose language",e(ti,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e(Rw,{className:"p-0 overflow-hidden text-ellipsis",children:n(Zb,{children:[e(Wb,{placeholder:"Choose timezone..."}),e(Kb,{children:e(Vb,{children:$w.map(a=>n(Hb,{className:Da("whitespace-nowrap text-left",{"text-green-500":r===a.value}),value:a.value,defaultValue:a.value,onSelect:e=>{const n=a.value;o(n),t.onChange&&"function"==typeof t.onChange&&t.onChange(n),i(!1)},children:[r===a.value&&e(ei,{className:Da("mr-2 h-4 w-4 text-green-400",r===a.value?"opacity-100":"opacity-0")}),(a.label+"").trim(),e("span",{className:"ml-2 text-xs text-muted-foreground",children:a.flag})]},a.value))})})]})})]})}const Gw=[{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 n=t.utc;for(let r=0;r<n.length;r++){const o=n[r],a=t.text;let i=a.substring(a.indexOf("(")+1,a.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:o,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${o}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,n)=>t===n.findIndex(t=>t.value===e.value));function Zw(t){const[r,o]=f(t.value||""),[a,i]=f(!1),s=Gw.find(e=>e.value==r);return n(Mw,{open:a,onOpenChange:i,children:[e(Ow,{asChild:!0,children:n(bi,{variant:"outline",role:"combobox","aria-expanded":a,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text||"Choose timezone",e(ti,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e(Rw,{className:"p-0 overflow-hidden text-ellipsis",children:n(Zb,{children:[e(Wb,{placeholder:"Choose timezone..."}),e(Kb,{children:e(Vb,{children:Gw.map(a=>n(Hb,{className:Da("whitespace-nowrap text-left",{"text-green-500":r===a.value}),value:a.value,defaultValue:a.value,onSelect:e=>{const n=a.value;o(n),t.onChange&&"function"==typeof t.onChange&&t.onChange(n),i(!1)},children:[r===a.value&&e(ei,{className:Da("mr-2 h-4 w-4 text-green-400",r===a.value?"opacity-100":"opacity-0")}),(a.text+"").trim()]},a.value))})})]})})]})}const Ww=({workspace:t})=>{const{updateUserProfile:r,getProfile:o}=ad(),[a,i]=f(!1),[s,c]=f(),[d,u]=f(0),m=Tt({resolver:To(Ns({name:ts().min(2,{message:"Name must be at least 2 characters."}),country:ts().optional(),timezone:ts().optional(),language:ts().optional(),currency:ts().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return l(()=>{o().then(e=>{c(e),m.setValue("name",e.name),m.setValue("country",e.country),m.setValue("timezone",e.timezone),m.setValue("language",e.language),m.setValue("currency",e.currency)})},[d]),s?n("div",{children:[e("div",{className:"space-y-4",children:e(Ai,{...m,children:n("form",{onSubmit:m.handleSubmit(async function(e){i(!0),await r({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),i(!1)}),className:"space-y-4",children:[n("div",{children:[e("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e(Ri,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),e(ki,{disabled:a,control:m.control,name:"name",render:({field:t})=>n(Ni,{children:[e(Ei,{children:"Name"}),e(Pi,{children:e(Ri,{...t})}),e(Oi,{})]})}),n("div",{className:"flex gap-y-2 my-4 flex-col",children:[n("div",{className:"flex flex-col gap-0.5",children:[e("div",{className:"text-sm font-medium",children:"Language"}),e(zw,{value:m.getValues("language"),onChange:e=>{m.setValue("language",e)}})]}),n("div",{className:"flex flex-col gap-0.5",children:[e("div",{className:"text-sm font-medium",children:"Country"}),e(Uw,{value:m.getValues("country"),onChange:e=>{m.setValue("country",e)}})]}),n("div",{className:"flex flex-col gap-0.5",children:[e("div",{className:"text-sm font-medium",children:"Currency"}),e(Lw,{value:m.getValues("currency"),onChange:e=>{m.setValue("currency",e)}})]}),n("div",{className:"flex flex-col gap-0.5",children:[e("div",{className:"text-sm font-medium",children:"Timezone"}),e(Zw,{value:m.getValues("timezone"),onChange:e=>{m.setValue("timezone",e)}})]})]}),n("div",{className:"flex justify-end gap-x-2",children:[e(bi,{type:"submit",progress:a,disabled:a,children:"Save"}),e(bi,{type:"button",variant:"outline",onClick:()=>{u(e=>e+1)},disabled:a,children:"Reset"})]})]})})}),s?.image&&n("div",{children:[e("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):e(Lh,{})};var Kw=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"});r.forwardRef((t,n)=>e(gi.span,{...t,ref:n,style:{...Kw,...t.style}})).displayName="VisuallyHidden";var Vw=[" ","Enter","ArrowUp","ArrowDown"],Hw=[" ","Enter"],Jw="Select",[qw,Yw,Xw]=pm(Jw),[Qw,ey]=pd(Jw,[Xw,Bv]),ty=Bv(),[ny,ry]=Qw(Jw),[oy,ay]=Qw(Jw),iy=t=>{const{be:o,children:a,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:m,autoComplete:p,disabled:h,required:b,form:g}=t,v=ty(o),[w,y]=r.useState(null),[x,A]=r.useState(null),[S,k]=r.useState(!1),T=bm(f),[C,N]=Yd({prop:i,defaultProp:s??!1,onChange:c,caller:Jw}),[E,P]=Yd({prop:l,defaultProp:d,onChange:u,caller:Jw}),M=r.useRef(null),O=!w||g||!!w.closest("form"),[R,_]=r.useState(new Set),D=Array.from(R).map(e=>e.props.value).join(";");return e(nw,{...v,children:n(ny,{required:b,scope:o,trigger:w,onTriggerChange:y,valueNode:x,onValueNodeChange:A,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Jd(),value:E,onValueChange:P,open:C,onOpenChange:N,dir:T,triggerPointerDownPosRef:M,disabled:h,children:[e(qw.Provider,{scope:o,children:e(oy,{scope:t.be,onNativeOptionAdd:r.useCallback(e=>{_(t=>new Set(t).add(e))},[]),onNativeOptionRemove:r.useCallback(e=>{_(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:a})}),O?n(Zy,{"aria-hidden":!0,required:b,tabIndex:-1,name:m,autoComplete:p,value:E,onChange:e=>P(e.target.value),disabled:h,form:g,children:[void 0===E?e("option",{value:""}):null,Array.from(R)]},D):null]})})};iy.displayName=Jw;var sy="SelectTrigger",cy=r.forwardRef((t,n)=>{const{be:o,disabled:a=!1,...i}=t,s=ty(o),c=ry(sy,o),l=c.disabled||a,d=Fa(n,c.onTriggerChange),u=Yw(o),f=r.useRef("touch"),[m,p,h]=Ky(e=>{const t=u().filter(e=>!e.disabled),n=t.find(e=>e.value===c.value),r=Vy(t,e,n);void 0!==r&&c.onValueChange(r.value)}),b=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return e(rw,{asChild:!0,...s,children:e(gi.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":Wy(c.value)?"":void 0,...i,ref:d,onClick:Kd(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&b(e)}),onPointerDown:Kd(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(b(e),e.preventDefault())}),onKeyDown:Kd(i.onKeyDown,e=>{const t=""!==m.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),t&&" "===e.key||Vw.includes(e.key)&&(b(),e.preventDefault())})})})});cy.displayName=sy;var ly="SelectValue",dy=r.forwardRef((n,r)=>{const{be:o,className:a,style:i,children:s,placeholder:c="",...l}=n,d=ry(ly,o),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,m=Fa(r,d.onValueNodeChange);return vd(()=>{u(f)},[u,f]),e(gi.span,{...l,ref:m,style:{pointerEvents:"none"},children:Wy(d.value)?e(t,{children:c}):s})});dy.displayName=ly;var uy=r.forwardRef((t,n)=>{const{be:r,children:o,...a}=t;return e(gi.span,{"aria-hidden":!0,...a,ref:n,children:o||"▼"})});uy.displayName="SelectIcon";var fy=t=>e(pu,{asChild:!0,...t});fy.displayName="SelectPortal";var my="SelectContent",py=r.forwardRef((t,n)=>{const o=ry(my,t.be),[a,i]=r.useState();if(vd(()=>{i(new DocumentFragment)},[]),!o.open){const n=a;return n?h.createPortal(e(by,{scope:t.be,children:e(qw.Slot,{scope:t.be,children:e("div",{children:t.children})})}),n):null}return e(wy,{...t,ref:n})});py.displayName=my;var hy=10,[by,gy]=Qw(my),vy=ja("SelectContent.RemoveScroll"),wy=r.forwardRef((t,n)=>{const{be:o,position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:h,sticky:b,hideWhenDetached:g,avoidCollisions:v,...w}=t,y=ry(my,o),[x,A]=r.useState(null),[S,k]=r.useState(null),T=Fa(n,e=>A(e)),[C,N]=r.useState(null),[E,P]=r.useState(null),M=Yw(o),[O,R]=r.useState(!1),_=r.useRef(!1);r.useEffect(()=>{if(x)return lf(x)},[x]),vu();const D=r.useCallback(e=>{const[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const n of e){if(n===o)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==o)return}},[M,S]),I=r.useCallback(()=>D([C,x]),[D,C,x]);r.useEffect(()=>{O&&I()},[O,I]);const{onOpenChange:U,triggerPointerDownPosRef:F}=y;r.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x>10||e.y>10?x.contains(n.target)||U(!1):n.preventDefault(),document.removeEventListener("pointermove",t),F.current=null};return null!==F.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[x,U,F]),r.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[j,L]=Ky(e=>{const t=M().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=Vy(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),B=r.useCallback((e,t,n)=>{const r=!_.current&&!n;(void 0!==y.value&&y.value===t||r)&&(N(e),r&&(_.current=!0))},[y.value]),$=r.useCallback(()=>x?.focus(),[x]),z=r.useCallback((e,t,n)=>{const r=!_.current&&!n;(void 0!==y.value&&y.value===t||r)&&P(e)},[y.value]),G="popper"===a?xy:yy,Z=G===xy?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:m,collisionBoundary:p,collisionPadding:h,sticky:b,hideWhenDetached:g,avoidCollisions:v}:{};return e(by,{scope:o,content:x,viewport:S,onViewportChange:k,itemRefCallback:B,selectedItem:C,onItemLeave:$,itemTextRefCallback:z,focusSelectedItem:I,selectedItemText:E,position:a,isPositioned:O,searchRef:j,children:e(nf,{as:vy,allowPinchZoom:!0,children:e(su,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Kd(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e(tu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:e(G,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:e=>e.preventDefault(),...w,...Z,onPlaced:()=>R(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Kd(w.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=M().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 n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>D(t)),e.preventDefault()}})})})})})})});wy.displayName="SelectContentImpl";var yy=r.forwardRef((t,n)=>{const{be:o,onPlaced:a,...i}=t,s=ry(my,o),c=gy(my,o),[l,d]=r.useState(null),[u,f]=r.useState(null),m=Fa(n,e=>f(e)),p=Yw(o),h=r.useRef(!1),b=r.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:w,focusSelectedItem:y}=c,x=r.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&g&&v&&w){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=w.getBoundingClientRect();if("rtl"!==s.dir){const o=r.left-t.left,a=n.left-o,i=e.left-a,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-hy,u=dp(a,[hy,Math.max(hy,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const o=t.right-r.right,a=window.innerWidth-n.right-o,i=window.innerWidth-e.right-a,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-hy,u=dp(a,[hy,Math.max(hy,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const o=p(),i=window.innerHeight-2*hy,c=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),b=parseInt(d.borderBottomWidth,10),y=f+m+c+parseInt(d.paddingBottom,10)+b,x=Math.min(5*v.offsetHeight,y),A=window.getComputedStyle(g),S=parseInt(A.paddingTop,10),k=parseInt(A.paddingBottom,10),T=e.top+e.height/2-hy,C=i-T,N=v.offsetHeight/2,E=f+m+(v.offsetTop+N),P=y-E;if(E>T){const e=o.length>0&&v===o[0].ref.current;l.style.top="0px";const t=Math.max(T,f+g.offsetTop+(e?S:0)+N)+P;l.style.height=t+"px",g.scrollTop=E-T+g.offsetTop}else{const e=o.length>0&&v===o[o.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-g.offsetTop-g.offsetHeight,n=E+Math.max(C,N+(e?k:0)+t+b);l.style.height=n+"px"}l.style.margin=hy+"px 0",l.style.minHeight=x+"px",l.style.maxHeight=i+"px",a?.(),requestAnimationFrame(()=>h.current=!0)}},[p,s.trigger,s.valueNode,l,u,g,v,w,s.dir,a]);vd(()=>x(),[x]);const[A,S]=r.useState();vd(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const k=r.useCallback(e=>{e&&!0===b.current&&(x(),y?.(),b.current=!1)},[x,y]);return e(Ay,{scope:o,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:e("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:e(gi.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});yy.displayName="SelectItemAlignedPosition";var xy=r.forwardRef((t,n)=>{const{be:r,align:o="start",collisionPadding:a=hy,...i}=t,s=ty(r);return e(ow,{...s,...i,ref:n,align:o,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xy.displayName="SelectPopperPosition";var[Ay,Sy]=Qw(my,{}),ky="SelectViewport",Ty=r.forwardRef((o,a)=>{const{be:i,nonce:s,...c}=o,l=gy(ky,i),d=Sy(ky,i),u=Fa(a,l.onViewportChange),f=r.useRef(0);return n(t,{children:[e("style",{dangerouslySetInnerHTML:{se:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e(qw.Slot,{scope:i,children:e(gi.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:Kd(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=d;if(r?.current&&n){const e=Math.abs(f.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*hy,o=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),i=Math.max(o,a);if(r>i){const o=i+e,a=Math.min(r,o),s=o-a;n.style.height=a+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});Ty.displayName=ky;var Cy="SelectGroup",[Ny,Ey]=Qw(Cy);r.forwardRef((t,n)=>{const{be:r,...o}=t,a=Jd();return e(Ny,{scope:r,id:a,children:e(gi.div,{role:"group","aria-labelledby":a,...o,ref:n})})}).displayName=Cy;var Py="SelectLabel",My=r.forwardRef((t,n)=>{const{be:r,...o}=t,a=Ey(Py,r);return e(gi.div,{id:a.id,...o,ref:n})});My.displayName=Py;var Oy="SelectItem",[Ry,_y]=Qw(Oy),Dy=r.forwardRef((t,n)=>{const{be:o,value:a,disabled:i=!1,textValue:s,...c}=t,l=ry(Oy,o),d=gy(Oy,o),u=l.value===a,[f,m]=r.useState(s??""),[p,h]=r.useState(!1),b=Fa(n,e=>d.itemRefCallback?.(e,a,i)),g=Jd(),v=r.useRef("touch"),w=()=>{i||(l.onValueChange(a),l.onOpenChange(!1))};if(""===a)throw 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(Ry,{scope:o,value:a,disabled:i,textId:g,isSelected:u,onItemTextChange:r.useCallback(e=>{m(t=>t||(e?.textContent??"").trim())},[]),children:e(qw.ItemSlot,{scope:o,value:a,disabled:i,textValue:f,children:e(gi.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:b,onFocus:Kd(c.onFocus,()=>h(!0)),onBlur:Kd(c.onBlur,()=>h(!1)),onClick:Kd(c.onClick,()=>{"mouse"!==v.current&&w()}),onPointerUp:Kd(c.onPointerUp,()=>{"mouse"===v.current&&w()}),onPointerDown:Kd(c.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:Kd(c.onPointerMove,e=>{v.current=e.pointerType,i?d.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Kd(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Kd(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Hw.includes(e.key)&&w()," "===e.key&&e.preventDefault())})})})})});Dy.displayName=Oy;var Iy="SelectItemText",Uy=r.forwardRef((o,a)=>{const{be:i,className:s,style:c,...l}=o,d=ry(Iy,i),u=gy(Iy,i),f=_y(Iy,i),m=ay(Iy,i),[p,b]=r.useState(null),g=Fa(a,e=>b(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),v=p?.textContent,w=r.useMemo(()=>e("option",{value:f.value,disabled:f.disabled,children:v},f.value),[f.disabled,f.value,v]),{onNativeOptionAdd:y,onNativeOptionRemove:x}=m;return vd(()=>(y(w),()=>x(w)),[y,x,w]),n(t,{children:[e(gi.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?h.createPortal(l.children,d.valueNode):null]})});Uy.displayName=Iy;var Fy="SelectItemIndicator",jy=r.forwardRef((t,n)=>{const{be:r,...o}=t;return _y(Fy,r).isSelected?e(gi.span,{"aria-hidden":!0,...o,ref:n}):null});jy.displayName=Fy;var Ly="SelectScrollUpButton";r.forwardRef((t,n)=>{const o=gy(Ly,t.be),a=Sy(Ly,t.be),[i,s]=r.useState(!1),c=Fa(n,a.onScrollButtonChange);return vd(()=>{if(o.viewport&&o.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=o.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[o.viewport,o.isPositioned]),i?e($y,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=Ly;var By="SelectScrollDownButton";r.forwardRef((t,n)=>{const o=gy(By,t.be),a=Sy(By,t.be),[i,s]=r.useState(!1),c=Fa(n,a.onScrollButtonChange);return vd(()=>{if(o.viewport&&o.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=o.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[o.viewport,o.isPositioned]),i?e($y,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=o;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=By;var $y=r.forwardRef((t,n)=>{const{be:o,onAutoScroll:a,...i}=t,s=gy("SelectScrollButton",o),c=r.useRef(null),l=Yw(o),d=r.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return r.useEffect(()=>()=>d(),[d]),vd(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e(gi.div,{"aria-hidden":!0,...i,ref:n,style:{flexShrink:0,...i.style},onPointerDown:Kd(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(a,50))}),onPointerMove:Kd(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(a,50))}),onPointerLeave:Kd(i.onPointerLeave,()=>{d()})})}),zy=r.forwardRef((t,n)=>{const{be:r,...o}=t;return e(gi.div,{"aria-hidden":!0,...o,ref:n})});zy.displayName="SelectSeparator";var Gy="SelectArrow";r.forwardRef((t,n)=>{const{be:r,...o}=t,a=ty(r),i=ry(Gy,r),s=gy(Gy,r);return i.open&&"popper"===s.position?e(aw,{...a,...o,ref:n}):null}).displayName=Gy;var Zy=r.forwardRef(({be:t,value:n,...o},a)=>{const i=r.useRef(null),s=Fa(a,i),c=Um(n);return r.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}},[c,n]),e(gi.select,{...o,style:{...Kw,...o.style},ref:s,defaultValue:n})});function Wy(e){return""===e||void 0===e}function Ky(e){const t=bd(e),n=r.useRef(""),o=r.useRef(0),a=r.useCallback(e=>{const r=n.current+e;t(r),function e(t){n.current=t,window.clearTimeout(o.current),""!==t&&(o.current=window.setTimeout(()=>e(""),1e3))}(r)},[t]),i=r.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return r.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,a,i]}function Vy(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=(i=e,s=Math.max(o,0),i.map((e,t)=>i[(s+t)%i.length]));var i,s;1===r.length&&(a=a.filter(e=>e!==n));const c=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return c!==n?c:void 0}Zy.displayName="SelectBubbleInput";var Hy=cy,Jy=uy,qy=fy,Yy=py,Xy=Ty,Qy=My,ex=Dy,tx=Uy,nx=jy,rx=zy;const ox=iy,ax=r.forwardRef(({className:t,children:r,...o},a)=>n(Hy,{ref:a,className:Da("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),...o,children:[r,e(Jy,{asChild:!0,children:e(Qf,{className:"h-4 w-4 opacity-50"})})]}));ax.displayName=Hy.displayName;const ix=r.forwardRef(({className:t,children:n,position:o="popper",...a},i)=>{const{container:s}=r.useContext(ce);return e(qy,{container:s,children:e(Yy,{ref:i,className:Da("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"===o&&"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:o,...a,children:e(Xy,{className:Da("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n})})})});ix.displayName=Yy.displayName,r.forwardRef(({className:t,...n},r)=>e(Qy,{ref:r,className:Da("px-2 py-1.5 text-sm font-semibold",t),...n})).displayName=Qy.displayName;const sx=r.forwardRef(({className:t,children:r,...o},a)=>n(ex,{ref:a,className:Da("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),...o,children:[e("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e(nx,{children:e(tm,{className:"h-4 w-4"})})}),e(tx,{children:r})]}));sx.displayName=ex.displayName,r.forwardRef(({className:t,...n},r)=>e(rx,{ref:r,className:Da("-mx-1 my-1 h-px bg-muted",t),...n})).displayName=rx.displayName;const cx=({workspace:t})=>{const r=re(e=>e.auth.session?.user||null),[o,a]=f(0),[i,s]=f(!1),[c,d]=f([]),{getUsers:u,removeUser:m,updateUser:p}=ad(),{settings:h}=md();l(()=>{t&&(s(!0),u(t.t).then(e=>{d(e)}).catch(e=>{}).finally(()=>{s(!1)}))},[t,o]);const b=()=>{a(e=>e+1)};if(i||!t)return e(Lh,{});const g=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e.t},v=c.map(e=>({...e,...g(e.user)})),w=c.find(e=>("string"==typeof e.user?e.user:e.user.t)===r?.id)?.role,y="admin"===w,x=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return n("div",{children:[!y&&e("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),y&&n("div",{className:"mb-4",children:[x&&e(lx,{onInvite:b,workspaceId:t.t}),!x&&e("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),n("div",{className:"mb-4 flex items-center justify-between",children:[e("div",{children:n("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),e("div",{children:e(bi,{variant:"ghost",size:"sm",onClick:b,progress:i,startIcon:e(ai,{}),children:"Refresh"})})]}),e("ul",{className:"space-y-2",children:v.map((o,a)=>{const i=o.id===r?.id,s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy.t:t.createdBy)===o.id;return n("li",{className:"flex items-center justify-between border rounded p-3",children:[n("div",{className:"flex items-center space-x-3",children:[e("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:o.name.charAt(0).toUpperCase()}),n("div",{children:[e("div",{className:"font-medium",children:o.name}),e("div",{className:"text-xs text-gray-500",children:o.email})]})]}),n("div",{className:"flex items-center gap-x-1",children:[e("div",{children:n(ox,{disabled:i||!y||s,value:o.role,onValueChange:e=>{return n=t.t,r=o.id,a=e,void(("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy.t:t.createdBy)!==r&&p(n,r,{role:a}).then(()=>{b()}));var n,r,a},children:[e(ax,{children:e(dy,{placeholder:"Select a role"})}),e(ix,{children:t?.roles.map(t=>e(sx,{value:t,children:t},t))})]})}),i&&e("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&e("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&y&&e(bi,{variant:"destructive",size:"sm",startIcon:e(ui,{}),onClick:()=>{var e;e=o.id,("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy.t:t.createdBy)!==e&&m(t.t,e).then(()=>{b()})}})]})]},a)})}),0===c.length&&e("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function lx({onInvite:t,workspaceId:r}){const[o,a]=f(""),[i,s]=f("admin"),[c,d]=f(!1),[u,m]=f(null),[p,h]=f(null),{addUser:b,getWorkspace:g}=ad(),[v,w]=f(null),{settings:y}=md(),x=y?.workspace.roles??v?.roles??[];return l(()=>{r&&g(r).then(w)},[r]),n("div",{className:"flex gap-2 flex-col gap-y-2",children:[u&&e("div",{className:"text-red-500 capitalize",children:u}),p&&e("div",{className:"text-green-500 capitalize",children:p}),n("div",{children:[e(xi,{children:"Invite member by email"}),e(Ri,{type:"email",value:o,onChange:e=>a(e.target.value),placeholder:"example@example.com"})]}),n("div",{children:[e(xi,{children:"Role"}),n(ox,{value:i,onValueChange:s,children:[e(ax,{children:e(dy,{placeholder:"Select a role"})}),e(ix,{children:x.map(t=>e(sx,{value:t,children:t},t))})]})]}),e("div",{children:e(bi,{progress:c,onClick:async()=>{const e=o.trim();e?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(d(!0),await b(r,e,i).then(()=>{h("User invited successfully"),t?.()}).catch(e=>{m(e.message||"Failed to invite member")}).finally(()=>{d(!1),setTimeout(()=>{m(null),h(null),a(""),s("admin")},6e3)})):m("Invalid email address format"):m("Email is required")},disabled:c||!o||!i,children:c?"Inviting...":"Invite as "+i})})]})}const dx=({workspace:t,section:r,setSection:o})=>{const a=re(e=>e.auth.session?.user||null),i=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy.t:t.createdBy)===a?.id;return n("div",{className:"w-56 h-full flex flex-col space-y-6",children:[t&&e("div",{className:"border-b p-2 py-4",children:n("div",{className:"flex items-center gap-x-2",children:[t.image&&e("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("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"}})}),n("div",{className:Da("flex-1 min-w-0",t.image?"":"pl-2"),children:[e("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e(ux,{title:"Account",children:e(fx,{activeSection:r,icon:e(mi,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>o("profile")})}),n(ux,{title:"Workspace",children:[e(fx,{activeSection:r,icon:e(si,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>o("general")}),e(fx,{activeSection:r,icon:e(pi,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>o("users")}),e(fx,{activeSection:r,icon:e(li,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>o("features")}),i&&e(fx,{activeSection:r,icon:e(fi,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>o("danger")})]})]})};function ux({title:t,children:r}){return n("div",{className:"px-2 flex flex-col space-y-1",children:[e("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function fx({icon:e,label:t,section:r,onClick:o,activeSection:a}){return n("button",{className:Da("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",r===a?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>o(r),children:[e,t]})}const mx=({workspace:t,onClose:r})=>{const[o,a]=f(!1),[i,s]=f("profile");return t?n(im,{open:o,onOpenChange:e=>{a(e),e||r()},children:[e(sm,{asChild:!0,children:e(bi,{variant:"outline",size:"icon",children:e(si,{className:"h-4 w-4"})})}),n(dm,{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(mm,{className:"sr-only",children:"Workspace settings dialog"}),e(dx,{workspace:t,section:i,setSection:s}),n("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[n(fm,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===i&&"Account","general"===i&&"Workspace Settings","users"===i&&"Workspace Members","features"===i&&"Workspace Features","danger"===i&&"Danger Zone"]}),n("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===i&&e(Ww,{workspace:t}),"general"===i&&e(rb,{workspace:t}),"users"===i&&e(cx,{workspace:t}),"features"===i&&e(eb,{workspaceId:t.t?.toString()}),"danger"===i&&e(Bh,{workspace:t})]})]})]})]}):null};function px(r){const{workspaces:o,currentWorkspace:a,loading:i,refreshing:s}=re(e=>e.workspaces),c=re(e=>e.auth.session?.user),{settings:d}=md(),[u,m]=f(!1),[p,h]=f(0),[b,g]=f(""),{fetchWorkspaces:v,getFeatures:w,refreshWorkspaces:y,setCurrentWorkspace:x,workspaces:A}=ad(),S=i||s;l(()=>{0===A.length?(v(),w()):w()},[]),l(()=>{p>0&&y()},[p]);const k=A.length>0?A:o,T=k.filter(e=>e.t!==a?.t).filter(e=>e.name.toLowerCase().includes(b.toLowerCase())),C=d?.workspace.maxWorkspaces??Number.MAX_VALUE,N=k?.filter(e=>("object"==typeof e.createdBy?e.createdBy.t?.toString():e.createdBy?.toString())===c?.id?.toString()).length,E=C>(N??0);return n(im,{open:u,onOpenChange:m,children:[e(sm,{children:r.trigger?.(S,a)}),n(dm,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[n(um,{children:[n(fm,{className:"flex items-center gap-2",children:[e(Qa,{className:"h-5 w-5"}),"Switch Workspace"]}),e(mm,{children:"Select a workspace to switch to or create a new one."})]}),!c&&e("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&n("div",{className:"flex flex-col gap-4",children:[a&&e(hx,{workspace:a,isCurrentWorkspace:!0,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>m(!1),setCurrentWorkspace:x,setOpen:m,workspacesToUse:k}),e(eh,{}),n("div",{children:[n("div",{className:"flex items-center justify-between",children:[n("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",T.length,")"]}),e("div",{children:e(bi,{progress:s,disabled:s,variant:"ghost",onClick:function(){h(e=>e+1)},startIcon:e(ai,{}),children:s?"Refreshing...":"Refresh"})})]}),n("div",{className:"relative",children:[e(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e(Ri,{placeholder:"Search workspaces...",value:b,onChange:e=>g(e.target.value),className:"pl-10"})]}),i?n("div",{className:"flex items-center justify-center py-8",children:[e(ri,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===T.length?n("div",{className:"text-center py-8",children:[e(Qa,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e("p",{className:"mt-2 text-sm text-muted-foreground",children:b?"No workspaces found":"No workspaces available"})]}):e(Hp,{className:"h-64",children:e("div",{className:"flex flex-col gap-2 my-2.5",children:T.map(t=>{const n=t.t===a?.t;return e(hx,{workspace:t,isCurrentWorkspace:n,onWorkspaceChange:r.onWorkspaceChange,onClose:()=>m(!1),setCurrentWorkspace:x,setOpen:m,workspacesToUse:k},t.t)})})})]}),E&&n(t,{children:[e(eh,{}),e(bx,{onCreated:()=>{v()}})]})]})]})]})}function hx(t){const{workspace:r,setCurrentWorkspace:o,setOpen:a,workspacesToUse:i}=t,s=t.isCurrentWorkspace??!1;return n("div",{className:Da("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":s}),children:[n(Gd,{className:"h-8 w-8 flex items-center justify-center",children:[e("div",{children:e(Zd,{src:r.image})}),e(Wd,{children:(c=r.name,c.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),n("div",{className:"flex-1 min-w-0 max-w-full",children:[e("div",{className:"flex items-center gap-2",children:e("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),n("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e(pi,{className:"h-3 w-3"}),n("span",{children:[r.users?.length||0," members"]})]})]}),n("div",{className:"flex items-center gap-2",children:[s?null:e(bi,{size:"sm",onClick:()=>{t.onWorkspaceChange(r).then(()=>{o(r),a(!1)})},children:"Switch to"}),e(mx,{workspace:r,onClose:()=>{if(s){const e=i.findIndex(e=>e.t?.toString()===r.t?.toString());-1!==e&&o(i[e])}}})]})]});var c}function bx(r){const[o,a]=f(!1),[i,s]=f("emoji"),[c,l]=f("🏢"),[d,u]=f(!1),{createWorkspace:m}=ad(),p=Tt({resolver:To(Ns({name:ts().min(2,{message:"Workspace name must be at least 2 characters."}),image:ts().optional()})),defaultValues:{name:"",image:""}});return n(im,{open:o,onOpenChange:a,children:[e(sm,{asChild:!0,children:n(bi,{className:"w-full rounded-none",children:[e(oi,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),n(dm,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[n(um,{children:[e(fm,{children:"Create New Workspace"}),e(mm,{children:"Create a new workspace to get started."})]}),e(Ai,{...p,children:n("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===i)t=tb(c);else if("url"===i&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await m(e.name,t),a(!1),p.reset(),l("🏢"),s("emoji"),r?.onCreated?.()}catch(e){}finally{u(!1)}}),children:[e(ki,{control:p.control,name:"name",render:({field:t})=>n(Ni,{children:[e(Ei,{children:"Workspace Name"}),e(Pi,{children:e(Ri,{placeholder:"My Awesome Workspace",...t})}),e(Oi,{})]})}),n("div",{className:"flex flex-col gap-y-2 my-2",children:[n("div",{children:[e(xi,{className:"text-sm font-medium",children:"Workspace Icon"}),e(Mi,{children:"Choose an emoji or upload a custom image for your workspace."})]}),n(cp,{value:i,onValueChange:e=>s(e),className:"flex flex-col gap-y-2",children:[n("div",{className:"flex items-center gap-x-2 my-1",children:[e(lp,{value:"emoji",id:"emoji"}),n(xi,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e(ci,{className:"h-4 w-4"}),"Choose Emoji"]})]}),n("div",{className:"flex items-center gap-x-2 my-1",children:[e(lp,{value:"url",id:"url"}),n(xi,{htmlFor:"url",className:"flex items-center gap-2",children:[e(ni,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===i&&n("div",{className:"flex flex-col gap-y-2",children:[n("div",{className:"flex items-center gap-3",children:[e("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),e(Hp,{className:"h-32 w-full rounded-md border",children:e("div",{className:"p-4 grid grid-cols-8 gap-2",children:nb.map((t,n)=>e("button",{type:"button",onClick:()=>(e=>{l(e),p.setValue("image",tb(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===t?"bg-primary text-primary-foreground":""),children:t},n))})})]}),"url"===i&&n("div",{className:"flex flex-col gap-y-2",children:[e(ki,{control:p.control,name:"image",render:({field:t})=>n(Ni,{children:[e(Ei,{children:"Image URL"}),e(Pi,{children:e(Ri,{placeholder:"https://example.com/image.png",...t})}),e(Mi,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e(Oi,{})]})}),p.watch("image")&&n("div",{className:"flex items-center gap-3",children:[e("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e("img",{src:p.watch("image"),alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),n("div",{className:"flex justify-end gap-3 pt-4",children:[e(bi,{type:"button",variant:"outline",onClick:()=>{a(!1),p.reset(),l("🏢"),s("emoji")},disabled:d,children:"Cancel"}),e(bi,{type:"submit",disabled:d,children:d?n(t,{children:[e(ri,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}export{g as ApiVersion,Ks as BetaForm,de as SaaSOSProvider,sd as WhenAuthenticated,ld as WhenRoles,cd as WhenUnauthenticated,fd as WhenWorkspaceFeatureDisabled,ud as WhenWorkspaceFeatureEnabled,dd as WhenWorkspaceRoles,px as WorkspaceSwitcher,se as eventEmitter,id as useSaaSAuth,md as useSaaSSettings,ad as useSaaSWorkspaces};
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,createContext as i,useReducer as s,useMemo as c,useCallback as l,useEffect as d,useState as u,forwardRef as f,createElement as p,useRef as m,useLayoutEffect as h,useContext as g}from"react";import*as v from"react-dom";import b from"react-dom";var y;!function(e){e.V1="v1"}(y||(y={}));class w 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,w)}}const x=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 w("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof w?r:new w(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 S(e,t={}){x.handleError(e,t)}function k(e,t,r,n){return new w(e,t,r,n)}class A extends o{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(S(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){console.error("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const E=()=>({type:"AUTHENTICATION_STARTED"}),C=()=>({type:"AUTHENTICATION_FAILED"}),T=e=>({type:"SET_SESSION",payload:e}),N=()=>({type:"REMOVE_SESSION"});function _({name:e,initialState:r,reducer:n,initializer:o}){const l=i(null),d=i(null),u=i(null),f=a.memo(({children:e})=>{const[a,i]=s(n,r,o||(e=>e)),f=c(()=>({state:a,dispatch:i}),[a,i]);return t(u.Provider,{value:f,children:t(l.Provider,{value:a,children:t(d.Provider,{value:i,children:e})})})});f.displayName=`${e}Provider`;const p=()=>{const t=a.useContext(l);if(null===t)throw new Error(`use${e}State must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t};return{Provider:f,useContext:()=>{const t=a.useContext(u);if(!t)throw new Error(`use${e}Context must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useState:p,useDispatch:()=>{const t=a.useContext(d);if(null===t)throw new Error(`use${e}Dispatch must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`);return t},useSelector:(e,t)=>{const r=p(),n=e||(e=>e),o=a.useRef(n),i=a.useRef(t),s=a.useRef(void 0),l=a.useRef(r);e&&(o.current=n),t&&(i.current=t);return c(()=>{const e=o.current(r);if(void 0!==s.current){if((i.current?i.current(s.current,e):Object.is(s.current,e))&&l.current===r)return s.current}return s.current=e,l.current=r,e},[r])}}}var R;function P(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 O(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){console.warn(`Failed to save ${e} to localStorage:`,t)}}function D(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"}(R||(R={}));const I="code",U="saas-session-id";function M(){D(U)}function L(){if("undefined"==typeof window)return null;try{return P(U)}catch(e){return console.warn("Failed to get sessionId from localStorage:",e),null}}function F(){const e=L(),t={};return e&&(t["x-session-id"]=e),t}function z(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const j=()=>({session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated}),{Provider:B,useState:W,useDispatch:V}=_({name:"Auth",initialState:j(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return{...e,isLoading:!0,isAuthenticated:!1,isRedirecting:!0,status:R.authenticating};case"AUTHENTICATION_FAILED":return{...e,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated};case"SET_SESSION":{const n=t.payload;return r=n.sessionId,O(U,r),{...e,session:n,isAuthenticated:!0,isRedirecting:!1,isLoading:!1,status:R.authenticated}}case"REMOVE_SESSION":return M(),{...e,session:null,isLoading:!1,isAuthenticated:!1,isRedirecting:!1,status:R.unauthenticated};default:return e}var r},initializer:j}),$=B,G=W,K=V,H=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),Z=e=>({type:"SET_SETTINGS",payload:e}),q=()=>({serverUrl:"",version:y.V1,orgId:"",settings:null}),{Provider:J,useState:Y,useDispatch:X}=_({name:"OS",initialState:q(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return{...e,...t.payload};case"REMOVE_SAAS_OS_CONFIG":return q();case"SET_SETTINGS":return{...e,settings:t.payload};default:return e}}}),Q=J,ee=Y,te=X,re=e=>({type:"SET_WORKSPACES",payload:e}),ne=e=>({type:"SET_ALL_FEATURES",payload:e}),ae=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),oe=()=>({type:"RESET_CURRENT_WORKSPACE"}),ie=e=>({type:"SET_IS_INITIALIZED",payload:e}),se=e=>({type:"SET_LOADING",payload:e}),ce=e=>({type:"SET_ERROR",payload:e}),le=e=>({type:"SET_REFRESHING",payload:e}),de="saas-workspace-current";const{Provider:ue,useState:fe,useDispatch:pe}=_({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)?O(de,r):D(de),{...e,currentWorkspace:t.payload};case"RESET_CURRENT_WORKSPACE":return D(de),{...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}}),me=ue,he=fe,ge=pe,ve=a.memo(({children:e})=>t(Q,{children:t($,{children:t(me,{children:e})})}));function be(e,t){const r=ee(),n=G(),o=he(),i=c(()=>({os:r,auth:n,workspaces:o}),[r,n,o]),s=e||(e=>e),l=a.useRef(s),d=a.useRef(t),u=a.useRef(void 0),f=a.useRef(i);e&&(l.current=s);return c(()=>{const e=l.current(i);if(void 0!==u.current){if((d.current?d.current(u.current,e):Object.is(u.current,e))&&f.current===i)return u.current}return u.current=e,f.current=i,e},[i])}function ye(){const e=K(),t=te(),r=ge();return c(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}ve.displayName="SDKContextProvider";const we=a.memo(({children:e,callbacks:n})=>{const o=ye(),i=be(e=>e.auth),s=be(e=>e.os),u=a.useRef(!1),f=a.useRef(null),p=c(()=>n,[n]),m=l(async e=>{try{if(p?.handleAuthentication){const{sessionId:t}=await p.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=s,{serverUrl:n,version:a,orgId:i}=r;if(!n||!a||!i)throw new Error("OS configuration is not available");const c=await fetch(`${n}/api/${a}/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 d=l._id||l.id;if(!d||"string"!=typeof d)throw new Error("User data missing required ID field");if(!l.email||"string"!=typeof l.email)throw new Error("User data missing required email field");const u=z({id:d,name:l.name||"",org:i,email:l.email,emailVerified:!0,clientId:r.auth?.clientId||"",role:l.role||"",image:l.image},t);o.auth(T(u)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(I),window.history.replaceState({},"",e.toString())}catch(e){console.error("Error removing token from URL:",e)}}()}}catch(t){throw S(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(C()),t}},[o,p,s]);return d(()=>{if("undefined"==typeof window)return;if(i.isAuthenticated)return;const e=L();if(!e)return;(async()=>{try{const{serverUrl:t,version:r,orgId:n}=s;if(!t||!r||!n)return void S(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const a=await fetch(`${t}/api/${r}/public/profile`,{headers:{"x-session-id":e,"Content-Type":"application/json"}});if(!a.ok)return S(new Error("Session invalid, removing from localStorage"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{status:a.status}}),void M();let i;try{i=await a.json()}catch(e){return S(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"parseResponse"}}),void M()}const c=i._id||i.id;if(!c||"string"!=typeof c)return S(new Error("User data missing required ID field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void M();if(!i.email||"string"!=typeof i.email)return S(new Error("User data missing required email field"),{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"validateUserData"}}),void M();const l=z({id:c,name:i.name||"",org:n,email:i.email,emailVerified:!0,clientId:s.auth?.clientId||"",role:i.role||"",image:i.image},e);o.auth(T(l))}catch(e){S(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"pageLoad"}}),M()}})()},[i.isAuthenticated,o,s]),d(()=>{const e=function(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(I)}catch(e){return console.error("Error getting token from URL:",e),null}}();if(!e)return;if(u.current||f.current===e)return;const{serverUrl:t,version:r,orgId:n}=s;t&&r&&n&&(u.current=!0,f.current=e,m(e).then(()=>{f.current=null}).catch(t=>{S(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),f.current=null}).finally(()=>{u.current=!1}))},[m,s.serverUrl,s.version,s.orgId]),t(r,{children:e})});we.displayName="AuthProviderWrapper";const xe=a.memo(({config:e,auth:n,children:o})=>{const i=ye(),s=be(e=>e.os),c=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return d(()=>{i.os(H({...e,auth:c}))},[e,c,i]),d(()=>{const{serverUrl:e,version:t,orgId:r,settings:n}=s;if(e&&t&&r&&!n){(async()=>{try{const n=F(),a=await fetch(`${e}/api/${t}/public/${r}/settings`,{headers:n});if(a.ok){const e=await a.json();i.os(Z(e))}}catch(n){S(n,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:e,version:t,orgId:r}})}})()}},[s.serverUrl,s.version,s.orgId,s.settings,i]),t(r,{children:o})});xe.displayName="ContextConfigProvider";const Se=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){S(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})}},ke=i({container:null,setContainer:()=>{}}),Ae=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(ke.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Ae.displayName="PortalProvider";const Ee=a.createContext(void 0),Ce=a.memo(({children:e})=>{const r=be(e=>e.os),n=be(e=>e.auth),{serverUrl:o,version:i}=r,s=n.isAuthenticated,[c,f]=u({}),[p,m]=u({}),[h,g]=u(!1),[v,b]=u(null),y=l(async()=>{if(o&&i&&s)try{const e=await fetch(`${o}/api/${i}/public/users/attributes`,{headers:F()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user attributes")}const t=await e.json();t&&"object"==typeof t&&!Array.isArray(t)?f(t):f({})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user attributes");b(t),S(e,{component:"UserProvider",action:"fetchAttributes"})}else f({})},[o,i,s]),w=l(async()=>{if(o&&i&&s){g(!0),b(null);try{await y()}finally{g(!1)}}},[o,i,s,y]),x=l(async e=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),b(null);try{const t=await fetch(`${o}/api/${i}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...F()},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 y(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw b(r),S(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{g(!1)}},[o,i,y]),k=l(async(e,t)=>{if(!o||!i)throw new Error("Server URL or version is missing");g(!0),b(null);try{const r=await fetch(`${o}/api/${i}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...F()},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 y(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw b(n),S(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{g(!1)}},[o,i,y]),A=l(async()=>{if(o&&i&&s)try{const e=await fetch(`${o}/api/${i}/public/users/features`,{headers:F()});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.message||"Failed to fetch user features")}const t=await e.json();m("object"==typeof t?t:{})}catch(e){const t=e instanceof Error?e:new Error("Failed to fetch user features");b(t),S(e,{component:"UserProvider",action:"fetchFeatures"})}else m({})},[o,i,s]),E=l(async()=>{if(o&&i&&s){g(!0),b(null);try{await A()}finally{g(!1)}}},[o,i,s,A]);d(()=>{s&&o&&i?(g(!0),b(null),Promise.all([y(),A()]).finally(()=>{g(!1)})):(f({}),m({}))},[s,o,i,y,A]);const C=a.useMemo(()=>({attributes:c,features:p,isLoading:h,error:v,updateAttributes:x,updateAttribute:k,refreshAttributes:w,refreshFeatures:E}),[c,p,h,v,x,k,w,E]);return t(Ee.Provider,{value:C,children:e})});Ce.displayName="UserProvider";class Te{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return F()}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 Ne=e=>"checkbox"===e.type,_e=e=>e instanceof Date,Re=e=>null==e;const Pe=e=>"object"==typeof e;var Oe=e=>!Re(e)&&!Array.isArray(e)&&Pe(e)&&!_e(e),De=e=>Oe(e)&&e.target?Ne(e.target)?e.target.checked:e.target.value:e,Ie=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Ue="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Me(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(Ue&&(e instanceof Blob||n)||!r&&!Oe(e))return e;if(t=r?[]:Object.create(Object.getPrototypeOf(e)),r||(e=>{const t=e.constructor&&e.constructor.prototype;return Oe(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=Me(e[r]));else t=e}return t}var Le=e=>/^\w*$/.test(e),Fe=e=>void 0===e,ze=e=>Array.isArray(e)?e.filter(Boolean):[],je=e=>ze(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Be=(e,t,r)=>{if(!t||!Oe(e))return r;const n=(Le(t)?[t]:je(t)).reduce((e,t)=>Re(e)?e:e[t],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},We=e=>"boolean"==typeof e,Ve=(e,t,r)=>{let n=-1;const a=Le(t)?[t]:je(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Oe(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const $e="blur",Ge="focusout",Ke="change",He="onBlur",Ze="onChange",qe="onSubmit",Je="onTouched",Ye="all",Xe="max",Qe="min",et="maxLength",tt="minLength",rt="pattern",nt="required",at="validate",ot=a.createContext(null);ot.displayName="HookFormContext";const it=()=>a.useContext(ot),st=e=>{const{children:t,...r}=e;return a.createElement(ot.Provider,{value:r},t)};var ct=(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]!==Ye&&(t._proxyFormState[a]=!n||Ye),r&&(r[a]=!0),e[a]}});return a};const lt="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var dt=e=>"string"==typeof e,ut=(e,t,r,n,a)=>dt(e)?(n&&t.watch.add(e),Be(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Be(r,e))):(n&&(t.watchAll=!0),r),ft=e=>Re(e)||!Pe(e);function pt(e,t,r=new WeakSet){if(ft(e)||ft(t))return e===t;if(_e(e)&&_e(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(_e(n)&&_e(e)||Oe(n)&&Oe(e)||Array.isArray(n)&&Array.isArray(e)?!pt(n,e,r):n!==e)return!1}}return!0}function mt(e){const t=it(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s}=e,c=Ie(o._names.array,r),l=a.useMemo(()=>Be(o._formValues,r,Be(o._defaultValues,r,s)),[o,r,s]),d=function(e){const t=it(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},l=a.useRef(o),d=a.useRef(c),u=a.useRef(void 0);d.current=c;const f=a.useMemo(()=>r._getWatch(n,l.current),[r,n]),[p,m]=a.useState(d.current?d.current(f):f);return lt(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{if(!i){const t=ut(n,r._names,e.values||r._formValues,!1,l.current);if(d.current){const e=d.current(t);pt(e,u.current)||(m(e),u.current=e)}else m(t)}}}),[r,i,n,s]),a.useEffect(()=>r._removeUnmounted()),p}({control:o,name:r,defaultValue:l,exact:!0}),u=function(e){const t=it(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,c]=a.useState(r._formState),l=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return lt(()=>r._subscribe({name:o,formState:l.current,exact:i,callback:e=>{!n&&c({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>ct(s,r,l.current,!1),[s,r])}({control:o,name:r,exact:!0}),f=a.useRef(e),p=a.useRef(o.register(r,{...e.rules,value:d,...We(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const m=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Be(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!Be(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Be(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Be(u.validatingFields,r)},error:{enumerable:!0,get:()=>Be(u.errors,r)}}),[u,r]),h=a.useCallback(e=>p.current.onChange({target:{value:De(e),name:r},type:Ke}),[r]),g=a.useCallback(()=>p.current.onBlur({target:{value:Be(o._formValues,r),name:r},type:$e}),[r,o._formValues]),v=a.useCallback(e=>{const t=Be(o._fields,r);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,r]),b=a.useMemo(()=>({name:r,value:d,...We(n)||u.disabled?{disabled:u.disabled||n}:{},onChange:h,onBlur:g,ref:v}),[r,n,u.disabled,h,g,v,d]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i;o.register(r,{...f.current.rules,...We(f.current.disabled)?{disabled:f.current.disabled}:{}});const t=(e,t)=>{const r=Be(o._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){const e=Me(Be(o._options.defaultValues,r));Ve(o._defaultValues,r,e),Fe(Be(o._formValues,r))&&Ve(o._formValues,r,e)}return!c&&o.register(r),()=>{(c?e&&!o._state.action:e)?o.unregister(r):t(r,!1)}},[r,o,c,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:b,formState:u,fieldState:m}),[b,u,m])}const ht=e=>e.render(mt(e));var gt=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},vt=e=>Array.isArray(e)?e:[e],bt=()=>{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=[]}}},yt=e=>Oe(e)&&!Object.keys(e).length,wt=e=>"file"===e.type,xt=e=>"function"==typeof e,St=e=>{if(!Ue)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},kt=e=>"select-multiple"===e.type,At=e=>"radio"===e.type,Et=e=>St(e)&&e.isConnected;function Ct(e,t){const r=Array.isArray(t)?t:Le(t)?[t]:je(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Oe(n)&&yt(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}(n))&&Ct(e,r.slice(0,-1)),e}var Tt=e=>{for(const t in e)if(xt(e[t]))return!0;return!1};function Nt(e,t={}){const r=Array.isArray(e);if(Oe(e)||r)for(const r in e)Array.isArray(e[r])||Oe(e[r])&&!Tt(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Nt(e[r],t[r])):Re(e[r])||(t[r]=!0);return t}function _t(e,t,r){const n=Array.isArray(e);if(Oe(e)||n)for(const n in e)Array.isArray(e[n])||Oe(e[n])&&!Tt(e[n])?Fe(t)||ft(r[n])?r[n]=Array.isArray(e[n])?Nt(e[n],[]):{...Nt(e[n])}:_t(e[n],Re(t)?{}:t[n],r[n]):r[n]=!pt(e[n],t[n]);return r}var Rt=(e,t)=>_t(e,t,Nt(t));const Pt={value:!1,isValid:!1},Ot={value:!0,isValid:!0};var Dt=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&&!Fe(e[0].attributes.value)?Fe(e[0].value)||""===e[0].value?Ot:{value:e[0].value,isValid:!0}:Ot:Pt}return Pt},It=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?""===e?NaN:e?+e:e:r&&dt(e)?new Date(e):n?n(e):e;const Ut={isValid:!1,value:null};var Mt=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Ut):Ut;function Lt(e){const t=e.ref;return wt(t)?t.files:At(t)?Mt(e.refs).value:kt(t)?[...t.selectedOptions].map(({value:e})=>e):Ne(t)?Dt(e.refs).value:It(Fe(t.value)?e.ref.value:t.value,e)}var Ft=e=>e instanceof RegExp,zt=e=>Fe(e)?e:Ft(e)?e.source:Oe(e)?Ft(e.value)?e.value.source:e.value:e,jt=e=>({isOnSubmit:!e||e===qe,isOnBlur:e===He,isOnChange:e===Ze,isOnAll:e===Ye,isOnTouch:e===Je});const Bt="AsyncFunction";var Wt=e=>!!e&&!!e.validate&&!!(xt(e.validate)&&e.validate.constructor.name===Bt||Oe(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Bt)),Vt=(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=Be(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(Oe(o)&&$t(o,t))break}}};function Gt(e,t,r){const n=Be(e,r);if(n||Le(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Be(t,n),i=Be(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var Kt=(e,t,r)=>{const n=vt(Be(e,r));return Ve(n,"root",t[r]),Ve(e,r,n),e},Ht=e=>dt(e);function Zt(e,t,r="validate"){if(Ht(e)||Array.isArray(e)&&e.every(Ht)||We(e)&&!e)return{type:r,message:Ht(e)?e:"",ref:t}}var qt=e=>Oe(e)&&!Ft(e)?e:{value:e,message:""},Jt=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:v}=e._f,b=Be(r,h);if(!v||t.has(h))return{};const y=s?s[0]:i,w=e=>{a&&y.reportValidity&&(y.setCustomValidity(We(e)?"":e||""),y.reportValidity())},x={},S=At(i),k=Ne(i),A=S||k,E=(g||wt(i))&&Fe(i.value)&&Fe(b)||St(i)&&""===i.value||""===b||Array.isArray(b)&&!b.length,C=gt.bind(null,h,n,x),T=(e,t,r,n=et,a=tt)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:i,...C(e?n:a,o)}};if(o?!Array.isArray(b)||!b.length:c&&(!A&&(E||Re(b))||We(b)&&!b||k&&!Dt(s).isValid||S&&!Mt(s).isValid)){const{value:e,message:t}=Ht(c)?{value:!!c,message:c}:qt(c);if(e&&(x[h]={type:nt,message:t,ref:y,...C(nt,t)},!n))return w(t),x}if(!(E||Re(u)&&Re(f))){let e,t;const r=qt(f),a=qt(u);if(Re(b)||isNaN(b)){const n=i.valueAsDate||new Date(b),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;dt(r.value)&&b&&(e=s?o(b)>o(r.value):c?b>r.value:n>new Date(r.value)),dt(a.value)&&b&&(t=s?o(b)<o(a.value):c?b<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(b?+b:b);Re(r.value)||(e=n>r.value),Re(a.value)||(t=n<a.value)}if((e||t)&&(T(!!e,r.message,a.message,Xe,Qe),!n))return w(x[h].message),x}if((l||d)&&!E&&(dt(b)||o&&Array.isArray(b))){const e=qt(l),t=qt(d),r=!Re(e.value)&&b.length>+e.value,a=!Re(t.value)&&b.length<+t.value;if((r||a)&&(T(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!E&&dt(b)){const{value:e,message:t}=qt(p);if(Ft(e)&&!b.match(e)&&(x[h]={type:rt,message:t,ref:i,...C(rt,t)},!n))return w(t),x}if(m)if(xt(m)){const e=Zt(await m(b,r),y);if(e&&(x[h]={...e,...C(at,e.message)},!n))return w(e.message),x}else if(Oe(m)){let e={};for(const t in m){if(!yt(e)&&!n)break;const a=Zt(await m[t](b,r),y,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(x[h]=e))}if(!yt(e)&&(x[h]={ref:y,...e},!n))return x}return w(!0),x};const Yt={mode:qe,reValidateMode:Ze,shouldFocusError:!0};function Xt(e={}){let t,r={...Yt,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:xt(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Oe(r.defaultValues)||Oe(r.values))&&Me(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:Me(o),s={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:bt(),state:bt()},p=r.criteriaMode===Ye,m=async e=>{if(!r.disabled&&(d.isValid||u.isValid||e)){const e=r.resolver?yt((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?Ve(n.validatingFields,e,t):Ct(n.validatingFields,e))}),f.state.next({validatingFields:n.validatingFields,isValidating:!yt(n.validatingFields)}))},g=(e,t,r,n)=>{const c=Be(a,e);if(c){const a=Be(i,e,Fe(r)?Be(o,e):r);Fe(a)||n&&n.defaultChecked||t?Ve(i,e,t?a:Lt(c._f)):k(e,a),s.mount&&m()}},v=(e,t,a,i,s)=>{let c=!1,l=!1;const p={name:e};if(!r.disabled){if(!a||i){(d.isDirty||u.isDirty)&&(l=n.isDirty,n.isDirty=p.isDirty=x(),c=l!==p.isDirty);const r=pt(Be(o,e),t);l=!!Be(n.dirtyFields,e),r?Ct(n.dirtyFields,e):Ve(n.dirtyFields,e,!0),p.dirtyFields=n.dirtyFields,c=c||(d.dirtyFields||u.dirtyFields)&&l!==!r}if(a){const t=Be(n.touchedFields,e);t||(Ve(n.touchedFields,e,a),p.touchedFields=n.touchedFields,c=c||(d.touchedFields||u.touchedFields)&&t!==a)}c&&s&&f.state.next(p)}return c?p:{}},b=(e,a,o,i)=>{const s=Be(n.errors,e),c=(d.isValid||u.isValid)&&We(a)&&n.isValid!==a;var p;if(r.delayError&&o?(p=()=>((e,t)=>{Ve(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?Ve(n.errors,e,o):Ct(n.errors,e)),(o?!pt(s,o):s)||!yt(i)||c){const t={...i,...c&&We(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(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Be(t,r);e&&Ve(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 s=e[o];if(s){const{_f:e,...l}=s;if(e){const l=c.array.has(e.name),u=s._f&&Wt(s._f);u&&d.validatingFields&&h([o],!0);const f=await Jt(s,c.disabled,i,p,r.shouldUseNativeValidation&&!t,l);if(u&&d.validatingFields&&h([o]),f[e.name]&&(a.valid=!1,t))break;!t&&(Be(f,e.name)?l?Kt(n.errors,f,e.name):Ve(n.errors,e.name,f[e.name]):Ct(n.errors,e.name))}!yt(l)&&await w(l,t,a)}}return a.valid},x=(e,t)=>!r.disabled&&(e&&t&&Ve(i,e,t),!pt(_(),o)),S=(e,t,r)=>ut(e,c,{...s.mount?i:Fe(t)?o:dt(e)?{[e]:t}:t},r,t),k=(e,t,r={})=>{const n=Be(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Ve(i,e,It(t,r)),o=St(r.ref)&&Re(t)?"":t,kt(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?Ne(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):wt(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||f.state.next({name:e,values:Me(i)})))}(r.shouldDirty||r.shouldTouch)&&v(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&N(e)},A=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=Be(a,i);(c.array.has(e)||Oe(o)||s&&!s._f)&&!_e(o)?A(i,o,r):k(i,o,r)}},E=(e,t,r={})=>{const l=Be(a,e),p=c.array.has(e),m=Me(t);Ve(i,e,m),p?(f.array.next({name:e,values:Me(i)}),(d.isDirty||d.dirtyFields||u.isDirty||u.dirtyFields)&&r.shouldDirty&&f.state.next({name:e,dirtyFields:Rt(o,i),isDirty:x(e,m)})):!l||l._f||Re(m)?k(e,m,r):A(e,m,r),Vt(e,c)&&f.state.next({...n,name:e}),f.state.next({name:s.mount?e:void 0,values:Me(i)})},C=async e=>{s.mount=!0;const o=e.target;let l=o.name,g=!0;const x=Be(a,l),S=e=>{g=Number.isNaN(e)||_e(e)&&isNaN(e.getTime())||pt(e,Be(i,l,e))},k=jt(r.mode),A=jt(r.reValidateMode);if(x){let s,E;const C=o.type?Lt(x._f):De(e),T=e.type===$e||e.type===Ge,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(x._f)&&!r.resolver&&!Be(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))(T,Be(n.touchedFields,l),n.isSubmitted,A,k),R=Vt(l,c,T);Ve(i,l,C),T?o&&o.readOnly||(x._f.onBlur&&x._f.onBlur(e),t&&t(0)):x._f.onChange&&x._f.onChange(e);const P=v(l,C,T),O=!yt(P)||R;if(!T&&f.state.next({name:l,type:e.type,values:Me(i)}),_)return(d.isValid||u.isValid)&&("onBlur"===r.mode?T&&m():T||m()),O&&f.state.next({name:l,...R?{}:P});if(!T&&R&&f.state.next({...n}),r.resolver){const{errors:e}=await y([l]);if(S(C),g){const t=Gt(n.errors,a,l),r=Gt(e,a,t.name||l);s=r.error,l=r.name,E=yt(e)}}else h([l],!0),s=(await Jt(x,c.disabled,i,p,r.shouldUseNativeValidation))[l],h([l]),S(C),g&&(s?E=!1:(d.isValid||u.isValid)&&(E=await w(a,!0)));g&&(x._f.deps&&N(x._f.deps),b(l,E,s,P))}},T=(e,t)=>{if(Be(n.errors,t)&&e.focus)return e.focus(),1},N=async(e,t={})=>{let o,i;const s=vt(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await y(e);if(e)for(const r of e){const e=Be(t,r);e?Ve(n.errors,r,e):Ct(n.errors,r)}else n.errors=t;return t})(Fe(e)?e:s);o=yt(t),i=e?!s.some(e=>Be(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=Be(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&m()):i=o=await w(a);return f.state.next({...!dt(e)||(d.isValid||u.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&$t(a,T,e?s:c.mount),i},_=e=>{const t={...s.mount?i:o};return Fe(e)?t:dt(e)?Be(t,e):e.map(e=>Be(t,e))},R=(e,t)=>({invalid:!!Be((t||n).errors,e),isDirty:!!Be((t||n).dirtyFields,e),error:Be((t||n).errors,e),isValidating:!!Be(n.validatingFields,e),isTouched:!!Be((t||n).touchedFields,e)}),P=(e,t,r)=>{const o=(Be(a,e,{_f:{}})._f||{}).ref,i=Be(n.errors,e)||{},{ref:s,message:c,type:l,...d}=i;Ve(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()},O=e=>f.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!vt(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return yt(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||Ye))})(t,e.formState||d,j,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const s of e?vt(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(Ct(a,s),Ct(i,s)),!t.keepError&&Ct(n.errors,s),!t.keepDirty&&Ct(n.dirtyFields,s),!t.keepTouched&&Ct(n.touchedFields,s),!t.keepIsValidating&&Ct(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Ct(o,s);f.state.next({values:Me(i)}),f.state.next({...n,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&m()},I=({disabled:e,name:t})=>{(We(e)&&s.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},U=(e,t={})=>{let n=Be(a,e);const i=We(t.disabled)||We(r.disabled);return Ve(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?I({disabled:We(t.disabled)?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:zt(t.min),max:zt(t.max),minLength:zt(t.minLength),maxLength:zt(t.maxLength),pattern:zt(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:i=>{if(i){U(e,t),n=Be(a,e);const r=Fe(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>At(e)||Ne(e))(r),c=n._f.refs||[];if(s?c.find(e=>e===r):r===n._f.ref)return;Ve(a,e,{_f:{...n._f,...s?{refs:[...c.filter(Et),r,...Array.isArray(Be(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),g(e,!1,void 0,r)}else n=Be(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Ie(c.array,e)||!s.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&$t(a,T,c.mount),L=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=Me(i);if(f.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await y();n.errors=e,l=Me(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)Ct(l,e);if(Ct(n.errors,"root"),yt(n.errors)){f.state.next({errors:{}});try{await e(l,o)}catch(e){s=e}}else t&&await t({...n.errors},o),M(),setTimeout(M);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:yt(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},F=(e,t={})=>{const l=e?Me(e):o,u=Me(l),p=yt(e),m=p?o:u;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(Rt(o,i))]);for(const t of Array.from(e))Be(n.dirtyFields,t)?Ve(m,t,Be(i,t)):E(t,Be(m,t))}else{if(Ue&&Fe(e))for(const e of c.mount){const t=Be(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(St(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)E(e,Be(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?Me(o):{}:Me(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:""},s.mount=!d.isValid||!!t.keepIsValid||!!t.keepDirtyValues,s.watch=!!r.shouldUnregister,f.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!p&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||pt(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:p?{}:t.keepDirtyValues?t.keepDefaultValues&&i?Rt(o,i):n.dirtyFields:t.keepDefaultValues&&e?Rt(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})},z=(e,t)=>F(xt(e)?e(i):e,t),j=e=>{n={...n,...e}},B={control:{register:U,unregister:D,getFieldState:R,handleSubmit:L,setError:P,_subscribe:O,_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(s.action=!0,m&&Array.isArray(Be(a,e))){const t=c(Be(a,e),l.argA,l.argB);p&&Ve(a,e,t)}if(m&&Array.isArray(Be(n.errors,e))){const t=c(Be(n.errors,e),l.argA,l.argB);p&&Ve(n.errors,e,t),((e,t)=>{!ze(Be(e,t)).length&&Ct(e,t)})(n.errors,e)}if((d.touchedFields||u.touchedFields)&&m&&Array.isArray(Be(n.touchedFields,e))){const t=c(Be(n.touchedFields,e),l.argA,l.argB);p&&Ve(n.touchedFields,e,t)}(d.dirtyFields||u.dirtyFields)&&(n.dirtyFields=Rt(o,i)),f.state.next({name:e,isDirty:x(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ve(i,e,t)},_setDisabledField:I,_setErrors:e=>{n.errors=e,f.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>ze(Be(s.mount?i:o,e,r.shouldUnregister?Be(o,e,[]):[])),_reset:F,_resetDefaultValues:()=>xt(r.defaultValues)&&r.defaultValues().then(e=>{z(e,r.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Be(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Et(e)):!Et(t._f.ref))&&D(e)}c.unMount=new Set},_disableForm:e=>{We(e)&&(f.state.next({disabled:e}),$t(a,(t,r)=>{const n=Be(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 i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(s.mount=!0,u={...u,...e.formState},O({...e,formState:u})),trigger:N,register:U,handleSubmit:L,watch:(e,t)=>xt(e)?f.state.subscribe({next:r=>"values"in r&&e(S(void 0,t),r)}):S(e,t,!0),setValue:E,getValues:_,reset:z,resetField:(e,t={})=>{Be(a,e)&&(Fe(t.defaultValue)?E(e,Me(Be(o,e))):(E(e,t.defaultValue),Ve(o,e,Me(t.defaultValue))),t.keepTouched||Ct(n.touchedFields,e),t.keepDirty||(Ct(n.dirtyFields,e),n.isDirty=t.defaultValue?x(e,Me(Be(o,e))):x()),t.keepError||(Ct(n.errors,e),d.isValid&&m()),f.state.next({...n}))},clearErrors:e=>{e&&vt(e).forEach(e=>Ct(n.errors,e)),f.state.next({errors:e?n.errors:{}})},unregister:D,setError:P,setFocus:(e,t={})=>{const r=Be(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&(e.focus(),t.shouldSelect&&xt(e.select)&&e.select())}},getFieldState:R};return{...B,formControl:B}}function Qt(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:xt(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:xt(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!xt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=Xt(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,lt(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{e.values&&!pt(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=ct(n,i),t.current}const er=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Be(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},tr=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?er(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>er(t,r,e))}},rr=(e,t)=>{t.shouldUseNativeValidation&&tr(e,t);const r={};for(const n in e){const a=Be(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(nr(t.names||Object.keys(e),n)){const e=Object.assign({},Be(r,n));Ve(e,"root",o),Ve(r,n,e)}else Ve(r,n,o)}return r},nr=(e,t)=>{const r=ar(t);return e.some(e=>ar(e).match(`^${r}\\.\\d+`))};function ar(e){return e.replace(/\]|\[/g,"")}function or(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 i.prototype)e in r||Object.defineProperty(r,e,{value:i.prototype[e].bind(r)});r._zod.constr=i,r._zod.def=n}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ir extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const cr={};function lr(e){return cr}function dr(e,t){return"bigint"==typeof t?t.toString():t}function ur(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function fr(e){return null==e}function pr(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const mr=Symbol("evaluating");function hr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==mr)return void 0===n&&(n=mr,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function gr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vr(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function br(e){return JSON.stringify(e)}const yr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const xr=ur(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Sr(e){if(!1===wr(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==wr(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function kr(e){return Sr(e)?{...e}:Array.isArray(e)?[...e]:e}const Ar=new Set(["string","number","symbol"]);function Er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Tr(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 Nr(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 _r(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Rr(e){return"string"==typeof e?e:e?.message}function Pr(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=Rr(e.inst?._zod.def?.error?.(e))??Rr(t?.error?.(e))??Rr(r.customError?.(e))??Rr(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Or(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Dr(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ir=(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,dr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ur=or("$ZodError",Ir),Mr=or("$ZodError",Ir,{Parent:Error});const Lr=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ir;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Pr(e,o,lr())));throw yr(t,a?.callee),t}return i.value},Fr=Lr(Mr),zr=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Pr(e,o,lr())));throw yr(t,a?.callee),t}return i.value},jr=zr(Mr),Br=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 ir;return o.issues.length?{success:!1,error:new(e??Ur)(o.issues.map(e=>Pr(e,a,lr())))}:{success:!0,data:o.value}},Wr=Br(Mr),Vr=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=>Pr(e,a,lr())))}:{success:!0,data:o.value}},$r=Vr(Mr),Gr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Lr(e)(t,r,a)},Kr=e=>(t,r,n)=>Lr(e)(t,r,n),Hr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zr(e)(t,r,a)},Zr=e=>async(t,r,n)=>zr(e)(t,r,n),qr=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Br(e)(t,r,a)},Jr=e=>(t,r,n)=>Br(e)(t,r,n),Yr=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vr(e)(t,r,a)},Xr=e=>async(t,r,n)=>Vr(e)(t,r,n),Qr=/^[cC][^\s-]{8,}$/,en=/^[0-9a-z]+$/,tn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rn=/^[0-9a-vA-V]{20}$/,nn=/^[A-Za-z0-9]{27}$/,an=/^[a-zA-Z0-9_-]{21}$/,on=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sn=/^([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})$/,cn=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)$/,ln=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const dn=/^(?:(?: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])$/,un=/^(([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}|:))$/,fn=/^((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])$/,pn=/^(([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])$/,mn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hn=/^[A-Za-z0-9_-]*$/,gn=/^(?=.{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])?)*\.?$/,vn=/^\+(?:[0-9]){6,14}[0-9]$/,bn="(?:(?:\\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])))",yn=new RegExp(`^${bn}$`);function wn(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 xn=/^[^A-Z]*$/,Sn=/^[^a-z]*$/,kn=or("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),An=or("$ZodCheckMaxLength",(e,t)=>{var r;kn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(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=Or(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),En=or("$ZodCheckMinLength",(e,t)=>{var r;kn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(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=Or(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Cn=or("$ZodCheckLengthEquals",(e,t)=>{var r;kn.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!fr(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=Or(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Tn=or("$ZodCheckStringFormat",(e,t)=>{var r,n;kn.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=()=>{})}),Nn=or("$ZodCheckRegex",(e,t)=>{Tn.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})}}),_n=or("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xn),Tn.init(e,t)}),Rn=or("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sn),Tn.init(e,t)}),Pn=or("$ZodCheckIncludes",(e,t)=>{kn.init(e,t);const r=Er(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})}}),On=or("$ZodCheckStartsWith",(e,t)=>{kn.init(e,t);const r=new RegExp(`^${Er(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})}}),Dn=or("$ZodCheckEndsWith",(e,t)=>{kn.init(e,t);const r=new RegExp(`.*${Er(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})}}),In=or("$ZodCheckOverwrite",(e,t)=>{kn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Un{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 Mn={major:4,minor:1,patch:8},Ln=or("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mn;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=Nr(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new ir;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=Nr(e,t)))});else{if(e.issues.length===t)continue;a||(a=Nr(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(Nr(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new ir;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new ir;return i.then(e=>t(e,n,o))}return t(i,n,o)}}e["~standard"]={validate:t=>{try{const r=Wr(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}}),Fn=or("$ZodString",(e,t)=>{var r;Ln.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),zn=or("$ZodStringFormat",(e,t)=>{Tn.init(e,t),Fn.init(e,t)}),jn=or("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=sn),zn.init(e,t)}),Bn=or("$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=cn(e))}else t.pattern??(t.pattern=cn());zn.init(e,t)}),Wn=or("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ln),zn.init(e,t)}),Vn=or("$ZodURL",(e,t)=>{zn.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:gn.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})}}}),$n=or("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zn.init(e,t)}),Gn=or("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=an),zn.init(e,t)}),Kn=or("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qr),zn.init(e,t)}),Hn=or("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=en),zn.init(e,t)}),Zn=or("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tn),zn.init(e,t)}),qn=or("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rn),zn.init(e,t)}),Jn=or("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nn),zn.init(e,t)}),Yn=or("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=wn({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(`^${bn}T(?:${n})$`)}(t)),zn.init(e,t)}),Xn=or("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yn),zn.init(e,t)}),Qn=or("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${wn(t)}$`)),zn.init(e,t)}),ea=or("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=on),zn.init(e,t)}),ta=or("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dn),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),ra=or("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=un),zn.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})}}}),na=or("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fn),zn.init(e,t)}),aa=or("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pn),zn.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function oa(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ia=or("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mn),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{oa(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const sa=or("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=hn),zn.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!hn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return oa(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})}}),ca=or("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vn),zn.init(e,t)});const la=or("$ZodJWT",(e,t)=>{zn.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),da=or("$ZodUnknown",(e,t)=>{Ln.init(e,t),e._zod.parse=e=>e}),ua=or("$ZodNever",(e,t)=>{Ln.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function fa(e,t,r){e.issues.length&&t.issues.push(..._r(r,e.issues)),t.value[r]=e.value}const pa=or("$ZodArray",(e,t)=>{Ln.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>fa(t,r,e))):fa(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function ma(e,t,r,n){e.issues.length&&t.issues.push(..._r(r,e.issues)),void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ha(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 ga(e,t,r,n,a,o){const i=[],s=a.keySet,c=a.catchall._zod,l=c.def.type;for(const a of Object.keys(t)){if(s.has(a))continue;if("never"===l){i.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>ma(e,r,a,t))):ma(o,r,a,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const va=or("$ZodObject",(e,t)=>{Ln.init(e,t);const r=ur(()=>ha(t));hr(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=wr,a=t.catchall;let o;e._zod.parse=(t,i)=>{o??(o=r.value);const s=t.value;if(!n(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=o.shape;for(const e of o.keys){const r=l[e]._zod.run({value:s[e],issues:[]},i);r instanceof Promise?c.push(r.then(r=>ma(r,t,e,s))):ma(r,t,e,s)}return a?ga(c,s,t,i,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),ba=or("$ZodObjectJIT",(e,t)=>{va.init(e,t);const r=e._zod.parse,n=ur(()=>ha(t));let a;const o=wr,i=!cr.jitless,s=i&&xr.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new Un(["shape","payload","ctx"]),r=n.value,a=e=>{const t=br(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const e of r.keys){const r=o[e],n=br(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 s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),c?ga([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function ya(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=>!Nr(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=>Pr(e,n,lr())))}),t)}const wa=or("$ZodUnion",(e,t)=>{Ln.init(e,t),hr(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),hr(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),hr(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),hr(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=>pr(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>ya(t,a,e,o)):ya(s,a,e,o)}}),xa=or("$ZodIntersection",(e,t)=>{Ln.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])=>ka(e,t,r)):ka(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(Sr(e)&&Sr(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 ka(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Nr(e))return e;const n=Sa(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 Aa=or("$ZodEnum",(e,t)=>{Ln.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=>Ar.has(typeof e)).map(e=>"string"==typeof e?Er(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}}),Ea=or("$ZodTransform",(e,t)=>{Ln.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new sr(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 ir;return r.value=a,r}});function Ca(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ta=or("$ZodOptional",(e,t)=>{Ln.init(e,t),e._zod.optin="optional",e._zod.optout="optional",hr(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),hr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pr(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=>Ca(t,e.value)):Ca(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Na=or("$ZodNullable",(e,t)=>{Ln.init(e,t),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),hr(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${pr(e.source)}|null)$`):void 0}),hr(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)}),_a=or("$ZodDefault",(e,t)=>{Ln.init(e,t),e._zod.optin="optional",hr(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=>Ra(e,t)):Ra(n,t)}});function Ra(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Pa=or("$ZodPrefault",(e,t)=>{Ln.init(e,t),e._zod.optin="optional",hr(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))}),Oa=or("$ZodNonOptional",(e,t)=>{Ln.init(e,t),hr(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=>Da(t,e)):Da(a,e)}});function Da(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 Ia=or("$ZodCatch",(e,t)=>{Ln.init(e,t),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(e._zod,"optout",()=>t.innerType._zod.optout),hr(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=>Pr(e,r,lr()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Pr(e,r,lr()))},input:e.value}),e.issues=[]),e)}}),Ua=or("$ZodPipe",(e,t)=>{Ln.init(e,t),hr(e._zod,"values",()=>t.in._zod.values),hr(e._zod,"optin",()=>t.in._zod.optin),hr(e._zod,"optout",()=>t.out._zod.optout),hr(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=>Ma(e,t.in,r)):Ma(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ma(e,t.out,r)):Ma(n,t.out,r)}});function Ma(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const La=or("$ZodReadonly",(e,t)=>{Ln.init(e,t),hr(e._zod,"propValues",()=>t.innerType._zod.propValues),hr(e._zod,"values",()=>t.innerType._zod.values),hr(e._zod,"optin",()=>t.innerType._zod.optin),hr(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(Fa):Fa(n)}});function Fa(e){return e.value=Object.freeze(e.value),e}const za=or("$ZodCustom",(e,t)=>{kn.init(e,t),Ln.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=>ja(t,r,n,e));ja(a,r,n,e)}});function ja(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(Dr(e))}}class Ba{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 Wa(){return new Ba}const Va=Wa();function $a(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Tr(t)})}function Ga(e,t){return new An({check:"max_length",...Tr(t),maximum:e})}function Ka(e,t){return new En({check:"min_length",...Tr(t),minimum:e})}function Ha(e,t){return new Cn({check:"length_equals",...Tr(t),length:e})}function Za(e){return new In({check:"overwrite",tx:e})}function qa(e){const t=function(e,t){const r=new kn({check:"custom",...Tr(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Dr(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(Dr(n))}},e(r.value,r)));return t}function Ja(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Ya(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=gt(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Xa(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=gt(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Qa(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(Ja(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&tr({},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:rr(Ya(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(Ja(function(){return Promise.resolve(("sync"===r.mode?Fr:jr)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&tr({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Ur}(e))return{values:{},errors:rr(Xa(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}
2
+ /**
3
+ * @license lucide-react v0.544.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const eo=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),to=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)},ro=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),no=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
8
+ /**
9
+ * @license lucide-react v0.544.0 - ISC
10
+ *
11
+ * This source code is licensed under the ISC license.
12
+ * See the LICENSE file in the root directory of this source tree.
13
+ */
14
+ var ao={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
+ /**
16
+ * @license lucide-react v0.544.0 - ISC
17
+ *
18
+ * This source code is licensed under the ISC license.
19
+ * See the LICENSE file in the root directory of this source tree.
20
+ */const oo=f(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...s},c)=>p("svg",{ref:c,...ao,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:ro("lucide",a),...!o&&!no(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>p(e,t)),...Array.isArray(o)?o:[o]])),io=(e,t)=>{const r=f(({className:r,...n},a)=>p(oo,{ref:a,iconNode:t,className:ro(`lucide-${eo(to(e))}`,`lucide-${e}`,r),...n}));return r.displayName=to(e),r},so=io("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"}]]),co=io("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),lo=io("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),uo=io("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"}]]),fo=io("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),po=io("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),mo=io("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"}]]),ho=io("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),go=io("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"}]]),vo=io("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"}]]),bo=io("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),yo=io("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"}]]),wo=io("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"}]]),xo=io("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=io("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"}]]),ko=io("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"}]]),Ao=or("ZodISODateTime",(e,t)=>{Yn.init(e,t),qo.init(e,t)});
21
+ /**
22
+ * @license lucide-react v0.544.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */function Eo(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Tr(t)})}(Ao,e)}const Co=or("ZodISODate",(e,t)=>{Xn.init(e,t),qo.init(e,t)});function To(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Tr(t)})}(Co,e)}const No=or("ZodISOTime",(e,t)=>{Qn.init(e,t),qo.init(e,t)});function _o(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Tr(t)})}(No,e)}const Ro=or("ZodISODuration",(e,t)=>{ea.init(e,t),qo.init(e,t)});function Po(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Tr(t)})}(Ro,e)}const Oo=or("ZodError",(e,t)=>{Ur.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,dr,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,dr,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Do=Lr(Oo),Io=zr(Oo),Uo=Br(Oo),Mo=Vr(Oo),Lo=Gr(Oo),Fo=Kr(Oo),zo=Hr(Oo),jo=Zr(Oo),Bo=qr(Oo),Wo=Jr(Oo),Vo=Yr(Oo),$o=Xr(Oo),Go=or("ZodType",(e,t)=>(Ln.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)=>Cr(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Do(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Uo(e,t,r),e.parseAsync=async(t,r)=>Io(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Mo(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Lo(e,t,r),e.decode=(t,r)=>Fo(e,t,r),e.encodeAsync=async(t,r)=>zo(e,t,r),e.decodeAsync=async(t,r)=>jo(e,t,r),e.safeEncode=(t,r)=>Bo(e,t,r),e.safeDecode=(t,r)=>Wo(e,t,r),e.safeEncodeAsync=async(t,r)=>Vo(e,t,r),e.safeDecodeAsync=async(t,r)=>$o(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,...Tr(r)})}(Li,e,t)}(t,r)),e.superRefine=t=>e.check(qa(t)),e.overwrite=t=>e.check(Za(t)),e.optional=()=>Ti(e),e.nullable=()=>_i(e),e.nullish=()=>Ti(_i(e)),e.nonoptional=t=>function(e,t){return new Oi({type:"nonoptional",innerType:e,...Tr(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...Tr(r)})}(yi,e,t);var t},e.or=t=>function(e,t){return new Si({type:"union",options:e,...Tr(t)})}([e,t]),e.and=t=>new ki({type:"intersection",left:e,right:t}),e.transform=t=>Ui(e,new Ei({type:"transform",transform:t})),e.default=t=>{return r=t,new Ri({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():kr(r)}});var r},e.prefault=t=>{return r=t,new Pi({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():kr(r)}});var r},e.catch=t=>{return new Di({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Ui(e,t),e.readonly=()=>new Mi({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Va.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Va.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Va.get(e);const r=e.clone();return Va.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ko=or("_ZodString",(e,t)=>{Fn.init(e,t),Go.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 Nn({check:"string_format",format:"regex",...Tr(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Pn({check:"string_format",format:"includes",...Tr(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new On({check:"string_format",format:"starts_with",...Tr(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Dn({check:"string_format",format:"ends_with",...Tr(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Ka(...t)),e.max=(...t)=>e.check(Ga(...t)),e.length=(...t)=>e.check(Ha(...t)),e.nonempty=(...t)=>e.check(Ka(1,...t)),e.lowercase=t=>e.check(function(e){return new _n({check:"string_format",format:"lowercase",...Tr(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Rn({check:"string_format",format:"uppercase",...Tr(e)})}(t)),e.trim=()=>e.check(Za(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Za(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Za(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Za(e=>e.toUpperCase()))}),Ho=or("ZodString",(e,t)=>{Fn.init(e,t),Ko.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Tr(t)})}(Jo,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Tr(t)})}(Qo,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Tr(t)})}(mi,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Tr(t)})}(ei,t)),e.guid=t=>e.check($a(Yo,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Tr(t)})}(Xo,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Tr(t)})}(Xo,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Tr(t)})}(Xo,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Tr(t)})}(Xo,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Tr(t)})}(ti,t)),e.guid=t=>e.check($a(Yo,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Tr(t)})}(ri,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Tr(t)})}(ni,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Tr(t)})}(ai,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Tr(t)})}(ui,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Tr(t)})}(fi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Tr(t)})}(oi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Tr(t)})}(ii,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Tr(t)})}(si,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Tr(t)})}(ci,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Tr(t)})}(li,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Tr(t)})}(di,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Tr(t)})}(pi,t)),e.datetime=t=>e.check(Eo(t)),e.date=t=>e.check(To(t)),e.time=t=>e.check(_o(t)),e.duration=t=>e.check(Po(t))});function Zo(e){return function(e,t){return new e({type:"string",...Tr(t)})}(Ho,e)}const qo=or("ZodStringFormat",(e,t)=>{zn.init(e,t),Ko.init(e,t)}),Jo=or("ZodEmail",(e,t)=>{Wn.init(e,t),qo.init(e,t)}),Yo=or("ZodGUID",(e,t)=>{jn.init(e,t),qo.init(e,t)}),Xo=or("ZodUUID",(e,t)=>{Bn.init(e,t),qo.init(e,t)}),Qo=or("ZodURL",(e,t)=>{Vn.init(e,t),qo.init(e,t)}),ei=or("ZodEmoji",(e,t)=>{$n.init(e,t),qo.init(e,t)}),ti=or("ZodNanoID",(e,t)=>{Gn.init(e,t),qo.init(e,t)}),ri=or("ZodCUID",(e,t)=>{Kn.init(e,t),qo.init(e,t)}),ni=or("ZodCUID2",(e,t)=>{Hn.init(e,t),qo.init(e,t)}),ai=or("ZodULID",(e,t)=>{Zn.init(e,t),qo.init(e,t)}),oi=or("ZodXID",(e,t)=>{qn.init(e,t),qo.init(e,t)}),ii=or("ZodKSUID",(e,t)=>{Jn.init(e,t),qo.init(e,t)}),si=or("ZodIPv4",(e,t)=>{ta.init(e,t),qo.init(e,t)}),ci=or("ZodIPv6",(e,t)=>{ra.init(e,t),qo.init(e,t)}),li=or("ZodCIDRv4",(e,t)=>{na.init(e,t),qo.init(e,t)}),di=or("ZodCIDRv6",(e,t)=>{aa.init(e,t),qo.init(e,t)}),ui=or("ZodBase64",(e,t)=>{ia.init(e,t),qo.init(e,t)}),fi=or("ZodBase64URL",(e,t)=>{sa.init(e,t),qo.init(e,t)}),pi=or("ZodE164",(e,t)=>{ca.init(e,t),qo.init(e,t)}),mi=or("ZodJWT",(e,t)=>{la.init(e,t),qo.init(e,t)}),hi=or("ZodUnknown",(e,t)=>{da.init(e,t),Go.init(e,t)});function gi(){return new hi({type:"unknown"})}const vi=or("ZodNever",(e,t)=>{ua.init(e,t),Go.init(e,t)});function bi(e){return function(e,t){return new e({type:"never",...Tr(t)})}(vi,e)}const yi=or("ZodArray",(e,t)=>{pa.init(e,t),Go.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(Ka(t,r)),e.nonempty=t=>e.check(Ka(1,t)),e.max=(t,r)=>e.check(Ga(t,r)),e.length=(t,r)=>e.check(Ha(t,r)),e.unwrap=()=>e.element});const wi=or("ZodObject",(e,t)=>{ba.init(e,t),Go.init(e,t),hr(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ai({type:"enum",entries:r,...Tr(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:gi()}),e.loose=()=>e.clone({...e._zod.def,catchall:gi()}),e.strict=()=>e.clone({...e._zod.def,catchall:bi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Sr(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=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gr(this,"shape",r),r},checks:[]});return Cr(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!Sr(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 gr(this,"shape",r),r},checks:e._zod.def.checks};return Cr(e,r)}(e,t),e.merge=t=>function(e,t){const r=vr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gr(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Cr(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def;return Cr(e,vr(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 gr(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=vr(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 gr(this,"shape",n),n},checks:[]});return Cr(e,n)}(e,t),e.partial=(...t)=>function(e,t,r){const n=vr(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 gr(this,"shape",a),a},checks:[]});return Cr(t,n)}(Ci,e,t[0]),e.required=(...t)=>function(e,t,r){const n=vr(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 gr(this,"shape",a),a},checks:[]});return Cr(t,n)}(Oi,e,t[0])});function xi(e,t){const r={type:"object",get shape(){var t;return gr(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...Tr(t)};return new wi(r)}const Si=or("ZodUnion",(e,t)=>{wa.init(e,t),Go.init(e,t),e.options=t.options});const ki=or("ZodIntersection",(e,t)=>{xa.init(e,t),Go.init(e,t)});const Ai=or("ZodEnum",(e,t)=>{Aa.init(e,t),Go.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 Ai({...t,checks:[],...Tr(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 Ai({...t,checks:[],...Tr(n),entries:a})}});const Ei=or("ZodTransform",(e,t)=>{Ea.init(e,t),Go.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new sr(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Dr(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(Dr(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Ci=or("ZodOptional",(e,t)=>{Ta.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ti(e){return new Ci({type:"optional",innerType:e})}const Ni=or("ZodNullable",(e,t)=>{Na.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _i(e){return new Ni({type:"nullable",innerType:e})}const Ri=or("ZodDefault",(e,t)=>{_a.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Pi=or("ZodPrefault",(e,t)=>{Pa.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Oi=or("ZodNonOptional",(e,t)=>{Oa.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Di=or("ZodCatch",(e,t)=>{Ia.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Ii=or("ZodPipe",(e,t)=>{Ua.init(e,t),Go.init(e,t),e.in=t.in,e.out=t.out});function Ui(e,t){return new Ii({type:"pipe",in:e,out:t})}const Mi=or("ZodReadonly",(e,t)=>{La.init(e,t),Go.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Li=or("ZodCustom",(e,t)=>{za.init(e,t),Go.init(e,t)});function Fi(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},zi(o,...r)]}function zi(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function ji(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}var Bi=globalThis?.document?n.useLayoutEffect:()=>{};function Wi(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Vi(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Wi(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():Wi(e[t],null)}}}}function $i(...e){return n.useCallback(Vi(...e),e)}function Gi(e){const r=Hi(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(qi);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var Ki=Gi("Slot");function Hi(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?Vi(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zi=Symbol("radix.slottable");function qi(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Zi}var Ji=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=Gi(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var Yi,Xi={exports:{}},Qi={};function es(){if(Yi)return Qi;Yi=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),c=r({inst:{value:a,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=a,l.getSnapshot=t,s(l)&&d({inst:l})},[e,a,t]),n(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(a),a};return Qi.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,Qi}var ts,rs,ns={};
27
+ /**
28
+ * @license React
29
+ * use-sync-external-store-shim.development.js
30
+ *
31
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */function as(){return ts||(ts=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){c||void 0===t.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};ns.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ns}function os(){return rs||(rs=1,"production"===process.env.NODE_ENV?Xi.exports=es():Xi.exports=as()),Xi.exports}var is=os();function ss(){return()=>{}}var cs="Avatar",[ls,ds]=Fi(cs),[us,fs]=ls(cs),ps=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(us,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(Ji.span,{...o,ref:r})})});ps.displayName=cs;var ms="AvatarImage",hs=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,c=fs(ms,a),l=function(e,{referrerPolicy:t,crossOrigin:r}){const a=is.useSyncExternalStore(ss,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,c]=n.useState(()=>bs(i,e));return Bi(()=>{c(bs(i,e))},[i,e]),Bi(()=>{const e=e=>()=>{c(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=ji(e=>{i(e),c.onImageLoadingStatusChange(e)});return Bi(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?t(Ji.img,{...s,ref:r,src:o}):null});hs.displayName=ms;var gs="AvatarFallback",vs=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=fs(gs,a),[c,l]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==s.imageLoadingStatus?t(Ji.span,{...i,ref:r}):null});function bs(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}vs.displayName=gs;var ys=ps,ws=hs,xs=vs;function Ss(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=Ss(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ks(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Ss(e))&&(n&&(n+=" "),n+=t);return n}const As=e=>{const t=Ns(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),Es(r,t)||Ts(e)},getConflictingClassGroupIds:(e,t)=>{const a=r[e]||[];return t&&n[e]?[...a,...n[e]]:a}}},Es=(e,t)=>{if(0===e.length)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?Es(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},Cs=/^\[(.+)\]$/,Ts=e=>{if(Cs.test(e)){const t=Cs.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Ns=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const e in r)_s(r[e],n,e,t);return n},_s=(e,t,r,n)=>{e.forEach(e=>{if("string"==typeof e){return void((""===e?t:Rs(t,e)).classGroupId=r)}if("function"==typeof e)return Ps(e)?void _s(e(n),t,r,n):void t.validators.push({validator:e,classGroupId:r});Object.entries(e).forEach(([e,a])=>{_s(a,Rs(t,e),r,n)})})},Rs=(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},Ps=e=>e.isThemeGetter,Os=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)}}},Ds=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;for(let i=0;i<e.length;i++){let 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.substring(o),s=Is(i);return{modifiers:t,hasImportantModifier:s!==i,baseClassName:s,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},Is=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,Us=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}},Ms=/\s+/;function Ls(){let e,t,r=0,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Fs(e))&&(n&&(n+=" "),n+=t);return n}const Fs=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Fs(e[n]))&&(r&&(r+=" "),r+=t);return r};function zs(e,...t){let r,n,a,o=function(s){const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:Os(e.cacheSize),parseClassName:Ds(e),sortModifiers:Us(e),...As(e)}))(c),n=r.cache.get,a=r.cache.set,o=i,i(s)};function i(e){const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(Ms);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=o(d).join(":"),v=u?g+"!":g,b=v+h;if(i.includes(b))continue;i.push(b);const y=a(h,m);for(let e=0;e<y.length;++e){const t=y[e];i.push(v+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o}return function(){return o(Ls.apply(null,arguments))}}const js=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},Bs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vs=/^\d+\/\d+$/,$s=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gs=/\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$/,Ks=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hs=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qs=e=>Vs.test(e),Js=e=>!!e&&!Number.isNaN(Number(e)),Ys=e=>!!e&&Number.isInteger(Number(e)),Xs=e=>e.endsWith("%")&&Js(e.slice(0,-1)),Qs=e=>$s.test(e),ec=()=>!0,tc=e=>Gs.test(e)&&!Ks.test(e),rc=()=>!1,nc=e=>Hs.test(e),ac=e=>Zs.test(e),oc=e=>!sc(e)&&!pc(e),ic=e=>wc(e,Ac,rc),sc=e=>Bs.test(e),cc=e=>wc(e,Ec,tc),lc=e=>wc(e,Cc,Js),dc=e=>wc(e,Sc,rc),uc=e=>wc(e,kc,ac),fc=e=>wc(e,Nc,nc),pc=e=>Ws.test(e),mc=e=>xc(e,Ec),hc=e=>xc(e,Tc),gc=e=>xc(e,Sc),vc=e=>xc(e,Ac),bc=e=>xc(e,kc),yc=e=>xc(e,Nc,!0),wc=(e,t,r)=>{const n=Bs.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},xc=(e,t,r=!1)=>{const n=Ws.exec(e);return!!n&&(n[1]?t(n[1]):r)},Sc=e=>"position"===e||"percentage"===e,kc=e=>"image"===e||"url"===e,Ac=e=>"length"===e||"size"===e||"bg-size"===e,Ec=e=>"length"===e,Cc=e=>"number"===e,Tc=e=>"family-name"===e,Nc=e=>"shadow"===e,_c=zs(()=>{const e=js("color"),t=js("font"),r=js("text"),n=js("font-weight"),a=js("tracking"),o=js("leading"),i=js("breakpoint"),s=js("container"),c=js("spacing"),l=js("radius"),d=js("shadow"),u=js("inset-shadow"),f=js("text-shadow"),p=js("drop-shadow"),m=js("blur"),h=js("perspective"),g=js("aspect"),v=js("ease"),b=js("animate"),y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",pc,sc],w=()=>[pc,sc,c],x=()=>[qs,"full","auto",...w()],S=()=>[Ys,"none","subgrid",pc,sc],k=()=>["auto",{span:["full",Ys,pc,sc]},Ys,pc,sc],A=()=>[Ys,"auto",pc,sc],E=()=>["auto","min","max","fr",pc,sc],C=()=>["auto",...w()],T=()=>[qs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[e,pc,sc],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",gc,dc,{position:[pc,sc]}],R=()=>["auto","cover","contain",vc,ic,{size:[pc,sc]}],P=()=>[Xs,mc,cc],O=()=>["","none","full",l,pc,sc],D=()=>["",Js,mc,cc],I=()=>[Js,Xs,gc,dc],U=()=>["","none",m,pc,sc],M=()=>["none",Js,pc,sc],L=()=>["none",Js,pc,sc],F=()=>[Js,pc,sc],z=()=>[qs,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qs],breakpoint:[Qs],color:[ec],container:[Qs],"drop-shadow":[Qs],ease:["in","out","in-out"],font:[oc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qs],shadow:[Qs],spacing:["px",Js],text:[Qs],"text-shadow":[Qs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qs,sc,pc,g]}],container:["container"],columns:[{columns:[Js,sc,pc,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object: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:[Ys,"auto",pc,sc]}],basis:[{basis:[qs,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Js,qs,"auto","initial","none",sc]}],grow:[{grow:["",Js,pc,sc]}],shrink:[{shrink:["",Js,pc,sc]}],order:[{order:[Ys,"first","last","none",pc,sc]}],"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:T()}],w:[{w:[s,"screen",...T()]}],"min-w":[{"min-w":[s,"screen","none",...T()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,mc,cc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,pc,lc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xs,sc]}],"font-family":[{font:[hc,sc,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,pc,sc]}],"line-clamp":[{"line-clamp":[Js,"none",pc,lc]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",pc,sc]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pc,sc]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Js,"from-font","auto",pc,cc]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Js,"auto",pc,sc]}],"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",pc,sc]}],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",pc,sc]}],"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:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ys,pc,sc],radial:["",pc,sc],conic:[Ys,pc,sc]},bc,uc]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],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:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"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:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Js,pc,sc]}],"outline-w":[{outline:["",Js,mc,cc]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",d,yc,fc]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",u,yc,fc]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Js,cc]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",f,yc,fc]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Js,pc,sc]}],"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":[Js]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[pc,sc]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"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":[Js]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"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:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pc,sc]}],filter:[{filter:["","none",pc,sc]}],blur:[{blur:U()}],brightness:[{brightness:[Js,pc,sc]}],contrast:[{contrast:[Js,pc,sc]}],"drop-shadow":[{"drop-shadow":["","none",p,yc,fc]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Js,pc,sc]}],"hue-rotate":[{"hue-rotate":[Js,pc,sc]}],invert:[{invert:["",Js,pc,sc]}],saturate:[{saturate:[Js,pc,sc]}],sepia:[{sepia:["",Js,pc,sc]}],"backdrop-filter":[{"backdrop-filter":["","none",pc,sc]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Js,pc,sc]}],"backdrop-contrast":[{"backdrop-contrast":[Js,pc,sc]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Js,pc,sc]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Js,pc,sc]}],"backdrop-invert":[{"backdrop-invert":["",Js,pc,sc]}],"backdrop-opacity":[{"backdrop-opacity":[Js,pc,sc]}],"backdrop-saturate":[{"backdrop-saturate":[Js,pc,sc]}],"backdrop-sepia":[{"backdrop-sepia":["",Js,pc,sc]}],"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",pc,sc]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Js,"initial",pc,sc]}],ease:[{ease:["linear","initial",v,pc,sc]}],delay:[{delay:[Js,pc,sc]}],animate:[{animate:["none",b,pc,sc]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,pc,sc]}],"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:L()}],"scale-x":[{"scale-x":L()}],"scale-y":[{"scale-y":L()}],"scale-z":[{"scale-z":L()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[pc,sc,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:z()}],"translate-x":[{"translate-x":z()}],"translate-y":[{"translate-y":z()}],"translate-z":[{"translate-z":z()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"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",pc,sc]}],"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",pc,sc]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Js,mc,cc,lc]}],stroke:[{stroke:["none",...N()]}],"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 Rc(...e){return _c(ks(e))}const Pc=n.forwardRef(({className:e,...r},n)=>t(ys,{ref:n,className:Rc("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));Pc.displayName=ys.displayName;const Oc=n.forwardRef(({className:e,...r},n)=>t(ws,{ref:n,className:Rc("aspect-square h-full w-full",e),...r}));Oc.displayName=ws.displayName;const Dc=n.forwardRef(({className:e,...r},n)=>t(xs,{ref:n,className:Rc("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));Dc.displayName=xs.displayName;const Ic=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Uc=ks,Mc=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Uc(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=Ic(t)||Ic(n);return a[e][i]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return Uc(e,i,c,null==r?void 0:r.class,null==r?void 0:r.className)},Lc=Mc("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"}}),Fc=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?Ki:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:Rc(Lc({variant:a,size:i,withIcon:null!=o||null!=s||null!=c,className:r})),ref:u,...d,children:[o&&t(fo,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,c&&n.cloneElement(c,{size:p})]})});function zc(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}Fc.displayName="Button";var jc=n[" useId ".trim().toString()]||(()=>{}),Bc=0;function Wc(e){const[t,r]=n.useState(jc());return Bi(()=>{r(e=>e??String(Bc++))},[e]),e||(t?`radix-${t}`:"")}var Vc=n[" useInsertionEffect ".trim().toString()]||Bi;function $c({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return Vc(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${a} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,a])}const d=n.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[c,e,i,s]);return[l,d]}var Gc,Kc="dismissableLayer.update",Hc="dismissableLayer.pointerDownOutside",Zc="dismissableLayer.focusOutside",qc=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jc=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=e,u=n.useContext(qc),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=$i(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=ji(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){Xc(Hc,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},m),A=function(e,t=globalThis?.document){const r=ji(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){Xc(Zc,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=ji(e);n.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Gc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Yc(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Gc)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Yc())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(Kc,e),()=>document.removeEventListener(Kc,e)},[]),t(Ji.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:zc(e.onFocusCapture,A.onFocusCapture),onBlurCapture:zc(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:zc(e.onPointerDownCapture,k.onPointerDownCapture)})});Jc.displayName="DismissableLayer";function Yc(){const e=new CustomEvent(Kc);document.dispatchEvent(e)}function Xc(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(qc),o=n.useRef(null),i=$i(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(Ji.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var Qc="focusScope.autoFocusOnMount",el="focusScope.autoFocusOnUnmount",tl={bubbles:!1,cancelable:!0},rl=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=e,[l,d]=n.useState(null),u=ji(i),f=ji(s),p=n.useRef(null),m=$i(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:il(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||il(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&il(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[o,l,h.paused]),n.useEffect(()=>{if(l){sl.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Qc,tl);l.addEventListener(Qc,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(il(n,{select:t}),document.activeElement!==r)return}((e=nl(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&il(l))}return()=>{l.removeEventListener(Qc,u),setTimeout(()=>{const e=new CustomEvent(el,tl);l.addEventListener(el,f),l.dispatchEvent(e),e.defaultPrevented||il(t??document.body,{select:!0}),l.removeEventListener(el,f),sl.remove(h)},0)}}var e},[l,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[n,o]=function(e){const t=nl(e),r=al(t,e),n=al(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&il(o,{select:!0})):(e.preventDefault(),a&&il(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(Ji.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function nl(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 al(e,t){for(const r of e)if(!ol(r,{upTo:t}))return r}function ol(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 il(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()}}rl.displayName="FocusScope";var sl=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=cl(e,t),e.unshift(t)},remove(t){e=cl(e,t),e[0]?.resume()}}}();function cl(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var ll=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);Bi(()=>s(!0),[]);const c=a||i&&globalThis?.document?.body;return c?b.createPortal(t(Ji.div,{...o,ref:r}),c):null});ll.displayName="Portal";var dl=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=ul(a.current);i.current="mounted"===c?e:"none"},[c]),Bi(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=ul(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]),Bi(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=ul(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(l("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=ul(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=$i(a.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function ul(e){return e?.animationName||"none"}dl.displayName="Presence";var fl=0;function pl(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ml()),document.body.insertAdjacentElement("beforeend",e[1]??ml()),fl++,()=>{1===fl&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),fl--}},[])}function ml(){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 hl=function(){return hl=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},hl.apply(this,arguments)};function gl(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 vl="right-scroll-bar-position",bl="width-before-scroll-bar";function yl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var wl="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,xl=new WeakMap;function Sl(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return yl(e,t)})},(a=u(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return wl(function(){var t=xl.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||yl(e,null)}),n.forEach(function(e){r.has(e)||yl(e,a)})}xl.set(o,e)},[e]),o}function kl(e){return e}var Al=function(e){var t=e.sideCar,r=gl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,hl({},r))};Al.isSideCarExport=!0;var El=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=kl);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=hl({async:!0,ssr:!1},e),t}(),Cl=function(){},Tl=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:Cl,onWheelCapture:Cl,onTouchMoveCapture:Cl}),o=a[0],i=a[1],s=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,y=void 0===b?"div":b,w=e.gapMode,x=gl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Sl([r,t]),A=hl(hl({},x),o);return n.createElement(n.Fragment,null,u&&n.createElement(S,{sideCar:El,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(c),hl(hl({},A),{ref:k})):n.createElement(y,hl({},A,{className:l,ref:k}),c))});Tl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Tl.classNames={fullWidth:bl,zeroRight:vl};function Nl(){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 _l=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Nl())&&(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)}}},Rl=function(){var e,t=(e=_l(),function(t,r){n.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},Pl={left:0,top:0,right:0,gap:0},Ol=function(e){return parseInt(e||"",10)||0},Dl=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Pl;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[Ol(r),Ol(n),Ol(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])}},Il=Rl(),Ul="data-scroll-locked",Ml=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(Ul,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(vl," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(bl," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(vl," .").concat(vl," {\n right: 0 ").concat(n,";\n }\n \n .").concat(bl," .").concat(bl," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Ul,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},Ll=function(){var e=parseInt(document.body.getAttribute(Ul)||"0",10);return isFinite(e)?e:0},Fl=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(Ul,(Ll()+1).toString()),function(){var e=Ll()-1;e<=0?document.body.removeAttribute(Ul):document.body.setAttribute(Ul,e.toString())}},[]);var i=n.useMemo(function(){return Dl(o)},[o]);return n.createElement(Il,{styles:Ml(i,!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 Bl=!!zl&&{passive:!1},Wl=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])},Vl=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),$l(e,n)){var a=Gl(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},$l=function(e,t){return"v"===e?function(e){return Wl(e,"overflowY")}(t):function(e){return Wl(e,"overflowX")}(t)},Gl=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},Kl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hl=function(e){return[e.deltaX,e.deltaY]},Zl=function(e){return e&&"current"in e?e.current:e},ql=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Jl=0,Yl=[];function Xl(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ql,ed=(Ql=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(Jl++)[0],i=n.useState(Rl)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Zl),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=Kl(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],l="deltaY"in e?e.deltaY:i[1]-o[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=Vl(u,d);if(!f)return!0;if(f?n=u:(n="v"===u?"h":"v",f=Vl(u,d)),!f)return!1;if(!a.current&&"changedTouches"in e&&(c||l)&&(a.current=n),!n)return!0;var p=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),c=!1,l=o>0,d=0,u=0;do{if(!i)break;var f=Gl(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&$l(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(p,t,e,"h"===p?c:l)},[]),l=n.useCallback(function(e){var r=e;if(Yl.length&&Yl[Yl.length-1]===i){var n="deltaY"in r?Hl(r):Kl(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var o=(s.current.shards||[]).map(Zl).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:Xl(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=Kl(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,Hl(t),t.target,c(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,Kl(t),t.target,c(t,e.lockRef.current))},[]);n.useEffect(function(){return Yl.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Bl),document.addEventListener("touchmove",l,Bl),document.addEventListener("touchstart",u,Bl),function(){Yl=Yl.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,Bl),document.removeEventListener("touchmove",l,Bl),document.removeEventListener("touchstart",u,Bl)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:ql(o)}):null,m?n.createElement(Fl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},El.useMedium(Ql),Al),td=n.forwardRef(function(e,t){return n.createElement(Tl,hl({},e,{ref:t,sideCar:ed}))});td.classNames=Tl.classNames;var rd=new WeakMap,nd=new WeakMap,ad={},od=0,id=function(e){return e&&(e.host||id(e.parentNode))},sd=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=id(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]);ad[r]||(ad[r]=new WeakMap);var o=ad[r],i=[],s=new Set,c=new Set(a),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(rd.get(e)||0)+1,l=(o.get(e)||0)+1;rd.set(e,c),o.set(e,l),i.push(e),1===c&&a&&nd.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),od++,function(){i.forEach(function(e){var t=rd.get(e)-1,a=o.get(e)-1;rd.set(e,t),o.set(e,a),t||(nd.has(e)||e.removeAttribute(n),nd.delete(e)),a||e.removeAttribute(r)}),--od||(rd=new WeakMap,rd=new WeakMap,nd=new WeakMap,ad={})}},cd=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),sd(n,a,r,"aria-hidden")):function(){return null}},ld="Dialog",[dd,ud]=Fi(ld),[fd,pd]=dd(ld),md=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,l=n.useRef(null),d=n.useRef(null),[u,f]=$c({prop:o,defaultProp:i??!1,onChange:s,caller:ld});return t(fd,{scope:r,triggerRef:l,contentRef:d,contentId:Wc(),titleId:Wc(),descriptionId:Wc(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:c,children:a})};md.displayName=ld;var hd="DialogTrigger",gd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(hd,n),i=$i(r,o.triggerRef);return t(Ji.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Md(o.open),...a,ref:i,onClick:zc(e.onClick,o.onOpenToggle)})});gd.displayName=hd;var vd="DialogPortal",[bd,yd]=dd(vd,{forceMount:void 0}),wd=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=pd(vd,r);return t(bd,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(dl,{present:a||s.open,children:t(ll,{asChild:!0,container:i,children:e})}))})};wd.displayName=vd;var xd="DialogOverlay",Sd=n.forwardRef((e,r)=>{const n=yd(xd,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=pd(xd,e.__scopeDialog);return i.modal?t(dl,{present:a||i.open,children:t(Ad,{...o,ref:r})}):null});Sd.displayName=xd;var kd=Gi("DialogOverlay.RemoveScroll"),Ad=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(xd,n);return t(td,{as:kd,allowPinchZoom:!0,shards:[o.contentRef],children:t(Ji.div,{"data-state":Md(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Ed="DialogContent",Cd=n.forwardRef((e,r)=>{const n=yd(Ed,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=pd(Ed,e.__scopeDialog);return t(dl,{present:a||i.open,children:i.modal?t(Td,{...o,ref:r}):t(Nd,{...o,ref:r})})});Cd.displayName=Ed;var Td=n.forwardRef((e,r)=>{const a=pd(Ed,e.__scopeDialog),o=n.useRef(null),i=$i(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return cd(e)},[]),t(_d,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault())})}),Nd=n.forwardRef((e,r)=>{const a=pd(Ed,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t(_d,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),_d=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=a,u=pd(Ed,i),f=n.useRef(null),p=$i(o,f);return pl(),e(r,{children:[t(rl,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:t(Jc,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Md(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(jd,{titleId:u.titleId}),t(Bd,{contentRef:f,descriptionId:u.descriptionId})]})]})}),Rd="DialogTitle",Pd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(Rd,n);return t(Ji.h2,{id:o.titleId,...a,ref:r})});Pd.displayName=Rd;var Od="DialogDescription",Dd=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(Od,n);return t(Ji.p,{id:o.descriptionId,...a,ref:r})});Dd.displayName=Od;var Id="DialogClose",Ud=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=pd(Id,n);return t(Ji.button,{type:"button",...a,ref:r,onClick:zc(e.onClick,()=>o.onOpenChange(!1))})});function Md(e){return e?"open":"closed"}Ud.displayName=Id;var Ld="DialogTitleWarning",[Fd,zd]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Ld,{contentName:Ed,titleName:Rd,docsSlug:"dialog"}),jd=({titleId:e})=>{const t=zd(Ld),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Bd=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zd("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},Wd=md,Vd=gd,$d=wd,Gd=Sd,Kd=Cd,Hd=Pd,Zd=Dd,qd=Ud;function Jd(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 Yd=["color"],Xd=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,Yd);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),Qd=["color"],eu=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,Qd);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),tu=["color"],ru=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,tu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))}),nu=["color"],au=f(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=Jd(e,nu);return p("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),p("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:n,fillRule:"evenodd",clipRule:"evenodd"}))});const ou=Wd,iu=Vd,su=$d,cu=n.forwardRef(({className:e,...r},n)=>t(Gd,{ref:n,className:Rc("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r}));cu.displayName=Gd.displayName;const lu=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(ke);return e(su,{container:s,children:[t(cu,{}),e(Kd,{ref:i,className:Rc("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...o,children:[a,e(qd,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t(ru,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});lu.displayName=Kd.displayName;const du=({className:e,...r})=>t("div",{className:Rc("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});du.displayName="DialogHeader";const uu=n.forwardRef(({className:e,...r},n)=>t(Hd,{ref:n,className:Rc("text-lg font-semibold leading-none tracking-tight",e),...r}));uu.displayName=Hd.displayName;const fu=n.forwardRef(({className:e,...r},n)=>t(Zd,{ref:n,className:Rc("text-sm text-muted-foreground",e),...r}));fu.displayName=Zd.displayName;var pu=n.forwardRef((e,r)=>t(Ji.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pu.displayName="Label";var mu=pu;const hu=Mc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),gu=n.forwardRef(({className:e,...r},n)=>t(mu,{ref:n,className:Rc(hu(),e),...r}));gu.displayName=mu.displayName;const vu=st,bu=n.createContext({}),yu=({...e})=>t(bu.Provider,{value:{name:e.name},children:t(ht,{...e})}),wu=()=>{const e=n.useContext(bu),t=n.useContext(xu),{getFieldState:r,formState:a}=it(),o=r(e.name,a);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},xu=n.createContext({}),Su=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(xu.Provider,{value:{id:o},children:t("div",{ref:a,className:Rc("space-y-2",e),...r})})});Su.displayName="FormItem";const ku=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=wu();return t(gu,{ref:n,className:Rc(a&&"text-destructive",e),htmlFor:o,...r})});ku.displayName="FormLabel";const Au=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=wu();return t(Ki,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});Au.displayName="FormControl";const Eu=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=wu();return t("p",{ref:n,id:a,className:Rc("text-sm text-muted-foreground",e),...r})});Eu.displayName="FormDescription";const Cu=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=wu(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:Rc("text-sm font-medium text-destructive",e),...n,children:s}):null});Cu.displayName="FormMessage";const Tu=n.forwardRef(({className:e,type:r,...n},a)=>t("input",{type:r,className:Rc("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));function Nu(e){const r=e+"CollectionProvider",[n,o]=Fi(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};c.displayName=r;const l=e+"CollectionSlot",d=Gi(l),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=$i(r,s(l,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Gi(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,c=a.useRef(null),l=$i(r,c),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),t(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}Tu.displayName="Input";var _u=n.createContext(void 0);function Ru(e){const t=n.useContext(_u);return e||t||"ltr"}var Pu="rovingFocusGroup.onEntryFocus",Ou={bubbles:!1,cancelable:!0},Du="RovingFocusGroup",[Iu,Uu,Mu]=Nu(Du),[Lu,Fu]=Fi(Du,[Mu]),[zu,ju]=Lu(Du),Bu=n.forwardRef((e,r)=>t(Iu.Provider,{scope:e.__scopeRovingFocusGroup,children:t(Iu.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Wu,{...e,ref:r})})}));Bu.displayName=Du;var Wu=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=$i(r,m),g=Ru(s),[v,b]=$c({prop:c,defaultProp:l??null,onChange:d,caller:Du}),[y,w]=n.useState(!1),x=ji(u),S=Uu(a),k=n.useRef(!1),[A,E]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Pu,x),()=>e.removeEventListener(Pu,x)},[x]),t(zu,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:v,onItemFocus:n.useCallback(e=>b(e),[b]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>E(e=>e-1),[]),children:t(Ji.div,{tabIndex:y||0===A?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:zc(e.onMouseDown,()=>{k.current=!0}),onFocus:zc(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(Pu,Ou);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Ku([e.find(e=>e.active),e.find(e=>e.id===v),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:zc(e.onBlur,()=>w(!1))})})}),Vu="RovingFocusGroupItem",$u=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:c,...l}=e,d=Wc(),u=s||d,f=ju(Vu,a),p=f.currentTabStopId===u,m=Uu(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(Iu.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(Ji.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:zc(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:zc(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:zc(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Gu[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(()=>Ku(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=v}):c})})});$u.displayName=Vu;var Gu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ku(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 Hu=Bu,Zu=$u;function qu(e){const[t,r]=n.useState(void 0);return Bi(()=>{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 Ju(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Yu="Radio",[Xu,Qu]=Fi(Yu),[ef,tf]=Xu(Yu),rf=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=$i(a,e=>h(e)),v=n.useRef(!1),b=!m||(f||!!m.closest("form"));return e(ef,{scope:o,checked:s,disabled:l,children:[t(Ji.button,{type:"button",role:"radio","aria-checked":s,"data-state":sf(s),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:zc(r.onClick,e=>{s||u?.(),b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})}),b&&t(of,{control:m,bubbles:!v.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});rf.displayName=Yu;var nf="RadioIndicator",af=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=tf(nf,n);return t(dl,{present:a||i.checked,children:t(Ji.span,{"data-state":sf(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});af.displayName=nf;var of=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=$i(c,s),d=Ju(a),u=qu(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(Ji.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function sf(e){return e?"checked":"unchecked"}of.displayName="RadioBubbleInput";var cf=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lf="RadioGroup",[df,uf]=Fi(lf,[Fu,Qu]),ff=Fu(),pf=Qu(),[mf,hf]=df(lf),gf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=ff(n),h=Ru(d),[g,v]=$c({prop:i,defaultProp:o??null,onChange:f,caller:lf});return t(mf,{scope:n,name:a,required:s,disabled:c,value:g,onValueChange:v,children:t(Hu,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:t(Ji.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});gf.displayName=lf;var vf="RadioGroupItem",bf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=hf(vf,a),c=s.disabled||o,l=ff(a),d=pf(a),u=n.useRef(null),f=$i(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{cf.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),t(Zu,{asChild:!0,...l,focusable:!c,active:p,children:t(rf,{disabled:c,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:zc(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:zc(i.onFocus,()=>{m.current&&u.current?.click()})})})});bf.displayName=vf;var yf=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=pf(n);return t(af,{...o,...a,ref:r})});yf.displayName="RadioGroupIndicator";var wf=gf,xf=bf,Sf=yf;const kf=n.forwardRef(({className:e,...r},n)=>t(wf,{className:Rc("grid gap-2",e),...r,ref:n}));kf.displayName=wf.displayName;const Af=n.forwardRef(({className:e,...r},n)=>t(xf,{ref:n,className:Rc("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:t(Sf,{className:"flex items-center justify-center",children:t(eu,{className:"h-3.5 w-3.5 fill-primary"})})}));function Ef(e,[t,r]){return Math.min(r,Math.max(t,e))}Af.displayName=xf.displayName;var Cf="ScrollArea",[Tf,Nf]=Fi(Cf),[_f,Rf]=Tf(Cf),Pf=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...c}=e,[l,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[v,b]=n.useState(null),[y,w]=n.useState(0),[x,S]=n.useState(0),[k,A]=n.useState(!1),[E,C]=n.useState(!1),T=$i(r,e=>d(e)),N=Ru(i);return t(_f,{scope:a,type:o,dir:N,scrollHideDelay:s,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:t(Ji.div,{dir:N,...c,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});Pf.displayName=Cf;var Of="ScrollAreaViewport",Df=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:c,...l}=a,d=Rf(Of,i),u=$i(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:c}),t(Ji.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Df.displayName=Of;var If="ScrollAreaScrollbar",Uf=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Rf(If,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===e.orientation;return n.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?t(Mf,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(Lf,{...o,ref:r,forceMount:a}):"auto"===i.type?t(Ff,{...o,ref:r,forceMount:a}):"always"===i.type?t(zf,{...o,ref:r}):null});Uf.displayName=If;var Mf=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Rf(If,e.__scopeScrollArea),[s,c]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(dl,{present:a||s,children:t(Ff,{"data-state":s?"visible":"hidden",...o,ref:r})})}),Lf=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Rf(If,e.__scopeScrollArea),s="horizontal"===e.orientation,c=ap(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,s,d,c]),t(dl,{present:a||"hidden"!==l,children:t(zf,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:zc(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:zc(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Ff=n.forwardRef((e,r)=>{const a=Rf(If,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=n.useState(!1),l="horizontal"===e.orientation,d=ap(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;c(l?e:t)}},10);return op(a.viewport,d),op(a.content,d),t(dl,{present:o||s,children:t(zf,{"data-state":s?"visible":"hidden",...i,ref:r})})}),zf=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=Rf(If,e.__scopeScrollArea),s=n.useRef(null),c=n.useRef(0),[l,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Xf(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Qf(r),o=a/2,i=t||o,s=a-i,c=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return tp([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===a?t(jf,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=ep(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(Bf,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=ep(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),jf=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=Rf(If,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=$i(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t($f,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Qf(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),rp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Yf(c.paddingLeft),paddingEnd:Yf(c.paddingRight)}})}})}),Bf=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=Rf(If,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=$i(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t($f,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Qf(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),rp(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Yf(c.paddingTop),paddingEnd:Yf(c.paddingBottom)}})}})}),[Wf,Vf]=Tf(If),$f=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=Rf(If,a),[g,v]=n.useState(null),b=$i(r,e=>v(e)),y=n.useRef(null),w=n.useRef(""),x=h.viewport,S=o.content-o.viewport,k=ji(f),A=ji(d),E=ap(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 n.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[x,g,S,k]),n.useEffect(A,[o,A]),op(g,E),op(h.content,E),t(Wf,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:ji(s),onThumbPointerUp:ji(c),onThumbPositionChange:A,onThumbPointerDown:ji(l),children:t(Ji.div,{...m,ref:b,style:{position:"absolute",...m.style},onPointerDown:zc(e.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:zc(e.onPointerMove,C),onPointerUp:zc(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),y.current=null})})})}),Gf="ScrollAreaThumb",Kf=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=Vf(Gf,e.__scopeScrollArea);return t(dl,{present:n||o.hasThumb,children:t(Hf,{ref:r,...a})})}),Hf=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=Rf(Gf,a),c=Vf(Gf,a),{onThumbPositionChange:l}=c,d=$i(r,e=>c.onThumbChange(e)),u=n.useRef(void 0),f=ap(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=np(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),t(Ji.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:zc(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:zc(e.onPointerUp,c.onThumbPointerUp)})});Kf.displayName=Gf;var Zf="ScrollAreaCorner",qf=n.forwardRef((e,r)=>{const n=Rf(Zf,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Jf,{...e,ref:r}):null});qf.displayName=Zf;var Jf=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=Rf(Zf,a),[s,c]=n.useState(0),[l,d]=n.useState(0),u=Boolean(s&&l);return op(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),op(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?t(Ji.div,{...o,ref:r,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Yf(e){return e?parseInt(e,10):0}function Xf(e,t){const r=e/t;return isNaN(r)?0:r}function Qf(e){const t=Xf(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function ep(e,t,r="ltr"){const n=Qf(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,c=Ef(e,"ltr"===r?[0,i]:[-1*i,0]);return tp([0,i],[0,s])(c)}function tp(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 rp(e,t){return e>0&&e<t}var np=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function ap(e,t){const r=ji(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function op(e,t){const r=ji(t);Bi(()=>{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 ip=Pf,sp=Df,cp=qf;const lp=n.forwardRef(({className:r,children:n,...a},o)=>e(ip,{ref:o,className:Rc("relative overflow-hidden",r),...a,children:[t(sp,{className:"h-full w-full rounded-[inherit]",children:n}),t(dp,{}),t(cp,{})]}));lp.displayName=ip.displayName;const dp=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(Uf,{ref:a,orientation:r,className:Rc("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",e),...n,children:t(Kf,{className:Rc("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));dp.displayName=Uf.displayName;var up="horizontal",fp=["horizontal","vertical"],pp=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=up,...o}=e,i=function(e){return fp.includes(e)}(a)?a:up,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t(Ji.div,{"data-orientation":i,...s,...o,ref:r})});pp.displayName="Separator";var mp=pp;const hp=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(mp,{ref:o,decorative:n,orientation:r,className:Rc("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));function gp(){const e=ye(),t=be(e=>e.os),{serverUrl:r,version:n,orgId:a,settings:o}=t,i=m(!1),s=l(async()=>{if(i.current)return o||null;if(o)return o;if(!r||!n||!a)return null;i.current=!0;try{const t=F(),o=await fetch(`${r}/api/${n}/public/${a}/settings`,{headers:t});if(!o.ok)throw new Error("Failed to fetch settings");const i=await o.json();return e.os(Z(i)),i}catch(e){return console.error("Failed to fetch settings:",e),null}finally{i.current=!1}},[r,n,a,o,e]);return d(()=>{r&&n&&a&&!o&&!i.current&&s()},[r,n,a]),c(()=>({settings:o,getSettings:s}),[o,s])}hp.displayName=mp.displayName;var vp="AlertDialog",[bp,yp]=Fi(vp,[ud]),wp=ud(),xp=e=>{const{__scopeAlertDialog:r,...n}=e,a=wp(r);return t(Wd,{...a,...n,modal:!0})};xp.displayName=vp;var Sp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Vd,{...o,...a,ref:r})});Sp.displayName="AlertDialogTrigger";var kp=e=>{const{__scopeAlertDialog:r,...n}=e,a=wp(r);return t($d,{...a,...n})};kp.displayName="AlertDialogPortal";var Ap=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Gd,{...o,...a,ref:r})});Ap.displayName="AlertDialogOverlay";var Ep="AlertDialogContent",[Cp,Tp]=bp(Ep),Np=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=Zi,n}("AlertDialogContent"),_p=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,c=wp(o),l=n.useRef(null),d=$i(a,l),u=n.useRef(null);return t(Fd,{contentName:Ep,titleName:Rp,docsSlug:"alert-dialog",children:t(Cp,{scope:o,cancelRef:u,children:e(Kd,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:zc(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(Np,{children:i}),t(Lp,{contentRef:l})]})})})});_p.displayName=Ep;var Rp="AlertDialogTitle",Pp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Hd,{...o,...a,ref:r})});Pp.displayName=Rp;var Op="AlertDialogDescription",Dp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(Zd,{...o,...a,ref:r})});Dp.displayName=Op;var Ip=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=wp(n);return t(qd,{...o,...a,ref:r})});Ip.displayName="AlertDialogAction";var Up="AlertDialogCancel",Mp=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=Tp(Up,n),i=wp(n),s=$i(r,o);return t(qd,{...i,...a,ref:s})});Mp.displayName=Up;var Lp=({contentRef:e})=>{const t=`\`${Ep}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${Ep}\` by passing a \`${Op}\` 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 \`${Ep}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Fp=Ap,zp=_p,jp=Ip,Bp=Mp,Wp=Pp,Vp=Dp;const $p=xp,Gp=Sp,Kp=kp,Hp=n.forwardRef(({className:e,...r},n)=>t(Fp,{className:Rc("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r,ref:n}));Hp.displayName=Fp.displayName;const Zp=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(ke);return e(Kp,{container:i,children:[t(Hp,{}),t(zp,{ref:o,className:Rc("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",r),...a})]})});Zp.displayName=zp.displayName;const qp=({className:e,...r})=>t("div",{className:Rc("flex flex-col space-y-2 text-center sm:text-left",e),...r});qp.displayName="AlertDialogHeader";const Jp=({className:e,...r})=>t("div",{className:Rc("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Jp.displayName="AlertDialogFooter";const Yp=n.forwardRef(({className:e,...r},n)=>t(Wp,{ref:n,className:Rc("text-lg font-semibold",e),...r}));Yp.displayName=Wp.displayName;const Xp=n.forwardRef(({className:e,...r},n)=>t(Vp,{ref:n,className:Rc("text-sm text-muted-foreground",e),...r}));Xp.displayName=Vp.displayName;const Qp=n.forwardRef(({className:e,...r},n)=>t(jp,{ref:n,className:Rc(Lc(),e),...r}));Qp.displayName=jp.displayName;const em=n.forwardRef(({className:e,...r},n)=>t(Bp,{ref:n,className:Rc(Lc({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));em.displayName=Bp.displayName;const tm="saas-workspace-current",rm=()=>P(tm),nm=(e,t)=>!!e&&t.some(t=>t._id===e);function am(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 om({className:e,...r}){return t("div",{className:Rc("animate-pulse rounded-md bg-primary/10",e),...r})}function im(){return e("div",{className:"space-y-3.5",children:[t(om,{className:"h-10 w-full"}),t(om,{className:"h-10 w-full"}),t(om,{className:"h-10 w-full"})]})}const sm=({workspace:n})=>{const[a,o]=u(!1),{deleteWorkspace:i}=jy(),s=be(e=>e.auth.session?.user||null);if(!n)return t(im,{});const c=function(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>"string"==typeof e?e===t:"object"==typeof e&&null!==e&&"_id"in e&&e._id===t);return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}(n,s?.id??null);return"admin"===c?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e($p,{children:[t(Gp,{asChild:!0,children:e(Fc,{variant:"destructive",disabled:a,progress:a,children:[t(yo,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e(Zp,{children:[e(qp,{children:[t(Yp,{children:"Are you absolutely sure?"}),e(Xp,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(Jp,{children:[t(em,{disabled:a,children:"Cancel"}),t(Qp,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){S(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t(fo,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var cm="Switch",[lm,dm]=Fi(cm),[um,fm]=lm(cm),pm=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),v=$i(a,e=>g(e)),b=n.useRef(!1),y=!h||(p||!!h.closest("form")),[w,x]=$c({prop:s,defaultProp:c??!1,onChange:f,caller:cm});return e(um,{scope:o,checked:w,disabled:d,children:[t(Ji.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":vm(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:v,onClick:zc(r.onClick,e=>{x(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&t(gm,{control:h,bubbles:!b.current,name:i,value:u,checked:w,required:l,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});pm.displayName=cm;var mm="SwitchThumb",hm=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=fm(mm,n);return t(Ji.span,{"data-state":vm(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});hm.displayName=mm;var gm=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=$i(c,s),d=Ju(a),u=qu(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function vm(e){return e?"checked":"unchecked"}gm.displayName="SwitchBubbleInput";var bm=pm,ym=hm;const wm=n.forwardRef(({className:e,...r},n)=>t(bm,{className:Rc("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:t(ym,{className:Rc("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")})}));wm.displayName=bm.displayName;const xm=({workspaceId:r})=>{const[n,a]=u({}),{allFeatures:o,updateFeature:i,getWorkspace:s}=jy(),[c,l]=u(null),f=be(e=>e.auth.session?.user||null);if(d(()=>{s(r).then(l)},[r]),!c)return t(im,{});const p=am(c,f?.id??null);return t("div",{children:e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!o.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),o.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:o.map(r=>{const o=c?.features?.[r.slug];return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),t(wm,{disabled:n[r.slug]||!p,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(!c)return;a(r=>({...r,[e]:t}));const r=await i(c._id,e,t);l(r),a(t=>({...t,[e]:!1}))}(r.slug,e)})]},r._id)})})]})})};function Sm(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 km=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],Am=({workspace:r})=>{const[n,a]=u(!1),[o,i]=u("emoji"),[s,c]=u(),{updateWorkspace:l}=jy(),d=be(e=>e.auth.session?.user||null),f=Qt({resolver:Qa(xi({name:Zo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Zo().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(im,{});const p=am(r,d?.id??null);return e("div",{children:[!p&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(vu,{...f,children:e("form",{onSubmit:f.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:[t(yu,{control:f.control,name:"name",render:({field:r})=>e(Su,{children:[t(ku,{children:"Name"}),t(Au,{children:t(Tu,{placeholder:"My Awesome Workspace",...r,disabled:!p})}),t(Cu,{})]})}),e("div",{className:"space-y-4",children:[e("div",{children:[t(gu,{className:"text-sm font-medium",children:"Icon"}),t(Eu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(kf,{value:o,disabled:!p,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(Af,{value:"emoji",id:"emoji"}),e(gu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(vo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(Af,{value:"url",id:"url"}),e(gu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(uo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&t("span",{className:"text-2xl",children:s}),!s&&f.watch("image")?.trim()&&t("img",{src:f.watch("image")||void 0,alt:"Workspace preview"})]})]}),p&&t(lp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:km.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),f.setValue("image",Sm(e))})(e),disabled:!p,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(yu,{control:f.control,name:"image",render:({field:r})=>e(Su,{children:[t(ku,{children:"Image URL"}),t(Au,{children:t(Tu,{placeholder:"https://example.com/image.png",...r,disabled:!p})}),t(Eu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(Cu,{})]})}),f.watch("image")&&f.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:f.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:p&&t(Fc,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var Em=.999,Cm=/[\\\/_+.#"@\[\(\{&]/,Tm=/[\\\/_+.#"@\[\(\{&]/g,Nm=/[\s-]/,_m=/[\s-]/g;function Rm(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=Rm(e,t,r,n,p+1,o+1,i))>m&&(p===a?c*=1:Cm.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Tm))&&a>0&&(c*=Math.pow(Em,d.length))):Nm.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(_m))&&a>0&&(c*=Math.pow(Em,u.length))):(c*=.17,a>0&&(c*=Math.pow(Em,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=Rm(e,t,r,n,p+1,o+2,i))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return i[s]=m,m}function Pm(e){return e.toLowerCase().replace(_m," ")}function Om(e,t,r){return Rm(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Pm(e),Pm(t),0,0,{})}var Dm='[cmdk-group=""]',Im='[cmdk-group-items=""]',Um='[cmdk-item=""]',Mm=`${Um}:not([aria-disabled="true"])`,Lm="cmdk-item-select",Fm="data-value",zm=(e,t,r)=>Om(e,t,r),jm=n.createContext(void 0),Bm=()=>n.useContext(jm),Wm=n.createContext(void 0),Vm=()=>n.useContext(Wm),$m=n.createContext(void 0),Gm=n.forwardRef((e,t)=>{let r=oh(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=oh(()=>new Set),o=oh(()=>new Map),i=oh(()=>new Map),s=oh(()=>new Set),c=nh(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,y=Wc(),w=Wc(),x=Wc(),S=n.useRef(null),k=ch();ah(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,A.emit()}},[u]),ah(()=>{k(6,R)},[]);let A=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),T(),k(1,N);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=P())?void 0:e.id,A.emit()}),n||k(5,R),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}A.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{T(),A.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{_(),T(),r.current.value||N(),A.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&N(),A.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId: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:zm;return e?o(e,r.current.search,t):0}function T(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(Im);t?t.appendChild(e.parentElement===t?e:e.closest(`${Im} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${Im} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Dm}[${Fm}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function N(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Fm);A.setState("value",t||void 0)}function _(){var e,t,n,s;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of a.current){let a=C(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&l++}for(let[e,t]of o.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function R(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Dm))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Um}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Mm))||[])}function D(e){let t=O()[e];t&&A.setState("value",t.getAttribute(Fm))}function I(e){var t;let r=P(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&A.setState("value",o.getAttribute(Fm))}function U(e){let t,r=P(),n=null==r?void 0:r.closest(Dm);for(;n&&!t;)n=e>0?th(n,Dm):rh(n,Dm),t=null==n?void 0:n.querySelector(Mm);t?A.setState("value",t.getAttribute(Fm)):I(e)}let M=()=>D(O().length-1),L=e=>{e.preventDefault(),e.metaKey?M():e.altKey?U(1):I(1)},F=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?U(-1):I(-1)};return n.createElement(Ji.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&&L(e);break;case"ArrowDown":L(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),M();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(Lm);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:dh},l),lh(e,e=>n.createElement(Wm.Provider,{value:A},n.createElement(jm.Provider,{value:E},e))))}),Km=n.forwardRef((e,t)=>{var r,a;let o=Wc(),i=n.useRef(null),s=n.useContext($m),c=Bm(),l=nh(e),d=null!=(a=null==(r=l.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;ah(()=>{if(!d)return c.item(o,null==s?void 0:s.id)},[d]);let u=sh(o,i,[e.value,e.children,i],e.keywords),f=Vm(),p=ih(e=>e.value&&e.value===u.current),m=ih(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Lm,h),()=>t.removeEventListener(Lm,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:v,value:b,onSelect:y,forceMount:w,keywords:x,...S}=e;return n.createElement(Ji.div,{ref:Vi(i,t),...S,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||c.getDisablePointerSelection()?void 0:g,onClick:v?void 0:h},e.children)}),Hm=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=Wc(),c=n.useRef(null),l=n.useRef(null),d=Wc(),u=Bm(),f=ih(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));ah(()=>u.group(s),[]),sh(s,c,[e.value,e.heading,l]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(Ji.div,{ref:Vi(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),lh(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement($m.Provider,{value:p},e))))}),Zm=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=ih(e=>!e.search);return r||i?n.createElement(Ji.div,{ref:Vi(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),qm=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=Vm(),s=ih(e=>e.search),c=ih(e=>e.selectedItemId),l=Bm();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(Ji.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),Jm=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),c=ih(e=>e.selectedItemId),l=Bm();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),n.createElement(Ji.div,{ref:Vi(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":a,id:l.listId},lh(e,e=>n.createElement("div",{ref:Vi(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Ym=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...c}=e;return n.createElement(Wd,{open:r,onOpenChange:a},n.createElement($d,{container:s},n.createElement(Gd,{"cmdk-overlay":"",className:o}),n.createElement(Kd,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(Gm,{ref:t,...c}))))}),Xm=n.forwardRef((e,t)=>ih(e=>0===e.filtered.count)?n.createElement(Ji.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Qm=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(Ji.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},lh(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),eh=Object.assign(Gm,{List:Jm,Item:Km,Input:qm,Group:Hm,Separator:Zm,Dialog:Ym,Empty:Xm,Loading:Qm});function th(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function rh(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function nh(e){let t=n.useRef(e);return ah(()=>{t.current=e}),t}var ah="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function oh(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function ih(e){let t=Vm(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function sh(e,t,r,a=[]){let o=n.useRef(),i=Bm();return ah(()=>{var n;let s=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),c=a.map(e=>e.trim());i.value(e,s,c),null==(n=t.current)||n.setAttribute(Fm,s),o.current=s}),o}var ch=()=>{let[e,t]=n.useState(),r=oh(()=>new Map);return ah(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function lh({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var dh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const uh=n.forwardRef(({className:e,...r},n)=>t(eh,{ref:n,className:Rc("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));uh.displayName=eh.displayName;const fh=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(au,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(eh.Input,{ref:a,className:Rc("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...n})]}));fh.displayName=eh.Input.displayName;const ph=n.forwardRef(({className:e,...r},n)=>t(eh.List,{ref:n,className:Rc("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));ph.displayName=eh.List.displayName;n.forwardRef((e,r)=>t(eh.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=eh.Empty.displayName;const mh=n.forwardRef(({className:e,...r},n)=>t(eh.Group,{ref:n,className:Rc("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...r}));mh.displayName=eh.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(eh.Separator,{ref:n,className:Rc("-mx-1 h-px bg-border",e),...r})).displayName=eh.Separator.displayName;const hh=n.forwardRef(({className:e,...r},n)=>t(eh.Item,{ref:n,className:Rc("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r}));hh.displayName=eh.Item.displayName;const gh=["top","right","bottom","left"],vh=Math.min,bh=Math.max,yh=Math.round,wh=Math.floor,xh=e=>({x:e,y:e}),Sh={left:"right",right:"left",bottom:"top",top:"bottom"},kh={start:"end",end:"start"};function Ah(e,t,r){return bh(e,vh(t,r))}function Eh(e,t){return"function"==typeof e?e(t):e}function Ch(e){return e.split("-")[0]}function Th(e){return e.split("-")[1]}function Nh(e){return"x"===e?"y":"x"}function _h(e){return"y"===e?"height":"width"}const Rh=new Set(["top","bottom"]);function Ph(e){return Rh.has(Ch(e))?"y":"x"}function Oh(e){return Nh(Ph(e))}function Dh(e){return e.replace(/start|end/g,e=>kh[e])}const Ih=["left","right"],Uh=["right","left"],Mh=["top","bottom"],Lh=["bottom","top"];function Fh(e,t,r,n){const a=Th(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Uh:Ih:t?Ih:Uh;case"left":case"right":return t?Mh:Lh;default:return[]}}(Ch(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Dh)))),o}function zh(e){return e.replace(/left|right|bottom|top/g,e=>Sh[e])}function jh(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 Bh(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 Wh(e,t,r){let{reference:n,floating:a}=e;const o=Ph(t),i=Oh(t),s=_h(i),c=Ch(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(Th(t)){case"start":p[i]-=f*(r&&l?-1:1);break;case"end":p[i]+=f*(r&&l?-1:1)}return p}async function Vh(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Eh(t,e),m=jh(p),h=s[f?"floating"===u?"reference":"floating":u],g=Bh(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),v="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.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=Bh(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,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 $h(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gh(e){return gh.some(t=>e[t]>=0)}const Kh=new Set(["left","top"]);function Hh(){return"undefined"!=typeof window}function Zh(e){return Yh(e)?(e.nodeName||"").toLowerCase():"#document"}function qh(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Jh(e){var t;return null==(t=(Yh(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Yh(e){return!!Hh()&&(e instanceof Node||e instanceof qh(e).Node)}function Xh(e){return!!Hh()&&(e instanceof Element||e instanceof qh(e).Element)}function Qh(e){return!!Hh()&&(e instanceof HTMLElement||e instanceof qh(e).HTMLElement)}function eg(e){return!(!Hh()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof qh(e).ShadowRoot)}const tg=new Set(["inline","contents"]);function rg(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=mg(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!tg.has(a)}const ng=new Set(["table","td","th"]);function ag(e){return ng.has(Zh(e))}const og=[":popover-open",":modal"];function ig(e){return og.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const sg=["transform","translate","scale","rotate","perspective"],cg=["transform","translate","scale","rotate","perspective","filter"],lg=["paint","layout","strict","content"];function dg(e){const t=ug(),r=Xh(e)?mg(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||cg.some(e=>(r.willChange||"").includes(e))||lg.some(e=>(r.contain||"").includes(e))}function ug(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const fg=new Set(["html","body","#document"]);function pg(e){return fg.has(Zh(e))}function mg(e){return qh(e).getComputedStyle(e)}function hg(e){return Xh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gg(e){if("html"===Zh(e))return e;const t=e.assignedSlot||e.parentNode||eg(e)&&e.host||Jh(e);return eg(t)?t.host:t}function vg(e){const t=gg(e);return pg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qh(t)&&rg(t)?t:vg(t)}function bg(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=vg(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=qh(a);if(o){const e=yg(i);return t.concat(i,i.visualViewport||[],rg(a)?a:[],e&&r?bg(e):[])}return t.concat(a,bg(a,[],r))}function yg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wg(e){const t=mg(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Qh(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=yh(r)!==o||yh(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function xg(e){return Xh(e)?e:e.contextElement}function Sg(e){const t=xg(e);if(!Qh(t))return xh(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=wg(t);let i=(o?yh(r.width):r.width)/n,s=(o?yh(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const kg=xh(0);function Ag(e){const t=qh(e);return ug()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:kg}function Eg(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=xg(e);let i=xh(1);t&&(n?Xh(n)&&(i=Sg(n)):i=Sg(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==qh(e))&&t}(o,r,n)?Ag(o):xh(0);let c=(a.left+s.x)/i.x,l=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=qh(o),t=n&&Xh(n)?qh(n):n;let r=e,a=yg(r);for(;a&&n&&t!==r;){const e=Sg(a),t=a.getBoundingClientRect(),n=mg(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=i,r=qh(a),a=yg(r)}}return Bh({width:d,height:u,x:c,y:l})}function Cg(e,t){const r=hg(e).scrollLeft;return t?t.left+r:Eg(Jh(e)).left+r}function Tg(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Cg(e,r),y:r.top+t.scrollTop}}const Ng=new Set(["absolute","fixed"]);function _g(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=qh(e),n=Jh(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;const e=ug();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,c=a.offsetTop)}const l=Cg(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else l<=25&&(o+=l);return{width:o,height:i,x:s,y:c}}(e,r);else if("document"===t)n=function(e){const t=Jh(e),r=hg(e),n=e.ownerDocument.body,a=bh(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=bh(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Cg(e);const s=-r.scrollTop;return"rtl"===mg(n).direction&&(i+=bh(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Jh(e));else if(Xh(t))n=function(e,t){const r=Eg(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Qh(e)?Sg(e):xh(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=Ag(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Bh(n)}function Rg(e,t){const r=gg(e);return!(r===t||!Xh(r)||pg(r))&&("fixed"===mg(r).position||Rg(r,t))}function Pg(e,t,r){const n=Qh(t),a=Jh(t),o="fixed"===r,i=Eg(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=xh(0);function l(){c.x=Cg(a)}if(n||!n&&!o)if(("body"!==Zh(t)||rg(a))&&(s=hg(t)),n){const e=Eg(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?xh(0):Tg(a,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function Og(e){return"static"===mg(e).position}function Dg(e,t){if(!Qh(e)||"fixed"===mg(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Jh(e)===r&&(r=r.ownerDocument.body),r}function Ig(e,t){const r=qh(e);if(ig(e))return r;if(!Qh(e)){let t=gg(e);for(;t&&!pg(t);){if(Xh(t)&&!Og(t))return t;t=gg(t)}return r}let n=Dg(e,t);for(;n&&ag(n)&&Og(n);)n=Dg(n,t);return n&&pg(n)&&Og(n)&&!dg(n)?r:n||function(e){let t=gg(e);for(;Qh(t)&&!pg(t);){if(dg(t))return t;if(ig(t))return null;t=gg(t)}return null}(e)||r}const Ug={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=Jh(n),s=!!t&&ig(t.floating);if(n===i||s&&o)return r;let c={scrollLeft:0,scrollTop:0},l=xh(1);const d=xh(0),u=Qh(n);if((u||!u&&!o)&&(("body"!==Zh(n)||rg(i))&&(c=hg(n)),Qh(n))){const e=Eg(n);l=Sg(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?xh(0):Tg(i,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Jh,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[..."clippingAncestors"===r?ig(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=bg(e,[],!1).filter(e=>Xh(e)&&"body"!==Zh(e)),a=null;const o="fixed"===mg(e).position;let i=o?gg(e):e;for(;Xh(i)&&!pg(i);){const t=mg(i),r=dg(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&Ng.has(a.position)||rg(i)&&!r&&Rg(e,i))?n=n.filter(e=>e!==i):a=t,i=gg(i)}return t.set(e,n),n}(t,this._c):[].concat(r),n],i=o[0],s=o.reduce((e,r)=>{const n=_g(t,r,a);return e.top=bh(n.top,e.top),e.right=vh(n.right,e.right),e.bottom=vh(n.bottom,e.bottom),e.left=bh(n.left,e.left),e},_g(t,i,a));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:Ig,getElementRects:async function(e){const t=this.getOffsetParent||Ig,r=this.getDimensions,n=await r(e.floating);return{reference:Pg(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}=wg(e);return{width:t,height:r}},getScale:Sg,isElement:Xh,isRTL:function(e){return"rtl"===mg(e).direction}};function Mg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Lg(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=xg(e),d=a||o?[...l?bg(l):[],...bg(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&s?function(e,t){let r,n=null;const a=Jh(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(s||t(),!f||!p)return;const m={rootMargin:-wh(u)+"px "+-wh(a.clientWidth-(d+f))+"px "+-wh(a.clientHeight-(u+p))+"px "+-wh(d)+"px",threshold:bh(0,vh(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||Mg(l,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(l,r):null;let f,p=-1,m=null;i&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?Eg(e):null;return c&&function t(){const n=Eg(e);h&&!Mg(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 Fg=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=Ch(r),s=Th(r),c="y"===Ph(r),l=Kh.has(i)?-1:1,d=o&&c?-1:1,u=Eh(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof m&&(p="end"===s?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},zg=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=Eh(e,t),l={x:r,y:n},d=await Vh(t,c),u=Ph(Ch(a)),f=Nh(u);let p=l[f],m=l[u];if(o){const e="y"===f?"bottom":"right";p=Ah(p+d["y"===f?"top":"left"],p,p-d[e])}if(i){const e="y"===u?"bottom":"right";m=Ah(m+d["y"===u?"top":"left"],m,m-d[e])}const h=s.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:o,[u]:i}}}}}},jg=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=Eh(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=Ch(a),b=Ph(s),y=Ch(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(y||!h?[zh(s)]:function(e){const t=zh(e);return[Dh(e),t,Dh(t)]}(s)),S="none"!==m;!f&&S&&x.push(...Fh(s,h,m,w));const k=[s,...x],A=await Vh(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=Th(e),a=Oh(e),o=_h(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=zh(i)),[i,zh(i)]}(a,i,w);E.push(A[e[0]],A[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var T,N;const e=((null==(T=o.flip)?void 0:T.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&b!==Ph(t))||C.every(e=>Ph(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(N=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:N.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=C.filter(e=>{if(S){const t=Ph(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=s}if(a!==r)return{reset:{placement:r}}}return{}}}},Bg=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:c=()=>{},...l}=Eh(e,t),d=await Vh(t,l),u=Ch(a),f=Th(a),p="y"===Ph(a),{width:m,height:h}=o.floating;let g,v;"top"===u||"bottom"===u?(g=u,v=f===(await(null==i.isRTL?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,g="end"===f?"top":"bottom");const b=h-d.top-d.bottom,y=m-d.left-d.right,w=vh(h-d[g],b),x=vh(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=bh(d.left,0),t=bh(d.right,0),r=bh(d.top,0),n=bh(d.bottom,0);p?A=m-2*(0!==e||0!==t?e+t:bh(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:bh(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:k});const E=await i.getDimensions(s.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},Wg=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=Eh(e,t);switch(n){case"referenceHidden":{const e=$h(await Vh(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Gh(e)}}}case"escaped":{const e=$h(await Vh(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Gh(e)}}}default:return{}}}}},Vg=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=Eh(e,t)||{};if(null==l)return{};const u=jh(d),f={x:r,y:n},p=Oh(a),m=_h(p),h=await i.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==i.getOffsetParent?void 0:i.getOffsetParent(l));let k=S?S[y]:0;k&&await(null==i.isElement?void 0:i.isElement(S))||(k=s.floating[y]||o.floating[m]);const A=w/2-x/2,E=k/2-h[m]/2-1,C=vh(u[v],E),T=vh(u[b],E),N=C,_=k-h[m]-T,R=k/2-h[m]/2+A,P=Ah(N,R,_),O=!c.arrow&&null!=Th(a)&&R!==P&&o.reference[m]/2-(R<N?C:T)-h[m]/2<0,D=O?R<N?R-N:R-_:0;return{[p]:f[p]+D,data:{[p]:P,centerOffset:R-P-D,...O&&{alignmentOffset:D}},reset:O}}}),$g=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Eh(e,t),d={x:r,y:n},u=Ph(a),f=Nh(u);let p=d[f],m=d[u];const h=Eh(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var v,b;const e="y"===f?"width":"height",t=Kh.has(Ch(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(v=i.offset)?void 0:v[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(b=i.offset)?void 0:b[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Gg=(e,t,r)=>{const n=new Map,a={platform:Ug,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Wh(l,n,c),f=n,p={},m=0;for(let r=0;r<s.length;r++){const{name:o,fn:h}=s[r],{x:g,y:v,data:b,reset:y}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=v?v:u,p={...p,[o]:{...p[o],...b}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(l=!0===y.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):y.rects),({x:d,y:u}=Wh(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Kg="undefined"!=typeof document?h:function(){};function Hg(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(!Hg(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)&&!Hg(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Zg(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qg(e,t){const r=Zg(e);return Math.round(t*r)/r}function Jg(e){const t=n.useRef(e);return Kg(()=>{t.current=e}),t}const Yg=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?Vg({element:r.current,padding:n}).fn(t):{}:r?Vg({element:r,padding:n}).fn(t):{};var a}}),Xg=(e,t)=>({...Fg(e),options:[e,t]}),Qg=(e,t)=>({...zg(e),options:[e,t]}),ev=(e,t)=>({...$g(e),options:[e,t]}),tv=(e,t)=>({...jg(e),options:[e,t]}),rv=(e,t)=>({...Bg(e),options:[e,t]}),nv=(e,t)=>({...Wg(e),options:[e,t]}),av=(e,t)=>({...Yg(e),options:[e,t]});var ov=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(Ji.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});ov.displayName="Arrow";var iv=ov,sv="Popper",[cv,lv]=Fi(sv),[dv,uv]=cv(sv),fv=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(dv,{scope:r,anchor:o,onAnchorChange:i,children:a})};fv.displayName=sv;var pv="PopperAnchor",mv=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=uv(pv,a),c=n.useRef(null),l=$i(r,c),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(Ji.div,{...i,ref:l})});mv.displayName=pv;var hv="PopperContent",[gv,vv]=cv(hv),bv=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=uv(hv,a),[w,x]=n.useState(null),S=$i(r,e=>x(e)),[k,A]=n.useState(null),E=qu(k),C=E?.width??0,T=E?.height??0,N=o+("center"!==s?"-"+s:""),_="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],P=R.length>0,O={padding:_,boundary:R.filter(Sv),altBoundary:P},{refs:D,floatingStyles:I,placement:U,isPositioned:M,middlewareData:L}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);Hg(p,a)||m(a);const[h,g]=n.useState(null),[b,y]=n.useState(null),w=n.useCallback(e=>{e!==A.current&&(A.current=e,g(e))},[]),x=n.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),S=i||h,k=s||b,A=n.useRef(null),E=n.useRef(null),C=n.useRef(u),T=null!=l,N=Jg(l),_=Jg(o),R=Jg(d),P=n.useCallback(()=>{if(!A.current||!E.current)return;const e={placement:t,strategy:r,middleware:p};_.current&&(e.platform=_.current),Gg(A.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};O.current&&!Hg(C.current,t)&&(C.current=t,v.flushSync(()=>{f(t)}))})},[p,t,r,_,R]);Kg(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const O=n.useRef(!1);Kg(()=>(O.current=!0,()=>{O.current=!1}),[]),Kg(()=>{if(S&&(A.current=S),k&&(E.current=k),S&&k){if(N.current)return N.current(S,k,P);P()}},[S,k,P,N,T]);const D=n.useMemo(()=>({reference:A,floating:E,setReference:w,setFloating:x}),[w,x]),I=n.useMemo(()=>({reference:S,floating:k}),[S,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=qg(I.floating,u.x),n=qg(I.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Zg(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:P,refs:D,elements:I,floatingStyles:U}),[u,P,D,I,U])}({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>Lg(...e,{animationFrame:"always"===h}),elements:{reference:y.anchor},middleware:[Xg({mainAxis:i+T,alignmentAxis:c}),d&&Qg({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?ev():void 0,...O}),d&&tv({...O}),rv({...O,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&av({element:k,padding:l}),kv({arrowWidth:C,arrowHeight:T}),m&&nv({strategy:"referenceHidden",...O})]}),[F,z]=Av(U),j=ji(g);Bi(()=>{M&&j?.()},[M,j]);const B=L.arrow?.x,W=L.arrow?.y,V=0!==L.arrow?.centerOffset,[$,G]=n.useState();return Bi(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:M?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(" "),...L.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t(gv,{scope:a,placedSide:F,onArrowChange:A,arrowX:B,arrowY:W,shouldHideArrow:V,children:t(Ji.div,{"data-side":F,"data-align":z,...b,ref:S,style:{...b.style,animation:M?void 0:"none"}})})})});bv.displayName=hv;var yv="PopperArrow",wv={top:"bottom",right:"left",bottom:"top",left:"right"},xv=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=vv(yv,n),i=wv[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(iv,{...a,ref:r,style:{...a.style,display:"block"}})})});function Sv(e){return null!==e}xv.displayName=yv;var kv=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[c,l]=Av(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-s+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===c?(p=-s+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function Av(e){const[t,r="center"]=e.split("-");return[t,r]}var Ev=fv,Cv=mv,Tv=bv,Nv=xv,_v="Popover",[Rv,Pv]=Fi(_v,[lv]),Ov=lv(),[Dv,Iv]=Rv(_v),Uv=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!1}=e,l=Ov(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=$c({prop:o,defaultProp:i??!1,onChange:s,caller:_v});return t(Ev,{...l,children:t(Dv,{scope:r,contentId:Wc(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:c,children:a})})};Uv.displayName=_v;var Mv="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=Iv(Mv,a),s=Ov(a),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return n.useEffect(()=>(c(),()=>l()),[c,l]),t(Cv,{...s,...o,ref:r})}).displayName=Mv;var Lv="PopoverTrigger",Fv=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Iv(Lv,n),i=Ov(n),s=$i(r,o.triggerRef),c=t(Ji.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Jv(o.open),...a,ref:s,onClick:zc(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:t(Cv,{asChild:!0,...i,children:c})});Fv.displayName=Lv;var zv="PopoverPortal",[jv,Bv]=Rv(zv,{forceMount:void 0}),Wv=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=Iv(zv,r);return t(jv,{scope:r,forceMount:n,children:t(dl,{present:n||i.open,children:t(ll,{asChild:!0,container:o,children:a})})})};Wv.displayName=zv;var Vv="PopoverContent",$v=n.forwardRef((e,r)=>{const n=Bv(Vv,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=Iv(Vv,e.__scopePopover);return t(dl,{present:a||i.open,children:i.modal?t(Kv,{...o,ref:r}):t(Hv,{...o,ref:r})})});$v.displayName=Vv;var Gv=Gi("PopoverContent.RemoveScroll"),Kv=n.forwardRef((e,r)=>{const a=Iv(Vv,e.__scopePopover),o=n.useRef(null),i=$i(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return cd(e)},[]),t(td,{as:Gv,allowPinchZoom:!0,children:t(Zv,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zc(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:zc(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:zc(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Hv=n.forwardRef((e,r)=>{const a=Iv(Vv,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(Zv,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Zv=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=e,p=Iv(Vv,n),m=Ov(n);return pl(),t(rl,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(Jc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(Tv,{"data-state":Jv(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)"}})})})}),qv="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Iv(qv,n);return t(Ji.button,{type:"button",...a,ref:r,onClick:zc(e.onClick,()=>o.onOpenChange(!1))})}).displayName=qv;function Jv(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=Ov(n);return t(Nv,{...o,...a,ref:r})}).displayName="PopoverArrow";var Yv=Wv,Xv=$v;const Qv=Uv,eb=Fv,tb=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(ke);return t(Yv,{container:s,children:t(Xv,{ref:i,align:r,sideOffset:a,className:Rc("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})})});tb.displayName=Xv.displayName;const rb={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"},nb={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"},ab=[{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=nb[e.code]||"USD",r=rb[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function ob(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=ab.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose country"}),t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose country..."}),t(ph,{children:t(mh,{children:ab.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const ib=ab.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),sb=Array.from(new Set(ib.map(e=>e.value))).map(e=>ib.find(t=>t.value===e)).filter(e=>void 0!==e);function cb(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=sb.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text&&e("div",{children:[String(s.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.icon})]}),!s&&t("span",{className:"text-muted-foreground",children:"Choose Currency"}),t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose currency..."}),t(ph,{children:t(mh,{children:sb.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.icon})]},o.value))})})]})})]})}let lb=[{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:"🇮🇱"}];lb=lb.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),lb.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const db=lb.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 ub(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=db.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s&&e("div",{children:[String(s.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:s.flag})]}),!s&&"Choose language",t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose timezone..."}),t(ph,{children:t(mh,{children:db.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.label).trim(),t("span",{className:"ml-2 text-xs text-muted-foreground",children:o.flag})]},o.value))})})]})})]})}const fb=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function pb(r){const[n,a]=u(r.value||""),[o,i]=u(!1),s=fb.find(e=>e.value==n);return e(Qv,{open:o,onOpenChange:i,children:[t(eb,{asChild:!0,children:e(Fc,{variant:"outline",role:"combobox","aria-expanded":o,className:"justify-between overflow-hidden text-ellipsis",children:[s?.text||"Choose timezone",t(lo,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tb,{className:"p-0 overflow-hidden text-ellipsis",children:e(uh,{children:[t(fh,{placeholder:"Choose timezone..."}),t(ph,{children:t(mh,{children:fb.map(o=>e(hh,{className:Rc("whitespace-nowrap text-left",{"text-green-500":n===o.value}),value:o.value,defaultValue:o.value,onSelect:e=>{const t=o.value;a(t),r.onChange&&"function"==typeof r.onChange&&r.onChange(t),i(!1)},children:[n===o.value&&t(co,{className:Rc("mr-2 h-4 w-4 text-green-400",n===o.value?"opacity-100":"opacity-0")}),String(o.text).trim()]},o.value))})})]})})]})}const mb=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=jy(),[o,i]=u(!1),[s,c]=u(),[l,f]=u(0),p=Qt({resolver:Qa(xi({name:Zo().min(2,{message:"Name must be at least 2 characters."}),country:Zo().optional(),timezone:Zo().optional(),language:Zo().optional(),currency:Zo().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return d(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),s?e("div",{children:[t("div",{className:"space-y-4",children:t(vu,{...p,children:e("form",{onSubmit:p.handleSubmit(async function(e){i(!0),await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),i(!1)}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(Tu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),t(yu,{disabled:o,control:p.control,name:"name",render:({field:r})=>e(Su,{children:[t(ku,{children:"Name"}),t(Au,{children:t(Tu,{...r})}),t(Cu,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(ub,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(ob,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(cb,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(pb,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(Fc,{type:"submit",progress:o,disabled:o,children:"Save"}),t(Fc,{type:"button",variant:"outline",onClick:()=>{f(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),s?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):t(im,{})};var hb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});n.forwardRef((e,r)=>t(Ji.span,{...e,ref:r,style:{...hb,...e.style}})).displayName="VisuallyHidden";var gb=[" ","Enter","ArrowUp","ArrowDown"],vb=[" ","Enter"],bb="Select",[yb,wb,xb]=Nu(bb),[Sb,kb]=Fi(bb,[xb,lv]),Ab=lv(),[Eb,Cb]=Sb(bb),[Tb,Nb]=Sb(bb),_b=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:v}=r,b=Ab(a),[y,w]=n.useState(null),[x,S]=n.useState(null),[k,A]=n.useState(!1),E=Ru(f),[C,T]=$c({prop:i,defaultProp:s??!1,onChange:c,caller:bb}),[N,_]=$c({prop:l,defaultProp:d,onChange:u,caller:bb}),R=n.useRef(null),P=!y||(v||!!y.closest("form")),[O,D]=n.useState(new Set),I=Array.from(O).map(e=>e.props.value).join(";");return t(Ev,{...b,children:e(Eb,{required:g,scope:a,trigger:y,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:A,contentId:Wc(),value:N,onValueChange:_,open:C,onOpenChange:T,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t(yb.Provider,{scope:a,children:t(Tb,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{D(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{D(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),P?e(py,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:N,onChange:e=>_(e.target.value),disabled:h,form:v,children:[void 0===N?t("option",{value:""}):null,Array.from(O)]},I):null]})})};_b.displayName=bb;var Rb="SelectTrigger",Pb=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=Ab(a),c=Cb(Rb,a),l=c.disabled||o,d=$i(r,c.onTriggerChange),u=wb(a),f=n.useRef("touch"),[p,m,h]=hy(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=gy(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t(Cv,{asChild:!0,...s,children:t(Ji.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":my(c.value)?"":void 0,...i,ref:d,onClick:zc(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:zc(i.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:zc(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||gb.includes(e.key)&&(g(),e.preventDefault())})})})});Pb.displayName=Rb;var Ob="SelectValue",Db=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:c="",...l}=e,d=Cb(Ob,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=$i(n,d.onValueNodeChange);return Bi(()=>{u(f)},[u,f]),t(Ji.span,{...l,ref:p,style:{pointerEvents:"none"},children:my(d.value)?t(r,{children:c}):s})});Db.displayName=Ob;var Ib=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(Ji.span,{"aria-hidden":!0,...o,ref:r,children:a||"▼"})});Ib.displayName="SelectIcon";var Ub=e=>t(ll,{asChild:!0,...e});Ub.displayName="SelectPortal";var Mb="SelectContent",Lb=n.forwardRef((e,r)=>{const a=Cb(Mb,e.__scopeSelect),[o,i]=n.useState();if(Bi(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?v.createPortal(t(zb,{scope:e.__scopeSelect,children:t(yb.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(Wb,{...e,ref:r})});Lb.displayName=Mb;var Fb=10,[zb,jb]=Sb(Mb),Bb=Gi("SelectContent.RemoveScroll"),Wb=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b,...y}=e,w=Cb(Mb,a),[x,S]=n.useState(null),[k,A]=n.useState(null),E=$i(r,e=>S(e)),[C,T]=n.useState(null),[N,_]=n.useState(null),R=wb(a),[P,O]=n.useState(!1),D=n.useRef(!1);n.useEffect(()=>{if(x)return cd(x)},[x]),pl();const I=n.useCallback(e=>{const[t,...r]=R().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[R,k]),U=n.useCallback(()=>I([C,x]),[I,C,x]);n.useEffect(()=>{P&&U()},[P,U]);const{onOpenChange:M,triggerPointerDownPosRef:L}=w;n.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():x.contains(r.target)||M(!1),document.removeEventListener("pointermove",t),L.current=null};return null!==L.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,L]),n.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[F,z]=hy(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=gy(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!D.current&&!r;(void 0!==w.value&&w.value===t||n)&&(T(e),n&&(D.current=!0))},[w.value]),B=n.useCallback(()=>x?.focus(),[x]),W=n.useCallback((e,t,r)=>{const n=!D.current&&!r;(void 0!==w.value&&w.value===t||n)&&_(e)},[w.value]),V="popper"===o?$b:Vb,$=V===$b?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:b}:{};return t(zb,{scope:a,content:x,viewport:k,onViewportChange:A,itemRefCallback:j,selectedItem:C,onItemLeave:B,itemTextRefCallback:W,focusSelectedItem:U,selectedItemText:N,position:o,isPositioned:P,searchRef:F,children:t(td,{as:Bb,allowPinchZoom:!0,children:t(rl,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:zc(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(Jc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(V,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...y,...$,onPlaced:()=>O(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:zc(y.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});Wb.displayName="SelectContentImpl";var Vb=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=Cb(Mb,a),c=jb(Mb,a),[l,d]=n.useState(null),[u,f]=n.useState(null),p=$i(r,e=>f(e)),m=wb(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=c,x=n.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&v&&b&&y){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=y.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-Fb,u=Ef(o,[Fb,Math.max(Fb,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-Fb,u=Ef(o,[Fb,Math.max(Fb,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const a=m(),i=window.innerHeight-2*Fb,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-Fb,C=i-E,T=b.offsetHeight/2,N=f+p+(b.offsetTop+T),_=w-N;if(N<=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=N+Math.max(C,T+(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)+T)+_;l.style.height=t+"px",v.scrollTop=N-E+v.offsetTop}l.style.margin=`${Fb}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,v,b,y,s.dir,o]);Bi(()=>x(),[x]);const[S,k]=n.useState();Bi(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const A=n.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t(Gb,{scope:a,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:A,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:t(Ji.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Vb.displayName="SelectItemAlignedPosition";var $b=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=Fb,...i}=e,s=Ab(n);return t(Tv,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$b.displayName="SelectPopperPosition";var[Gb,Kb]=Sb(Mb,{}),Hb="SelectViewport",Zb=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...c}=a,l=jb(Hb,i),d=Kb(Hb,i),u=$i(o,l.onViewportChange),f=n.useRef(0);return e(r,{children:[t("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),t(yb.Slot,{scope:i,children:t(Ji.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:zc(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Fb,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});Zb.displayName=Hb;var qb="SelectGroup",[Jb,Yb]=Sb(qb);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Wc();return t(Jb,{scope:n,id:o,children:t(Ji.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=qb;var Xb="SelectLabel",Qb=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Yb(Xb,n);return t(Ji.div,{id:o.id,...a,ref:r})});Qb.displayName=Xb;var ey="SelectItem",[ty,ry]=Sb(ey),ny=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...c}=e,l=Cb(ey,a),d=jb(ey,a),u=l.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=$i(r,e=>d.itemRefCallback?.(e,o,i)),v=Wc(),b=n.useRef("touch"),y=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t(ty,{scope:a,value:o,disabled:i,textId:v,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(yb.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(Ji.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:g,onFocus:zc(c.onFocus,()=>h(!0)),onBlur:zc(c.onBlur,()=>h(!1)),onClick:zc(c.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:zc(c.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:zc(c.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:zc(c.onPointerMove,e=>{b.current=e.pointerType,i?d.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:zc(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:zc(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(vb.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});ny.displayName=ey;var ay="SelectItemText",oy=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:c,...l}=a,d=Cb(ay,i),u=jb(ay,i),f=ry(ay,i),p=Nb(ay,i),[m,h]=n.useState(null),g=$i(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),b=m?.textContent,y=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:b},f.value),[f.disabled,f.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return Bi(()=>(w(y),()=>x(y)),[w,x,y]),e(r,{children:[t(Ji.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?v.createPortal(l.children,d.valueNode):null]})});oy.displayName=ay;var iy="SelectItemIndicator",sy=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return ry(iy,n).isSelected?t(Ji.span,{"aria-hidden":!0,...a,ref:r}):null});sy.displayName=iy;var cy="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=jb(cy,e.__scopeSelect),o=Kb(cy,e.__scopeSelect),[i,s]=n.useState(!1),c=$i(r,o.onScrollButtonChange);return Bi(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(dy,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=cy;var ly="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=jb(ly,e.__scopeSelect),o=Kb(ly,e.__scopeSelect),[i,s]=n.useState(!1),c=$i(r,o.onScrollButtonChange);return Bi(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(dy,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=ly;var dy=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=jb("SelectScrollButton",a),c=n.useRef(null),l=wb(a),d=n.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),Bi(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t(Ji.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:zc(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:zc(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:zc(i.onPointerLeave,()=>{d()})})}),uy=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(Ji.div,{"aria-hidden":!0,...a,ref:r})});uy.displayName="SelectSeparator";var fy="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Ab(n),i=Cb(fy,n),s=jb(fy,n);return i.open&&"popper"===s.position?t(Nv,{...o,...a,ref:r}):null}).displayName=fy;var py=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=$i(o,i),c=Ju(r);return n.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),t(Ji.select,{...a,style:{...hb,...a.style},ref:s,defaultValue:r})});function my(e){return""===e||void 0===e}function hy(e){const t=ji(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function gy(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}py.displayName="SelectBubbleInput";var vy=Pb,by=Ib,yy=Ub,wy=Lb,xy=Zb,Sy=Qb,ky=ny,Ay=oy,Ey=sy,Cy=uy;const Ty=_b,Ny=n.forwardRef(({className:r,children:n,...a},o)=>e(vy,{ref:o,className:Rc("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),...a,children:[n,t(by,{asChild:!0,children:t(Xd,{className:"h-4 w-4 opacity-50"})})]}));Ny.displayName=vy.displayName;const _y=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(ke);return t(yy,{container:s,children:t(wy,{ref:i,className:Rc("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...o,children:t(xy,{className:Rc("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});_y.displayName=wy.displayName;n.forwardRef(({className:e,...r},n)=>t(Sy,{ref:n,className:Rc("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=Sy.displayName;const Ry=n.forwardRef(({className:r,children:n,...a},o)=>e(ky,{ref:o,className:Rc("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(Ey,{children:t(eu,{className:"h-4 w-4"})})}),t(Ay,{children:n})]}));Ry.displayName=ky.displayName;n.forwardRef(({className:e,...r},n)=>t(Cy,{ref:n,className:Rc("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=Cy.displayName;const Py=({workspace:r})=>{const n=be(e=>e.auth.session?.user||null),[a,o]=u(0),[i,s]=u(!1),[c,l]=u([]),{getUsers:f,removeUser:p,updateUser:m}=jy(),{settings:h}=gp();d(()=>{r&&(s(!0),f(r._id).then(e=>{l(e)}).catch(e=>{console.error(e)}).finally(()=>{s(!1)}))},[r,a]);const g=()=>{o(e=>e+1)};if(i||!r)return t(im,{});const v=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},b=c.map(e=>({...e,...v(e.user)})),y=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===y,x=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e("div",{children:[!w&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e("div",{className:"mb-4",children:[x&&t(Oy,{onInvite:g,workspaceId:r._id}),!x&&t("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),t("div",{children:t(Fc,{variant:"ghost",size:"sm",onClick:g,progress:i,startIcon:t(mo,{}),children:"Refresh"})})]}),t("ul",{className:"space-y-2",children:b.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[t("div",{children:e(Ty,{disabled:i||!w||s,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(am(r,n)?S(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):m(t,n,{role:o}).then(()=>{g()}).catch(e=>{S(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}));var t,n,o},children:[t(Ny,{children:t(Db,{placeholder:"Select a role"})}),t(_y,{children:r?.roles.map(e=>t(Ry,{value:e,children:e},e))})]})}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&w&&t(Fc,{variant:"destructive",size:"sm",startIcon:t(wo,{}),onClick:()=>{var e;e=a.id,am(r,e)?S(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{g()}).catch(t=>{S(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===c.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function Oy({onInvite:r,workspaceId:n}){const[a,o]=u(""),[i,s]=u("admin"),[c,l]=u(!1),[f,p]=u(null),[m,h]=u(null),{addUser:g,getWorkspace:v}=jy(),[b,y]=u(null),{settings:w}=gp(),x=w?.workspace.roles??b?.roles??[];d(()=>{n&&v(n).then(y)},[n]);const S=()=>{p(null),h(null),o(""),s("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[f&&t("div",{className:"text-red-500 capitalize",children:f}),m&&t("div",{className:"text-green-500 capitalize",children:m}),e("div",{children:[t(gu,{children:"Invite member by email"}),t(Tu,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(gu,{children:"Role"}),e(Ty,{value:i,onValueChange:s,children:[t(Ny,{children:t(Db,{placeholder:"Select a role"})}),t(_y,{children:x.map(e=>t(Ry,{value:e,children:e},e))})]})]}),t("div",{children:t(Fc,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void p("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await g(n,e,i).then(()=>{h("User invited successfully"),r?.()}).catch(e=>{console.error(e),p(e.message||"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{S()},6e3)})):p("Invalid email address format")},disabled:c||!a||!i,children:c?"Inviting...":`Invite as ${i}`})})]})}const Dy=({workspace:r,section:n,setSection:a})=>{const o=be(e=>e.auth.session?.user||null),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id;return e("div",{className:"w-56 h-full flex flex-col space-y-6",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:Rc("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(Iy,{title:"Account",children:t(Uy,{activeSection:n,icon:t(So,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(Iy,{title:"Workspace",children:[t(Uy,{activeSection:n,icon:t(go,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t(Uy,{activeSection:n,icon:t(ko,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t(Uy,{activeSection:n,icon:t(bo,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),i&&t(Uy,{activeSection:n,icon:t(xo,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function Iy({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function Uy({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:Rc("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 My=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[f,p]=u(!1),[m,h]=u(i),g=void 0!==a?a:f,v=o||p,b=void 0!==s?s:m,y=c||h;if(!r)return null;const w=t(Fc,{variant:"outline",size:"icon",children:t(go,{className:"h-4 w-4"})});return e(ou,{open:g,onOpenChange:e=>{v(e),!e&&n&&n()},children:[l&&t(iu,{asChild:!0,children:d||w}),e(lu,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[t(fu,{className:"sr-only",children:"Workspace settings dialog"}),t(Dy,{workspace:r,section:b,setSection:y}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(uu,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===b&&t(mb,{workspace:r}),"general"===b&&t(Am,{workspace:r}),"users"===b&&t(Py,{workspace:r}),"features"===b&&t(xm,{workspaceId:r._id?.toString()}),"danger"===b&&t(sm,{workspace:r})]})]})]})]})};function Ly(n){const{workspaces:a,currentWorkspace:o,loading:i,refreshing:s}=be(e=>e.workspaces),c=be(e=>e.auth.session?.user),{settings:l}=gp(),[f,p]=u(!1),[m,h]=u(0),[g,v]=u(""),{fetchWorkspaces:b,getFeatures:y,refreshWorkspaces:w,setCurrentWorkspace:x,workspaces:S}=jy(),k=i||s;d(()=>{0===S.length?(b(),y()):y()},[]),d(()=>{m>0&&w()},[m]);const A=S.length>0?S:a,E=A.filter(e=>e._id!==o?._id).filter(e=>e.name.toLowerCase().includes(g.toLowerCase())),C=l?.workspace.maxWorkspaces??Number.MAX_VALUE,T=A?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===c?.id?.toString()).length,N=C>(T??0);return e(ou,{open:f,onOpenChange:p,children:[t(iu,{children:n.trigger?.(k,o)}),e(lu,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(du,{children:[e(uu,{className:"flex items-center gap-2",children:[t(so,{className:"h-5 w-5"}),"Switch Workspace"]}),t(fu,{children:"Select a workspace to switch to or create a new one."})]}),!c&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&e("div",{className:"flex flex-col gap-4",children:[o&&t(Fy,{workspace:o,isCurrentWorkspace:!0,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:x,setOpen:p,workspacesToUse:A}),t(hp,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),t("div",{children:t(Fc,{progress:s,disabled:s,variant:"ghost",onClick:function(){h(e=>e+1)},startIcon:t(mo,{}),children:s?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(ho,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(Tu,{placeholder:"Search workspaces...",value:g,onChange:e=>v(e.target.value),className:"pl-10"})]}),i?e("div",{className:"flex items-center justify-center py-8",children:[t(fo,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e("div",{className:"text-center py-8",children:[t(so,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:g?"No workspaces found":"No workspaces available"})]}):t(lp,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(e=>{const r=e._id===o?._id;return t(Fy,{workspace:e,isCurrentWorkspace:r,onWorkspaceChange:n.onWorkspaceChange,onClose:()=>p(!1),setCurrentWorkspace:x,setOpen:p,workspacesToUse:A},e._id)})})})]}),N&&e(r,{children:[t(hp,{}),t(zy,{onCreated:()=>{b()}})]})]})]})]})}function Fy(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i}=r,s=r.isCurrentWorkspace??!1,[c,l]=u(!1);return e("div",{className:Rc("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":s}),children:[e(Pc,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(Oc,{src:n.image&&n.image.trim()?n.image:void 0})}),t(Dc,{children:(d=n.name,d.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(ko,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]})]}),e("div",{className:"flex items-center gap-2",children:[s?null:t(Fc,{size:"sm",disabled:c,progress:c,onClick:()=>{l(!0),r.onWorkspaceChange(n).then(()=>{a(n),o(!1)}).catch(e=>{S(e,{component:"WorkspaceItem",action:"onWorkspaceChange",metadata:{workspaceId:n._id}})}).finally(()=>{l(!1)})},children:"Switch to"}),t(My,{workspace:n,onClose:()=>{if(s){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var d}function zy(n){const[a,o]=u(!1),[i,s]=u("emoji"),[c,l]=u("🏢"),[d,f]=u(!1),{createWorkspace:p}=jy(),m=Qt({resolver:Qa(xi({name:Zo().min(2,{message:"Workspace name must be at least 2 characters."}),image:Zo().optional()})),defaultValues:{name:"",image:""}});return e(ou,{open:a,onOpenChange:o,children:[t(iu,{asChild:!0,children:e(Fc,{className:"w-full rounded-none",children:[t(po,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(lu,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(du,{children:[t(uu,{children:"Create New Workspace"}),t(fu,{children:"Create a new workspace to get started."})]}),t(vu,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){let t="";if("emoji"===i)t=Sm(c);else if("url"===i&&e.image)try{new URL(e.image),t=e.image}catch{return void m.setError("image",{message:"Please enter a valid URL"})}f(!0);try{await p(e.name,t),o(!1),m.reset(),l("🏢"),s("emoji"),n?.onCreated?.()}catch(e){console.error("Failed to create workspace:",e)}finally{f(!1)}}),children:[t(yu,{control:m.control,name:"name",render:({field:r})=>e(Su,{children:[t(ku,{children:"Workspace Name"}),t(Au,{children:t(Tu,{placeholder:"My Awesome Workspace",...r})}),t(Cu,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(gu,{className:"text-sm font-medium",children:"Workspace Icon"}),t(Eu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(kf,{value:i,onValueChange:e=>s(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(Af,{value:"emoji",id:"emoji"}),e(gu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(vo,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(Af,{value:"url",id:"url"}),e(gu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(uo,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===i&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),t(lp,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:km.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",Sm(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===i&&e("div",{className:"flex flex-col gap-y-2",children:[t(yu,{control:m.control,name:"image",render:({field:r})=>e(Su,{children:[t(ku,{children:"Image URL"}),t(Au,{children:t(Tu,{placeholder:"https://example.com/image.png",...r})}),t(Eu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(Cu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(Fc,{type:"button",variant:"outline",onClick:()=>{o(!1),m.reset(),l("🏢"),s("emoji")},disabled:d,children:"Cancel"}),t(Fc,{type:"submit",disabled:d,children:d?e(r,{children:[t(fo,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const jy=()=>{const e=ye(),t=be(e=>e.os),r=c(()=>new Te(t),[t]),n=be(e=>e.workspaces),o=be(e=>e.auth.session?.user),i=l(t=>{if(t._id!==n.currentWorkspace?._id&&t){const r=n.currentWorkspace;e.workspaces(ae(t)),Se.emitWorkspaceChanged(t,r).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]);d(()=>{if(!n.isInitialized){const t=rm();if(e.workspaces(ie(!0)),t){const e=n.workspaces.find(e=>e._id===t);if(e){if(e._id===n.currentWorkspace?._id)return;i(e)}}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,i]);const s=l(()=>{e.workspaces(oe())},[e]),u=a.useRef(!1),f=a.useRef(!1),p=l(async()=>{if(!n.loading&&!u.current){u.current=!0,e.workspaces(se(!0)),e.workspaces(ce(null));try{const t=await r.getWorkspaces();if(e.workspaces(re(t)),t.length>0){const e=rm();if(e&&nm(e,t)){const r=t.find(t=>t._id===e);r&&i(r)}else t.length>0&&(n.currentWorkspace||i(t[0]))}}catch(t){e.workspaces(ce(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(se(!1)),u.current=!1}}},[r,n.loading,n.currentWorkspace?._id,e,i]),m=l(async()=>{if(!n.refreshing&&!u.current){u.current=!0,e.workspaces(le(!0));try{const t=await r.getWorkspaces();e.workspaces(re(t))}catch(e){}finally{e.workspaces(le(!1)),u.current=!1}}},[r,n.refreshing,e]),h=l(async(t,a)=>{const o=await r.createWorkspace({name:t,image:a});e.workspaces(re([...n.workspaces,o])),Se.emitWorkspaceCreated(o).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),g=l(async(t,a)=>{const o=await r.updateWorkspace(t._id,a);e.workspaces(re(n.workspaces.map(e=>e._id===t._id?o:e))),Se.emitWorkspaceUpdated(o).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),v=l(async()=>{if(f.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;f.current=!0;try{const t=await r.getFeatures();return e.workspaces(ne(t)),t}catch(e){return S(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{f.current=!1}},[r,e,n.allFeatures]),b=l(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const e=n.currentWorkspace._id,t=n.workspaces.find(t=>t._id===e);if(t)t!==n.currentWorkspace&&i(t);else if(n.workspaces.length>0){const t=n.workspaces[0];t._id!==e&&i(t)}},[n.workspaces,n.currentWorkspace,i]);const y=l(async e=>await r.getWorkspaceUsers(e),[r]),w=l(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&Se.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{S(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),o},[r,n.workspaces]),x=l(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&am(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;Se.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{S(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return i},[r,n.workspaces]),k=l(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&am(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&Se.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{S(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),A=l(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return Se.emitUserUpdated(n,t||void 0).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),E=l(async()=>await r.getProfile(),[r]),C=l(async e=>await r.getWorkspace(e),[r]),T=l(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!am(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(re(n.workspaces.filter(e=>e._id!==t))),n.currentWorkspace?._id===t&&e.workspaces(oe()),a&&Se.emitWorkspaceDeleted(a).catch(e=>{S(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:p,refreshWorkspaces:m,refreshing:n.refreshing,WorkspaceSwitcher:Ly,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,resetCurrentWorkspace:s,createWorkspace:h,allFeatures:n.allFeatures,getFeatures:v,updateFeature:b,getWorkspace:C,switching:n.switching,updateWorkspace:g,getUsers:y,addUser:w,removeUser:x,updateUser:k,getProfile:E,updateUserProfile:A,deleteWorkspace:T}};const By=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)})}},Wy=({children:n})=>{const{currentWorkspace:a}=jy(),[o,i]=u(!1),[s,c]=u("profile");return d(()=>{const e=By.getState();i(e.open),c(e.section);return By.subscribe((e,t)=>{i(e),c(t)})},[]),e(r,{children:[n,a&&t(My,{workspace:a,open:o,onOpenChange:e=>{e||By.closeSettings()},section:s,onSectionChange:e=>{By.setSection(e)},showTrigger:!1})]})},Vy=(e,t,r)=>{if(t!==y.V1)throw new Error(`Invalid version: "${t}". Only "${y.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).`)},$y=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{Vy(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),c=a.useMemo(()=>o?.callbacks,[o?.callbacks]),l=a.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return d(()=>(Se.setCallbacks(l?{handleEvent:l}:null),()=>{Se.setCallbacks(null)}),[l]),t(A,{children:t(ve,{children:t(we,{callbacks:c,children:t(Ae,{children:t(xe,{config:s,auth:o,children:t(Ce,{children:t(Wy,{children:i})})})})})})})});$y.displayName="SaaSOSProvider";let Gy=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),i=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(!i.ok)throw new Error(`Failed to submit beta user request: ${i.statusText}`);return i.json()}};const Ky=xi({name:Zo().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:Zo().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)")}),Hy={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:"오류가 발생했습니다"}},Zy=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:c={},autoFocus:f=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,v]=u("en"),[b,y]=u(!1),[w,x]=u(!1),{submitBetaForm:S,isLoading:k,isSubmitting:A,error:E,config:C,success:T,message:N}=(()=>{const e=be(e=>e.os),[t,r]=u(null),[n,a]=u(!0),[o,i]=u(!1),[s,c]=u(null),[f,p]=u(!1),[m,h]=u(null);return d(()=>{(async()=>{a(!0);const t=new Gy(e),n=await t.fetchConfig();r(n),a(!1)})()},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:f,message:m,submitBetaForm:l(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),p(!1),h(null);const r=new Gy(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{v((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Hy).indexOf(e)?e:"en"})())},[]),d(()=>{T&&p&&(y(!0),x(!0)),E&&x(!0)},[T,p,E]);const _={...Hy[s||g],...c},R=Qt({resolver:Qa(Ky),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{f&&R.setFocus("name")},[f,R]);const P=R.formState.isValid&&!A;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{className:Rc("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",o),children:[t(om,{className:"h-24 w-24 rounded-lg"}),t(om,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(om,{className:"h-4 w-16"}),t(om,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(om,{className:"h-4 w-16"}),t(om,{className:"h-10 w-full"})]}),t(om,{className:"h-10 w-full"})]})]}:{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[C?.logo&&t(Jy,{logo:C?.logo}),C?.name&&t("div",{children:C?.name})]}),t(st,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await S(e);t.success?(n?.(),R.reset(),p&&y(!0),x(!0)):(a?.(t.message),x(!0))}catch(e){a?.(e instanceof Error?e.message:_.errorMessage),x(!0)}}),className:o,noValidate:!0,"aria-busy":A,children:[!w&&e(r,{children:[!h&&C?.screen?.register&&t(qy,{screen:C?.screen?.register}),t(yu,{control:R.control,name:"name",render:({field:r})=>e(Su,{className:i,children:[t(ku,{children:_.nameLabel}),t(Au,{children:t(Tu,{...r})}),t(Eu,{}),t(Cu,{})]})}),t(yu,{control:R.control,name:"email",render:({field:r})=>e(Su,{className:i,children:[t(ku,{children:_.emailLabel}),t(Au,{children:t(Tu,{...r})}),t(Eu,{}),t(Cu,{})]})}),t(Fc,{type:"submit",disabled:!P,className:i,children:A?_.submittingText:_.submitText})]}),w&&E&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),E]}),t("div",{className:"mt-4 flex justify-center",children:t(Fc,{type:"button",onClick:()=>{x(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&b&&N&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:C?.screen?.thankYou&&t(qy,{screen:C?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:C?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:C?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function qy({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function Jy({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function Yy(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xy}=Object.prototype,{getPrototypeOf:Qy}=Object,{iterator:ew,toStringTag:tw}=Symbol,rw=(nw=Object.create(null),e=>{const t=Xy.call(e);return nw[t]||(nw[t]=t.slice(8,-1).toLowerCase())});var nw;const aw=e=>(e=e.toLowerCase(),t=>rw(t)===e),ow=e=>t=>typeof t===e,{isArray:iw}=Array,sw=ow("undefined");function cw(e){return null!==e&&!sw(e)&&null!==e.constructor&&!sw(e.constructor)&&uw(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const lw=aw("ArrayBuffer");const dw=ow("string"),uw=ow("function"),fw=ow("number"),pw=e=>null!==e&&"object"==typeof e,mw=e=>{if("object"!==rw(e))return!1;const t=Qy(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||tw in e||ew in e)},hw=aw("Date"),gw=aw("File"),vw=aw("Blob"),bw=aw("FileList"),yw=aw("URLSearchParams"),[ww,xw,Sw,kw]=["ReadableStream","Request","Response","Headers"].map(aw);function Aw(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),iw(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 i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function Ew(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 Cw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Tw=e=>!sw(e)&&e!==Cw;const Nw=(_w="undefined"!=typeof Uint8Array&&Qy(Uint8Array),e=>_w&&e instanceof _w);var _w;const Rw=aw("HTMLFormElement"),Pw=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ow=aw("RegExp"),Dw=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Aw(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Iw=aw("AsyncFunction"),Uw=(Mw="function"==typeof setImmediate,Lw=uw(Cw.postMessage),Mw?setImmediate:Lw?(Fw=`axios@${Math.random()}`,zw=[],Cw.addEventListener("message",({source:e,data:t})=>{e===Cw&&t===Fw&&zw.length&&zw.shift()()},!1),e=>{zw.push(e),Cw.postMessage(Fw,"*")}):e=>setTimeout(e));var Mw,Lw,Fw,zw;const jw="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Cw):"undefined"!=typeof process&&process.nextTick||Uw;var Bw={isArray:iw,isArrayBuffer:lw,isBuffer:cw,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||uw(e.append)&&("formdata"===(t=rw(e))||"object"===t&&uw(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&lw(e.buffer),t},isString:dw,isNumber:fw,isBoolean:e=>!0===e||!1===e,isObject:pw,isPlainObject:mw,isEmptyObject:e=>{if(!pw(e)||cw(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ww,isRequest:xw,isResponse:Sw,isHeaders:kw,isUndefined:sw,isDate:hw,isFile:gw,isBlob:vw,isRegExp:Ow,isFunction:uw,isStream:e=>pw(e)&&uw(e.pipe),isURLSearchParams:yw,isTypedArray:Nw,isFileList:bw,forEach:Aw,merge:function e(){const{caseless:t,skipUndefined:r}=Tw(this)&&this||{},n={},a=(a,o)=>{const i=t&&Ew(n,o)||o;mw(n[i])&&mw(a)?n[i]=e(n[i],a):mw(a)?n[i]=e({},a):iw(a)?n[i]=a.slice():r&&sw(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Aw(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Aw(t,(t,n)=>{r&&uw(t)?e[n]=Yy(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,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Qy(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:rw,kindOfTest:aw,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(iw(e))return e;let t=e.length;if(!fw(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[ew]).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:Rw,hasOwnProperty:Pw,hasOwnProp:Pw,reduceDescriptors:Dw,freezeMethods:e=>{Dw(e,(t,r)=>{if(uw(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];uw(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 iw(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:Ew,global:Cw,isContextDefined:Tw,isSpecCompliantForm:function(e){return!!(e&&uw(e.append)&&"FormData"===e[tw]&&e[ew])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(pw(e)){if(t.indexOf(e)>=0)return;if(cw(e))return e;if(!("toJSON"in e)){t[n]=e;const a=iw(e)?[]:{};return Aw(e,(e,t)=>{const o=r(e,n+1);!sw(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Iw,isThenable:e=>e&&(pw(e)||uw(e))&&uw(e.then)&&uw(e.catch),setImmediate:Uw,asap:jw,isIterable:e=>null!=e&&uw(e[ew])};function Ww(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)}Bw.inherits(Ww,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:Bw.toJSONObject(this.config),code:this.code,status:this.status}}});const Vw=Ww.prototype,$w={};["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=>{$w[e]={value:e}}),Object.defineProperties(Ww,$w),Object.defineProperty(Vw,"isAxiosError",{value:!0}),Ww.from=(e,t,r,n,a,o)=>{const i=Object.create(Vw);Bw.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const s=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return Ww.call(i,s,c,r,n,a),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function Gw(e){return Bw.isPlainObject(e)||Bw.isArray(e)}function Kw(e){return Bw.endsWith(e,"[]")?e.slice(0,-2):e}function Hw(e,t,r){return e?e.concat(t).map(function(e,t){return e=Kw(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Zw=Bw.toFlatObject(Bw,{},null,function(e){return/^is[A-Z]/.test(e)});function qw(e,t,r){if(!Bw.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=Bw.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Bw.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Bw.isSpecCompliantForm(t);if(!Bw.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Bw.isDate(e))return e.toISOString();if(Bw.isBoolean(e))return e.toString();if(!s&&Bw.isBlob(e))throw new Ww("Blob is not supported. Use a Buffer instead.");return Bw.isArrayBuffer(e)||Bw.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(Bw.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Bw.isArray(e)&&function(e){return Bw.isArray(e)&&!e.some(Gw)}(e)||(Bw.isFileList(e)||Bw.endsWith(r,"[]"))&&(s=Bw.toArray(e)))return r=Kw(r),s.forEach(function(e,n){!Bw.isUndefined(e)&&null!==e&&t.append(!0===i?Hw([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!Gw(e)||(t.append(Hw(a,r,o),c(e)),!1)}const d=[],u=Object.assign(Zw,{defaultVisitor:l,convertValue:c,isVisitable:Gw});if(!Bw.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Bw.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),Bw.forEach(r,function(r,o){!0===(!(Bw.isUndefined(r)||null===r)&&a.call(t,r,Bw.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Jw(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Yw(e,t){this._pairs=[],e&&qw(e,this,t)}const Xw=Yw.prototype;function Qw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ex(e,t,r){if(!t)return e;const n=r&&r.encode||Qw;Bw.isFunction(r)&&(r={serialize:r});const a=r&&r.serialize;let o;if(o=a?a(t,r):Bw.isURLSearchParams(t)?t.toString():new Yw(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Xw.append=function(e,t){this._pairs.push([e,t])},Xw.toString=function(e){const t=e?function(t){return e.call(this,t,Jw)}:Jw;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class tx{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){Bw.forEach(this.handlers,function(t){null!==t&&e(t)})}}var rx={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},nx={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Yw,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ax="undefined"!=typeof window&&"undefined"!=typeof document,ox="object"==typeof navigator&&navigator||void 0,ix=ax&&(!ox||["ReactNative","NativeScript","NS"].indexOf(ox.product)<0),sx="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,cx=ax&&window.location.href||"http://localhost";var lx={...Object.freeze({__proto__:null,hasBrowserEnv:ax,hasStandardBrowserEnv:ix,hasStandardBrowserWebWorkerEnv:sx,navigator:ox,origin:cx}),...nx};function dx(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&Bw.isArray(n)?n.length:o,s)return Bw.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&Bw.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&Bw.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(Bw.isFormData(e)&&Bw.isFunction(e.entries)){const r={};return Bw.forEachEntry(e,(e,n)=>{t(function(e){return Bw.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const ux={transitional:rx,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=Bw.isObject(e);a&&Bw.isHTMLForm(e)&&(e=new FormData(e));if(Bw.isFormData(e))return n?JSON.stringify(dx(e)):e;if(Bw.isArrayBuffer(e)||Bw.isBuffer(e)||Bw.isStream(e)||Bw.isFile(e)||Bw.isBlob(e)||Bw.isReadableStream(e))return e;if(Bw.isArrayBufferView(e))return e.buffer;if(Bw.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 qw(e,new lx.classes.URLSearchParams,{visitor:function(e,t,r,n){return lx.isNode&&Bw.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=Bw.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return qw(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(Bw.isString(e))try{return(t||JSON.parse)(e),Bw.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ux.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Bw.isResponse(e)||Bw.isReadableStream(e))return e;if(e&&Bw.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 Ww.from(e,Ww.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:lx.classes.FormData,Blob:lx.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Bw.forEach(["delete","get","head","post","put","patch"],e=>{ux.headers[e]={}});const fx=Bw.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 px=Symbol("internals");function mx(e){return e&&String(e).trim().toLowerCase()}function hx(e){return!1===e||null==e?e:Bw.isArray(e)?e.map(hx):String(e)}function gx(e,t,r,n,a){return Bw.isFunction(n)?n.call(this,t,r):(a&&(t=r),Bw.isString(t)?Bw.isString(n)?-1!==t.indexOf(n):Bw.isRegExp(n)?n.test(t):void 0:void 0)}let vx=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=mx(t);if(!a)throw new Error("header name must be a non-empty string");const o=Bw.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=hx(e))}const o=(e,t)=>Bw.forEach(e,(e,r)=>a(e,r,t));if(Bw.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Bw.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]&&fx[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(Bw.isObject(e)&&Bw.isIterable(e)){let r,n,a={};for(const t of e){if(!Bw.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?Bw.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=mx(e)){const r=Bw.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(Bw.isFunction(t))return t.call(this,e,r);if(Bw.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=mx(e)){const r=Bw.findKey(this,e);return!(!r||void 0===this[r]||t&&!gx(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=mx(e)){const a=Bw.findKey(r,e);!a||t&&!gx(0,r[a],a,t)||(delete r[a],n=!0)}}return Bw.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&&!gx(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return Bw.forEach(this,(n,a)=>{const o=Bw.findKey(r,a);if(o)return t[o]=hx(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=hx(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Bw.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&Bw.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[px]=this[px]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=mx(e);t[n]||(!function(e,t){const r=Bw.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 Bw.isArray(e)?e.forEach(n):n(e),this}};function bx(e,t){const r=this||ux,n=t||r,a=vx.from(n.headers);let o=n.data;return Bw.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function yx(e){return!(!e||!e.__CANCEL__)}function wx(e,t,r){Ww.call(this,null==e?"canceled":e,Ww.ERR_CANCELED,t,r),this.name="CanceledError"}function xx(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Ww("Request failed with status code "+r.status,[Ww.ERR_BAD_REQUEST,Ww.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}vx.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Bw.reduceDescriptors(vx.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),Bw.freezeMethods(vx),Bw.inherits(wx,Ww,{__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,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=n[i];a||(a=c),r[o]=s,n[o]=c;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,c=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},kx=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Ax=e=>(...t)=>Bw.asap(()=>e(...t));var Ex=lx.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,lx.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(lx.origin),lx.navigator&&/(msie|trident)/i.test(lx.navigator.userAgent)):()=>!0,Cx=lx.hasStandardBrowserEnv?{write(e,t,r,n,a,o){const i=[e+"="+encodeURIComponent(t)];Bw.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),Bw.isString(n)&&i.push("path="+n),Bw.isString(a)&&i.push("domain="+a),!0===o&&i.push("secure"),document.cookie=i.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 Tx(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 Nx=e=>e instanceof vx?{...e}:e;function _x(e,t){t=t||{};const r={};function n(e,t,r,n){return Bw.isPlainObject(e)&&Bw.isPlainObject(t)?Bw.merge.call({caseless:n},e,t):Bw.isPlainObject(t)?Bw.merge({},t):Bw.isArray(t)?t.slice():t}function a(e,t,r,a){return Bw.isUndefined(t)?Bw.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!Bw.isUndefined(t))return n(void 0,t)}function i(e,t){return Bw.isUndefined(t)?Bw.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(Nx(e),Nx(t),0,!0)};return Bw.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,i=o(e[n],t[n],n);Bw.isUndefined(i)&&o!==s||(r[n]=i)}),r}var Rx=e=>{const t=_x({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=vx.from(i),t.url=ex(Tx(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Bw.isFormData(r))if(lx.hasStandardBrowserEnv||lx.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Bw.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(lx.hasStandardBrowserEnv&&(n&&Bw.isFunction(n)&&(n=n(t)),n||!1!==n&&Ex(t.url))){const e=a&&o&&Cx.read(o);e&&i.set(a,e)}return t};var Px="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Rx(e);let a=n.data;const o=vx.from(n.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=vx.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());xx(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 Ww("Request aborted",Ww.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=new Ww(t&&t.message?t.message:"Network Error",Ww.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||rx;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Ww(t,a.clarifyTimeoutError?Ww.ETIMEDOUT:Ww.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&Bw.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),Bw.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&&([s,l]=Sx(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new wx(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);v&&-1===lx.protocols.indexOf(v)?r(new Ww("Unsupported protocol "+v+":",Ww.ERR_BAD_REQUEST,e)):h.send(a||null)})};const Ox=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Ww?t:new wx(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Ww(`timeout ${t} of ms exceeded`,Ww.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>Bw.asap(i),s}},Dx=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},Ix=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()}},Ux=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Ix(e))yield*Dx(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:Mx}=Bw,Lx=(({Request:e,Response:t})=>({Request:e,Response:t}))(Bw.global),{ReadableStream:Fx,TextEncoder:zx}=Bw.global,jx=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Bx=e=>{e=Bw.merge.call({skipUndefined:!0},Lx,e);const{fetch:t,Request:r,Response:n}=e,a=t?Mx(t):"function"==typeof fetch,o=Mx(r),i=Mx(n);if(!a)return!1;const s=a&&Mx(Fx),c=a&&("function"==typeof zx?(l=new zx,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&s&&jx(()=>{let e=!1;const t=new r(lx.origin,{body:new Fx,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&jx(()=>Bw.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 Ww(`Response type '${e}' is not supported`,Ww.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=Bw.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(Bw.isBlob(e))return e.size;if(Bw.isSpecCompliantForm(e)){const t=new r(lx.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Bw.isArrayBufferView(e)||Bw.isArrayBuffer(e)?e.byteLength:(Bw.isURLSearchParams(e)&&(e+=""),Bw.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:v,headers:b,withCredentials:y="same-origin",fetchOptions:w}=Rx(e),x=t||fetch;v=v?(v+"").toLowerCase():"text";let S=Ox([c,l&&l.toAbortSignal()],m),k=null;const A=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(E=await p(b,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(Bw.isFormData(s)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=kx(E,Sx(Ax(g)));s=Ux(t.body,65536,e,r)}}Bw.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:S,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:s,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=Bw.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&kx(t,Sx(Ax(h),!0))||[];l=new n(Ux(l.body,65536,r,()=>{a&&a(),A&&A()}),e)}v=v||"text";let C=await f[Bw.findKey(f,v)||"text"](l,e);return!m&&A&&A(),await new Promise((t,r)=>{xx(t,r,{data:C,headers:vx.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 Ww("Network Error",Ww.ERR_NETWORK,e,k),{cause:t.cause||t});throw Ww.from(t,t&&t.code,e,k)}}},Wx=new Map,Vx=e=>{let t=e?e.env:{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,c=o.length,l=Wx;for(;c--;)i=o[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:Bx(t)),l=s;return s};Vx();const $x={http:null,xhr:Px,fetch:{get:Vx}};Bw.forEach($x,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Gx=e=>`- ${e}`,Kx=e=>Bw.isFunction(e)||null===e||!1===e;var Hx=(e,t)=>{e=Bw.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!Kx(n)&&(a=$x[(r=String(n)).toLowerCase()],void 0===a))throw new Ww(`Unknown adapter '${r}'`);if(a&&(Bw.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Ww("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(Gx).join("\n"):" "+Gx(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return a};function Zx(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new wx(null,e)}function qx(e){Zx(e),e.headers=vx.from(e.headers),e.data=bx.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Hx(e.adapter||ux.adapter,e)(e).then(function(t){return Zx(e),t.data=bx.call(e,e.transformResponse,t),t.headers=vx.from(t.headers),t},function(t){return yx(t)||(Zx(e),t&&t.response&&(t.response.data=bx.call(e,e.transformResponse,t.response),t.response.headers=vx.from(t.response.headers))),Promise.reject(t)})}const Jx="1.12.2",Yx={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Yx[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Xx={};Yx.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Jx+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Ww(n(a," has been removed"+(t?" in "+t:"")),Ww.ERR_DEPRECATED);return t&&!Xx[a]&&(Xx[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)}},Yx.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Qx={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Ww("options must be an object",Ww.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new Ww("option "+o+" must be "+r,Ww.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Ww("Unknown option "+o,Ww.ERR_BAD_OPTION)}},validators:Yx};const eS=Qx.validators;let tS=class{constructor(e){this.defaults=e||{},this.interceptors={request:new tx,response:new tx}}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=_x(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Qx.assertOptions(r,{silentJSONParsing:eS.transitional(eS.boolean),forcedJSONParsing:eS.transitional(eS.boolean),clarifyTimeoutError:eS.transitional(eS.boolean)},!1),null!=n&&(Bw.isFunction(n)?t.paramsSerializer={serialize:n}:Qx.assertOptions(n,{encode:eS.function,serialize:eS.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Qx.assertOptions(t,{baseUrl:eS.spelling("baseURL"),withXsrfToken:eS.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&Bw.merge(a.common,a[t.method]);a&&Bw.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=vx.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[qx.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=qx.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 ex(Tx((e=_x(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Bw.forEach(["delete","get","head","options"],function(e){tS.prototype[e]=function(t,r){return this.request(_x(r||{},{method:e,url:t,data:(r||{}).data}))}}),Bw.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(_x(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}tS.prototype[e]=t(),tS.prototype[e+"Form"]=t(!0)});const rS={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(rS).forEach(([e,t])=>{rS[t]=e});const nS=function e(t){const r=new tS(t),n=Yy(tS.prototype.request,r);return Bw.extend(n,tS.prototype,r,{allOwnKeys:!0}),Bw.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(_x(t,r))},n}(ux);nS.Axios=tS,nS.CanceledError=wx,nS.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 wx(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}}},nS.isCancel=yx,nS.VERSION=Jx,nS.toFormData=qw,nS.AxiosError=Ww,nS.Cancel=nS.CanceledError,nS.all=function(e){return Promise.all(e)},nS.spread=function(e){return function(t){return e.apply(null,t)}},nS.isAxiosError=function(e){return Bw.isObject(e)&&!0===e.isAxiosError},nS.mergeConfig=_x,nS.AxiosHeaders=vx,nS.formToJSON=e=>dx(Bw.isHTMLForm(e)?new FormData(e):e),nS.getAdapter=Hx,nS.HttpStatusCode=rS,nS.default=nS;const{Axios:aS,AxiosError:oS,CanceledError:iS,isCancel:sS,CancelToken:cS,VERSION:lS,all:dS,Cancel:uS,isAxiosError:fS,spread:pS,toFormData:mS,AxiosHeaders:hS,HttpStatusCode:gS,formToJSON:vS,getAdapter:bS,mergeConfig:yS}=nS;const wS=new class{constructor(e={}){this.client=nS.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=L();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 xS(){const e=ye(),t=be(e=>e.auth),r=be(e=>e.os),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:s}=jy(),d=l(async()=>{e.auth(E());try{const t=await wS.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(C()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(C()),S(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),u=l(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth(N()),i(),M()}catch(e){S(e,{component:"useSaaSAuth",action:"signOut"}),M()}},[e,i,o?.callbacks?.onSignOut]),f=l(e=>{s?By.openWorkspaceSettings(e):S(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[s]);return c(()=>({user:t.session?.user,session:t.session,isLoading:t.isLoading,isAuthenticated:t.isAuthenticated,isRedirecting:t.isRedirecting,status:t.status,signIn:d,signOut:u,openWorkspaceSettings:f}),[t,d,u,f])}const SS=e=>{const{children:t}=e,{status:r}=xS();return r!==R.authenticated?null:t},kS=e=>{const{children:t}=e,{status:r}=xS();return r===R.authenticated?null:t},AS=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=xS();return n.includes(a?.role??"")?t:r||null},ES=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=xS(),{currentWorkspace:o}=jy(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function CS(){const e=g(Ee);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function TS(){const e=g(Ee);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}const NS=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=jy(),a=n?.features?.[r];return a?t:null},_S=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=jy(),a=n?.features?.[r];return a?null:t},RS=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=TS();return n(r)?t:null},PS=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=TS();return n(r)?null:t};export{y as ApiVersion,Zy as BetaForm,A as ErrorBoundary,w as SDKError,A as SDKErrorBoundary,$y as SaaSOSProvider,SS as WhenAuthenticated,AS as WhenRoles,kS as WhenUnauthenticated,PS as WhenUserFeatureDisabled,RS as WhenUserFeatureEnabled,_S as WhenWorkspaceFeatureDisabled,NS as WhenWorkspaceFeatureEnabled,ES as WhenWorkspaceRoles,Ly as WorkspaceSwitcher,k as createSDKError,x as errorHandler,Se as eventEmitter,S as handleError,xS as useSaaSAuth,gp as useSaaSSettings,jy as useSaaSWorkspaces,CS as useUserAttributes,TS as useUserFeatures};
2
36
  //# sourceMappingURL=index.esm.js.map