@buildbase/sdk 0.0.22 โ†’ 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -26,5 +26,5 @@ var fd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
26
26
  *
27
27
  * This source code is licensed under the MIT license found in the
28
28
  * LICENSE file in the root directory of this source tree.
29
- */function tp(){return Xf||(Xf=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,i=r.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){l||void 0===r.startTransition||(l=!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(!c){var f=d();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return o(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),s(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};ep.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ep}function rp(){return Qf||(Qf=1,"production"===process.env.NODE_ENV?qf.exports=Yf():qf.exports=tp()),qf.exports}var np=rp();function ap(){return()=>{}}var sp="Avatar",[op]=function(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s);o.displayName=r+"Context";const i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Bf(s,...r)]}(sp),[ip,lp]=op(sp),cp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...s}=t,[o,i]=a.useState("idle");return e.jsx(ip,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:e.jsx(Zf.span,{...s,ref:r})})});cp.displayName=sp;var dp="AvatarImage",up=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...i}=t,l=lp(dp,n),c=function(e,{referrerPolicy:t,crossOrigin:r}){const n=np.useSyncExternalStore(ap,()=>!0,()=>!1),s=a.useRef(null),o=n?(s.current||(s.current=new window.Image),s.current):null,[i,l]=a.useState(()=>mp(o,e));return Hf(()=>{l(mp(o,e))},[o,e]),Hf(()=>{const e=e=>()=>{l(e)};if(!o)return;const n=e("loaded"),a=e("error");return o.addEventListener("load",n),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",n),o.removeEventListener("error",a)}},[o,r,t]),i}(s,i),d=Gf(e=>{o(e),l.onImageLoadingStatusChange(e)});return Hf(()=>{"idle"!==c&&d(c)},[c,d]),"loaded"===c?e.jsx(Zf.img,{...i,ref:r,src:s}):null});up.displayName=dp;var fp="AvatarFallback",pp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:s,...o}=t,i=lp(fp,n),[l,c]=a.useState(void 0===s);return a.useEffect(()=>{if(void 0!==s){const e=window.setTimeout(()=>c(!0),s);return()=>window.clearTimeout(e)}},[s]),l&&"loaded"!==i.imageLoadingStatus?e.jsx(Zf.span,{...o,ref:r}):null});function mp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}pp.displayName=fp;var hp=cp,gp=up,bp=pp;const yp=a.forwardRef(({className:t,...r},n)=>e.jsx(hp,{ref:n,className:je("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));yp.displayName=hp.displayName;const xp=a.forwardRef(({className:t,...r},n)=>e.jsx(gp,{ref:n,className:je("aspect-square h-full w-full",t),...r}));xp.displayName=gp.displayName;const vp=a.forwardRef(({className:t,...r},n)=>e.jsx(bp,{ref:n,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function wp(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Sp(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s),i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},kp(s,...r)]}function kp(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}vp.displayName=bp.displayName;var jp=a[" useId ".trim().toString()]||(()=>{}),Np=0;function Ep(e){const[t,r]=a.useState(jp());return Hf(()=>{r(e=>e??String(Np++))},[e]),e||(t?`radix-${t}`:"")}var Cp=a[" useInsertionEffect ".trim().toString()]||Hf;function Ap({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),s=a.useRef(r),o=a.useRef(t);return Cp(()=>{o.current=t},[t]),a.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}({defaultProp:t,onChange:r}),l=void 0!==e,c=l?e:s;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l},[l,n])}const d=a.useCallback(t=>{if(l){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[l,e,o,i]);return[c,d]}function _p(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Tp=Symbol("radix.slottable");function Rp(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Tp}var Pp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=_p(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Rp);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{});var Op,Ip="dismissableLayer.update",Dp="dismissableLayer.pointerDownOutside",Up="dismissableLayer.focusOutside",Fp=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mp=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:c,...d}=t,u=a.useContext(Fp),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Jc(r,e=>p(e)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=b.indexOf(y),v=f?b.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=x,k=function(e,t=globalThis?.document){const r=Gf(e),n=a.useRef(!1),s=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){Lp(Dp,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=n,t.addEventListener("click",s.current,{once:!0})):n()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},m),j=function(e,t=globalThis?.document){const r=Gf(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){Lp(Up,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),l?.(e),e.defaultPrevented||c?.())},m);return function(e,t=globalThis?.document){const r=Gf(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{v===u.layers.size-1&&(s?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Op=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),zp(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Op)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),zp())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(Ip,e),()=>document.removeEventListener(Ip,e)},[]),e.jsx(Pp.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:wp(t.onFocusCapture,j.onFocusCapture),onBlurCapture:wp(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:wp(t.onPointerDownCapture,k.onPointerDownCapture)})});Mp.displayName="DismissableLayer";function zp(){const e=new CustomEvent(Ip);document.dispatchEvent(e)}function Lp(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&&s.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}a.forwardRef((t,r)=>{const n=a.useContext(Fp),s=a.useRef(null),o=Jc(r,s);return a.useEffect(()=>{const e=s.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Pp.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var $p="focusScope.autoFocusOnMount",Wp="focusScope.autoFocusOnUnmount",Vp={bubbles:!1,cancelable:!0},Bp=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=t,[c,d]=a.useState(null),u=Gf(o),f=Gf(i),p=a.useRef(null),m=Jc(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(s){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:Zp(p.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Zp(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Zp(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return c&&n.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[s,c,h.paused]),a.useEffect(()=>{if(c){qp.add(h);const t=document.activeElement;if(!c.contains(t)){const r=new CustomEvent($p,Vp);c.addEventListener($p,u),c.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Zp(n,{select:t}),document.activeElement!==r)return}((e=Gp(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Zp(c))}return()=>{c.removeEventListener($p,u),setTimeout(()=>{const e=new CustomEvent(Wp,Vp);c.addEventListener(Wp,f),c.dispatchEvent(e),e.defaultPrevented||Zp(t??document.body,{select:!0}),c.removeEventListener(Wp,f),qp.remove(h)},0)}}var e},[c,u,f,h]);const g=a.useCallback(e=>{if(!n&&!s)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[a,s]=function(e){const t=Gp(e),r=Kp(t,e),n=Kp(t.reverse(),e);return[r,n]}(t);a&&s?e.shiftKey||r!==s?e.shiftKey&&r===a&&(e.preventDefault(),n&&Zp(s,{select:!0})):(e.preventDefault(),n&&Zp(a,{select:!0})):r===t&&e.preventDefault()}},[n,s,h.paused]);return e.jsx(Pp.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})});function Gp(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 Kp(e,t){for(const r of e)if(!Hp(r,{upTo:t}))return r}function Hp(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 Zp(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()}}Bp.displayName="FocusScope";var qp=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Jp(e,t),e.unshift(t)},remove(t){e=Jp(e,t),e[0]?.resume()}}}();function Jp(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Yp=a.forwardRef((t,n)=>{const{container:s,...o}=t,[i,l]=a.useState(!1);Hf(()=>l(!0),[]);const c=s||i&&globalThis?.document?.body;return c?r.createPortal(e.jsx(Pp.div,{...o,ref:n}),c):null});Yp.displayName="Portal";var Xp=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),s=a.useRef(e),o=a.useRef("none"),i=e?"mounted":"unmounted",[l,c]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=Qp(n.current);o.current="mounted"===l?e:"none"},[l]),Hf(()=>{const t=n.current,r=s.current;if(r!==e){const n=o.current,a=Qp(t);if(e)c("MOUNT");else if("none"===a||"none"===t?.display)c("UNMOUNT");else{c(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}s.current=e}},[e,c]),Hf(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const o=Qp(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c("ANIMATION_END"),!s.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},i=e=>{e.target===t&&(o.current=Qp(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),s="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),o=Jc(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof r||n.isPresent?a.cloneElement(s,{ref:o}):null};function Qp(e){return e?.animationName||"none"}Xp.displayName="Presence";var em=0;function tm(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rm()),document.body.insertAdjacentElement("beforeend",e[1]??rm()),em++,()=>{1===em&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),em--}},[])}function rm(){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 nm=function(){return nm=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},nm.apply(this,arguments)};function am(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 sm="right-scroll-bar-position",om="width-before-scroll-bar";function im(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var lm="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,cm=new WeakMap;function dm(e,r){var n,a,s,o=(n=null,a=function(t){return e.forEach(function(e){return im(e,t)})},(s=t.useState(function(){return{value:n,callback:a,facade:{get current(){return s.value},set current(e){var t=s.value;t!==e&&(s.value=e,s.callback(e,t))}}}})[0]).callback=a,s.facade);return lm(function(){var t=cm.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||im(e,null)}),n.forEach(function(e){r.has(e)||im(e,a)})}cm.set(o,e)},[e]),o}function um(e){return e}var fm=function(e){var t=e.sideCar,r=am(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,nm({},r))};fm.isSideCarExport=!0;var pm=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=um);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 s=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=nm({async:!0,ssr:!1},e),t}(),mm=function(){},hm=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:mm,onWheelCapture:mm,onTouchMoveCapture:mm}),s=n[0],o=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,x=void 0===y?"div":y,v=e.gapMode,w=am(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=dm([r,t]),j=nm(nm({},w),s);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:pm,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:v}),i?a.cloneElement(a.Children.only(l),nm(nm({},j),{ref:k})):a.createElement(x,nm({},j,{className:c,ref:k}),l))});hm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},hm.classNames={fullWidth:om,zeroRight:sm};function gm(){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 bm=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=gm())&&(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)}}},ym=function(){var e,t=(e=bm(),function(t,r){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},xm={left:0,top:0,right:0,gap:0},vm=function(e){return parseInt(e||"",10)||0},wm=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return xm;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[vm(r),vm(n),vm(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])}},Sm=ym(),km="data-scroll-locked",jm=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(km,"] {\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(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(sm," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(om," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(sm," .").concat(sm," {\n right: 0 ").concat(n,";\n }\n \n .").concat(om," .").concat(om," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(km,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Nm=function(){var e=parseInt(document.body.getAttribute(km)||"0",10);return isFinite(e)?e:0},Em=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(km,(Nm()+1).toString()),function(){var e=Nm()-1;e<=0?document.body.removeAttribute(km):document.body.setAttribute(km,e.toString())}},[]);var o=a.useMemo(function(){return wm(s)},[s]);return a.createElement(Sm,{styles:jm(o,!t,s,r?"":"!important")})},Cm=!1;if("undefined"!=typeof window)try{var Am=Object.defineProperty({},"passive",{get:function(){return Cm=!0,!0}});window.addEventListener("test",Am,Am),window.removeEventListener("test",Am,Am)}catch(e){Cm=!1}var _m=!!Cm&&{passive:!1},Tm=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])},Rm=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Pm(e,n)){var a=Om(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Pm=function(e,t){return"v"===e?function(e){return Tm(e,"overflowY")}(t):function(e){return Tm(e,"overflowX")}(t)},Om=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Im=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dm=function(e){return[e.deltaX,e.deltaY]},Um=function(e){return e&&"current"in e?e.current:e},Fm=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Mm=0,zm=[];function Lm(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var $m,Wm=($m=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),s=a.useState(Mm++)[0],o=a.useState(ym)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,s=t.length;a<s;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(Um),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=Im(e),o=r.current,l="deltaX"in e?e.deltaX:o[0]-s[0],c="deltaY"in e?e.deltaY:o[1]-s[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=Rm(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Rm(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(l||c)&&(n.current=a),!a)return!0;var h=n.current||a;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=a*n,o=r.target,i=t.contains(o),l=!1,c=s>0,d=0,u=0;do{if(!o)break;var f=Om(e,o),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Pm(e,o)&&(d+=m,u+=p);var h=o.parentNode;o=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&o!==document.body||i&&(t.contains(o)||t===o));return(c&&Math.abs(d)<1||!c&&Math.abs(u)<1)&&(l=!0),l}(h,t,e,"h"===h?l:c)},[]),c=a.useCallback(function(e){var r=e;if(zm.length&&zm[zm.length-1]===o){var n="deltaY"in r?Dm(r):Im(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 s=(i.current.shards||[]).map(Um).filter(Boolean).filter(function(e){return e.contains(r.target)});(s.length>0?l(r,s[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:Lm(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=a.useCallback(function(e){r.current=Im(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,Dm(t),t.target,l(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,Im(t),t.target,l(t,e.lockRef.current))},[]);a.useEffect(function(){return zm.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,_m),document.addEventListener("touchmove",c,_m),document.addEventListener("touchstart",u,_m),function(){zm=zm.filter(function(e){return e!==o}),document.removeEventListener("wheel",c,_m),document.removeEventListener("touchmove",c,_m),document.removeEventListener("touchstart",u,_m)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(o,{styles:Fm(s)}):null,m?a.createElement(Em,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},pm.useMedium($m),fm),Vm=a.forwardRef(function(e,t){return a.createElement(hm,nm({},e,{ref:t,sideCar:Wm}))});Vm.classNames=hm.classNames;var Bm=new WeakMap,Gm=new WeakMap,Km={},Hm=0,Zm=function(e){return e&&(e.host||Zm(e.parentNode))},qm=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Zm(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]);Km[r]||(Km[r]=new WeakMap);var s=Km[r],o=[],i=new Set,l=new Set(a),c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(Bm.get(e)||0)+1,c=(s.get(e)||0)+1;Bm.set(e,l),s.set(e,c),o.push(e),1===l&&a&&Gm.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),i.clear(),Hm++,function(){o.forEach(function(e){var t=Bm.get(e)-1,a=s.get(e)-1;Bm.set(e,t),s.set(e,a),t||(Gm.has(e)||e.removeAttribute(n),Gm.delete(e)),a||e.removeAttribute(r)}),--Hm||(Bm=new WeakMap,Bm=new WeakMap,Gm=new WeakMap,Km={})}},Jm=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"))),qm(n,a,r,"aria-hidden")):function(){return null}};function Ym(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xm=Symbol("radix.slottable");function Qm(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Xm}var eh="Dialog",[th,rh]=Sp(eh),[nh,ah]=th(eh),sh=t=>{const{__scopeDialog:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!0}=t,c=a.useRef(null),d=a.useRef(null),[u,f]=Ap({prop:s,defaultProp:o??!1,onChange:i,caller:eh});return e.jsx(nh,{scope:r,triggerRef:c,contentRef:d,contentId:Ep(),titleId:Ep(),descriptionId:Ep(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:l,children:n})};sh.displayName=eh;var oh="DialogTrigger",ih=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(oh,n),o=Jc(r,s.triggerRef);return e.jsx(Pp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ch(s.open),...a,ref:o,onClick:wp(t.onClick,s.onOpenToggle)})});ih.displayName=oh;var lh="DialogPortal",[ch,dh]=th(lh,{forceMount:void 0}),uh=t=>{const{__scopeDialog:r,forceMount:n,children:s,container:o}=t,i=ah(lh,r);return e.jsx(ch,{scope:r,forceMount:n,children:a.Children.map(s,t=>e.jsx(Xp,{present:n||i.open,children:e.jsx(Yp,{asChild:!0,container:o,children:t})}))})};uh.displayName=lh;var fh="DialogOverlay",ph=a.forwardRef((t,r)=>{const n=dh(fh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=ah(fh,t.__scopeDialog);return o.modal?e.jsx(Xp,{present:a||o.open,children:e.jsx(hh,{...s,ref:r})}):null});ph.displayName=fh;var mh=function(t){const r=Ym(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Qm);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),hh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(fh,n);return e.jsx(Vm,{as:mh,allowPinchZoom:!0,shards:[s.contentRef],children:e.jsx(Pp.div,{"data-state":Ch(s.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),gh="DialogContent",bh=a.forwardRef((t,r)=>{const n=dh(gh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=ah(gh,t.__scopeDialog);return e.jsx(Xp,{present:a||o.open,children:o.modal?e.jsx(yh,{...s,ref:r}):e.jsx(xh,{...s,ref:r})})});bh.displayName=gh;var yh=a.forwardRef((t,r)=>{const n=ah(gh,t.__scopeDialog),s=a.useRef(null),o=Jc(r,n.contentRef,s);return a.useEffect(()=>{const e=s.current;if(e)return Jm(e)},[]),e.jsx(vh,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:wp(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:wp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:wp(t.onFocusOutside,e=>e.preventDefault())})}),xh=a.forwardRef((t,r)=>{const n=ah(gh,t.__scopeDialog),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(vh,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),vh=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=t,c=ah(gh,n),d=a.useRef(null),u=Jc(r,d);return tm(),e.jsxs(e.Fragment,{children:[e.jsx(Bp,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:e.jsx(Mp,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ch(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Rh,{titleId:c.titleId}),e.jsx(Ph,{contentRef:d,descriptionId:c.descriptionId})]})]})}),wh="DialogTitle",Sh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(wh,n);return e.jsx(Pp.h2,{id:s.titleId,...a,ref:r})});Sh.displayName=wh;var kh="DialogDescription",jh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(kh,n);return e.jsx(Pp.p,{id:s.descriptionId,...a,ref:r})});jh.displayName=kh;var Nh="DialogClose",Eh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(Nh,n);return e.jsx(Pp.button,{type:"button",...a,ref:r,onClick:wp(t.onClick,()=>s.onOpenChange(!1))})});function Ch(e){return e?"open":"closed"}Eh.displayName=Nh;var Ah="DialogTitleWarning",[_h,Th]=function(t,r){const n=a.createContext(r),s=t=>{const{children:r,...s}=t,o=a.useMemo(()=>s,Object.values(s));return e.jsx(n.Provider,{value:o,children:r})};return s.displayName=t+"Provider",[s,function(e){const s=a.useContext(n);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(Ah,{contentName:gh,titleName:wh,docsSlug:"dialog"}),Rh=({titleId:e})=>{const t=Th(Ah),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Ph=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Th("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},Oh=sh,Ih=ih,Dh=uh,Uh=ph,Fh=bh,Mh=Sh,zh=jh,Lh=Eh;function $h(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Wh=["color"],Vh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Wh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Bh=["color"],Gh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Bh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Kh=["color"],Hh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Kh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Zh=["color"],qh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Zh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const Jh=Oh,Yh=Ih,Xh=Dh,Qh=a.forwardRef(({className:t,...r},n)=>e.jsx(Uh,{ref:n,className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));Qh.displayName=Uh.displayName;const eg=a.forwardRef(({className:t,children:r,...n},s)=>{const{container:o}=a.useContext(ns);return e.jsxs(Xh,{container:o,children:[e.jsx(Qh,{}),e.jsxs(Fh,{ref:s,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n,children:[r,e.jsxs(Lh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Hh,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});eg.displayName=Fh.displayName;const tg=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});tg.displayName="DialogHeader";const rg=a.forwardRef(({className:t,...r},n)=>e.jsx(Mh,{ref:n,className:je("text-lg font-semibold leading-none tracking-tight",t),...r}));rg.displayName=Mh.displayName;const ng=a.forwardRef(({className:t,...r},n)=>e.jsx(zh,{ref:n,className:je("text-sm text-muted-foreground",t),...r}));function ag(t){const r=sg(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(ig);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}function sg(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}ng.displayName=zh.displayName;var og=Symbol("radix.slottable");function ig(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===og}function lg(r){const n=r+"CollectionProvider",[a,s]=Sp(n),[o,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),l=r=>{const{scope:n,children:a}=r,s=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(o,{scope:n,itemMap:i,collectionRef:s,children:a})};l.displayName=n;const c=r+"CollectionSlot",d=ag(c),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,s=Jc(r,i(c,n).collectionRef);return e.jsx(d,{ref:s,children:a})});u.displayName=c;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=ag(f),h=t.forwardRef((r,n)=>{const{scope:a,children:s,...o}=r,l=t.useRef(null),c=Jc(n,l),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(l,{ref:l,...o}),()=>{d.itemMap.delete(l)})),e.jsx(m,{[p]:"",ref:c,children:s})});return h.displayName=f,[{Provider:l,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},s]}var cg=a.createContext(void 0);function dg(e){const t=a.useContext(cg);return e||t||"ltr"}var ug="rovingFocusGroup.onEntryFocus",fg={bubbles:!1,cancelable:!0},pg="RovingFocusGroup",[mg,hg,gg]=lg(pg),[bg,yg]=Sp(pg,[gg]),[xg,vg]=bg(pg),wg=a.forwardRef((t,r)=>e.jsx(mg.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(mg.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Sg,{...t,ref:r})})}));wg.displayName=pg;var Sg=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Jc(r,m),g=dg(i),[b,y]=Ap({prop:l,defaultProp:c??null,onChange:d,caller:pg}),[x,v]=a.useState(!1),w=Gf(u),S=hg(n),k=a.useRef(!1),[j,N]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(ug,w),()=>e.removeEventListener(ug,w)},[w]),e.jsx(xg,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:b,onItemFocus:a.useCallback(e=>y(e),[y]),onItemShiftTab:a.useCallback(()=>v(!0),[]),onFocusableItemAdd:a.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>N(e=>e-1),[]),children:e.jsx(Pp.div,{tabIndex:x||0===j?-1:0,"data-orientation":s,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:wp(t.onMouseDown,()=>{k.current=!0}),onFocus:wp(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!x){const t=new CustomEvent(ug,fg);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Eg([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:wp(t.onBlur,()=>v(!1))})})}),kg="RovingFocusGroupItem",jg=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:l,...c}=t,d=Ep(),u=i||d,f=vg(kg,n),p=f.currentTabStopId===u,m=hg(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return a.useEffect(()=>{if(s)return h(),()=>g()},[s,h,g]),e.jsx(mg.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:e.jsx(Pp.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:r,onMouseDown:wp(t.onMouseDown,e=>{s?f.onItemFocus(u):e.preventDefault()}),onFocus:wp(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:wp(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Ng[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(()=>Eg(r))}}),children:"function"==typeof l?l({isCurrentTabStop:p,hasTabStop:null!=b}):l})})});jg.displayName=kg;var Ng={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Eg(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 Cg=wg,Ag=jg;function _g(e){const[t,r]=a.useState(void 0);return Hf(()=>{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,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Tg(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Rg="Radio",[Pg,Og]=Sp(Rg),[Ig,Dg]=Pg(Rg),Ug=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:s,checked:o=!1,required:i,disabled:l,value:c="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Jc(r,e=>m(e)),g=a.useRef(!1),b=!p||(u||!!p.closest("form"));return e.jsxs(Ig,{scope:n,checked:o,disabled:l,children:[e.jsx(Pp.button,{type:"button",role:"radio","aria-checked":o,"data-state":Lg(o),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:h,onClick:wp(t.onClick,e=>{o||d?.(),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&e.jsx(zg,{control:p,bubbles:!g.current,name:s,value:c,checked:o,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});Ug.displayName=Rg;var Fg="RadioIndicator",Mg=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...s}=t,o=Dg(Fg,n);return e.jsx(Xp,{present:a||o.checked,children:e.jsx(Pp.span,{"data-state":Lg(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})})});Mg.displayName=Fg;var zg=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=Jc(l,i),d=Tg(n),u=_g(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx(Pp.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Lg(e){return e?"checked":"unchecked"}zg.displayName="RadioBubbleInput";var $g=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Wg="RadioGroup",[Vg]=Sp(Wg,[yg,Og]),Bg=yg(),Gg=Og(),[Kg,Hg]=Vg(Wg),Zg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=Bg(n),h=dg(d),[g,b]=Ap({prop:o,defaultProp:s??null,onChange:f,caller:Wg});return e.jsx(Kg,{scope:n,name:a,required:i,disabled:l,value:g,onValueChange:b,children:e.jsx(Cg,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:e.jsx(Pp.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:h,...p,ref:r})})})});Zg.displayName=Wg;var qg="RadioGroupItem",Jg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:s,...o}=t,i=Hg(qg,n),l=i.disabled||s,c=Bg(n),d=Gg(n),u=a.useRef(null),f=Jc(r,u),p=i.value===o.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{$g.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e.jsx(Ag,{asChild:!0,...c,focusable:!l,active:p,children:e.jsx(Ug,{disabled:l,required:i.required,checked:p,...d,...o,name:i.name,ref:f,onCheck:()=>i.onValueChange(o.value),onKeyDown:wp(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:wp(o.onFocus,()=>{m.current&&u.current?.click()})})})});Jg.displayName=qg;var Yg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,s=Gg(n);return e.jsx(Mg,{...s,...a,ref:r})});Yg.displayName="RadioGroupIndicator";var Xg=Zg,Qg=Jg,eb=Yg;const tb=a.forwardRef(({className:t,...r},n)=>e.jsx(Xg,{className:je("grid gap-2",t),...r,ref:n}));tb.displayName=Xg.displayName;const rb=a.forwardRef(({className:t,...r},n)=>e.jsx(Qg,{ref:n,className:je("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(eb,{className:"flex items-center justify-center",children:e.jsx(Gh,{className:"h-3.5 w-3.5 fill-primary"})})}));function nb(e,[t,r]){return Math.min(r,Math.max(t,e))}rb.displayName=Qg.displayName;var ab="ScrollArea",[sb]=Sp(ab),[ob,ib]=sb(ab),lb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...l}=t,[c,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[b,y]=a.useState(null),[x,v]=a.useState(0),[w,S]=a.useState(0),[k,j]=a.useState(!1),[N,E]=a.useState(!1),C=Jc(r,e=>d(e)),A=dg(o);return e.jsx(ob,{scope:n,type:s,dir:A,scrollHideDelay:i,scrollArea:c,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:j,scrollbarY:b,onScrollbarYChange:y,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:v,onCornerHeightChange:S,children:e.jsx(Pp.div,{dir:A,...l,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});lb.displayName=ab;var cb="ScrollAreaViewport",db=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=t,l=ib(cb,n),c=Jc(r,a.useRef(null),l.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(Pp.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});db.displayName=cb;var ub="ScrollAreaScrollbar",fb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=ib(ub,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,c="horizontal"===t.orientation;return a.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),"hover"===o.type?e.jsx(pb,{...s,ref:r,forceMount:n}):"scroll"===o.type?e.jsx(mb,{...s,ref:r,forceMount:n}):"auto"===o.type?e.jsx(hb,{...s,ref:r,forceMount:n}):"always"===o.type?e.jsx(gb,{...s,ref:r}):null});fb.displayName=ub;var pb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=ib(ub,t.__scopeScrollArea),[i,l]=a.useState(!1);return a.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),l(!0)},n=()=>{t=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),e.jsx(Xp,{present:n||i,children:e.jsx(hb,{"data-state":i?"visible":"hidden",...s,ref:r})})}),mb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=ib(ub,t.__scopeScrollArea),i="horizontal"===t.orientation,l=Db(()=>d("SCROLL_END"),100),[c,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===c){const e=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,o.scrollHideDelay,d]),a.useEffect(()=>{const e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),l()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[o.viewport,i,d,l]),e.jsx(Xp,{present:n||"hidden"!==c,children:e.jsx(gb,{"data-state":"hidden"===c?"hidden":"visible",...s,ref:r,onPointerEnter:wp(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:wp(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),hb=a.forwardRef((t,r)=>{const n=ib(ub,t.__scopeScrollArea),{forceMount:s,...o}=t,[i,l]=a.useState(!1),c="horizontal"===t.orientation,d=Db(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?e:t)}},10);return Ub(n.viewport,d),Ub(n.content,d),e.jsx(Xp,{present:s||i,children:e.jsx(gb,{"data-state":i?"visible":"hidden",...o,ref:r})})}),gb=a.forwardRef((t,r)=>{const{orientation:n="vertical",...s}=t,o=ib(ub,t.__scopeScrollArea),i=a.useRef(null),l=a.useRef(0),[c,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=_b(c.viewport,c.content),f={...s,sizes:c,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Tb(r),s=a/2,o=t||s,i=a-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Pb([l,c],u)(e)}(e,l.current,c,t)}return"horizontal"===n?e.jsx(bb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Rb(o.viewport.scrollLeft,c,o.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):"vertical"===n?e.jsx(yb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Rb(o.viewport.scrollTop,c);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),bb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=ib(ub,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=Jc(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(wb,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Tb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),Ob(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Ab(l.paddingLeft),paddingEnd:Ab(l.paddingRight)}})}})}),yb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=ib(ub,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=Jc(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(wb,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Tb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),Ob(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Ab(l.paddingTop),paddingEnd:Ab(l.paddingBottom)}})}})}),[xb,vb]=sb(ub),wb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=ib(ub,n),[g,b]=a.useState(null),y=Jc(r,e=>b(e)),x=a.useRef(null),v=a.useRef(""),w=h.viewport,S=s.content-s.viewport,k=Gf(f),j=Gf(d),N=Db(p,10);function E(e){if(x.current){const t=e.clientX-x.current.left,r=e.clientY-x.current.top;u({x:t,y:r})}}return a.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,g,S,k]),a.useEffect(j,[s,j]),Ub(g,N),Ub(h.content,N),e.jsx(xb,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:Gf(i),onThumbPointerUp:Gf(l),onThumbPositionChange:j,onThumbPointerDown:Gf(c),children:e.jsx(Pp.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:wp(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),x.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),E(e)}}),onPointerMove:wp(t.onPointerMove,E),onPointerUp:wp(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,h.viewport&&(h.viewport.style.scrollBehavior=""),x.current=null})})})}),Sb="ScrollAreaThumb",kb=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,s=vb(Sb,t.__scopeScrollArea);return e.jsx(Xp,{present:n||s.hasThumb,children:e.jsx(jb,{ref:r,...a})})}),jb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:s,...o}=t,i=ib(Sb,n),l=vb(Sb,n),{onThumbPositionChange:c}=l,d=Jc(r,e=>l.onThumbChange(e)),u=a.useRef(void 0),f=Db(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Ib(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,c]),e.jsx(Pp.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:wp(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;l.onThumbPointerDown({x:r,y:n})}),onPointerUp:wp(t.onPointerUp,l.onThumbPointerUp)})});kb.displayName=Sb;var Nb="ScrollAreaCorner",Eb=a.forwardRef((t,r)=>{const n=ib(Nb,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Cb,{...t,ref:r}):null});Eb.displayName=Nb;var Cb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...s}=t,o=ib(Nb,n),[i,l]=a.useState(0),[c,d]=a.useState(0),u=Boolean(i&&c);return Ub(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),d(e)}),Ub(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)}),u?e.jsx(Pp.div,{...s,ref:r,style:{width:i,height:c,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...t.style}}):null});function Ab(e){return e?parseInt(e,10):0}function _b(e,t){const r=e/t;return isNaN(r)?0:r}function Tb(e){const t=_b(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Rb(e,t,r="ltr"){const n=Tb(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-n,l=nb(e,"ltr"===r?[0,o]:[-1*o,0]);return Pb([0,o],[0,i])(l)}function Pb(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 Ob(e,t){return e>0&&e<t}var Ib=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,i=r.top!==s.top;(o||i)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Db(e,t){const r=Gf(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Ub(e,t){const r=Gf(t);Hf(()=>{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 Fb=lb,Mb=db,zb=Eb;const Lb=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Fb,{ref:a,className:je("relative overflow-hidden",t),...n,children:[e.jsx(Mb,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx($b,{}),e.jsx(zb,{})]}));Lb.displayName=Fb.displayName;const $b=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(fb,{ref:a,orientation:r,className:je("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(kb,{className:je("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));$b.displayName=fb.displayName;var Wb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=ed(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Vb="horizontal",Bb=["horizontal","vertical"],Gb=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Vb,...s}=t,o=function(e){return Bb.includes(e)}(a)?a:Vb,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return e.jsx(Wb.div,{"data-orientation":o,...i,...s,ref:r})});Gb.displayName="Separator";var Kb=Gb;const Hb=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},s)=>e.jsx(Kb,{ref:s,decorative:n,orientation:r,className:je("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Hb.displayName=Kb.displayName;var Zb=Symbol("radix.slottable");var qb="AlertDialog",[Jb]=Sp(qb,[rh]),Yb=rh(),Xb=t=>{const{__scopeAlertDialog:r,...n}=t,a=Yb(r);return e.jsx(Oh,{...a,...n,modal:!0})};Xb.displayName=qb;var Qb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Ih,{...s,...a,ref:r})});Qb.displayName="AlertDialogTrigger";var ey=t=>{const{__scopeAlertDialog:r,...n}=t,a=Yb(r);return e.jsx(Dh,{...a,...n})};ey.displayName="AlertDialogPortal";var ty=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Uh,{...s,...a,ref:r})});ty.displayName="AlertDialogOverlay";var ry="AlertDialogContent",[ny,ay]=Jb(ry),sy=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=Zb,r}("AlertDialogContent"),oy=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:s,...o}=t,i=Yb(n),l=a.useRef(null),c=Jc(r,l),d=a.useRef(null);return e.jsx(_h,{contentName:ry,titleName:iy,docsSlug:"alert-dialog",children:e.jsx(ny,{scope:n,cancelRef:d,children:e.jsxs(Fh,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:wp(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(sy,{children:s}),e.jsx(my,{contentRef:l})]})})})});oy.displayName=ry;var iy="AlertDialogTitle",ly=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Mh,{...s,...a,ref:r})});ly.displayName=iy;var cy="AlertDialogDescription",dy=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(zh,{...s,...a,ref:r})});dy.displayName=cy;var uy=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Lh,{...s,...a,ref:r})});uy.displayName="AlertDialogAction";var fy="AlertDialogCancel",py=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:s}=ay(fy,n),o=Yb(n),i=Jc(r,s);return e.jsx(Lh,{...o,...a,ref:i})});py.displayName=fy;var my=({contentRef:e})=>{const t=`\`${ry}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${ry}\` by passing a \`${cy}\` 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 \`${ry}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},hy=ty,gy=oy,by=uy,yy=py,xy=ly,vy=dy;const wy=Xb,Sy=Qb,ky=ey,jy=a.forwardRef(({className:t,...r},n)=>e.jsx(hy,{className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:n}));jy.displayName=hy.displayName;const Ny=a.forwardRef(({className:t,...r},n)=>{const{container:s}=a.useContext(ns);return e.jsxs(ky,{container:s,children:[e.jsx(jy,{}),e.jsx(gy,{ref:n,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...r})]})});Ny.displayName=gy.displayName;const Ey=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col space-y-2 text-center sm:text-left",t),...r});Ey.displayName="AlertDialogHeader";const Cy=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Cy.displayName="AlertDialogFooter";const Ay=a.forwardRef(({className:t,...r},n)=>e.jsx(xy,{ref:n,className:je("text-lg font-semibold",t),...r}));Ay.displayName=xy.displayName;const _y=a.forwardRef(({className:t,...r},n)=>e.jsx(vy,{ref:n,className:je("text-sm text-muted-foreground",t),...r}));_y.displayName=vy.displayName;const Ty=a.forwardRef(({className:t,...r},n)=>e.jsx(by,{ref:n,className:je(Md(),t),...r}));Ty.displayName=by.displayName;const Ry=a.forwardRef(({className:t,...r},n)=>e.jsx(yy,{ref:n,className:je(Md({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Py(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(ru,{className:"h-10 w-full"}),e.jsx(ru,{className:"h-10 w-full"}),e.jsx(ru,{className:"h-10 w-full"})]})}Ry.displayName=yy.displayName;const Oy=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:s}=or(),{user:o}=es();if(!r)return e.jsx(Py,{});const i=ar(r,o?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(wy,{children:[e.jsx(Sy,{asChild:!0,children:e.jsxs(zd,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(Od,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Ny,{children:[e.jsxs(Ey,{children:[e.jsx(Ay,{children:"Are you absolutely sure?"}),e.jsxs(_y,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Cy,{children:[e.jsx(Ry,{disabled:n,children:"Cancel"}),e.jsx(Ty,{onClick:async()=>{a(!0);try{await s(r._id)}catch(e){De(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(Nd,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Iy="Switch",[Dy]=Sp(Iy),[Uy,Fy]=Dy(Iy),My=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Jc(r,e=>h(e)),b=a.useRef(!1),y=!m||(f||!!m.closest("form")),[x,v]=Ap({prop:o,defaultProp:i??!1,onChange:u,caller:Iy});return e.jsxs(Uy,{scope:n,checked:x,disabled:c,children:[e.jsx(Pp.button,{type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":Wy(x),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:g,onClick:wp(t.onClick,e=>{v(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&e.jsx($y,{control:m,bubbles:!b.current,name:s,value:d,checked:x,required:l,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});My.displayName=Iy;var zy="SwitchThumb",Ly=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,s=Fy(zy,n);return e.jsx(Pp.span,{"data-state":Wy(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});Ly.displayName=zy;var $y=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=Jc(l,i),d=Tg(n),u=_g(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Wy(e){return e?"checked":"unchecked"}$y.displayName="SwitchBubbleInput";var Vy=My,By=Ly;const Gy=a.forwardRef(({className:t,...r},n)=>e.jsx(Vy,{className:je("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:n,children:e.jsx(By,{className:je("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")})}));Gy.displayName=Vy.displayName;const Ky=({workspaceId:r})=>{const[n,a]=t.useState({}),[s,o]=t.useState(null),i=t.useRef(null),{allFeatures:l,updateFeature:c,getWorkspace:d}=or();t.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const[u,f]=t.useState(null),{user:p}=es();if(t.useEffect(()=>{d(r).then(f)},[r]),!u)return e.jsx(Py,{});const m=nr(u,p?.id??null);return e.jsxs("div",{children:[s&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:s})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!l.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),l.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:l.map(t=>{const r=u?.features?.[t.slug],s=null!==n[t.slug]&&void 0!==n[t.slug],d=n[t.slug],p=!0===d?"Enabling":!1===d?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),s?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(Nd,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[p,"..."]})]}):e.jsx(Gy,{disabled:!m,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(u){a(r=>({...r,[e]:t})),o(null);try{const r=await c(u._id,e,t);f(r);const n=l.find(t=>t.slug===e);o(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o(null)},5e3)}catch(t){De(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:u._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})},Hy={usd:"$",eur:"โ‚ฌ",gbp:"ยฃ",jpy:"ยฅ",cad:"CA$",aud:"A$",chf:"CHF",cny:"ยฅ",hkd:"HK$",sgd:"S$",inr:"โ‚น",mxn:"MX$",brl:"R$",nzd:"NZ$",sek:"kr",nok:"kr",dkk:"kr",pln:"zล‚",thb:"เธฟ"},Zy={usd:"๐Ÿ‡บ๐Ÿ‡ธ",eur:"๐Ÿ‡ช๐Ÿ‡บ",gbp:"๐Ÿ‡ฌ๐Ÿ‡ง",jpy:"๐Ÿ‡ฏ๐Ÿ‡ต",cad:"๐Ÿ‡จ๐Ÿ‡ฆ",aud:"๐Ÿ‡ฆ๐Ÿ‡บ",chf:"๐Ÿ‡จ๐Ÿ‡ญ",cny:"๐Ÿ‡จ๐Ÿ‡ณ",hkd:"๐Ÿ‡ญ๐Ÿ‡ฐ",sgd:"๐Ÿ‡ธ๐Ÿ‡ฌ",inr:"๐Ÿ‡ฎ๐Ÿ‡ณ",mxn:"๐Ÿ‡ฒ๐Ÿ‡ฝ",brl:"๐Ÿ‡ง๐Ÿ‡ท",nzd:"๐Ÿ‡ณ๐Ÿ‡ฟ",sek:"๐Ÿ‡ธ๐Ÿ‡ช",nok:"๐Ÿ‡ณ๐Ÿ‡ด",dkk:"๐Ÿ‡ฉ๐Ÿ‡ฐ",pln:"๐Ÿ‡ต๐Ÿ‡ฑ",thb:"๐Ÿ‡น๐Ÿ‡ญ"};function qy(e){return e&&e.trim()?Zy[e.trim().toLowerCase()]??"":""}function Jy(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return Hy[t]??t.toUpperCase()}const Yy=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],Xy=Yy.map(e=>({value:e,label:`${e.toUpperCase()} (${Jy(e)})`}));function Qy(e,t){return Jy(t)+(e/100).toFixed(2)}function ex(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.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}</text></svg>`}const tx=["๐Ÿข","๐Ÿฌ","๐Ÿฃ","๐Ÿค","๐Ÿฆ","๐Ÿ›๏ธ","๐Ÿ ","๐Ÿก","๐Ÿญ","๐Ÿ—๏ธ","๐Ÿช","๐Ÿจ","๐Ÿซ","๐Ÿฅ","๐Ÿ’ผ","๐Ÿ“Š","๐Ÿ“ˆ","๐Ÿ“‰","๐Ÿ“‹","๐Ÿ“","๐Ÿ“‚","๐Ÿ—‚๏ธ","๐Ÿ—ƒ๏ธ","๐Ÿ—„๏ธ","๐Ÿ“…","๐Ÿ—“๏ธ","๐Ÿ“","๐Ÿ–‹๏ธ","โœ๏ธ","๐Ÿ–Š๏ธ","๐Ÿ–Œ๏ธ","๐Ÿ–๏ธ","๐Ÿ“‡","๐Ÿ“Œ","๐Ÿ“","๐Ÿ“Ž","๐Ÿ–‡๏ธ","๐Ÿ’ป","๐Ÿ–ฅ๏ธ","๐Ÿ–จ๏ธ","๐Ÿ–ฑ๏ธ","โŒจ๏ธ","๐Ÿ“ฑ","๐Ÿ“ฒ","๐Ÿ“ก","๐ŸŒ","๐Ÿ”—","๐Ÿ”’","๐Ÿ”“","โš™๏ธ","๐Ÿ”ง","๐Ÿ› ๏ธ","๐Ÿง‘โ€๐Ÿ’ป","๐Ÿ‘จโ€๐Ÿ’ป","๐Ÿ‘ฉโ€๐Ÿ’ป","๐Ÿ•น๏ธ","๐Ÿ’พ","๐Ÿ“Ÿ","๐Ÿ–ฅ๏ธ","๐Ÿ–ฒ๏ธ","๐Ÿš€","๐Ÿ’ก","๐ŸŽจ","๐Ÿ–ผ๏ธ","๐Ÿงช","๐Ÿ”ฌ","๐Ÿงฌ","๐ŸŽฏ","โšก","๐ŸŽฒ","๐ŸŽฎ","๐Ÿงฉ","๐Ÿ“ท","๐ŸŽฅ","โœ‰๏ธ","๐Ÿ“จ","๐Ÿ“ฉ","๐Ÿ“ง","๐Ÿ“ž","โ˜Ž๏ธ","๐Ÿ“ ","๐Ÿ—ฃ๏ธ","๐Ÿ’ฌ","๐Ÿ—จ๏ธ","๐Ÿ“ข","๐Ÿ“ฃ","๐Ÿ””","๐Ÿ›Ž๏ธ","๐Ÿ’ฐ","๐Ÿ’ธ","๐Ÿ’ณ","๐Ÿฆ","๐Ÿ“ˆ","๐Ÿ“‰","โš–๏ธ","๐Ÿงพ","๐Ÿช™","๐Ÿ›๏ธ","โš—๏ธ","๐Ÿงช","๐Ÿ”ญ","๐Ÿ”ฌ","๐Ÿฉบ","๐Ÿงฌ","๐Ÿฉป","๐Ÿฅ","๐ŸŒฑ","๐ŸŒ","๐ŸŒ","๐ŸŒŽ","๐ŸŒก๏ธ","๐Ÿ‘จโ€๐Ÿ’ผ","๐Ÿ‘ฉโ€๐Ÿ’ผ","๐Ÿ‘จโ€๐Ÿซ","๐Ÿ‘ฉโ€๐Ÿซ","๐Ÿ‘จโ€๐Ÿ”ฌ","๐Ÿ‘ฉโ€๐Ÿ”ฌ","๐Ÿ‘จโ€๐ŸŽจ","๐Ÿ‘ฉโ€๐ŸŽจ","๐Ÿ‘จโ€๐Ÿ”ง","๐Ÿ‘ฉโ€๐Ÿ”ง","๐Ÿ‘จโ€๐Ÿš€","๐Ÿ‘ฉโ€๐Ÿš€","๐Ÿ‘จโ€โš–๏ธ","๐Ÿ‘ฉโ€โš–๏ธ","๐Ÿ…","๐ŸŽ–๏ธ","๐Ÿฅ‡","๐Ÿฅˆ","๐Ÿฅ‰","๐Ÿ†","๐ŸŽ—๏ธ","๐Ÿ”‘","๐Ÿ—๏ธ","๐Ÿงญ","๐Ÿ›ก๏ธ","๐Ÿšฉ","๐Ÿณ๏ธโ€๐ŸŒˆ","๐ŸŽŸ๏ธ","๐ŸŽซ"],rx=({workspace:r})=>{const[n,a]=t.useState(!1),[s,o]=t.useState("emoji"),[i,l]=t.useState(),[c,d]=t.useState(null),u=t.useRef(null),{updateWorkspace:f}=or();t.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const{user:p}=es(),m=zo({resolver:Hc(rf({name:_u().min(2,{message:"Workspace name must be at least 2 characters."}),image:_u().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Py,{});const h=nr(r,p?.id??null);return e.jsxs("div",{children:[c&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:c})]}),!h&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Gd,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await f(r,e),d("Workspace settings saved successfully"),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{d(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Hd,{control:m.control,name:"name",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Name"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"My Awesome Workspace",...t,disabled:!h})}),e.jsx(eu,{})]})}),r.billingCurrency?.trim()&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Bd,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[qy(r.billingCurrency)&&e.jsx("span",{className:"text-base",children:qy(r.billingCurrency)}),e.jsx("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Bd,{className:"text-sm font-medium",children:"Icon"}),e.jsx(Qd,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(tb,{value:s,disabled:!h,onValueChange:e=>o(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(rb,{value:"emoji",id:"emoji"}),e.jsxs(Bd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Rd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(rb,{value:"url",id:"url"}),e.jsxs(Bd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(jd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&m.watch("image")?.trim()&&e.jsx("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&e.jsx(Lb,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:tx.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",ex(e))})(t),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Hd,{control:m.control,name:"image",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Image URL"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"https://example.com/image.png",...t,disabled:!h})}),e.jsx(Qd,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(eu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:h&&e.jsx(zd,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var nx=.999,ax=/[\\\/_+.#"@\[\(\{&]/,sx=/[\\\/_+.#"@\[\(\{&]/g,ox=/[\s-]/,ix=/[\s-]/g;function lx(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?1:.99;var i=`${a},${s}`;if(void 0!==o[i])return o[i];for(var l,c,d,u,f=n.charAt(s),p=r.indexOf(f,a),m=0;p>=0;)(l=lx(e,t,r,n,p+1,s+1,o))>m&&(p===a?l*=1:ax.test(e.charAt(p-1))?(l*=.8,(d=e.slice(a,p-1).match(sx))&&a>0&&(l*=Math.pow(nx,d.length))):ox.test(e.charAt(p-1))?(l*=.9,(u=e.slice(a,p-1).match(ix))&&a>0&&(l*=Math.pow(nx,u.length))):(l*=.17,a>0&&(l*=Math.pow(nx,p-a))),e.charAt(p)!==t.charAt(s)&&(l*=.9999)),(l<.1&&r.charAt(p-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(p-1)!==n.charAt(s))&&(.1*(c=lx(e,t,r,n,p+1,s+2,o))>l&&(l=.1*c)),l>m&&(m=l),p=r.indexOf(f,p+1);return o[i]=m,m}function cx(e){return e.toLowerCase().replace(ix," ")}function dx(e,t,r){return lx(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,cx(e),cx(t),0,0,{})}var ux='[cmdk-group=""]',fx='[cmdk-group-items=""]',px='[cmdk-item=""]',mx=`${px}:not([aria-disabled="true"])`,hx="cmdk-item-select",gx="data-value",bx=(e,t,r)=>dx(e,t,r),yx=a.createContext(void 0),xx=()=>a.useContext(yx),vx=a.createContext(void 0),wx=()=>a.useContext(vx),Sx=a.createContext(void 0),kx=a.forwardRef((e,t)=>{let r=Fx(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Fx(()=>new Set),s=Fx(()=>new Map),o=Fx(()=>new Map),i=Fx(()=>new Set),l=Dx(e),{label:c,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...y}=e,x=Ep(),v=Ep(),w=Ep(),S=a.useRef(null),k=Lx();Ux(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,j.emit()}},[u]),Ux(()=>{k(6,T)},[]);let j=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),C(),k(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(x))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,j.emit()}),n||k(5,T),void 0!==(null==(s=l.current)?void 0:s.value)){let e=null!=t?t:"";return void(null==(i=(o=l.current).onValueChange)||i.call(o,e))}}j.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),N=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=o.current.get(e))?void 0:a.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,E(t,n)),k(2,()=>{C(),j.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),k(3,()=>{_(),C(),r.current.value||A(),j.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&A(),j.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:w,labelId:v,listInnerRef:S}),[]);function E(e,t){var n,a;let s=null!=(a=null==(n=l.current)?void 0:n.filter)?a:bx;return e?s(e,r.current.search,t):0}function C(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;P().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(fx);t?t.appendChild(e.parentElement===t?e:e.closest(`${fx} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${fx} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${ux}[${gx}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function A(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(gx);j.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=E(null!=(t=null==(e=o.current.get(s))?void 0:e.value)?t:"",null!=(i=null==(a=o.current.get(s))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.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=c}function T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(ux))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${px}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(mx))||[])}function O(e){let t=P()[e];t&&j.setState("value",t.getAttribute(gx))}function I(e){var t;let r=R(),n=P(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=l.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&j.setState("value",s.getAttribute(gx))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(ux);for(;n&&!t;)n=e>0?Ox(n,ux):Ix(n,ux),t=null==n?void 0:n.querySelector(mx);t?j.setState("value",t.getAttribute(gx)):I(e)}let U=()=>O(P().length-1),F=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},M=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Pp.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":b&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":b&&e.ctrlKey&&M(e);break;case"ArrowUp":M(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(hx);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:Wx},c),$x(e,e=>a.createElement(vx.Provider,{value:j},a.createElement(yx.Provider,{value:N},e))))}),jx=a.forwardRef((e,t)=>{var r,n;let s=Ep(),o=a.useRef(null),i=a.useContext(Sx),l=xx(),c=Dx(e),d=null!=(n=null==(r=c.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Ux(()=>{if(!d)return l.item(s,null==i?void 0:i.id)},[d]);let u=zx(s,o,[e.value,e.children,o],e.keywords),f=wx(),p=Mx(e=>e.value&&e.value===u.current),m=Mx(e=>!(!d&&!1!==l.filter())||(!e.search||e.filtered.items.get(s)>0));function h(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(a.useEffect(()=>{let t=o.current;if(t&&!e.disabled)return t.addEventListener(hx,h),()=>t.removeEventListener(hx,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:y,onSelect:x,forceMount:v,keywords:w,...S}=e;return a.createElement(Pp.div,{ref:qc(o,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||l.getDisablePointerSelection()?void 0:g,onClick:b?void 0:h},e.children)}),Nx=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...o}=e,i=Ep(),l=a.useRef(null),c=a.useRef(null),d=Ep(),u=xx(),f=Mx(e=>!(!s&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Ux(()=>u.group(i),[]),zx(i,l,[e.value,e.heading,c]);let p=a.useMemo(()=>({id:i,forceMount:s}),[s]);return a.createElement(Pp.div,{ref:qc(l,t),...o,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),$x(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(Sx.Provider,{value:p},e))))}),Ex=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=a.useRef(null),o=Mx(e=>!e.search);return r||o?a.createElement(Pp.div,{ref:qc(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),Cx=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=wx(),i=Mx(e=>e.search),l=Mx(e=>e.selectedItemId),c=xx();return a.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),a.createElement(Pp.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:i,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),Ax=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,o=a.useRef(null),i=a.useRef(null),l=Mx(e=>e.selectedItemId),c=xx();return a.useEffect(()=>{if(i.current&&o.current){let e,t=i.current,r=o.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),a.createElement(Pp.div,{ref:qc(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},$x(e,e=>a.createElement("div",{ref:qc(i,c.listInnerRef),"cmdk-list-sizer":""},e)))}),_x=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:i,...l}=e;return a.createElement(Oh,{open:r,onOpenChange:n},a.createElement(Dh,{container:i},a.createElement(Uh,{"cmdk-overlay":"",className:s}),a.createElement(Fh,{"aria-label":e.label,"cmdk-dialog":"",className:o},a.createElement(kx,{ref:t,...l}))))}),Tx=a.forwardRef((e,t)=>Mx(e=>0===e.filtered.count)?a.createElement(Pp.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Rx=a.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return a.createElement(Pp.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},$x(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Px=Object.assign(kx,{List:Ax,Item:jx,Input:Cx,Group:Nx,Separator:Ex,Dialog:_x,Empty:Tx,Loading:Rx});function Ox(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Ix(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Dx(e){let t=a.useRef(e);return Ux(()=>{t.current=e}),t}var Ux="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function Fx(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Mx(e){let t=wx(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function zx(e,t,r,n=[]){let s=a.useRef(),o=xx();return Ux(()=>{var a;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),l=n.map(e=>e.trim());o.value(e,i,l),null==(a=t.current)||a.setAttribute(gx,i),s.current=i}),s}var Lx=()=>{let[e,t]=a.useState(),r=Fx(()=>new Map);return Ux(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function $x({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var Wx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Vx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px,{ref:n,className:je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Vx.displayName=Px.displayName;const Bx=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(qh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Px.Input,{ref:n,className:je("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})]}));Bx.displayName=Px.Input.displayName;const Gx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px.List,{ref:n,className:je("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));Gx.displayName=Px.List.displayName;a.forwardRef((t,r)=>e.jsx(Px.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Px.Empty.displayName;const Kx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px.Group,{ref:n,className:je("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));Kx.displayName=Px.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Px.Separator,{ref:n,className:je("-mx-1 h-px bg-border",t),...r})).displayName=Px.Separator.displayName;const Hx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px.Item,{ref:n,className:je("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r}));Hx.displayName=Px.Item.displayName;const Zx=["top","right","bottom","left"],qx=Math.min,Jx=Math.max,Yx=Math.round,Xx=Math.floor,Qx=e=>({x:e,y:e}),ev={left:"right",right:"left",bottom:"top",top:"bottom"},tv={start:"end",end:"start"};function rv(e,t,r){return Jx(e,qx(t,r))}function nv(e,t){return"function"==typeof e?e(t):e}function av(e){return e.split("-")[0]}function sv(e){return e.split("-")[1]}function ov(e){return"x"===e?"y":"x"}function iv(e){return"y"===e?"height":"width"}const lv=new Set(["top","bottom"]);function cv(e){return lv.has(av(e))?"y":"x"}function dv(e){return ov(cv(e))}function uv(e){return e.replace(/start|end/g,e=>tv[e])}const fv=["left","right"],pv=["right","left"],mv=["top","bottom"],hv=["bottom","top"];function gv(e,t,r,n){const a=sv(e);let s=function(e,t,r){switch(e){case"top":case"bottom":return r?t?pv:fv:t?fv:pv;case"left":case"right":return t?mv:hv;default:return[]}}(av(e),"start"===r,n);return a&&(s=s.map(e=>e+"-"+a),t&&(s=s.concat(s.map(uv)))),s}function bv(e){return e.replace(/left|right|bottom|top/g,e=>ev[e])}function yv(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 xv(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 vv(e,t,r){let{reference:n,floating:a}=e;const s=cv(t),o=dv(t),i=iv(o),l=av(t),c="y"===s,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/2;let p;switch(l){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(sv(t)){case"start":p[o]-=f*(r&&c?-1:1);break;case"end":p[o]+=f*(r&&c?-1:1)}return p}async function wv(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:s,rects:o,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=nv(t,e),m=yv(p),h=i[f?"floating"===u?"reference":"floating":u],g=xv(await s.getClippingRect({element:null==(r=await(null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),x=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},v=xv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-v.top+m.top)/x.y,bottom:(v.bottom-g.bottom+m.bottom)/x.y,left:(g.left-v.left+m.left)/x.x,right:(v.right-g.right+m.right)/x.x}}function Sv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kv(e){return Zx.some(t=>e[t]>=0)}const jv=new Set(["left","top"]);function Nv(){return"undefined"!=typeof window}function Ev(e){return _v(e)?(e.nodeName||"").toLowerCase():"#document"}function Cv(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Av(e){var t;return null==(t=(_v(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function _v(e){return!!Nv()&&(e instanceof Node||e instanceof Cv(e).Node)}function Tv(e){return!!Nv()&&(e instanceof Element||e instanceof Cv(e).Element)}function Rv(e){return!!Nv()&&(e instanceof HTMLElement||e instanceof Cv(e).HTMLElement)}function Pv(e){return!(!Nv()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Cv(e).ShadowRoot)}const Ov=new Set(["inline","contents"]);function Iv(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Kv(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Ov.has(a)}const Dv=new Set(["table","td","th"]);function Uv(e){return Dv.has(Ev(e))}const Fv=[":popover-open",":modal"];function Mv(e){return Fv.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const zv=["transform","translate","scale","rotate","perspective"],Lv=["transform","translate","scale","rotate","perspective","filter"],$v=["paint","layout","strict","content"];function Wv(e){const t=Vv(),r=Tv(e)?Kv(e):e;return zv.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Lv.some(e=>(r.willChange||"").includes(e))||$v.some(e=>(r.contain||"").includes(e))}function Vv(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Bv=new Set(["html","body","#document"]);function Gv(e){return Bv.has(Ev(e))}function Kv(e){return Cv(e).getComputedStyle(e)}function Hv(e){return Tv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zv(e){if("html"===Ev(e))return e;const t=e.assignedSlot||e.parentNode||Pv(e)&&e.host||Av(e);return Pv(t)?t.host:t}function qv(e){const t=Zv(e);return Gv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Rv(t)&&Iv(t)?t:qv(t)}function Jv(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=qv(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),o=Cv(a);if(s){const e=Yv(o);return t.concat(o,o.visualViewport||[],Iv(a)?a:[],e&&r?Jv(e):[])}return t.concat(a,Jv(a,[],r))}function Yv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xv(e){const t=Kv(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Rv(e),s=a?e.offsetWidth:r,o=a?e.offsetHeight:n,i=Yx(r)!==s||Yx(n)!==o;return i&&(r=s,n=o),{width:r,height:n,$:i}}function Qv(e){return Tv(e)?e:e.contextElement}function ew(e){const t=Qv(e);if(!Rv(t))return Qx(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=Xv(t);let o=(s?Yx(r.width):r.width)/n,i=(s?Yx(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}const tw=Qx(0);function rw(e){const t=Cv(e);return Vv()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:tw}function nw(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),s=Qv(e);let o=Qx(1);t&&(n?Tv(n)&&(o=ew(n)):o=ew(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Cv(e))&&t}(s,r,n)?rw(s):Qx(0);let l=(a.left+i.x)/o.x,c=(a.top+i.y)/o.y,d=a.width/o.x,u=a.height/o.y;if(s){const e=Cv(s),t=n&&Tv(n)?Cv(n):n;let r=e,a=Yv(r);for(;a&&n&&t!==r;){const e=ew(a),t=a.getBoundingClientRect(),n=Kv(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=o,r=Cv(a),a=Yv(r)}}return xv({width:d,height:u,x:l,y:c})}function aw(e,t){const r=Hv(e).scrollLeft;return t?t.left+r:nw(Av(e)).left+r}function sw(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-aw(e,r),y:r.top+t.scrollTop}}const ow=new Set(["absolute","fixed"]);function iw(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Cv(e),n=Av(e),a=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,i=0,l=0;if(a){s=a.width,o=a.height;const e=Vv();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,l=a.offsetTop)}const c=aw(n);if(c<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(s-=o)}else c<=25&&(s+=c);return{width:s,height:o,x:i,y:l}}(e,r);else if("document"===t)n=function(e){const t=Av(e),r=Hv(e),n=e.ownerDocument.body,a=Jx(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Jx(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+aw(e);const i=-r.scrollTop;return"rtl"===Kv(n).direction&&(o+=Jx(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:o,y:i}}(Av(e));else if(Tv(t))n=function(e,t){const r=nw(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Rv(e)?ew(e):Qx(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:a*s.x,y:n*s.y}}(t,r);else{const r=rw(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return xv(n)}function lw(e,t){const r=Zv(e);return!(r===t||!Tv(r)||Gv(r))&&("fixed"===Kv(r).position||lw(r,t))}function cw(e,t,r){const n=Rv(t),a=Av(t),s="fixed"===r,o=nw(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=Qx(0);function c(){l.x=aw(a)}if(n||!n&&!s)if(("body"!==Ev(t)||Iv(a))&&(i=Hv(t)),n){const e=nw(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();s&&!n&&a&&c();const d=!a||n||s?Qx(0):sw(a,i);return{x:o.left+i.scrollLeft-l.x-d.x,y:o.top+i.scrollTop-l.y-d.y,width:o.width,height:o.height}}function dw(e){return"static"===Kv(e).position}function uw(e,t){if(!Rv(e)||"fixed"===Kv(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Av(e)===r&&(r=r.ownerDocument.body),r}function fw(e,t){const r=Cv(e);if(Mv(e))return r;if(!Rv(e)){let t=Zv(e);for(;t&&!Gv(t);){if(Tv(t)&&!dw(t))return t;t=Zv(t)}return r}let n=uw(e,t);for(;n&&Uv(n)&&dw(n);)n=uw(n,t);return n&&Gv(n)&&dw(n)&&!Wv(n)?r:n||function(e){let t=Zv(e);for(;Rv(t)&&!Gv(t);){if(Wv(t))return t;if(Mv(t))return null;t=Zv(t)}return null}(e)||r}const pw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s="fixed"===a,o=Av(n),i=!!t&&Mv(t.floating);if(n===o||i&&s)return r;let l={scrollLeft:0,scrollTop:0},c=Qx(1);const d=Qx(0),u=Rv(n);if((u||!u&&!s)&&(("body"!==Ev(n)||Iv(o))&&(l=Hv(n)),Rv(n))){const e=nw(n);c=ew(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!o||u||s?Qx(0):sw(o,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:r.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:Av,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s="clippingAncestors"===r?Mv(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Jv(e,[],!1).filter(e=>Tv(e)&&"body"!==Ev(e)),a=null;const s="fixed"===Kv(e).position;let o=s?Zv(e):e;for(;Tv(o)&&!Gv(o);){const t=Kv(o),r=Wv(o);r||"fixed"!==t.position||(a=null),(s?!r&&!a:!r&&"static"===t.position&&a&&ow.has(a.position)||Iv(o)&&!r&&lw(e,o))?n=n.filter(e=>e!==o):a=t,o=Zv(o)}return t.set(e,n),n}(t,this._c):[].concat(r),o=[...s,n],i=o[0],l=o.reduce((e,r)=>{const n=iw(t,r,a);return e.top=Jx(n.top,e.top),e.right=qx(n.right,e.right),e.bottom=qx(n.bottom,e.bottom),e.left=Jx(n.left,e.left),e},iw(t,i,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:fw,getElementRects:async function(e){const t=this.getOffsetParent||fw,r=this.getDimensions,n=await r(e.floating);return{reference:cw(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}=Xv(e);return{width:t,height:r}},getScale:ew,isElement:Tv,isRTL:function(e){return"rtl"===Kv(e).direction}};function mw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hw(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Qv(e),d=a||s?[...c?Jv(c):[],...Jv(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});const u=c&&i?function(e,t){let r,n=null;const a=Av(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const m={rootMargin:-Xx(u)+"px "+-Xx(a.clientWidth-(d+f))+"px "+-Xx(a.clientHeight-(u+p))+"px "+-Xx(d)+"px",threshold:Jx(0,qx(1,l))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||mw(c,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),s}(c,r):null;let f,p=-1,m=null;o&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!l&&m.observe(c),m.observe(t));let h=l?nw(e):null;return l&&function t(){const n=nw(e);h&&!mw(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const gw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:o,middlewareData:i}=t,l=await async function(e,t){const{placement:r,platform:n,elements:a}=e,s=await(null==n.isRTL?void 0:n.isRTL(a.floating)),o=av(r),i=sv(r),l="y"===cv(r),c=jv.has(o)?-1:1,d=s&&l?-1:1,u=nv(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof m&&(p="end"===i?-1*m:m),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return o===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+l.x,y:s+l.y,data:{...l,placement:o}}}}},bw=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=nv(e,t),d={x:r,y:n},u=await s.detectOverflow(t,c),f=cv(av(a)),p=ov(f);let m=d[p],h=d[f];if(o){const e="y"===p?"bottom":"right";m=rv(m+u["y"===p?"top":"left"],m,m-u[e])}if(i){const e="y"===f?"bottom":"right";h=rv(h+u["y"===f?"top":"left"],h,h-u[e])}const g=l.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[p]:o,[f]:i}}}}}},yw=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:o,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=nv(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};const b=av(a),y=cv(i),x=av(i)===i,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(x||!h?[bv(i)]:function(e){const t=bv(e);return[uv(e),t,uv(t)]}(i)),S="none"!==m;!f&&S&&w.push(...gv(i,h,m,v));const k=[i,...w],j=await l.detectOverflow(t,g),N=[];let E=(null==(n=s.flip)?void 0:n.overflows)||[];if(d&&N.push(j[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=sv(e),a=dv(e),s=iv(a);let o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=bv(o)),[o,bv(o)]}(a,o,v);N.push(j[e[0]],j[e[1]])}if(E=[...E,{placement:a,overflows:N}],!N.every(e=>e<=0)){var C,A;const e=((null==(C=s.flip)?void 0:C.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==cv(t))||E.every(e=>cv(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let r=null==(A=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=E.filter(e=>{if(S){const t=cv(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},xw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:o,elements:i}=t,{apply:l=()=>{},...c}=nv(e,t),d=await o.detectOverflow(t,c),u=av(a),f=sv(a),p="y"===cv(a),{width:m,height:h}=s.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,x=m-d.left-d.right,v=qx(h-d[g],y),w=qx(m-d[b],x),S=!t.middlewareData.shift;let k=v,j=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(j=x),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=Jx(d.left,0),t=Jx(d.right,0),r=Jx(d.top,0),n=Jx(d.bottom,0);p?j=m-2*(0!==e||0!==t?e+t:Jx(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Jx(d.top,d.bottom))}await l({...t,availableWidth:j,availableHeight:k});const N=await o.getDimensions(i.floating);return m!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}},vw=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=nv(e,t);switch(a){case"referenceHidden":{const e=Sv(await n.detectOverflow(t,{...s,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kv(e)}}}case"escaped":{const e=Sv(await n.detectOverflow(t,{...s,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:kv(e)}}}default:return{}}}}},ww=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:o,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=nv(e,t)||{};if(null==c)return{};const u=yv(d),f={x:r,y:n},p=dv(a),m=iv(p),h=await o.getDimensions(c),g="y"===p,b=g?"top":"left",y=g?"bottom":"right",x=g?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[p]-f[p]-s.floating[m],w=f[p]-s.reference[p],S=await(null==o.getOffsetParent?void 0:o.getOffsetParent(c));let k=S?S[x]:0;k&&await(null==o.isElement?void 0:o.isElement(S))||(k=i.floating[x]||s.floating[m]);const j=v/2-w/2,N=k/2-h[m]/2-1,E=qx(u[b],N),C=qx(u[y],N),A=E,_=k-h[m]-C,T=k/2-h[m]/2+j,R=rv(A,T,_),P=!l.arrow&&null!=sv(a)&&T!==R&&s.reference[m]/2-(T<A?E:C)-h[m]/2<0,O=P?T<A?T-A:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),Sw=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:o}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=nv(e,t),d={x:r,y:n},u=cv(a),f=ov(u);let p=d[f],m=d[u];const h=nv(i,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+g.mainAxis,r=s.reference[f]+s.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){var b,y;const e="y"===f?"width":"height",t=jv.has(av(a)),r=s.reference[u]-s.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=s.reference[u]+s.reference[e]+(t?0:(null==(y=o.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},kw=(e,t,r)=>{const n=new Map,a={platform:pw,...r},s={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:o}=r,i=s.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=vv(c,n,l),f=n,p={},m=0;for(let r=0;r<i.length;r++){var h;const{name:s,fn:g}=i[r],{x:b,y:y,data:x,reset:v}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:c,platform:{...o,detectOverflow:null!=(h=o.detectOverflow)?h:wv},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=y?y:u,p={...p,[s]:{...p[s],...x}},v&&m<=50&&(m++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):v.rects),({x:d,y:u}=vv(c,f,l))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:s})};var jw="undefined"!=typeof document?t.useLayoutEffect:function(){};function Nw(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(!Nw(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)&&!Nw(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Ew(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cw(e,t){const r=Ew(e);return Math.round(t*r)/r}function Aw(e){const t=a.useRef(e);return jw(()=>{t.current=e}),t}const _w=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?ww({element:r.current,padding:n}).fn(t):{}:r?ww({element:r,padding:n}).fn(t):{};var a}}),Tw=(e,t)=>({...gw(e),options:[e,t]}),Rw=(e,t)=>({...bw(e),options:[e,t]}),Pw=(e,t)=>({...Sw(e),options:[e,t]}),Ow=(e,t)=>({...yw(e),options:[e,t]}),Iw=(e,t)=>({...xw(e),options:[e,t]}),Dw=(e,t)=>({...vw(e),options:[e,t]}),Uw=(e,t)=>({..._w(e),options:[e,t]});var Fw=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:s=5,...o}=t;return e.jsx(Pp.svg,{...o,ref:r,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fw.displayName="Arrow";var Mw=Fw,zw="Popper",[Lw,$w]=Sp(zw),[Ww,Vw]=Lw(zw),Bw=t=>{const{__scopePopper:r,children:n}=t,[s,o]=a.useState(null);return e.jsx(Ww,{scope:r,anchor:s,onAnchorChange:o,children:n})};Bw.displayName=zw;var Gw="PopperAnchor",Kw=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:s,...o}=t,i=Vw(Gw,n),l=a.useRef(null),c=Jc(r,l),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=s?.current||l.current,e!==d.current&&i.onAnchorChange(d.current)}),s?null:e.jsx(Pp.div,{...o,ref:c})});Kw.displayName=Gw;var Hw="PopperContent",[Zw,qw]=Lw(Hw),Jw=a.forwardRef((t,r)=>{const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=t,x=Vw(Hw,n),[v,w]=a.useState(null),S=Jc(r,e=>w(e)),[k,j]=a.useState(null),N=_g(k),E=N?.width??0,C=N?.height??0,A=o+("center"!==l?"-"+l:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(eS),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:F}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:l}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);Nw(m,n)||h(n);const[g,b]=a.useState(null),[y,x]=a.useState(null),v=a.useCallback(e=>{e!==j.current&&(j.current=e,b(e))},[]),w=a.useCallback(e=>{e!==N.current&&(N.current=e,x(e))},[]),S=i||g,k=l||y,j=a.useRef(null),N=a.useRef(null),E=a.useRef(f),C=null!=d,A=Aw(d),_=Aw(o),T=Aw(u),R=a.useCallback(()=>{if(!j.current||!N.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),kw(j.current,N.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!Nw(E.current,t)&&(E.current=t,s.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);jw(()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);jw(()=>(P.current=!0,()=>{P.current=!1}),[]),jw(()=>{if(S&&(j.current=S),k&&(N.current=k),S&&k){if(A.current)return A.current(S,k,R);R()}},[S,k,R,A,C]);const O=a.useMemo(()=>({reference:j,floating:N,setReference:v,setFloating:w}),[v,w]),I=a.useMemo(()=>({reference:S,floating:k}),[S,k]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Cw(I.floating,f.x),n=Cw(I.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Ew(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>hw(...e,{animationFrame:"always"===g}),elements:{reference:x.anchor},middleware:[Tw({mainAxis:i+C,alignmentAxis:c}),u&&Rw({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Pw():void 0,...P}),u&&Ow({...P}),Iw({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}}),k&&Uw({element:k,padding:d}),tS({arrowWidth:E,arrowHeight:C}),h&&Dw({strategy:"referenceHidden",...P})]}),[M,z]=rS(D),L=Gf(b);Hf(()=>{U&&L?.()},[U,L]);const $=F.arrow?.x,W=F.arrow?.y,V=0!==F.arrow?.centerOffset,[B,G]=a.useState();return Hf(()=>{v&&G(window.getComputedStyle(v).zIndex)},[v]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(Zw,{scope:n,placedSide:M,onArrowChange:j,arrowX:$,arrowY:W,shouldHideArrow:V,children:e.jsx(Pp.div,{"data-side":M,"data-align":z,...y,ref:S,style:{...y.style,animation:U?void 0:"none"}})})})});Jw.displayName=Hw;var Yw="PopperArrow",Xw={top:"bottom",right:"left",bottom:"top",left:"right"},Qw=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,s=qw(Yw,n),o=Xw[s.placedSide];return e.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:e.jsx(Mw,{...a,ref:r,style:{...a.style,display:"block"}})})});function eS(e){return null!==e}Qw.displayName=Yw;var tS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[l,c]=rS(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===l?(p=s?d:`${u}px`,m=-i+"px"):"top"===l?(p=s?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===l?(p=-i+"px",m=s?d:`${f}px`):"left"===l&&(p=`${n.floating.width+i}px`,m=s?d:`${f}px`),{data:{x:p,y:m}}}});function rS(e){const[t,r="center"]=e.split("-");return[t,r]}var nS=Bw,aS=Kw,sS=Jw,oS=Qw;function iS(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lS=Symbol("radix.slottable");function cS(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===lS}var dS="Popover",[uS]=Sp(dS,[$w]),fS=$w(),[pS,mS]=uS(dS),hS=t=>{const{__scopePopover:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!1}=t,c=fS(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=Ap({prop:s,defaultProp:o??!1,onChange:i,caller:dS});return e.jsx(nS,{...c,children:e.jsx(pS,{scope:r,contentId:Ep(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:l,children:n})})};hS.displayName=dS;var gS="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...s}=t,o=mS(gS,n),i=fS(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=o;return a.useEffect(()=>(l(),()=>c()),[l,c]),e.jsx(aS,{...i,...s,ref:r})}).displayName=gS;var bS="PopoverTrigger",yS=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=mS(bS,n),o=fS(n),i=Jc(r,s.triggerRef),l=e.jsx(Pp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":TS(s.open),...a,ref:i,onClick:wp(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:e.jsx(aS,{asChild:!0,...o,children:l})});yS.displayName=bS;var xS="PopoverPortal",[vS,wS]=uS(xS,{forceMount:void 0}),SS=t=>{const{__scopePopover:r,forceMount:n,children:a,container:s}=t,o=mS(xS,r);return e.jsx(vS,{scope:r,forceMount:n,children:e.jsx(Xp,{present:n||o.open,children:e.jsx(Yp,{asChild:!0,container:s,children:a})})})};SS.displayName=xS;var kS="PopoverContent",jS=a.forwardRef((t,r)=>{const n=wS(kS,t.__scopePopover),{forceMount:a=n.forceMount,...s}=t,o=mS(kS,t.__scopePopover);return e.jsx(Xp,{present:a||o.open,children:o.modal?e.jsx(ES,{...s,ref:r}):e.jsx(CS,{...s,ref:r})})});jS.displayName=kS;var NS=function(t){const r=iS(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(cS);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),ES=a.forwardRef((t,r)=>{const n=mS(kS,t.__scopePopover),s=a.useRef(null),o=Jc(r,s),i=a.useRef(!1);return a.useEffect(()=>{const e=s.current;if(e)return Jm(e)},[]),e.jsx(Vm,{as:NS,allowPinchZoom:!0,children:e.jsx(AS,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:wp(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:wp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:wp(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),CS=a.forwardRef((t,r)=>{const n=mS(kS,t.__scopePopover),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(AS,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),AS=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=t,p=mS(kS,n),m=fS(n);return tm(),e.jsx(Bp,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:e.jsx(Mp,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(sS,{"data-state":TS(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)"}})})})}),_S="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=mS(_S,n);return e.jsx(Pp.button,{type:"button",...a,ref:r,onClick:wp(t.onClick,()=>s.onOpenChange(!1))})}).displayName=_S;function TS(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=fS(n);return e.jsx(oS,{...s,...a,ref:r})}).displayName="PopoverArrow";var RS=SS,PS=jS;const OS=hS,IS=yS,DS=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...s},o)=>{const{container:i}=a.useContext(ns);return e.jsx(RS,{container:i,children:e.jsx(PS,{ref:o,align:r,sideOffset:n,className:je("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),...s})})});function US({options:r,value:n,onChange:a,placeholder:s="Search...",emptyLabel:o="Choose option"}){const[i,l]=t.useState(n??""),[c,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&l(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs(OS,{open:c,onOpenChange:d,children:[e.jsx(IS,{asChild:!0,children:e.jsxs(zd,{variant:"outline",role:"combobox","aria-expanded":c,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:o}),e.jsx(xd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(DS,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Vx,{children:[e.jsx(Bx,{placeholder:s}),e.jsx(Gx,{children:e.jsx(Kx,{children:r.map(t=>e.jsxs(Hx,{className:je("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,l(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(yd,{className:je("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}DS.displayName=PS.displayName;const FS={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"},MS={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"},zS=[{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=MS[e.code]||"USD",r=FS[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 LS({value:t,onChange:r}){const n=zS.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const $S=zS.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),WS=Array.from(new Set($S.map(e=>e.value))).map(e=>$S.find(t=>t.value===e)).filter(e=>void 0!==e);function VS({value:t,onChange:r}){const n=WS.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let BS=[{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:"๐Ÿ‡ฎ๐Ÿ‡ฑ"}];BS=BS.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),BS.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const GS=BS.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 KS({value:t,onChange:r}){const n=GS.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const HS=[{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],s=t.text;let o=s.substring(s.indexOf("(")+1,s.indexOf(")"));-1!==o.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${o}) ${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 ZS({value:t,onChange:r}){const n=HS.map(e=>({value:e.value,label:e.text}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const qS=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=or(),[s,o]=t.useState(!1),[i,l]=t.useState(),[c,d]=t.useState(0),[u,f]=t.useState(null),p=t.useRef(null);t.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const m=zo({resolver:Hc(rf({name:_u().min(2,{message:"Name must be at least 2 characters."}),country:_u().optional(),timezone:_u().optional(),language:_u().optional(),currency:_u().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{l(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)})},[c]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(Gd,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){o(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{f(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{o(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(tu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Hd,{disabled:s,control:m.control,name:"name",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Name"}),e.jsx(Xd,{children:e.jsx(tu,{...t})}),e.jsx(eu,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(KS,{value:m.watch("language"),onChange:e=>{m.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(LS,{value:m.watch("country"),onChange:e=>{m.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(VS,{value:m.watch("currency"),onChange:e=>{m.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(ZS,{value:m.watch("timezone"),onChange:e=>{m.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(zd,{type:"submit",progress:s,disabled:s,children:"Save"}),e.jsx(zd,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:s,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Py,{})};function JS(e,t){const r=e.pricingVariants;if(!r?.length)return null;const n=t.toLowerCase();return r.find(e=>e.currency?.toLowerCase()===n)??null}function YS(e,t,r){const n=JS(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function XS(e,t,r){const n=JS(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",s="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(s?n.stripePrices[s]:void 0)??null}function QS(e,t,r,n){const a=JS(e,t),s=a?.quotaOverages?.[r];if(s)return s[n]}function ek(e){const t=new Set;for(const r of e)r.pricingVariants?.forEach(e=>{e.currency&&t.add(e.currency.toLowerCase())});return Array.from(t).sort()}function tk(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const s=a[n];if(!s)return null;const o=QS(e,t,r,n);return{included:s.included,...void 0!==s.unitSize&&{unitSize:s.unitSize},...void 0!==o&&{overage:o}}}function rk(e,t){if(!e)return null;for(const r of t){const t=r.pricingVariants;if(t?.length)for(const r of t){const t=r.stripePrices;if(t){if(t.monthlyPriceId===e||t.monthly===e)return{interval:"monthly",currency:r.currency};if(t.yearlyPriceId===e||t.yearly===e)return{interval:"yearly",currency:r.currency};if(t.quarterlyPriceId===e)return{interval:"quarterly",currency:r.currency}}}}return null}function nk(e,t){const r=JS(e,t);return r?.seatPricing?.enabled?r.seatPricing:null}function ak(e,t,r){const n=nk(e,t);return n?.perSeat?n.perSeat[r]??null:null}function sk(e,t){return Math.max(0,e-(t||0))}function ok(e,t,r,n){const a=nk(e,t);if(!a)return null;return sk(n,a.includedSeats)*(ak(e,t,r)??0)}function ik(e,t){if(null==e)return null;const r=e[t??"monthly"];return r?{included:r.included,...void 0!==r.overage&&{overage:r.overage},...void 0!==r.unitSize&&{unitSize:r.unitSize}}:null}function lk(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,s=r.currencySymbol??Jy(a??"");if(null==e)return"โ€”";const{included:o,overage:i}=e,l=`${o} included`;if(null==i)return l;const c=n?i/100:i;return`${l}, then ${s}${"number"==typeof c&&Number.isFinite(c)?c.toFixed(2):String(i)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const ck=(e,t)=>{const r=(t??"").trim();return r?new Intl.NumberFormat("en-US",{style:"currency",currency:r.toUpperCase(),minimumFractionDigits:2}).format(e/100):(e/100).toFixed(2)},dk=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",uk=e=>{switch(e){case"paid":return"bg-green-100 text-green-800";case"open":return"bg-yellow-100 text-yellow-800";case"draft":case"void":default:return"bg-gray-100 text-gray-800";case"uncollectible":return"bg-red-100 text-red-800"}},fk=({workspaceId:t,hasActiveSubscription:r=!1,onViewPricingPlans:n,limit:a=20})=>{const{invoices:s,loading:o,error:i,refetch:l}=gr(t,a),c=s.length>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Billing History"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),e.jsx(zd,{variant:"ghost",size:"sm",progress:o,onClick:l,disabled:o,children:o?"Refreshing...":"Refresh"})]}),i&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm mt-1",children:i})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:l,disabled:o,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:o?"Retrying...":"Retry"})]}),o&&!c?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Py,{})}):c?e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(t);return e.jsx("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t.description||t.number||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${uk(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:ck(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"โ€ข"}),e.jsxs("span",{children:["Created: ",dk(t.created)]})]}),t.due_date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"โ€ข"}),e.jsxs("span",{children:["Due: ",dk(t.due_date)]})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"โ€ข"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",ck(t.amount_paid,t.currency)]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(zd,{size:"sm",disabled:!t.hosted_invoice_url,onClick:()=>t.hosted_invoice_url&&window.open(t.hosted_invoice_url,"_blank","noopener,noreferrer"),className:r.color,children:[r.text,e.jsx(Sd,{className:"h-3 w-3 ml-1.5"})]}),t.invoice_pdf&&e.jsxs(zd,{size:"sm",variant:"outline",onClick:()=>window.open(t.invoice_pdf,"_blank","noopener,noreferrer"),children:[e.jsx(wd,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]})},t.id)})}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(kd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:r?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!r&&n&&e.jsx(zd,{size:"sm",className:"mt-4",onClick:n,children:"View Pricing Plans"})]})]})},pk=t.lazy(()=>Promise.resolve().then(function(){return Xj}).then(e=>({default:e.default}))),mk=e=>{if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric"}).format(t)}catch{return""}},hk=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:s,error:o,updateSubscription:i,refetch:l}=hr(n),{createCheckoutSession:c}=pr(n),{cancelSubscription:d,loading:u}=br(n),{resumeSubscription:f,loading:p}=yr(n),{versions:m,loading:h,error:g,refetch:b}=fr(n),y=s||h,x=o||g,{currentVersion:v,latestVersion:w,isDeprecated:S,whatsNew:k,plansToShow:j}=t.useMemo(()=>{const e=m?.currentVersion,t=m?.availableVersions||[],r=null!=a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const s=!!(r&&n&&e)&&n.version>e.version,o=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:s,isDeprecated:s&&r,whatsNew:n?.whatsNew,plansToShow:o}},[m,a?.subscription]),[N,E]=t.useState(!1),[C,A]=t.useState(null),[_,T]=t.useState(null),R=t.useRef(null),[P,O]=t.useState(!1),[I,D]=t.useState(!1);t.useEffect(()=>()=>{R.current&&clearTimeout(R.current)},[]);const[U,F]=t.useState(!1),[M,z]=t.useState("subscription"),L=async()=>{await Promise.all([l(),b()])},$=t.useMemo(()=>rk(a?.subscription?.stripePriceId,j??[]),[a?.subscription?.stripePriceId,j]);if(y&&!a&&!m)return e.jsx(Py,{});const W=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[x&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm mt-1",children:x}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:L,disabled:y,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:y?"Retrying...":"Retry"})]}),C&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm mt-1",children:C})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>A(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),_&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm mt-1",children:_})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>T(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[e.jsx("button",{type:"button",onClick:()=>z("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===M?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),e.jsx("button",{type:"button",onClick:()=>z("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===M?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===M&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Nd,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading subscription and pricing plans..."})]}),S&&a?.subscription&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Dd,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),e.jsx("p",{className:"text-sm text-amber-700 mb-2",children:"A new version of the pricing plans is now available. Please upgrade to one of the new plans below to continue receiving updates and support."}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e.jsxs("span",{children:["Current: Version ",v?.version||"N/A"]}),e.jsx("span",{children:"โ€ข"}),e.jsxs("span",{children:["Latest: Version ",w?.version||"N/A"]})]}),k&&(k.newPlans.length>0||k.updatedPlans.length>0)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e.jsxs("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",w?.version,":"]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-amber-700",children:[k.newPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"New Plans: "}),e.jsx("span",{children:k.newPlans.map(e=>e.plan.name).join(", ")})]}),k.updatedPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Updated Plans: "}),e.jsx("span",{children:k.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?.cancelAtPeriodEnd||u?null:a?.subscription?e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>O(!0),children:"Change Plan"}):!a?.subscription&&j&&j.length>0?e.jsx(zd,{size:"sm",onClick:()=>O(!0),children:"View Pricing Plans"}):null,e.jsx(zd,{variant:"ghost",size:"sm",progress:y,onClick:L,disabled:y||N,children:y?"Refreshing...":"Refresh"})]})]}),a?.subscription?(()=>{const t=rk(a.subscription.stripePriceId,j??[]),n=t?.interval??null,s=t?.currency??a.plan?.currency??r?.billingCurrency??"",o=n&&a.planVersion?YS(a.planVersion,s,n):null,i=s,l=a.planVersion?nk(a.planVersion,s):null,c=l&&n?ak(a.planVersion,s,n):null,d=Array.isArray(r?.users)?r.users.length:1,f=l?.includedSeats??0,m=d,h=null!=o?0===o?"Free":Qy(o,i):null,g="monthly"===n?"/month":"quarterly"===n?"/quarter":"yearly"===n?"/year":"";return e.jsxs("div",{className:"border rounded-lg overflow-hidden "+(S?"border-amber-300":"border-gray-200"),children:["trialing"===a.subscription.subscriptionStatus&&(()=>{const t=a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd,r=t?new Date(t):null,n=r&&!isNaN(r.getTime())?r:null,s=n?Math.max(0,Math.ceil((n.getTime()-Date.now())/864e5)):null;return e.jsx("div",{className:"px-5 py-3 text-sm flex items-center justify-between "+(null!==s&&s<=3?"bg-amber-50 text-amber-800 border-b border-amber-200":"bg-blue-50 text-blue-800 border-b border-blue-200"),children:e.jsxs("span",{children:[null!==s&&s<=0?"Your trial has ended.":null!==s?`Your trial ends in ${s} day${1===s?"":"s"}.`:"You are on a trial."," ","Upgrade to keep access after the trial."]})})})(),e.jsxs("div",{className:"p-5 "+(S?"bg-amber-50/50":"bg-gray-50/50"),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.plan?.name||"No plan assigned"}),e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.subscription.subscriptionStatus?"bg-green-100 text-green-800":"trialing"===a.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===a.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===a.subscription.subscriptionStatus&&"Active","trialing"===a.subscription.subscriptionStatus&&"Trial","canceled"===a.subscription.subscriptionStatus&&"Canceled","past_due"===a.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===a.subscription.subscriptionStatus&&mk(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(ends"," ",mk(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd),")"]}),S&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800",children:[e.jsx(Dd,{className:"h-3 w-3"}),"Deprecated"]})]}),a.plan?.description&&e.jsx("p",{className:"text-sm text-gray-600",children:a.plan.description})]}),e.jsxs("div",{className:"text-right ml-4 shrink-0",children:[e.jsxs("div",{className:"flex items-baseline justify-end gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:h||"N/A"}),h&&"Free"!==h&&g&&e.jsx("span",{className:"text-sm text-gray-500",children:g})]}),l&&c&&c>0&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["+ ",Qy(c,i),"/seat",g]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&!a.subscription.cancelAtPeriodEnd&&mk(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-500",children:[e.jsx(gd,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Next billing:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:mk(a.subscription.stripeCurrentPeriodEnd)})]})]})]})]}),S&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",v?.version||"N/A"," - A newer version is available"]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&e.jsx("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-200",children:"active"===a.subscription.subscriptionStatus&&a.subscription.cancelAtPeriodEnd?e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>F(!0),disabled:N||u||p,progress:p,children:"Resume Subscription"}):e.jsx(zd,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>D(!0),disabled:N||u||p,progress:u||N,children:u||N?"Canceling...":"trialing"===a.subscription.subscriptionStatus?"Cancel Trial":"Cancel Subscription"})})]}),"past_due"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Dd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"Please update your payment method to avoid service interruption. Check your invoices for details."}),e.jsx(zd,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>z("invoices"),children:"View Invoices"})]})]})}),"past_due"===a.subscription.subscriptionStatus&&a.subscription.dunningState&&"none"!==a.subscription.dunningState&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Dd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"final"===a.subscription.dunningState?"Final warning: Subscription will be suspended":"suspended"===a.subscription.dunningState?"Subscription suspended":"Payment recovery in progress"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"suspended"===a.subscription.dunningState?"Your subscription has been suspended due to repeated payment failures. Update your payment method to restore access.":"We were unable to process your payment. Please update your payment method to avoid losing access."})]})]})}),"paused"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-blue-50 border-t border-blue-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(gd,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Subscription paused"}),e.jsx("p",{className:"text-sm text-blue-700 mt-0.5",children:"Your subscription is currently paused. Resume to restore full access."})]})]})}),a.subscription.cancelAtPeriodEnd&&e.jsx("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(gd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),e.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:mk(a.subscription.stripeCurrentPeriodEnd)?e.jsxs(e.Fragment,{children:["Your subscription will end on"," ",e.jsx("span",{className:"font-medium",children:mk(a.subscription.stripeCurrentPeriodEnd)}),". You'll retain access until then and won't be charged again."]}):"Your subscription will be canceled at the end of the current billing period. You won't be charged again."})]})]})}),a.planVersion&&(()=>{const t=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],s=[];return e.subscriptionItems.forEach(o=>{const i=o.slug;if("feature"===o.type){const t=e.features?.[i]??!1;n.push({item:o,enabled:t})}else if("limit"===o.type){const t=e.limits?.[i]??0;a.push({item:o,value:t})}else if("quota"===o.type){const n=t&&e.pricingVariants?.length?tk(e,t,i,r):ik(e.quotas?.[i],r);null!=n&&s.push({item:o,value:n})}}),{features:n,limits:a,quotas:s}})(a.planVersion,s,n??"monthly");return t.features.length>0||t.limits.length>0||t.quotas.length>0?e.jsx("div",{className:"p-5 border-t border-gray-100",children:e.jsxs("div",{className:"space-y-6",children:[t.features.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Features"}),e.jsx("ul",{className:"space-y-2",children:t.features.sort(e=>e.enabled?-1:1).map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"mt-0.5 flex-shrink-0 "+(r?"text-green-500":"text-gray-300"),children:r?"โœ“":"โ€”"}),e.jsx("span",{className:r?"text-gray-700":"text-gray-400",children:t.name})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Limits"}),e.jsx("ul",{className:"space-y-2",children:t.limits.map(({item:t,value:r})=>e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:r})]})},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Usage Quotas"}),e.jsx("ul",{className:"space-y-2",children:t.quotas.map(({item:t,value:r})=>{const n=lk(r,t.name.toLowerCase(),{currency:s});return e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:n})]})},t._id)})})]}),l&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Seats"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Current members"}),e.jsx("span",{className:"font-semibold text-gray-900",children:m})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Included with plan"}),e.jsx("span",{className:"text-gray-900",children:f})]}),c&&c>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Extra seat price"}),e.jsxs("span",{className:"text-gray-900",children:[Qy(c,s),g]})]}),l.maxSeats>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Seat limit"}),e.jsx("span",{className:"text-gray-900",children:l.maxSeats})]})]})]})]})}):null})()]})})():r.pendingOnboarding?e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(vd,{className:"h-12 w-12 mx-auto mb-3 text-blue-400"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"Start your free trial"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Try the full plan with no commitment. You can upgrade or cancel anytime."})]}),e.jsx(zd,{size:"sm",progress:N,onClick:async()=>{try{E(!0);const e=await c({planVersionId:r.pendingOnboarding?.planVersionId??""});e&&"checkoutUrl"in e&&e.checkoutUrl&&(window.location.href=e.checkoutUrl)}catch(e){}finally{E(!1)}},children:"Start Free Trial"}),j&&j.length>0&&e.jsx(zd,{variant:"ghost",size:"sm",className:"ml-2",onClick:()=>O(!0),children:"View All Plans"})]}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(vd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),j&&j.length>0&&e.jsx(zd,{size:"sm",onClick:()=>O(!0),children:"View Pricing Plans"})]})]}),!m&&!y&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),x&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",x]}),!x&&e.jsx("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e.jsx(zd,{variant:"outline",size:"sm",progress:y,onClick:L,disabled:y,className:"mt-4",children:y?"Refreshing...":"Refresh"})]})]}),"invoices"===M&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Nd,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading invoices..."})]}),e.jsx(fk,{workspaceId:n,hasActiveSubscription:null!==a?.subscription,onViewPricingPlans:()=>z("subscription"),limit:20})]}),j&&j.length>0&&e.jsx(t.Suspense,{fallback:P?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Nd,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading plans..."})]})}):null,children:e.jsx(pk,{open:P,onOpenChange:O,planVersions:j,currentPlanVersionId:W||null,currentStripePriceId:a?.subscription?.stripePriceId,billingCurrency:r.billingCurrency,onSelectPlan:async(e,t="monthly",s)=>{if(!n)return;const o=j?.find(t=>t._id===e),l=o?XS(o,s??$?.currency??a?.plan?.currency??r?.billingCurrency??"",t):null,d=a?.subscription?.stripePriceId;if(!l||!d||l!==d){E(!0),A(null),T(null);try{let r,n,s;try{const e=new URL(window.location.href);r=e.toString(),n=e.toString()}catch{const e=window.location.protocol||"https:",t=window.location.host||window.location.hostname||"",a=`${e}//${t}${window.location.pathname||"/"}`;r=a,n=a}if(s=a?.subscription?await i(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await c({planVersionId:e,billingInterval:t,successUrl:r,cancelUrl:n}),s&&"checkoutUrl"in s&&s.checkoutUrl)return void(window.location.href=s.checkoutUrl);T("Subscription updated successfully!"),await L()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";A(t)}finally{E(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{A(null),T(null)},5e3)}}},loading:N||y})}),e.jsx(wy,{open:U,onOpenChange:F,children:e.jsxs(Ny,{children:[e.jsxs(Ey,{children:[e.jsx(Ay,{children:"Resume Subscription"}),e.jsx(_y,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to resume your subscription?"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Dd,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("span",{children:["You will be charged again on"," ",a?.subscription?.stripeCurrentPeriodEnd&&mk(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:mk(a.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-0.5",children:"โ€ข"}),e.jsx("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),e.jsx("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e.jsxs(Cy,{children:[e.jsx(Ry,{disabled:p,children:"Keep Canceled"}),e.jsx(Ty,{onClick:async()=>{if(n){F(!1),E(!0),A(null),T(null);try{await f(),T("Subscription has been resumed."),await L()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";A(t)}finally{E(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{A(null),T(null)},5e3)}}},disabled:p,children:p?"Resuming...":"Yes, Resume Subscription"})]})]})}),e.jsx(wy,{open:I,onOpenChange:D,children:e.jsxs(Ny,{children:[e.jsxs(Ey,{children:[e.jsx(Ay,{children:"Cancel Subscription"}),e.jsx(_y,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to cancel your subscription?"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),e.jsxs("span",{children:["You'll retain full access to this plan until"," ",a?.subscription?.stripeCurrentPeriodEnd&&mk(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:mk(a.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),e.jsx("span",{children:"You won't be charged again after cancellation"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),e.jsx("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e.jsxs(Cy,{children:[e.jsx(Ry,{disabled:u,children:"Keep Subscription"}),e.jsx(Ty,{onClick:async()=>{if(n){D(!1),E(!0),A(null),T(null);try{await d(),T("Subscription will be canceled at the end of the billing period."),await L()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";A(t)}finally{E(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{A(null),T(null)},5e3)}}},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function gk(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toLocaleString()}function bk(e){return e.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function yk(e,t){return t+e.toFixed(2)}function xk(e){try{const t=new Date(e);if(isNaN(t.getTime()))return null;const r=new Date;return Math.ceil((t.getTime()-r.getTime())/864e5)}catch{return null}}const vk=()=>{const{quotas:r,loading:n,error:a,refetch:s}=Cr(),{response:o}=Sr(),[i,l]=t.useState(!1),c=t.useMemo(()=>{const e={};if(!o?.planVersion||!o?.subscription)return e;const t=o.planVersion,n=o.subscription,a=n.billingInterval??"monthly",s=n.plan?.currency??"usd",i=Jy(s);if(!r)return e;for(const n of Object.keys(r)){const o=QS(t,s,n,a);if(null==o||o<=0)continue;const l=t.quotas?.[n],c=l?.[a],d=c?.unitSize??1,u=r[n].overage,f=(d>1?Math.ceil(u/d):u)*o/100;e[n]={overageCents:o,unitSize:d,currency:s,currencySymbol:i,estimatedCost:f}}return e},[o,r]),d=t.useMemo(()=>{const e=o?.subscription?.stripeCurrentPeriodEnd;if(!e)return null;const t=function(e){try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}catch{return""}}(e);return t?{endDate:t,daysRemaining:xk(e)}:null},[o]),u=async()=>{l(!0);try{await s()}finally{l(!1)}};if(n&&!r)return e.jsx(Py,{});if(a)return e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load usage data"}),e.jsx("p",{className:"text-sm mt-1",children:a})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:u,disabled:i,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:i?"Retrying...":"Retry"})]});const f=function(e){return[...e].sort(([,e],[,t])=>{if(e.hasOverage&&!t.hasOverage)return-1;if(!e.hasOverage&&t.hasOverage)return 1;const r=e.included>0?e.consumed/e.included:e.consumed>0?1:0;return(t.included>0?t.consumed/t.included:t.consumed>0?1:0)-r})}(r?Object.entries(r):[]);if(0===f.length)return e.jsxs("div",{className:"border rounded-lg p-8 text-center",children:[e.jsx(bd,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-600",children:"No quota usage data available for this workspace."}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quotas will appear here once your plan includes metered resources."})]});const p=f.filter(([,e])=>e.hasOverage).length,m=f.length>0?Math.round(f.reduce((e,[,t])=>e+(t.included>0?t.consumed/t.included*100:0),0)/f.length):0,h=Object.values(c).reduce((e,t)=>e+t.estimatedCost,0),g=Object.values(c)[0]?.currencySymbol??"$";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Monitor your resource consumption and quotas"}),e.jsxs(zd,{variant:"ghost",size:"sm",onClick:u,disabled:i,children:[e.jsx(Ad,{className:je("h-3.5 w-3.5 mr-1.5",i&&"animate-spin")}),i?"Refreshing...":"Refresh"]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50/50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(gd,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e.jsxs("span",{children:["Usage resets on ",e.jsx("span",{className:"font-medium text-gray-900",children:d.endDate}),null!==d.daysRemaining&&d.daysRemaining>0&&e.jsxs("span",{className:"text-gray-500",children:[" (",d.daysRemaining," ",1===d.daysRemaining?"day":"days"," remaining)"]}),null!==d.daysRemaining&&d.daysRemaining<=0&&e.jsx("span",{className:"text-amber-600 font-medium",children:" (renewing soon)"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:[e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Total Resources"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:f.length})]}),e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Overall Usage"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:m+"%"})]}),e.jsxs("div",{className:je("border rounded-lg p-3 sm:p-4",p>0?"border-red-200 bg-red-50":"border-gray-200"),children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"In Overage"}),e.jsx("p",{className:je("text-lg sm:text-xl font-semibold mt-1",p>0?"text-red-600":"text-gray-900"),children:p})]}),p>0&&h>0&&e.jsxs("div",{className:"border border-red-200 bg-red-50 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Est. Overage Cost"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold mt-1 text-red-600",children:yk(h,g)})]})]}),p>0&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Dd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5 hidden sm:block"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Overage Detected"}),e.jsxs("p",{className:"text-sm text-amber-700",children:[p," ",1===p?"resource has":"resources have"," exceeded the included quota. Additional usage will be billed as overage on your next invoice."]}),h>0&&e.jsxs("p",{className:"text-sm text-amber-700 font-medium mt-1",children:["Estimated overage charges this period: ",yk(h,g)]})]})]})}),e.jsx("div",{className:"space-y-3",children:f.map(([t,r])=>{const n=(a=r.consumed,(s=r.included)<=0?a>0?100:0:Math.min(a/s*100,100));var a,s;const o=function(e,t){return t?{bar:"bg-red-500",bg:"bg-red-100",badge:"bg-red-100",badgeText:"text-red-800"}:e>=90?{bar:"bg-amber-500",bg:"bg-amber-100",badge:"bg-amber-100",badgeText:"text-amber-800"}:e>=75?{bar:"bg-yellow-500",bg:"bg-yellow-100",badge:"bg-yellow-100",badgeText:"text-yellow-800"}:{bar:"bg-blue-500",bg:"bg-blue-100",badge:"bg-blue-100",badgeText:"text-blue-800"}}(n,r.hasOverage),i=c[t];return e.jsx(wk,{slug:t,quota:r,percent:n,colors:o,pricing:i},t)})})]})};function wk({slug:t,quota:r,percent:n,colors:a,pricing:s}){return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:bk(t)}),r.hasOverage&&e.jsx("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Overage"}),!r.hasOverage&&n>=90&&e.jsx("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Almost full"})]}),e.jsxs("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:[gk(r.consumed)," / ",gk(r.included)]})]}),e.jsx("div",{className:je("h-2 rounded-full w-full",a.bg),children:e.jsx("div",{className:je("h-2 rounded-full transition-all duration-500",a.bar),style:{width:`${n}%`}})}),e.jsxs("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-500",children:[e.jsxs("span",{children:[Math.round(n),"% used"]}),e.jsx("span",{children:r.available>0?`${gk(r.available)} remaining`:r.hasOverage?`${gk(r.overage)} over limit`:"Fully used"})]}),r.hasOverage&&s&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Overage units"}),e.jsx("span",{className:"font-medium text-gray-900",children:gk(r.overage)})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Rate"}),e.jsxs("span",{className:"font-medium text-gray-900",children:[s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]}),s.unitSize>1&&e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Billable blocks"}),e.jsx("span",{className:"font-medium text-gray-900",children:Math.ceil(r.overage/s.unitSize).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs pt-2 border-t border-gray-200",children:[e.jsx("span",{className:"font-medium text-red-600",children:"Estimated charge"}),e.jsx("span",{className:"font-semibold text-red-600",children:yk(s.estimatedCost,s.currencySymbol)})]})]}),!r.hasOverage&&s&&e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Overage rate: ",s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]})}function Sk(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kk=Symbol("radix.slottable");function jk(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===kk}var Nk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});a.forwardRef((t,r)=>e.jsx(Pp.span,{...t,ref:r,style:{...Nk,...t.style}})).displayName="VisuallyHidden";var Ek=[" ","Enter","ArrowUp","ArrowDown"],Ck=[" ","Enter"],Ak="Select",[_k,Tk,Rk]=lg(Ak),[Pk]=Sp(Ak,[Rk,$w]),Ok=$w(),[Ik,Dk]=Pk(Ak),[Uk,Fk]=Pk(Ak),Mk=t=>{const{__scopeSelect:r,children:n,open:s,defaultOpen:o,onOpenChange:i,value:l,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,b=Ok(r),[y,x]=a.useState(null),[v,w]=a.useState(null),[S,k]=a.useState(!1),j=dg(u),[N,E]=Ap({prop:s,defaultProp:o??!1,onChange:i,caller:Ak}),[C,A]=Ap({prop:l,defaultProp:c,onChange:d,caller:Ak}),_=a.useRef(null),T=!y||(g||!!y.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(nS,{...b,children:e.jsxs(Ik,{required:h,scope:r,trigger:y,onTriggerChange:x,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Ep(),value:C,onValueChange:A,open:N,onOpenChange:E,dir:j,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(_k.Provider,{scope:r,children:e.jsx(Uk,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(Sj,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:C,onChange:e=>A(e.target.value),disabled:m,form:g,children:[void 0===C?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};Mk.displayName=Ak;var zk="SelectTrigger",Lk=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:s=!1,...o}=t,i=Ok(n),l=Dk(zk,n),c=l.disabled||s,d=Jc(r,l.onTriggerChange),u=Tk(n),f=a.useRef("touch"),[p,m,h]=jj(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),n=Nj(t,e,r);void 0!==n&&l.onValueChange(n.value)}),g=e=>{c||(l.onOpenChange(!0),h()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return e.jsx(aS,{asChild:!0,...i,children:e.jsx(Pp.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":kj(l.value)?"":void 0,...o,ref:d,onClick:wp(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:wp(o.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:wp(o.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Ek.includes(e.key)&&(g(),e.preventDefault())})})})});Lk.displayName=zk;var $k="SelectValue",Wk=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:i="",...l}=t,c=Dk($k,n),{onValueNodeHasChildrenChange:d}=c,u=void 0!==o,f=Jc(r,c.onValueNodeChange);return Hf(()=>{d(u)},[d,u]),e.jsx(Pp.span,{...l,ref:f,style:{pointerEvents:"none"},children:kj(c.value)?e.jsx(e.Fragment,{children:i}):o})});Wk.displayName=$k;var Vk=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(Pp.span,{"aria-hidden":!0,...s,ref:r,children:a||"โ–ผ"})});Vk.displayName="SelectIcon";var Bk=t=>e.jsx(Yp,{asChild:!0,...t});Bk.displayName="SelectPortal";var Gk="SelectContent",Kk=a.forwardRef((t,r)=>{const n=Dk(Gk,t.__scopeSelect),[o,i]=a.useState();if(Hf(()=>{i(new DocumentFragment)},[]),!n.open){const r=o;return r?s.createPortal(e.jsx(Zk,{scope:t.__scopeSelect,children:e.jsx(_k.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(Yk,{...t,ref:r})});Kk.displayName=Gk;var Hk=10,[Zk,qk]=Pk(Gk),Jk=function(t){const r=Sk(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(jk);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),Yk=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y,...x}=t,v=Dk(Gk,n),[w,S]=a.useState(null),[k,j]=a.useState(null),N=Jc(r,e=>S(e)),[E,C]=a.useState(null),[A,_]=a.useState(null),T=Tk(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return Jm(w)},[w]),tm();const I=a.useCallback(e=>{const[t,...r]=T().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[T,k]),D=a.useCallback(()=>I([E,w]),[I,E,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:F}=v;a.useEffect(()=>{if(w){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))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),F.current=null};return null!==F.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,F]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[M,z]=jj(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Nj(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&(C(e),n&&(O.current=!0))},[v.value]),$=a.useCallback(()=>w?.focus(),[w]),W=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&_(e)},[v.value]),V="popper"===s?Qk:Xk,B=V===Qk?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y}:{};return e.jsx(Zk,{scope:n,content:w,viewport:k,onViewportChange:j,itemRefCallback:L,selectedItem:E,onItemLeave:$,itemTextRefCallback:W,focusSelectedItem:D,selectedItemText:A,position:s,isPositioned:R,searchRef:M,children:e.jsx(Vm,{as:Jk,allowPinchZoom:!0,children:e.jsx(Bp,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:wp(o,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(Mp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:e.jsx(V,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:e=>e.preventDefault(),...x,...B,onPlaced:()=>P(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:wp(x.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});Yk.displayName="SelectContentImpl";var Xk=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:s,...o}=t,i=Dk(Gk,n),l=qk(Gk,n),[c,d]=a.useState(null),[u,f]=a.useState(null),p=Jc(r,e=>f(e)),m=Tk(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:x,focusSelectedItem:v}=l,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&u&&b&&y&&x){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=x.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,s=r.left-a,o=e.left-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-Hk,u=nb(s,[Hk,Math.max(Hk,d-l)]);c.style.minWidth=i+"px",c.style.left=u+"px"}else{const a=t.right-n.right,s=window.innerWidth-r.right-a,o=window.innerWidth-e.right-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-Hk,u=nb(s,[Hk,Math.max(Hk,d-l)]);c.style.minWidth=i+"px",c.style.right=u+"px"}const a=m(),o=window.innerHeight-2*Hk,l=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),v=f+p+l+parseInt(d.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,v),S=window.getComputedStyle(b),k=parseInt(S.paddingTop,10),j=parseInt(S.paddingBottom,10),N=e.top+e.height/2-Hk,E=o-N,C=y.offsetHeight/2,A=f+p+(y.offsetTop+C),_=v-A;if(A<=N){const e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=A+Math.max(E,C+(e?j:0)+t+g);c.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;c.style.top="0px";const t=Math.max(N,f+b.offsetTop+(e?k:0)+C)+_;c.style.height=t+"px",b.scrollTop=A-N+b.offsetTop}c.style.margin=`${Hk}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=o+"px",s?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,c,u,b,y,x,i.dir,s]);Hf(()=>w(),[w]);const[S,k]=a.useState();Hf(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const j=a.useCallback(e=>{e&&!0===g.current&&(w(),v?.(),g.current=!1)},[w,v]);return e.jsx(ej,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Pp.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Xk.displayName="SelectItemAlignedPosition";var Qk=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=Hk,...o}=t,i=Ok(n);return e.jsx(sS,{...i,...o,ref:r,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});Qk.displayName="SelectPopperPosition";var[ej,tj]=Pk(Gk,{}),rj="SelectViewport",nj=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:s,...o}=t,i=qk(rj,n),l=tj(rj,n),c=Jc(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e.jsx(_k.Slot,{scope:n,children:e.jsx(Pp.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:wp(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=l;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Hk,a=parseFloat(r.style.minHeight),s=parseFloat(r.style.height),o=Math.max(a,s);if(o<n){const a=o+e,s=Math.min(n,a),i=a-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});nj.displayName=rj;var aj="SelectGroup",[sj,oj]=Pk(aj);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Ep();return e.jsx(sj,{scope:n,id:s,children:e.jsx(Pp.div,{role:"group","aria-labelledby":s,...a,ref:r})})}).displayName=aj;var ij="SelectLabel",lj=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=oj(ij,n);return e.jsx(Pp.div,{id:s.id,...a,ref:r})});lj.displayName=ij;var cj="SelectItem",[dj,uj]=Pk(cj),fj=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...l}=t,c=Dk(cj,n),d=qk(cj,n),u=c.value===s,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Jc(r,e=>d.itemRefCallback?.(e,s,o)),b=Ep(),y=a.useRef("touch"),x=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(dj,{scope:n,value:s,disabled:o,textId:b,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(_k.ItemSlot,{scope:n,value:s,disabled:o,textValue:f,children:e.jsx(Pp.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:wp(l.onFocus,()=>h(!0)),onBlur:wp(l.onBlur,()=>h(!1)),onClick:wp(l.onClick,()=>{"mouse"!==y.current&&x()}),onPointerUp:wp(l.onPointerUp,()=>{"mouse"===y.current&&x()}),onPointerDown:wp(l.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:wp(l.onPointerMove,e=>{y.current=e.pointerType,o?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:wp(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:wp(l.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Ck.includes(e.key)&&x()," "===e.key&&e.preventDefault())})})})})});fj.displayName=cj;var pj="SelectItemText",mj=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:o,style:i,...l}=t,c=Dk(pj,n),d=qk(pj,n),u=uj(pj,n),f=Fk(pj,n),[p,m]=a.useState(null),h=Jc(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,b=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:x}=f;return Hf(()=>(y(b),()=>x(b)),[y,x,b]),e.jsxs(e.Fragment,{children:[e.jsx(Pp.span,{id:u.textId,...l,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren?s.createPortal(l.children,c.valueNode):null]})});mj.displayName=pj;var hj="SelectItemIndicator",gj=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return uj(hj,n).isSelected?e.jsx(Pp.span,{"aria-hidden":!0,...a,ref:r}):null});gj.displayName=hj;var bj="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=qk(bj,t.__scopeSelect),s=tj(bj,t.__scopeSelect),[o,i]=a.useState(!1),l=Jc(r,s.onScrollButtonChange);return Hf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(xj,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=bj;var yj="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=qk(yj,t.__scopeSelect),s=tj(yj,t.__scopeSelect),[o,i]=a.useState(!1),l=Jc(r,s.onScrollButtonChange);return Hf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(xj,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=yj;var xj=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=t,i=qk("SelectScrollButton",n),l=a.useRef(null),c=Tk(n),d=a.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),Hf(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),e.jsx(Pp.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:wp(o.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(s,50))}),onPointerMove:wp(o.onPointerMove,()=>{i.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(s,50))}),onPointerLeave:wp(o.onPointerLeave,()=>{d()})})}),vj=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Pp.div,{"aria-hidden":!0,...a,ref:r})});vj.displayName="SelectSeparator";var wj="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Ok(n),o=Dk(wj,n),i=qk(wj,n);return o.open&&"popper"===i.position?e.jsx(oS,{...s,...a,ref:r}):null}).displayName=wj;var Sj=a.forwardRef(({__scopeSelect:t,value:r,...n},s)=>{const o=a.useRef(null),i=Jc(s,o),l=Tg(r);return a.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[l,r]),e.jsx(Pp.select,{...n,style:{...Nk,...n.style},ref:i,defaultValue:r})});function kj(e){return""===e||void 0===e}function jj(e){const t=Gf(e),r=a.useRef(""),n=a.useRef(0),s=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function Nj(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 s=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(s=s.filter(e=>e!==r));const o=s.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}Sj.displayName="SelectBubbleInput";var Ej=Lk,Cj=Vk,Aj=Bk,_j=Kk,Tj=nj,Rj=lj,Pj=fj,Oj=mj,Ij=gj,Dj=vj;const Uj=Mk,Fj=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Ej,{ref:a,className:je("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[r,e.jsx(Cj,{asChild:!0,children:e.jsx(Vh,{className:"h-4 w-4 opacity-50"})})]}));Fj.displayName=Ej.displayName;const Mj=a.forwardRef(({className:t,children:r,position:n="popper",...s},o)=>{const{container:i}=a.useContext(ns);return e.jsx(Aj,{container:i,children:e.jsx(_j,{ref:o,className:je("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:e.jsx(Tj,{className:je("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Mj.displayName=_j.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Rj,{ref:n,className:je("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=Rj.displayName;const zj=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Pj,{ref:a,className:je("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ij,{children:e.jsx(Gh,{className:"h-4 w-4"})})}),e.jsx(Oj,{children:r})]}));zj.displayName=Pj.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Dj,{ref:n,className:je("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=Dj.displayName;const Lj=({workspace:r})=>{const{user:n}=es(),[a,s]=t.useState(0),[o,i]=t.useState(!1),[l,c]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=or(),{settings:h}=Yt(),{response:g}=Sr();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{c(e)}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const b=()=>{s(e=>e+1)};if(o||!r)return e.jsx(Py,{});const y=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},x=l.map(e=>({...e,...y(e.user)})),v=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===v,S=g?.subscription,k=g?.planVersion,j=S?.seatPricingEnabled,N=r?.billingCurrency||"usd",E=k?nk(k,N):null,C=E?.includedSeats??0,A=E?.maxSeats??0,_=l.length,T=j&&A>0&&_>=A,R=h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE,P=j?!T:R>_,O=S?.billingInterval??"monthly",I=k?ak(k,N,O):null,D=j&&_>=C;return e.jsxs("div",{children:[!w&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e.jsx("div",{className:"mb-4",children:P?e.jsxs("div",{children:[e.jsx($j,{onInvite:b,workspaceId:r._id}),D&&I&&I>0&&e.jsx("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-amber-600 bg-amber-50 px-3 py-1.5 rounded-md",children:e.jsxs("span",{children:["Each additional member adds ",e.jsxs("span",{className:"font-medium",children:[Qy(I,N),"/","yearly"===O?"yr":"quarterly"===O?"qtr":"mo"]})," to your subscription"]})})]}):e.jsx("div",{className:"flex items-center justify-between p-3 bg-red-50 border border-red-100 rounded-md",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-700",children:T?"Seat limit reached":"Member limit reached"}),e.jsx("p",{className:"text-xs text-red-600 mt-0.5",children:T?`Your plan allows up to ${A} members. Upgrade for more seats.`:"Contact your admin to increase the workspace member limit."})]})})}),j&&E&&e.jsxs("div",{className:"mb-4 rounded-lg border bg-gray-50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Seats"}),A>0&&e.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full "+(_>=A?"bg-red-100 text-red-700":_>=.8*A?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"),children:[_," / ",A]})]}),A>0&&e.jsx("div",{className:"w-full h-1.5 bg-gray-200 rounded-full mb-3",children:e.jsx("div",{className:"h-1.5 rounded-full transition-all "+(_>=A?"bg-red-500":_>=.8*A?"bg-amber-500":"bg-emerald-500"),style:{width:`${Math.min(100,_/A*100)}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-900 font-medium",children:C})," included",I&&I>0&&e.jsxs("span",{className:"text-gray-400",children:[" ยท ",Qy(I,N),"/extra seat"]})]}),A>0?e.jsxs("span",{children:[Math.max(0,A-_)," available"]}):e.jsx("span",{className:"text-gray-400",children:"No seat limit"})]})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600",children:[_," member",1!==_?"s":""]})}),e.jsx("div",{children:e.jsx(zd,{variant:"ghost",size:"sm",onClick:b,progress:o,children:o?"Refreshing...":"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:x.map((t,a)=>{const s=t.id===n?.id,o=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"flex items-center justify-between border rounded p-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(Uj,{disabled:s||!w||o||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,s=e,void(nr(r,a)?De(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}}):(u(a),m(n,a,{role:s}).then(()=>{b()}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}})}).finally(()=>{u(null)})));var n,a,s},children:[e.jsx(Fj,{children:e.jsx(Wk,{placeholder:"Select a role"})}),e.jsx(Mj,{children:r?.roles.map(t=>e.jsx(zj,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(Nd,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),s&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),o&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!s&&!o&&w&&e.jsx(zd,{variant:"destructive",size:"sm",startIcon:e.jsx(Id,{}),onClick:()=>{var e;e=t.id,nr(r,e)?De(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{b()}).catch(t=>{De(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},a)})}),0===l.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function $j({onInvite:r,workspaceId:n}){const[a,s]=t.useState(""),[o,i]=t.useState("admin"),[l,c]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),m=t.useRef(null),{addUser:h,getWorkspace:g}=or();t.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const[b,y]=t.useState(null),{settings:x}=Yt(),v=x?.workspace.roles??b?.roles??[];t.useEffect(()=>{n&&g(n).then(y)},[n]);const w=()=>{u(null),p(null),s(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Bd,{children:"Invite member by email"}),e.jsx(tu,{type:"email",value:a,onChange:e=>s(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Bd,{children:"Role"}),e.jsxs(Uj,{value:o,onValueChange:i,children:[e.jsx(Fj,{children:e.jsx(Wk,{placeholder:"Select a role"})}),e.jsx(Mj,{children:v.map(t=>e.jsx(zj,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(zd,{progress:l,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(c(!0),await h(n,e,o).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{De(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:o}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{c(!1),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{w()},6e3)})):u("Invalid email address format")},disabled:l||!a||!o,children:l?"Inviting...":`Invite as ${o}`})})]})}const Wj=({workspace:t,section:r,setSection:n})=>{const{user:a}=es(),s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id,o=ar(t,a?.id??null),i=s||"admin"===o?.toLowerCase();return e.jsxs("div",{className:"w-44 sm:w-56 h-full flex flex-col space-y-4 sm:space-y-6 shrink-0",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:je("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(Vj,{title:"Account",children:e.jsx(Bj,{activeSection:r,icon:e.jsx(Ud,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(Vj,{title:"Workspace",children:[e.jsx(Bj,{activeSection:r,icon:e.jsx(Td,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(Fd,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(vd,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>n("subscription")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(bd,{className:"h-3.5 w-3.5"}),label:"Usage",section:"usage",onClick:()=>n("usage")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(Pd,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),i&&e.jsx(Bj,{activeSection:r,icon:e.jsx(Dd,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function Vj({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function Bj({icon:t,label:r,section:n,onClick:a,activeSection:s}){return e.jsxs("button",{className:je("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===s?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const Gj=({workspace:r,onClose:n,open:a,onOpenChange:s,defaultSection:o="profile",section:i,onSectionChange:l,showTrigger:c=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(o),h=void 0!==a?a:u,g=s||f,b=void 0!==i?i:p,y=l||m;if(!r)return null;const x=e.jsx(zd,{variant:"outline",size:"icon",children:e.jsx(Td,{className:"h-4 w-4"})});return e.jsxs(Jh,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[c&&e.jsx(Yh,{asChild:!0,children:d||x}),e.jsxs(eg,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[e.jsx(ng,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(Wj,{workspace:r,section:b,setSection:y}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(rg,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","subscription"===b&&"Plan & Billing","usage"===b&&"Usage","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===b&&e.jsx(qS,{workspace:r}),"general"===b&&e.jsx(rx,{workspace:r}),"users"===b&&e.jsx(Lj,{workspace:r}),"subscription"===b&&e.jsx(hk,{workspace:r}),"usage"===b&&e.jsx(vk,{}),"features"===b&&e.jsx(Ky,{workspaceId:r._id?.toString()}),"danger"===b&&e.jsx(Oy,{workspace:r})]})]})]})]})};var Kj=Object.freeze({__proto__:null,WorkspaceSettingsDialog:Gj,default:Gj});function Hj(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:s,switchingToId:o}=t,i=t.isCurrentWorkspace??!1,l=o===r._id,c=r.subscription??null,d=null!=c&&"object"==typeof c?c.plan??null:null,u=d?.name??"";return e.jsxs("div",{className:je("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(yp,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(xp,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(vp,{children:(f=r.name,f.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Fd,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]}),u&&e.jsx("div",{className:"max-w-fit",children:e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground bg-green-500 text-white rounded-full px-2 py-0.5",children:e.jsx("span",{className:"text-xs",children:u})})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(zd,{size:"sm",disabled:null!==o||l,progress:l,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{De(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(Gj,{workspace:r,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(s[e])}}})]})]});var f}function Zj(r){const{switching:n}=or(),[a,s]=t.useState(!1),[o,i]=t.useState("emoji"),[l,c]=t.useState("๐Ÿข"),[d,u]=t.useState(!1),{createWorkspace:f}=or(),p=zo({resolver:Hc(rf({name:_u().min(2,{message:"Workspace name must be at least 2 characters."}),image:_u().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(Jh,{open:a,onOpenChange:s,children:[e.jsx(Yh,{asChild:!0,children:e.jsxs(zd,{className:"w-full rounded-none",disabled:n,children:[e.jsx(Ed,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(eg,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(tg,{children:[e.jsx(rg,{children:"Create New Workspace"}),e.jsx(ng,{children:"Create a new workspace to get started."})]}),e.jsx(Gd,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===o)t=ex(l);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),s(!1),p.reset(),c("๐Ÿข"),i("emoji"),r?.onCreated?.()}catch(t){De(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(Hd,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Workspace Name"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"My Awesome Workspace",...t})}),e.jsx(eu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Bd,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(Qd,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(tb,{value:o,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(rb,{value:"emoji",id:"emoji"}),e.jsxs(Bd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Rd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(rb,{value:"url",id:"url"}),e.jsxs(Bd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(jd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:l})]}),e.jsx(Lb,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:tx.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",ex(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Hd,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Image URL"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"https://example.com/image.png",...t})}),e.jsx(Qd,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(eu,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(zd,{type:"button",variant:"outline",onClick:()=>{s(!1),p.reset(),c("๐Ÿข"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(zd,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(Nd,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}function qj(e){if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t}const Jj=(e,t)=>null==e||0===e?"Free":Qy(e,t),Yj=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}};var Xj=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:s,currentStripePriceId:o,billingCurrency:i,onSelectPlan:l,loading:c=!1})=>{const[d,u]=t.useState(!1),[f,p]=t.useState(null),m=t.useRef(!1),h=t.useMemo(()=>rk(o,a),[o,a]),g=h?.interval??null,b=h?.currency??null,y=t.useMemo(()=>ek(a),[a]),x=t.useMemo(()=>{const e=i?.trim().toLowerCase();return e?y.includes(e)?[e]:[]:y},[i,y]),[v,w]=t.useState(g||"monthly"),[S,k]=t.useState(()=>b&&x.includes(b)?b:x.length>0?x[0]:""),j=i?.trim()||S;t.useEffect(()=>{r&&(w(g||"monthly"),b&&x.includes(b)?k(b):x.length>0&&!x.includes(S)&&k(x[0]))},[r,g,b,x]);const N=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),E=(e=>{const t=new Map;return e.forEach(e=>{e.subscriptionItems?.forEach(e=>{t.has(e._id)||t.set(e._id,e)})}),Array.from(t.values())})(N),C=E.filter(e=>"feature"===e.type),A=E.filter(e=>"limit"===e.type),_=E.filter(e=>"quota"===e.type),T=c||d,R=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},P=(e,t,r="monthly")=>{if("feature"===t.type)return e.features?.[t.slug]??!1;if("limit"===t.type)return e.limits?.[t.slug]??null;if("quota"===t.type){const n=tk(e,j,t.slug,r);return n||ik(e.quotas?.[t.slug],r)}return null},O=(e,t,r)=>{if("feature"===t.type)return!0===e?"โœ“":"โ€”";if("limit"===t.type)return null!=e?String(e):"โ€”";if("quota"===t.type){return lk("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"โ€”"};return e.jsx(Jh,{open:r,onOpenChange:n,children:e.jsxs(eg,{className:"inset-0 w-screen h-screen max-w-none rounded-none translate-x-0 translate-y-0 p-0 flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-6 border-b space-y-4",children:[e.jsxs("div",{children:[e.jsx(rg,{className:"text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(ng,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:!i?.trim()&&x.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Currency"}),e.jsx("select",{"aria-label":"Select billing currency",value:S,onChange:e=>k(e.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm font-medium text-slate-900 shadow-sm focus:outline-none focus:ring-2 focus:ring-primary",children:x.map(t=>{const r=qy(t);return e.jsx("option",{value:t,children:r?`${r} ${t.toUpperCase()}`:t.toUpperCase()},t)})})]})}),e.jsx("div",{className:"flex items-center gap-1 p-1 bg-slate-100 rounded-lg",role:"group","aria-label":"Billing interval",children:["monthly","quarterly","yearly"].map(t=>{const r=g===t;return e.jsx("button",{onClick:()=>w(t),className:"px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(v===t?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e.jsxs("span",{className:"flex items-center gap-1.5",children:["monthly"===t&&"Monthly","quarterly"===t&&"Quarterly","yearly"===t&&"Yearly","yearly"===t&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),r&&s&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},t)})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:i?.trim()&&0===x.length?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===N.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:e.jsx("div",{className:"overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e.jsxs("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*N.length+"px",borderCollapse:"separate"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:280,minWidth:280}}),N.map(t=>e.jsx("col",{style:{width:200,minWidth:200}},t._id))]}),e.jsx("thead",{children:e.jsxs("tr",{className:"align-top",children:[e.jsx("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),N.map(t=>{const r=t._id===s,a=(e=>{const t=e._id===s,r=g===v;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${R(v)}`,variant:"default",disabled:!1};if(!s)return{label:"Subscribe",variant:"default",disabled:!1};const n=N.findIndex(e=>e._id===s),a=N.findIndex(t=>t._id===e._id);return-1===n||-1===a?{label:"Select",variant:"default",disabled:!1}:a<n?{label:"Downgrade",variant:"outline",disabled:!1}:a>n?{label:"Upgrade",variant:"default",disabled:!1}:{label:"Select",variant:"default",disabled:!1}})(t),o=T&&t._id===f,i=(e=>YS(e,j,v))(t),h=YS(t,j,"monthly")??0,b="monthly"!==v&&null!==i?((e,t,r)=>{if(!e||0===e)return null;let n;switch(r){case"yearly":n=t/12;break;case"quarterly":n=t/3;break;default:return null}const a=(e-n)/e*100;return a>0?Math.round(a):null})(h,i,v):null,y=(e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===j.toLowerCase()))(t),x=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===j.toLowerCase())?j:t.plan?.currency??j??"";return e.jsx("th",{className:"sticky top-0 z-20 border-b border-slate-200 p-3 shadow-[0_2px_4px_-2px_rgba(0,0,0,0.06)] "+(t._id===s?"bg-blue-50/80":"bg-white"),children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 truncate",children:t.plan.name}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:y&&null!==i||y?Jj(i,x):"โ€”"}),null!==i&&i>0&&y&&e.jsx("span",{className:"text-sm text-slate-500",children:Yj(v)})]}),null!==b&&b>0&&y&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",b,"% vs monthly"]}),(()=>{const r=nk(t,j);if(!r)return null;const n=ak(t,j,v);return!n||n<=0?null:e.jsxs("div",{className:"text-xs text-slate-500 mt-1 border-t border-slate-100 pt-1",children:[e.jsxs("span",{children:["+ ",Qy(n,x),"/seat",Yj(v)]}),r.includedSeats>0&&e.jsxs("span",{className:"text-slate-400",children:[" (",r.includedSeats," included)"]})]})})()]}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:t.plan.description}),e.jsx(zd,{className:"mt-auto w-full",variant:a.variant,disabled:a.disabled||T||!y,progress:o,onClick:()=>(async e=>{if(!(e===s&&g===v||c||d||m.current)){m.current=!0,u(!0),p(e);try{await l(e,v,j),n(!1)}catch(e){}finally{m.current=!1,u(!1),p(null)}}})(t._id),children:o?"Processing...":y?a.label:"Unavailable"})]})},t._id)})]})}),e.jsxs("tbody",{children:[C.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Features"}),e.jsx("td",{colSpan:N.length,className:"border-t border-slate-200 bg-slate-100"})]}),C.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),N.map(r=>{const n=P(r,t,v),a=r.pricingVariants?.length?j:r.plan?.currency??j??"",o=O(n,t,a),i="feature"===t.type&&!0===n;return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+(i?"text-emerald-600":"โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),A.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Limits"}),e.jsx("td",{colSpan:N.length,className:"border-t border-slate-200 bg-slate-100"})]}),A.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),N.map(r=>{const n=P(r,t,v),a=r.pricingVariants?.length?j:r.plan?.currency??j??"",o=O(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),_.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Quotas"}),e.jsx("td",{colSpan:N.length,className:"border-t border-slate-200 bg-slate-100"})]}),_.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),N.map(r=>{const n=P(r,t,v),a=r.pricingVariants?.length?j:r.plan?.currency??j??"",o=O(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),N.some(e=>{const t=nk(e,j);return t?.enabled})&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-emerald-200 bg-emerald-50 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-emerald-700 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Seats"}),e.jsx("td",{colSpan:N.length,className:"border-t border-emerald-200 bg-emerald-50"})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Included seats"}),e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:"Free with base price"})]}),N.map(t=>{const r=nk(t,j);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.includedSeats||0:"โ€”"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Max seats"})}),N.map(t=>{const r=nk(t,j);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.maxSeats>0?r.maxSeats:"Unlimited":"โ€”"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Per extra seat"})}),N.map(t=>{const r=ak(t,j,v),n=t.pricingVariants?.length?j:t.plan?.currency??j??"";return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r&&r>0?`${Qy(r,n)}${Yj(v)}`:"โ€”"})},t._id)})]})]})]})]})})})})]})})}});exports.BaseApi=Zt,exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:s="flex flex-col gap-1.5 w-full",language:o,customTexts:i={},autoFocus:l=!0,showSuccessMessage:c=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,b]=t.useState(!1),{submitBetaForm:y,isLoading:x,isSubmitting:v,error:w,config:S,success:k,message:j}=(()=>{const e=Jt(),[r,n]=t.useState(null),[a,s]=t.useState(!0),[o,i]=t.useState(!1),[l,c]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{let t=!1;return(async()=>{s(!0),c(null);try{const r=new au(e),a=await r.fetchConfig();t||n(a)}catch(e){t||c(e instanceof Error?e.message:"Failed to load beta form config")}finally{t||s(!1)}})(),()=>{t=!0}},[e]),{isLoading:a,isSubmitting:o,config:r,error:l,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),u(!1),p(null);const r=new au(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Sf).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&c&&(h(!0),b(!0)),w&&b(!0)},[k,c,w]);const N={...Sf[o||f],...i},E=zo({resolver:Hc(wf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{l&&E.setFocus("name")},[l,E]);const C=E.formState.isValid&&!v;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:x?e.jsxs("div",{className:je("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",a),children:[e.jsx(ru,{className:"h-24 w-24 rounded-lg"}),e.jsx(ru,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ru,{className:"h-4 w-16"}),e.jsx(ru,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ru,{className:"h-4 w-16"}),e.jsx(ru,{className:"h-10 w-full"})]}),e.jsx(ru,{className:"h-10 w-full"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(jf,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(ro,{...E,children:e.jsxs("form",{onSubmit:E.handleSubmit(async e=>{try{const t=await y(e);t.success?(r?.(),E.reset(),c&&h(!0),b(!0)):(n?.(t.message),b(!0))}catch(e){n?.(e instanceof Error?e.message:N.errorMessage),b(!0)}}),className:a,noValidate:!0,"aria-busy":v,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(kf,{screen:S?.screen?.register}),e.jsx(Hd,{control:E.control,name:"name",render:({field:t})=>e.jsxs(Jd,{className:s,children:[e.jsx(Yd,{children:N.nameLabel}),e.jsx(Xd,{children:e.jsx(tu,{...t})}),e.jsx(Qd,{}),e.jsx(eu,{})]})}),e.jsx(Hd,{control:E.control,name:"email",render:({field:t})=>e.jsxs(Jd,{className:s,children:[e.jsx(Yd,{children:N.emailLabel}),e.jsx(Xd,{children:e.jsx(tu,{...t})}),e.jsx(Qd,{}),e.jsx(eu,{})]})}),e.jsx(zd,{type:"submit",disabled:!C,className:s,children:v?N.submittingText:N.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"โ—"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(zd,{type:"button",onClick:()=>{b(!1),E.reset()},className:s,children:"Try Again"})})]}),g&&m&&j&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(kf,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.CURRENCY_DISPLAY=Hy,exports.CURRENCY_FLAG=Zy,exports.PLAN_CURRENCY_CODES=Yy,exports.PLAN_CURRENCY_OPTIONS=Xy,exports.PricingPage=function({slug:t,children:r,loadingFallback:n,errorFallback:a}){const{items:s,plans:o,notes:i,loading:l,error:c,refetch:d}=cr(t);return l?void 0!==n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(ru,{className:"h-8 w-48"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(t=>e.jsx(ru,{className:"h-64 rounded-lg"},t))})]}):c?a?e.jsx(e.Fragment,{children:a(c)}):e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:c}):e.jsx(e.Fragment,{children:r({loading:l,error:c,items:s,plans:o,notes:i,refetch:d})})},exports.QuotaUsageContextProvider=Er,exports.SaaSOSProvider=fs,exports.SettingsApi=qt,exports.SubscriptionContextProvider=wr,exports.UserApi=ss,exports.WhenAuthenticated=Nf,exports.WhenNoSubscription=Df,exports.WhenNotTrialing=Mf,exports.WhenQuotaAvailable=Lf,exports.WhenQuotaExhausted=$f,exports.WhenQuotaOverage=Wf,exports.WhenQuotaThreshold=Vf,exports.WhenRoles=Cf,exports.WhenSubscription=If,exports.WhenSubscriptionToPlans=Uf,exports.WhenTrialEnding=zf,exports.WhenTrialing=Ff,exports.WhenUnauthenticated=Ef,exports.WhenUserFeatureDisabled=Of,exports.WhenUserFeatureEnabled=Pf,exports.WhenWorkspaceFeatureDisabled=Rf,exports.WhenWorkspaceFeatureEnabled=Tf,exports.WhenWorkspaceRoles=Af,exports.WorkspaceApi=Xt,exports.WorkspaceSwitcher=function(r){const{isAuthenticated:n,user:a}=es(),s=o(Jt()),{workspaces:i,currentWorkspace:l,loading:c,refreshing:d,switchingToId:u,fetchWorkspaces:f,getFeatures:p,refreshWorkspaces:m,setCurrentWorkspace:h,switchToWorkspace:g}=or(),{settings:b}=Yt(),[y,x]=t.useState(!1),[v,w]=t.useState(0),[S,k]=t.useState(""),j=c||d;t.useEffect(()=>{n&&s&&(0===i.length?(f(),p()):p())},[n,s]),t.useEffect(()=>{n&&s&&v>0&&m()},[v,n,s]);const N=i,E=N.filter(e=>e._id!==l?._id).filter(e=>e.name.toLowerCase().includes(S.toLowerCase())),C=b?.workspace.maxWorkspaces??Number.MAX_VALUE,A=N?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===a?.id?.toString()).length,_=C>(A??0);return e.jsxs(Jh,{open:y,onOpenChange:x,children:[e.jsx(Yh,{children:r.trigger?.(j,l)}),e.jsxs(eg,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(tg,{children:[e.jsxs(rg,{className:"flex items-center gap-2",children:[e.jsx(hd,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(ng,{children:"Select a workspace to switch to or create a new one."})]}),!a&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),a&&e.jsxs("div",{className:"flex flex-col gap-4",children:[l&&e.jsx(Hj,{workspace:l,isCurrentWorkspace:!0,switchToWorkspace:g,switchingToId:u,onClose:()=>x(!1),setCurrentWorkspace:h,setOpen:x,workspacesToUse:N}),e.jsx(Hb,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),e.jsx("div",{children:e.jsx(zd,{progress:d,disabled:d,variant:"ghost",onClick:function(){n&&s&&w(e=>e+1)},startIcon:e.jsx(Cd,{}),children:d?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(_d,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(tu,{placeholder:"Search workspaces...",value:S,onChange:e=>k(e.target.value),className:"pl-10"})]}),c?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Nd,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(hd,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:S?"No workspaces found":"No workspaces available"})]}):e.jsx(Lb,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(t=>{const r=t._id===l?._id;return e.jsx(Hj,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:g,switchingToId:u,onClose:()=>x(!1),setCurrentWorkspace:h,setOpen:x,workspacesToUse:N},t._id)})})})]}),_&&e.jsxs(e.Fragment,{children:[e.jsx(Hb,{}),e.jsx(Zj,{onCreated:()=>{f()}})]})]})]})]})},exports.calculateBillableSeats=sk,exports.calculateSeatOverageCents=ok,exports.calculateTotalSubscriptionCents=function(e,t,r,n){const a=YS(e,t,r);return null===a?null:void 0===n?a:a+(ok(e,t,r,n)??0)},exports.eventEmitter=Pt,exports.formatCents=Qy,exports.formatOverageRate=function(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=Jy(r),s=(e/100).toFixed(2);return 1===n?`${a}${s}/unit`:`${a}${s}/${n.toLocaleString()} units`},exports.formatOverageRateWithLabel=function(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,s=Jy(n),o=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${s}${o}/${a.toLocaleString()} ${e}`:`${s}${o}/${r}`}return 1===a?`${s}${o}/unit`:`${s}${o}/${a.toLocaleString()} units`},exports.formatQuotaIncludedOverage=function(e,t,r,n,a){const s=r.endsWith("s")?r:`${r}s`,o=null!=a&&a>=2?`${a.toLocaleString()} ${s}`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${Qy(t,n)}/${o}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${Qy(t,n)}/${o}`:"โ€”"},exports.formatQuotaWithPrice=lk,exports.getAvailableCurrenciesFromPlans=ek,exports.getBasePriceCents=YS,exports.getBillingIntervalAndCurrencyFromPriceId=rk,exports.getCurrencyFlag=qy,exports.getCurrencySymbol=Jy,exports.getDisplayCurrency=function(e,t){const r=JS(e,t);return r?r.currency:e.plan?.currency??""},exports.getPerSeatPriceCents=ak,exports.getPricingVariant=JS,exports.getQuotaDisplayValue=ik,exports.getQuotaDisplayWithVariant=tk,exports.getQuotaOverageCents=QS,exports.getQuotaUnitLabelFromName=function(e){const t=(e||"").trim().toLowerCase();if(!t)return"unit";const r=t.split(/\s+/)[0]??t;return new Set(["series","species","status","analysis","basis","bus","campus","corpus","axis"]).has(r)?r:r.endsWith("ies")&&r.length>3?r.slice(0,-3)+"y":r.endsWith("ses")||r.endsWith("xes")||r.endsWith("zes")||r.endsWith("ches")||r.endsWith("shes")?r.slice(0,-2):r.endsWith("s")&&!r.endsWith("ss")&&r.length>1?r.slice(0,-1):r||"unit"},exports.getSeatPricing=nk,exports.getStripePriceIdForInterval=XS,exports.invalidateQuotaUsage=lr,exports.invalidateSubscription=Rt,exports.useAllQuotaUsage=xr,exports.useCancelSubscription=br,exports.useCreateCheckoutSession=pr,exports.useInvoice=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";c(n),De(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{invoice:a,loading:o,error:l,refetch:d}},exports.useInvoices=gr,exports.usePlanGroup=ur,exports.usePlanGroupVersions=fr,exports.usePublicPlanGroupVersion=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getPlanGroupVersion(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";l(r),De(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{planGroupVersion:n,loading:s,error:i,refetch:c}},exports.usePublicPlans=cr,exports.useQuotaUsageContext=Cr,exports.useQuotaUsageStatus=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getQuotaUsageStatus(e,r);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch quota usage status";c(n),De(t,{component:"useQuotaUsageStatus",action:"fetchStatus",metadata:{workspaceId:e,quotaSlug:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{status:a,loading:o,error:l,refetch:d}},exports.useRecordUsage=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{recordUsage:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=await r.recordUsage(e,t);return lr(),n}catch(r){const n=r instanceof Error?r.message:"Failed to record usage";throw o(n),De(r,{component:"useRecordUsage",action:"recordUsage",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},exports.useResumeSubscription=yr,exports.useSaaSAuth=es,exports.useSaaSOs=Jt,exports.useSaaSSettings=Yt,exports.useSaaSWorkspaces=or,exports.useSeatStatus=function(e){const{response:r}=Sr();return t.useMemo(()=>{const t={hasSeatPricing:!1,memberCount:0,includedSeats:0,maxSeats:0,billableSeats:0,availableSeats:1/0,isAtMax:!1,isNearMax:!1,perSeatPriceCents:null,currency:""};if(!r?.subscription||!e)return t;const n=r.subscription;if(!n.seatPricingEnabled)return{...t,memberCount:e.users?.length??0};const a=r.planVersion,s=e.billingCurrency||"usd",o=a?nk(a,s):null;if(!o)return{...t,hasSeatPricing:!0,memberCount:e.users?.length??0};const i=e.users?.length??0,l=o.includedSeats??0,c=o.maxSeats??0,d=Math.max(0,i-l),u=c>0?Math.max(0,c-i):1/0,f=c>0&&i>=c,p=c>0&&i>=.8*c&&!f,m=n.billingInterval??"monthly";return{hasSeatPricing:!0,memberCount:i,includedSeats:l,maxSeats:c,billableSeats:d,availableSeats:u,isAtMax:f,isNearMax:p,perSeatPriceCents:a?ak(a,s,m):null,currency:s}},[r,e])},exports.useSubscription=dr,exports.useSubscriptionContext=Sr,exports.useSubscriptionManagement=hr,exports.useTrialStatus=function(){const{response:e}=Sr();return t.useMemo(()=>{const t=e?.subscription;if(!t||"trialing"!==t.subscriptionStatus)return{isTrialing:!1,daysRemaining:0,trialEndsAt:null,trialStartedAt:null,isTrialEnding:!1};const r=qj(t.trialEnd)??qj(t.stripeCurrentPeriodEnd),n=qj(t.trialStart),a=r?Math.max(0,Math.ceil((r.getTime()-Date.now())/864e5)):0;return{isTrialing:!0,daysRemaining:a,trialEndsAt:r,trialStartedAt:n,isTrialEnding:a<=3}},[e])},exports.useUpdateSubscription=mr,exports.useUsageLogs=(e,r,n)=>{const{api:a}=sr(),[s,o]=t.useState([]),[i,l]=t.useState(0),[c,d]=t.useState(0),[u,f]=t.useState(1),[p,m]=t.useState(!1),[h,g]=t.useState(!1),[b,y]=t.useState(!1),[x,v]=t.useState(null),w=n?.from,S=n?.to,k=n?.source,j=n?.page,N=n?.limit,E=t.useCallback(async()=>{if(!e)return o([]),l(0),d(0),f(1),m(!1),void g(!1);y(!0),v(null);try{const t={...r&&{quotaSlug:r},...w&&{from:w},...S&&{to:S},...k&&{source:k},...j&&{page:j},...N&&{limit:N}},n=await a.getUsageLogs(e,t);o(n.docs||[]),l(n.totalDocs||0),d(n.totalPages||0),f(n.page||1),m(n.hasNextPage||!1),g(n.hasPrevPage||!1)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch usage logs";v(n),De(t,{component:"useUsageLogs",action:"fetchLogs",metadata:{workspaceId:e,quotaSlug:r}})}finally{y(!1)}},[a,e,r,w,S,k,j,N]);return t.useEffect(()=>{E()},[E]),{logs:s,totalDocs:i,totalPages:c,page:u,hasNextPage:p,hasPrevPage:h,loading:b,error:x,refetch:E}},exports.useUserAttributes=function(){const e=t.useContext(os);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=_f;
29
+ */function tp(){return Xf||(Xf=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,i=r.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){l||void 0===r.startTransition||(l=!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(!c){var f=d();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return o(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),s(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};ep.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ep}function rp(){return Qf||(Qf=1,"production"===process.env.NODE_ENV?qf.exports=Yf():qf.exports=tp()),qf.exports}var np=rp();function ap(){return()=>{}}var sp="Avatar",[op]=function(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s);o.displayName=r+"Context";const i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Bf(s,...r)]}(sp),[ip,lp]=op(sp),cp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...s}=t,[o,i]=a.useState("idle");return e.jsx(ip,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:e.jsx(Zf.span,{...s,ref:r})})});cp.displayName=sp;var dp="AvatarImage",up=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...i}=t,l=lp(dp,n),c=function(e,{referrerPolicy:t,crossOrigin:r}){const n=np.useSyncExternalStore(ap,()=>!0,()=>!1),s=a.useRef(null),o=n?(s.current||(s.current=new window.Image),s.current):null,[i,l]=a.useState(()=>mp(o,e));return Hf(()=>{l(mp(o,e))},[o,e]),Hf(()=>{const e=e=>()=>{l(e)};if(!o)return;const n=e("loaded"),a=e("error");return o.addEventListener("load",n),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",n),o.removeEventListener("error",a)}},[o,r,t]),i}(s,i),d=Gf(e=>{o(e),l.onImageLoadingStatusChange(e)});return Hf(()=>{"idle"!==c&&d(c)},[c,d]),"loaded"===c?e.jsx(Zf.img,{...i,ref:r,src:s}):null});up.displayName=dp;var fp="AvatarFallback",pp=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:s,...o}=t,i=lp(fp,n),[l,c]=a.useState(void 0===s);return a.useEffect(()=>{if(void 0!==s){const e=window.setTimeout(()=>c(!0),s);return()=>window.clearTimeout(e)}},[s]),l&&"loaded"!==i.imageLoadingStatus?e.jsx(Zf.span,{...o,ref:r}):null});function mp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}pp.displayName=fp;var hp=cp,gp=up,bp=pp;const yp=a.forwardRef(({className:t,...r},n)=>e.jsx(hp,{ref:n,className:je("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));yp.displayName=hp.displayName;const xp=a.forwardRef(({className:t,...r},n)=>e.jsx(gp,{ref:n,className:je("aspect-square h-full w-full",t),...r}));xp.displayName=gp.displayName;const vp=a.forwardRef(({className:t,...r},n)=>e.jsx(bp,{ref:n,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function wp(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Sp(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s),i=n.length;n=[...n,s];const l=r=>{const{scope:n,children:s,...l}=r,c=n?.[t]?.[i]||o,d=a.useMemo(()=>l,Object.values(l));return e.jsx(c.Provider,{value:d,children:s})};return l.displayName=r+"Provider",[l,function(e,n){const l=n?.[t]?.[i]||o,c=a.useContext(l);if(c)return c;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},kp(s,...r)]}function kp(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}vp.displayName=bp.displayName;var jp=a[" useId ".trim().toString()]||(()=>{}),Np=0;function Ep(e){const[t,r]=a.useState(jp());return Hf(()=>{r(e=>e??String(Np++))},[e]),e||(t?`radix-${t}`:"")}var Cp=a[" useInsertionEffect ".trim().toString()]||Hf;function Ap({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),s=a.useRef(r),o=a.useRef(t);return Cp(()=>{o.current=t},[t]),a.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}({defaultProp:t,onChange:r}),l=void 0!==e,c=l?e:s;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l},[l,n])}const d=a.useCallback(t=>{if(l){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[l,e,o,i]);return[c,d]}function _p(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Tp=Symbol("radix.slottable");function Rp(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Tp}var Pp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=_p(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Rp);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{});var Op,Ip="dismissableLayer.update",Dp="dismissableLayer.pointerDownOutside",Up="dismissableLayer.focusOutside",Fp=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mp=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:c,...d}=t,u=a.useContext(Fp),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Jc(r,e=>p(e)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=b.indexOf(y),v=f?b.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=x,k=function(e,t=globalThis?.document){const r=Gf(e),n=a.useRef(!1),s=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){Lp(Dp,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=n,t.addEventListener("click",s.current,{once:!0})):n()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),l?.(e),e.defaultPrevented||c?.())},m),j=function(e,t=globalThis?.document){const r=Gf(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){Lp(Up,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),l?.(e),e.defaultPrevented||c?.())},m);return function(e,t=globalThis?.document){const r=Gf(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{v===u.layers.size-1&&(s?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(Op=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),zp(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Op)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),zp())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(Ip,e),()=>document.removeEventListener(Ip,e)},[]),e.jsx(Pp.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:wp(t.onFocusCapture,j.onFocusCapture),onBlurCapture:wp(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:wp(t.onPointerDownCapture,k.onPointerDownCapture)})});Mp.displayName="DismissableLayer";function zp(){const e=new CustomEvent(Ip);document.dispatchEvent(e)}function Lp(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&&s.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}a.forwardRef((t,r)=>{const n=a.useContext(Fp),s=a.useRef(null),o=Jc(r,s);return a.useEffect(()=>{const e=s.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Pp.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var $p="focusScope.autoFocusOnMount",Wp="focusScope.autoFocusOnUnmount",Vp={bubbles:!1,cancelable:!0},Bp=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=t,[c,d]=a.useState(null),u=Gf(o),f=Gf(i),p=a.useRef(null),m=Jc(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(s){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:Zp(p.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Zp(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Zp(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return c&&n.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[s,c,h.paused]),a.useEffect(()=>{if(c){qp.add(h);const t=document.activeElement;if(!c.contains(t)){const r=new CustomEvent($p,Vp);c.addEventListener($p,u),c.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Zp(n,{select:t}),document.activeElement!==r)return}((e=Gp(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&Zp(c))}return()=>{c.removeEventListener($p,u),setTimeout(()=>{const e=new CustomEvent(Wp,Vp);c.addEventListener(Wp,f),c.dispatchEvent(e),e.defaultPrevented||Zp(t??document.body,{select:!0}),c.removeEventListener(Wp,f),qp.remove(h)},0)}}var e},[c,u,f,h]);const g=a.useCallback(e=>{if(!n&&!s)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[a,s]=function(e){const t=Gp(e),r=Kp(t,e),n=Kp(t.reverse(),e);return[r,n]}(t);a&&s?e.shiftKey||r!==s?e.shiftKey&&r===a&&(e.preventDefault(),n&&Zp(s,{select:!0})):(e.preventDefault(),n&&Zp(a,{select:!0})):r===t&&e.preventDefault()}},[n,s,h.paused]);return e.jsx(Pp.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})});function Gp(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 Kp(e,t){for(const r of e)if(!Hp(r,{upTo:t}))return r}function Hp(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 Zp(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()}}Bp.displayName="FocusScope";var qp=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Jp(e,t),e.unshift(t)},remove(t){e=Jp(e,t),e[0]?.resume()}}}();function Jp(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var Yp=a.forwardRef((t,n)=>{const{container:s,...o}=t,[i,l]=a.useState(!1);Hf(()=>l(!0),[]);const c=s||i&&globalThis?.document?.body;return c?r.createPortal(e.jsx(Pp.div,{...o,ref:n}),c):null});Yp.displayName="Portal";var Xp=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),s=a.useRef(e),o=a.useRef("none"),i=e?"mounted":"unmounted",[l,c]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=Qp(n.current);o.current="mounted"===l?e:"none"},[l]),Hf(()=>{const t=n.current,r=s.current;if(r!==e){const n=o.current,a=Qp(t);if(e)c("MOUNT");else if("none"===a||"none"===t?.display)c("UNMOUNT");else{c(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}s.current=e}},[e,c]),Hf(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const o=Qp(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c("ANIMATION_END"),!s.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},i=e=>{e.target===t&&(o.current=Qp(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),s="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),o=Jc(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof r||n.isPresent?a.cloneElement(s,{ref:o}):null};function Qp(e){return e?.animationName||"none"}Xp.displayName="Presence";var em=0;function tm(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rm()),document.body.insertAdjacentElement("beforeend",e[1]??rm()),em++,()=>{1===em&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),em--}},[])}function rm(){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 nm=function(){return nm=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},nm.apply(this,arguments)};function am(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 sm="right-scroll-bar-position",om="width-before-scroll-bar";function im(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var lm="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,cm=new WeakMap;function dm(e,r){var n,a,s,o=(n=null,a=function(t){return e.forEach(function(e){return im(e,t)})},(s=t.useState(function(){return{value:n,callback:a,facade:{get current(){return s.value},set current(e){var t=s.value;t!==e&&(s.value=e,s.callback(e,t))}}}})[0]).callback=a,s.facade);return lm(function(){var t=cm.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||im(e,null)}),n.forEach(function(e){r.has(e)||im(e,a)})}cm.set(o,e)},[e]),o}function um(e){return e}var fm=function(e){var t=e.sideCar,r=am(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,nm({},r))};fm.isSideCarExport=!0;var pm=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=um);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 s=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=nm({async:!0,ssr:!1},e),t}(),mm=function(){},hm=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:mm,onWheelCapture:mm,onTouchMoveCapture:mm}),s=n[0],o=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,x=void 0===y?"div":y,v=e.gapMode,w=am(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=dm([r,t]),j=nm(nm({},w),s);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:pm,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:v}),i?a.cloneElement(a.Children.only(l),nm(nm({},j),{ref:k})):a.createElement(x,nm({},j,{className:c,ref:k}),l))});hm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},hm.classNames={fullWidth:om,zeroRight:sm};function gm(){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 bm=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=gm())&&(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)}}},ym=function(){var e,t=(e=bm(),function(t,r){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},xm={left:0,top:0,right:0,gap:0},vm=function(e){return parseInt(e||"",10)||0},wm=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return xm;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[vm(r),vm(n),vm(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])}},Sm=ym(),km="data-scroll-locked",jm=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(km,"] {\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(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(sm," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(om," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(sm," .").concat(sm," {\n right: 0 ").concat(n,";\n }\n \n .").concat(om," .").concat(om," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(km,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Nm=function(){var e=parseInt(document.body.getAttribute(km)||"0",10);return isFinite(e)?e:0},Em=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(km,(Nm()+1).toString()),function(){var e=Nm()-1;e<=0?document.body.removeAttribute(km):document.body.setAttribute(km,e.toString())}},[]);var o=a.useMemo(function(){return wm(s)},[s]);return a.createElement(Sm,{styles:jm(o,!t,s,r?"":"!important")})},Cm=!1;if("undefined"!=typeof window)try{var Am=Object.defineProperty({},"passive",{get:function(){return Cm=!0,!0}});window.addEventListener("test",Am,Am),window.removeEventListener("test",Am,Am)}catch(e){Cm=!1}var _m=!!Cm&&{passive:!1},Tm=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])},Rm=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Pm(e,n)){var a=Om(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Pm=function(e,t){return"v"===e?function(e){return Tm(e,"overflowY")}(t):function(e){return Tm(e,"overflowX")}(t)},Om=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Im=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dm=function(e){return[e.deltaX,e.deltaY]},Um=function(e){return e&&"current"in e?e.current:e},Fm=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Mm=0,zm=[];function Lm(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var $m,Wm=($m=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),s=a.useState(Mm++)[0],o=a.useState(ym)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,s=t.length;a<s;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(Um),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=Im(e),o=r.current,l="deltaX"in e?e.deltaX:o[0]-s[0],c="deltaY"in e?e.deltaY:o[1]-s[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=Rm(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Rm(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(l||c)&&(n.current=a),!a)return!0;var h=n.current||a;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=a*n,o=r.target,i=t.contains(o),l=!1,c=s>0,d=0,u=0;do{if(!o)break;var f=Om(e,o),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Pm(e,o)&&(d+=m,u+=p);var h=o.parentNode;o=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&o!==document.body||i&&(t.contains(o)||t===o));return(c&&Math.abs(d)<1||!c&&Math.abs(u)<1)&&(l=!0),l}(h,t,e,"h"===h?l:c)},[]),c=a.useCallback(function(e){var r=e;if(zm.length&&zm[zm.length-1]===o){var n="deltaY"in r?Dm(r):Im(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 s=(i.current.shards||[]).map(Um).filter(Boolean).filter(function(e){return e.contains(r.target)});(s.length>0?l(r,s[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:Lm(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=a.useCallback(function(e){r.current=Im(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,Dm(t),t.target,l(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,Im(t),t.target,l(t,e.lockRef.current))},[]);a.useEffect(function(){return zm.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,_m),document.addEventListener("touchmove",c,_m),document.addEventListener("touchstart",u,_m),function(){zm=zm.filter(function(e){return e!==o}),document.removeEventListener("wheel",c,_m),document.removeEventListener("touchmove",c,_m),document.removeEventListener("touchstart",u,_m)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(o,{styles:Fm(s)}):null,m?a.createElement(Em,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},pm.useMedium($m),fm),Vm=a.forwardRef(function(e,t){return a.createElement(hm,nm({},e,{ref:t,sideCar:Wm}))});Vm.classNames=hm.classNames;var Bm=new WeakMap,Gm=new WeakMap,Km={},Hm=0,Zm=function(e){return e&&(e.host||Zm(e.parentNode))},qm=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=Zm(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]);Km[r]||(Km[r]=new WeakMap);var s=Km[r],o=[],i=new Set,l=new Set(a),c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(Bm.get(e)||0)+1,c=(s.get(e)||0)+1;Bm.set(e,l),s.set(e,c),o.push(e),1===l&&a&&Gm.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),i.clear(),Hm++,function(){o.forEach(function(e){var t=Bm.get(e)-1,a=s.get(e)-1;Bm.set(e,t),s.set(e,a),t||(Gm.has(e)||e.removeAttribute(n),Gm.delete(e)),a||e.removeAttribute(r)}),--Hm||(Bm=new WeakMap,Bm=new WeakMap,Gm=new WeakMap,Km={})}},Jm=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"))),qm(n,a,r,"aria-hidden")):function(){return null}};function Ym(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xm=Symbol("radix.slottable");function Qm(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Xm}var eh="Dialog",[th,rh]=Sp(eh),[nh,ah]=th(eh),sh=t=>{const{__scopeDialog:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!0}=t,c=a.useRef(null),d=a.useRef(null),[u,f]=Ap({prop:s,defaultProp:o??!1,onChange:i,caller:eh});return e.jsx(nh,{scope:r,triggerRef:c,contentRef:d,contentId:Ep(),titleId:Ep(),descriptionId:Ep(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:l,children:n})};sh.displayName=eh;var oh="DialogTrigger",ih=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(oh,n),o=Jc(r,s.triggerRef);return e.jsx(Pp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Ch(s.open),...a,ref:o,onClick:wp(t.onClick,s.onOpenToggle)})});ih.displayName=oh;var lh="DialogPortal",[ch,dh]=th(lh,{forceMount:void 0}),uh=t=>{const{__scopeDialog:r,forceMount:n,children:s,container:o}=t,i=ah(lh,r);return e.jsx(ch,{scope:r,forceMount:n,children:a.Children.map(s,t=>e.jsx(Xp,{present:n||i.open,children:e.jsx(Yp,{asChild:!0,container:o,children:t})}))})};uh.displayName=lh;var fh="DialogOverlay",ph=a.forwardRef((t,r)=>{const n=dh(fh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=ah(fh,t.__scopeDialog);return o.modal?e.jsx(Xp,{present:a||o.open,children:e.jsx(hh,{...s,ref:r})}):null});ph.displayName=fh;var mh=function(t){const r=Ym(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(Qm);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),hh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(fh,n);return e.jsx(Vm,{as:mh,allowPinchZoom:!0,shards:[s.contentRef],children:e.jsx(Pp.div,{"data-state":Ch(s.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),gh="DialogContent",bh=a.forwardRef((t,r)=>{const n=dh(gh,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=ah(gh,t.__scopeDialog);return e.jsx(Xp,{present:a||o.open,children:o.modal?e.jsx(yh,{...s,ref:r}):e.jsx(xh,{...s,ref:r})})});bh.displayName=gh;var yh=a.forwardRef((t,r)=>{const n=ah(gh,t.__scopeDialog),s=a.useRef(null),o=Jc(r,n.contentRef,s);return a.useEffect(()=>{const e=s.current;if(e)return Jm(e)},[]),e.jsx(vh,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:wp(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:wp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:wp(t.onFocusOutside,e=>e.preventDefault())})}),xh=a.forwardRef((t,r)=>{const n=ah(gh,t.__scopeDialog),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(vh,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),vh=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=t,c=ah(gh,n),d=a.useRef(null),u=Jc(r,d);return tm(),e.jsxs(e.Fragment,{children:[e.jsx(Bp,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:e.jsx(Mp,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ch(c.open),...l,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Rh,{titleId:c.titleId}),e.jsx(Ph,{contentRef:d,descriptionId:c.descriptionId})]})]})}),wh="DialogTitle",Sh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(wh,n);return e.jsx(Pp.h2,{id:s.titleId,...a,ref:r})});Sh.displayName=wh;var kh="DialogDescription",jh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(kh,n);return e.jsx(Pp.p,{id:s.descriptionId,...a,ref:r})});jh.displayName=kh;var Nh="DialogClose",Eh=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=ah(Nh,n);return e.jsx(Pp.button,{type:"button",...a,ref:r,onClick:wp(t.onClick,()=>s.onOpenChange(!1))})});function Ch(e){return e?"open":"closed"}Eh.displayName=Nh;var Ah="DialogTitleWarning",[_h,Th]=function(t,r){const n=a.createContext(r),s=t=>{const{children:r,...s}=t,o=a.useMemo(()=>s,Object.values(s));return e.jsx(n.Provider,{value:o,children:r})};return s.displayName=t+"Provider",[s,function(e){const s=a.useContext(n);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(Ah,{contentName:gh,titleName:wh,docsSlug:"dialog"}),Rh=({titleId:e})=>{const t=Th(Ah),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Ph=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Th("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},Oh=sh,Ih=ih,Dh=uh,Uh=ph,Fh=bh,Mh=Sh,zh=jh,Lh=Eh;function $h(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Wh=["color"],Vh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Wh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Bh=["color"],Gh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Bh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Kh=["color"],Hh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Kh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Zh=["color"],qh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=$h(e,Zh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const Jh=Oh,Yh=Ih,Xh=Dh,Qh=a.forwardRef(({className:t,...r},n)=>e.jsx(Uh,{ref:n,className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));Qh.displayName=Uh.displayName;const eg=a.forwardRef(({className:t,children:r,...n},s)=>{const{container:o}=a.useContext(ns);return e.jsxs(Xh,{container:o,children:[e.jsx(Qh,{}),e.jsxs(Fh,{ref:s,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n,children:[r,e.jsxs(Lh,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Hh,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});eg.displayName=Fh.displayName;const tg=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});tg.displayName="DialogHeader";const rg=a.forwardRef(({className:t,...r},n)=>e.jsx(Mh,{ref:n,className:je("text-lg font-semibold leading-none tracking-tight",t),...r}));rg.displayName=Mh.displayName;const ng=a.forwardRef(({className:t,...r},n)=>e.jsx(zh,{ref:n,className:je("text-sm text-muted-foreground",t),...r}));function ag(t){const r=sg(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(ig);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}function sg(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}ng.displayName=zh.displayName;var og=Symbol("radix.slottable");function ig(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===og}function lg(r){const n=r+"CollectionProvider",[a,s]=Sp(n),[o,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),l=r=>{const{scope:n,children:a}=r,s=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(o,{scope:n,itemMap:i,collectionRef:s,children:a})};l.displayName=n;const c=r+"CollectionSlot",d=ag(c),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,s=Jc(r,i(c,n).collectionRef);return e.jsx(d,{ref:s,children:a})});u.displayName=c;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=ag(f),h=t.forwardRef((r,n)=>{const{scope:a,children:s,...o}=r,l=t.useRef(null),c=Jc(n,l),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(l,{ref:l,...o}),()=>{d.itemMap.delete(l)})),e.jsx(m,{[p]:"",ref:c,children:s})});return h.displayName=f,[{Provider:l,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},s]}var cg=a.createContext(void 0);function dg(e){const t=a.useContext(cg);return e||t||"ltr"}var ug="rovingFocusGroup.onEntryFocus",fg={bubbles:!1,cancelable:!0},pg="RovingFocusGroup",[mg,hg,gg]=lg(pg),[bg,yg]=Sp(pg,[gg]),[xg,vg]=bg(pg),wg=a.forwardRef((t,r)=>e.jsx(mg.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(mg.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Sg,{...t,ref:r})})}));wg.displayName=pg;var Sg=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Jc(r,m),g=dg(i),[b,y]=Ap({prop:l,defaultProp:c??null,onChange:d,caller:pg}),[x,v]=a.useState(!1),w=Gf(u),S=hg(n),k=a.useRef(!1),[j,N]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(ug,w),()=>e.removeEventListener(ug,w)},[w]),e.jsx(xg,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:b,onItemFocus:a.useCallback(e=>y(e),[y]),onItemShiftTab:a.useCallback(()=>v(!0),[]),onFocusableItemAdd:a.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>N(e=>e-1),[]),children:e.jsx(Pp.div,{tabIndex:x||0===j?-1:0,"data-orientation":s,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:wp(t.onMouseDown,()=>{k.current=!0}),onFocus:wp(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!x){const t=new CustomEvent(ug,fg);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Eg([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:wp(t.onBlur,()=>v(!1))})})}),kg="RovingFocusGroupItem",jg=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:l,...c}=t,d=Ep(),u=i||d,f=vg(kg,n),p=f.currentTabStopId===u,m=hg(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return a.useEffect(()=>{if(s)return h(),()=>g()},[s,h,g]),e.jsx(mg.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:e.jsx(Pp.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:r,onMouseDown:wp(t.onMouseDown,e=>{s?f.onItemFocus(u):e.preventDefault()}),onFocus:wp(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:wp(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Ng[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(()=>Eg(r))}}),children:"function"==typeof l?l({isCurrentTabStop:p,hasTabStop:null!=b}):l})})});jg.displayName=kg;var Ng={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Eg(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 Cg=wg,Ag=jg;function _g(e){const[t,r]=a.useState(void 0);return Hf(()=>{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,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Tg(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Rg="Radio",[Pg,Og]=Sp(Rg),[Ig,Dg]=Pg(Rg),Ug=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:s,checked:o=!1,required:i,disabled:l,value:c="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Jc(r,e=>m(e)),g=a.useRef(!1),b=!p||(u||!!p.closest("form"));return e.jsxs(Ig,{scope:n,checked:o,disabled:l,children:[e.jsx(Pp.button,{type:"button",role:"radio","aria-checked":o,"data-state":Lg(o),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:h,onClick:wp(t.onClick,e=>{o||d?.(),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&e.jsx(zg,{control:p,bubbles:!g.current,name:s,value:c,checked:o,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});Ug.displayName=Rg;var Fg="RadioIndicator",Mg=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...s}=t,o=Dg(Fg,n);return e.jsx(Xp,{present:a||o.checked,children:e.jsx(Pp.span,{"data-state":Lg(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})})});Mg.displayName=Fg;var zg=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=Jc(l,i),d=Tg(n),u=_g(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx(Pp.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Lg(e){return e?"checked":"unchecked"}zg.displayName="RadioBubbleInput";var $g=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Wg="RadioGroup",[Vg]=Sp(Wg,[yg,Og]),Bg=yg(),Gg=Og(),[Kg,Hg]=Vg(Wg),Zg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=Bg(n),h=dg(d),[g,b]=Ap({prop:o,defaultProp:s??null,onChange:f,caller:Wg});return e.jsx(Kg,{scope:n,name:a,required:i,disabled:l,value:g,onValueChange:b,children:e.jsx(Cg,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:e.jsx(Pp.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:h,...p,ref:r})})})});Zg.displayName=Wg;var qg="RadioGroupItem",Jg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:s,...o}=t,i=Hg(qg,n),l=i.disabled||s,c=Bg(n),d=Gg(n),u=a.useRef(null),f=Jc(r,u),p=i.value===o.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{$g.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e.jsx(Ag,{asChild:!0,...c,focusable:!l,active:p,children:e.jsx(Ug,{disabled:l,required:i.required,checked:p,...d,...o,name:i.name,ref:f,onCheck:()=>i.onValueChange(o.value),onKeyDown:wp(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:wp(o.onFocus,()=>{m.current&&u.current?.click()})})})});Jg.displayName=qg;var Yg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,s=Gg(n);return e.jsx(Mg,{...s,...a,ref:r})});Yg.displayName="RadioGroupIndicator";var Xg=Zg,Qg=Jg,eb=Yg;const tb=a.forwardRef(({className:t,...r},n)=>e.jsx(Xg,{className:je("grid gap-2",t),...r,ref:n}));tb.displayName=Xg.displayName;const rb=a.forwardRef(({className:t,...r},n)=>e.jsx(Qg,{ref:n,className:je("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(eb,{className:"flex items-center justify-center",children:e.jsx(Gh,{className:"h-3.5 w-3.5 fill-primary"})})}));function nb(e,[t,r]){return Math.min(r,Math.max(t,e))}rb.displayName=Qg.displayName;var ab="ScrollArea",[sb]=Sp(ab),[ob,ib]=sb(ab),lb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...l}=t,[c,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[b,y]=a.useState(null),[x,v]=a.useState(0),[w,S]=a.useState(0),[k,j]=a.useState(!1),[N,E]=a.useState(!1),C=Jc(r,e=>d(e)),A=dg(o);return e.jsx(ob,{scope:n,type:s,dir:A,scrollHideDelay:i,scrollArea:c,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:j,scrollbarY:b,onScrollbarYChange:y,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:v,onCornerHeightChange:S,children:e.jsx(Pp.div,{dir:A,...l,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});lb.displayName=ab;var cb="ScrollAreaViewport",db=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=t,l=ib(cb,n),c=Jc(r,a.useRef(null),l.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(Pp.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});db.displayName=cb;var ub="ScrollAreaScrollbar",fb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=ib(ub,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:l}=o,c="horizontal"===t.orientation;return a.useEffect(()=>(c?i(!0):l(!0),()=>{c?i(!1):l(!1)}),[c,i,l]),"hover"===o.type?e.jsx(pb,{...s,ref:r,forceMount:n}):"scroll"===o.type?e.jsx(mb,{...s,ref:r,forceMount:n}):"auto"===o.type?e.jsx(hb,{...s,ref:r,forceMount:n}):"always"===o.type?e.jsx(gb,{...s,ref:r}):null});fb.displayName=ub;var pb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=ib(ub,t.__scopeScrollArea),[i,l]=a.useState(!1);return a.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),l(!0)},n=()=>{t=window.setTimeout(()=>l(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),e.jsx(Xp,{present:n||i,children:e.jsx(hb,{"data-state":i?"visible":"hidden",...s,ref:r})})}),mb=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=ib(ub,t.__scopeScrollArea),i="horizontal"===t.orientation,l=Db(()=>d("SCROLL_END"),100),[c,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===c){const e=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,o.scrollHideDelay,d]),a.useEffect(()=>{const e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),l()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[o.viewport,i,d,l]),e.jsx(Xp,{present:n||"hidden"!==c,children:e.jsx(gb,{"data-state":"hidden"===c?"hidden":"visible",...s,ref:r,onPointerEnter:wp(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:wp(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),hb=a.forwardRef((t,r)=>{const n=ib(ub,t.__scopeScrollArea),{forceMount:s,...o}=t,[i,l]=a.useState(!1),c="horizontal"===t.orientation,d=Db(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?e:t)}},10);return Ub(n.viewport,d),Ub(n.content,d),e.jsx(Xp,{present:s||i,children:e.jsx(gb,{"data-state":i?"visible":"hidden",...o,ref:r})})}),gb=a.forwardRef((t,r)=>{const{orientation:n="vertical",...s}=t,o=ib(ub,t.__scopeScrollArea),i=a.useRef(null),l=a.useRef(0),[c,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=_b(c.viewport,c.content),f={...s,sizes:c,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Tb(r),s=a/2,o=t||s,i=a-o,l=r.scrollbar.paddingStart+o,c=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Pb([l,c],u)(e)}(e,l.current,c,t)}return"horizontal"===n?e.jsx(bb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Rb(o.viewport.scrollLeft,c,o.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):"vertical"===n?e.jsx(yb,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Rb(o.viewport.scrollTop,c);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),bb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=ib(ub,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=Jc(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(wb,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Tb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),Ob(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Ab(l.paddingLeft),paddingEnd:Ab(l.paddingRight)}})}})}),yb=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=ib(ub,t.__scopeScrollArea),[l,c]=a.useState(),d=a.useRef(null),u=Jc(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),e.jsx(wb,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Tb(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),Ob(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&l&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Ab(l.paddingTop),paddingEnd:Ab(l.paddingBottom)}})}})}),[xb,vb]=sb(ub),wb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=ib(ub,n),[g,b]=a.useState(null),y=Jc(r,e=>b(e)),x=a.useRef(null),v=a.useRef(""),w=h.viewport,S=s.content-s.viewport,k=Gf(f),j=Gf(d),N=Db(p,10);function E(e){if(x.current){const t=e.clientX-x.current.left,r=e.clientY-x.current.top;u({x:t,y:r})}}return a.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,g,S,k]),a.useEffect(j,[s,j]),Ub(g,N),Ub(h.content,N),e.jsx(xb,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:Gf(i),onThumbPointerUp:Gf(l),onThumbPositionChange:j,onThumbPointerDown:Gf(c),children:e.jsx(Pp.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:wp(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),x.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),E(e)}}),onPointerMove:wp(t.onPointerMove,E),onPointerUp:wp(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,h.viewport&&(h.viewport.style.scrollBehavior=""),x.current=null})})})}),Sb="ScrollAreaThumb",kb=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,s=vb(Sb,t.__scopeScrollArea);return e.jsx(Xp,{present:n||s.hasThumb,children:e.jsx(jb,{ref:r,...a})})}),jb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:s,...o}=t,i=ib(Sb,n),l=vb(Sb,n),{onThumbPositionChange:c}=l,d=Jc(r,e=>l.onThumbChange(e)),u=a.useRef(void 0),f=Db(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Ib(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,c]),e.jsx(Pp.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:wp(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;l.onThumbPointerDown({x:r,y:n})}),onPointerUp:wp(t.onPointerUp,l.onThumbPointerUp)})});kb.displayName=Sb;var Nb="ScrollAreaCorner",Eb=a.forwardRef((t,r)=>{const n=ib(Nb,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Cb,{...t,ref:r}):null});Eb.displayName=Nb;var Cb=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...s}=t,o=ib(Nb,n),[i,l]=a.useState(0),[c,d]=a.useState(0),u=Boolean(i&&c);return Ub(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),d(e)}),Ub(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)}),u?e.jsx(Pp.div,{...s,ref:r,style:{width:i,height:c,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...t.style}}):null});function Ab(e){return e?parseInt(e,10):0}function _b(e,t){const r=e/t;return isNaN(r)?0:r}function Tb(e){const t=_b(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Rb(e,t,r="ltr"){const n=Tb(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-n,l=nb(e,"ltr"===r?[0,o]:[-1*o,0]);return Pb([0,o],[0,i])(l)}function Pb(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 Ob(e,t){return e>0&&e<t}var Ib=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,i=r.top!==s.top;(o||i)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Db(e,t){const r=Gf(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Ub(e,t){const r=Gf(t);Hf(()=>{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 Fb=lb,Mb=db,zb=Eb;const Lb=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Fb,{ref:a,className:je("relative overflow-hidden",t),...n,children:[e.jsx(Mb,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx($b,{}),e.jsx(zb,{})]}));Lb.displayName=Fb.displayName;const $b=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(fb,{ref:a,orientation:r,className:je("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(kb,{className:je("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));$b.displayName=fb.displayName;var Wb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=ed(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Vb="horizontal",Bb=["horizontal","vertical"],Gb=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=Vb,...s}=t,o=function(e){return Bb.includes(e)}(a)?a:Vb,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return e.jsx(Wb.div,{"data-orientation":o,...i,...s,ref:r})});Gb.displayName="Separator";var Kb=Gb;const Hb=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},s)=>e.jsx(Kb,{ref:s,decorative:n,orientation:r,className:je("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Hb.displayName=Kb.displayName;var Zb=Symbol("radix.slottable");var qb="AlertDialog",[Jb]=Sp(qb,[rh]),Yb=rh(),Xb=t=>{const{__scopeAlertDialog:r,...n}=t,a=Yb(r);return e.jsx(Oh,{...a,...n,modal:!0})};Xb.displayName=qb;var Qb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Ih,{...s,...a,ref:r})});Qb.displayName="AlertDialogTrigger";var ey=t=>{const{__scopeAlertDialog:r,...n}=t,a=Yb(r);return e.jsx(Dh,{...a,...n})};ey.displayName="AlertDialogPortal";var ty=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Uh,{...s,...a,ref:r})});ty.displayName="AlertDialogOverlay";var ry="AlertDialogContent",[ny,ay]=Jb(ry),sy=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=Zb,r}("AlertDialogContent"),oy=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:s,...o}=t,i=Yb(n),l=a.useRef(null),c=Jc(r,l),d=a.useRef(null);return e.jsx(_h,{contentName:ry,titleName:iy,docsSlug:"alert-dialog",children:e.jsx(ny,{scope:n,cancelRef:d,children:e.jsxs(Fh,{role:"alertdialog",...i,...o,ref:c,onOpenAutoFocus:wp(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(sy,{children:s}),e.jsx(my,{contentRef:l})]})})})});oy.displayName=ry;var iy="AlertDialogTitle",ly=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Mh,{...s,...a,ref:r})});ly.displayName=iy;var cy="AlertDialogDescription",dy=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(zh,{...s,...a,ref:r})});dy.displayName=cy;var uy=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=Yb(n);return e.jsx(Lh,{...s,...a,ref:r})});uy.displayName="AlertDialogAction";var fy="AlertDialogCancel",py=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:s}=ay(fy,n),o=Yb(n),i=Jc(r,s);return e.jsx(Lh,{...o,...a,ref:i})});py.displayName=fy;var my=({contentRef:e})=>{const t=`\`${ry}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${ry}\` by passing a \`${cy}\` 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 \`${ry}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},hy=ty,gy=oy,by=uy,yy=py,xy=ly,vy=dy;const wy=Xb,Sy=Qb,ky=ey,jy=a.forwardRef(({className:t,...r},n)=>e.jsx(hy,{className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:n}));jy.displayName=hy.displayName;const Ny=a.forwardRef(({className:t,...r},n)=>{const{container:s}=a.useContext(ns);return e.jsxs(ky,{container:s,children:[e.jsx(jy,{}),e.jsx(gy,{ref:n,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...r})]})});Ny.displayName=gy.displayName;const Ey=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col space-y-2 text-center sm:text-left",t),...r});Ey.displayName="AlertDialogHeader";const Cy=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Cy.displayName="AlertDialogFooter";const Ay=a.forwardRef(({className:t,...r},n)=>e.jsx(xy,{ref:n,className:je("text-lg font-semibold",t),...r}));Ay.displayName=xy.displayName;const _y=a.forwardRef(({className:t,...r},n)=>e.jsx(vy,{ref:n,className:je("text-sm text-muted-foreground",t),...r}));_y.displayName=vy.displayName;const Ty=a.forwardRef(({className:t,...r},n)=>e.jsx(by,{ref:n,className:je(Md(),t),...r}));Ty.displayName=by.displayName;const Ry=a.forwardRef(({className:t,...r},n)=>e.jsx(yy,{ref:n,className:je(Md({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Py(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(ru,{className:"h-10 w-full"}),e.jsx(ru,{className:"h-10 w-full"}),e.jsx(ru,{className:"h-10 w-full"})]})}Ry.displayName=yy.displayName;const Oy=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:s}=or(),{user:o}=es();if(!r)return e.jsx(Py,{});const i=ar(r,o?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(wy,{children:[e.jsx(Sy,{asChild:!0,children:e.jsxs(zd,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(Od,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Ny,{children:[e.jsxs(Ey,{children:[e.jsx(Ay,{children:"Are you absolutely sure?"}),e.jsxs(_y,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Cy,{children:[e.jsx(Ry,{disabled:n,children:"Cancel"}),e.jsx(Ty,{onClick:async()=>{a(!0);try{await s(r._id)}catch(e){De(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(Nd,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Iy="Switch",[Dy]=Sp(Iy),[Uy,Fy]=Dy(Iy),My=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:i,required:l,disabled:c,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Jc(r,e=>h(e)),b=a.useRef(!1),y=!m||(f||!!m.closest("form")),[x,v]=Ap({prop:o,defaultProp:i??!1,onChange:u,caller:Iy});return e.jsxs(Uy,{scope:n,checked:x,disabled:c,children:[e.jsx(Pp.button,{type:"button",role:"switch","aria-checked":x,"aria-required":l,"data-state":Wy(x),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:g,onClick:wp(t.onClick,e=>{v(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&e.jsx($y,{control:m,bubbles:!b.current,name:s,value:d,checked:x,required:l,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});My.displayName=Iy;var zy="SwitchThumb",Ly=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,s=Fy(zy,n);return e.jsx(Pp.span,{"data-state":Wy(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});Ly.displayName=zy;var $y=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const l=a.useRef(null),c=Jc(l,i),d=Tg(n),u=_g(r);return a.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:c,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Wy(e){return e?"checked":"unchecked"}$y.displayName="SwitchBubbleInput";var Vy=My,By=Ly;const Gy=a.forwardRef(({className:t,...r},n)=>e.jsx(Vy,{className:je("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:n,children:e.jsx(By,{className:je("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")})}));Gy.displayName=Vy.displayName;const Ky=({workspaceId:r})=>{const[n,a]=t.useState({}),[s,o]=t.useState(null),i=t.useRef(null),{allFeatures:l,updateFeature:c,getWorkspace:d}=or();t.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const[u,f]=t.useState(null),{user:p}=es();if(t.useEffect(()=>{d(r).then(f)},[r]),!u)return e.jsx(Py,{});const m=nr(u,p?.id??null);return e.jsxs("div",{children:[s&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:s})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!l.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),l.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:l.map(t=>{const r=u?.features?.[t.slug],s=null!==n[t.slug]&&void 0!==n[t.slug],d=n[t.slug],p=!0===d?"Enabling":!1===d?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),s?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(Nd,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[p,"..."]})]}):e.jsx(Gy,{disabled:!m,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(u){a(r=>({...r,[e]:t})),o(null);try{const r=await c(u._id,e,t);f(r);const n=l.find(t=>t.slug===e);o(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o(null)},5e3)}catch(t){De(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:u._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})},Hy={usd:"$",eur:"โ‚ฌ",gbp:"ยฃ",jpy:"ยฅ",cad:"CA$",aud:"A$",chf:"CHF",cny:"ยฅ",hkd:"HK$",sgd:"S$",inr:"โ‚น",mxn:"MX$",brl:"R$",nzd:"NZ$",sek:"kr",nok:"kr",dkk:"kr",pln:"zล‚",thb:"เธฟ"},Zy={usd:"๐Ÿ‡บ๐Ÿ‡ธ",eur:"๐Ÿ‡ช๐Ÿ‡บ",gbp:"๐Ÿ‡ฌ๐Ÿ‡ง",jpy:"๐Ÿ‡ฏ๐Ÿ‡ต",cad:"๐Ÿ‡จ๐Ÿ‡ฆ",aud:"๐Ÿ‡ฆ๐Ÿ‡บ",chf:"๐Ÿ‡จ๐Ÿ‡ญ",cny:"๐Ÿ‡จ๐Ÿ‡ณ",hkd:"๐Ÿ‡ญ๐Ÿ‡ฐ",sgd:"๐Ÿ‡ธ๐Ÿ‡ฌ",inr:"๐Ÿ‡ฎ๐Ÿ‡ณ",mxn:"๐Ÿ‡ฒ๐Ÿ‡ฝ",brl:"๐Ÿ‡ง๐Ÿ‡ท",nzd:"๐Ÿ‡ณ๐Ÿ‡ฟ",sek:"๐Ÿ‡ธ๐Ÿ‡ช",nok:"๐Ÿ‡ณ๐Ÿ‡ด",dkk:"๐Ÿ‡ฉ๐Ÿ‡ฐ",pln:"๐Ÿ‡ต๐Ÿ‡ฑ",thb:"๐Ÿ‡น๐Ÿ‡ญ"};function qy(e){return e&&e.trim()?Zy[e.trim().toLowerCase()]??"":""}function Jy(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return Hy[t]??t.toUpperCase()}const Yy=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],Xy=Yy.map(e=>({value:e,label:`${e.toUpperCase()} (${Jy(e)})`}));function Qy(e,t){return Jy(t)+(e/100).toFixed(2)}function ex(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.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}</text></svg>`}const tx=["๐Ÿข","๐Ÿฌ","๐Ÿฃ","๐Ÿค","๐Ÿฆ","๐Ÿ›๏ธ","๐Ÿ ","๐Ÿก","๐Ÿญ","๐Ÿ—๏ธ","๐Ÿช","๐Ÿจ","๐Ÿซ","๐Ÿฅ","๐Ÿ’ผ","๐Ÿ“Š","๐Ÿ“ˆ","๐Ÿ“‰","๐Ÿ“‹","๐Ÿ“","๐Ÿ“‚","๐Ÿ—‚๏ธ","๐Ÿ—ƒ๏ธ","๐Ÿ—„๏ธ","๐Ÿ“…","๐Ÿ—“๏ธ","๐Ÿ“","๐Ÿ–‹๏ธ","โœ๏ธ","๐Ÿ–Š๏ธ","๐Ÿ–Œ๏ธ","๐Ÿ–๏ธ","๐Ÿ“‡","๐Ÿ“Œ","๐Ÿ“","๐Ÿ“Ž","๐Ÿ–‡๏ธ","๐Ÿ’ป","๐Ÿ–ฅ๏ธ","๐Ÿ–จ๏ธ","๐Ÿ–ฑ๏ธ","โŒจ๏ธ","๐Ÿ“ฑ","๐Ÿ“ฒ","๐Ÿ“ก","๐ŸŒ","๐Ÿ”—","๐Ÿ”’","๐Ÿ”“","โš™๏ธ","๐Ÿ”ง","๐Ÿ› ๏ธ","๐Ÿง‘โ€๐Ÿ’ป","๐Ÿ‘จโ€๐Ÿ’ป","๐Ÿ‘ฉโ€๐Ÿ’ป","๐Ÿ•น๏ธ","๐Ÿ’พ","๐Ÿ“Ÿ","๐Ÿ–ฅ๏ธ","๐Ÿ–ฒ๏ธ","๐Ÿš€","๐Ÿ’ก","๐ŸŽจ","๐Ÿ–ผ๏ธ","๐Ÿงช","๐Ÿ”ฌ","๐Ÿงฌ","๐ŸŽฏ","โšก","๐ŸŽฒ","๐ŸŽฎ","๐Ÿงฉ","๐Ÿ“ท","๐ŸŽฅ","โœ‰๏ธ","๐Ÿ“จ","๐Ÿ“ฉ","๐Ÿ“ง","๐Ÿ“ž","โ˜Ž๏ธ","๐Ÿ“ ","๐Ÿ—ฃ๏ธ","๐Ÿ’ฌ","๐Ÿ—จ๏ธ","๐Ÿ“ข","๐Ÿ“ฃ","๐Ÿ””","๐Ÿ›Ž๏ธ","๐Ÿ’ฐ","๐Ÿ’ธ","๐Ÿ’ณ","๐Ÿฆ","๐Ÿ“ˆ","๐Ÿ“‰","โš–๏ธ","๐Ÿงพ","๐Ÿช™","๐Ÿ›๏ธ","โš—๏ธ","๐Ÿงช","๐Ÿ”ญ","๐Ÿ”ฌ","๐Ÿฉบ","๐Ÿงฌ","๐Ÿฉป","๐Ÿฅ","๐ŸŒฑ","๐ŸŒ","๐ŸŒ","๐ŸŒŽ","๐ŸŒก๏ธ","๐Ÿ‘จโ€๐Ÿ’ผ","๐Ÿ‘ฉโ€๐Ÿ’ผ","๐Ÿ‘จโ€๐Ÿซ","๐Ÿ‘ฉโ€๐Ÿซ","๐Ÿ‘จโ€๐Ÿ”ฌ","๐Ÿ‘ฉโ€๐Ÿ”ฌ","๐Ÿ‘จโ€๐ŸŽจ","๐Ÿ‘ฉโ€๐ŸŽจ","๐Ÿ‘จโ€๐Ÿ”ง","๐Ÿ‘ฉโ€๐Ÿ”ง","๐Ÿ‘จโ€๐Ÿš€","๐Ÿ‘ฉโ€๐Ÿš€","๐Ÿ‘จโ€โš–๏ธ","๐Ÿ‘ฉโ€โš–๏ธ","๐Ÿ…","๐ŸŽ–๏ธ","๐Ÿฅ‡","๐Ÿฅˆ","๐Ÿฅ‰","๐Ÿ†","๐ŸŽ—๏ธ","๐Ÿ”‘","๐Ÿ—๏ธ","๐Ÿงญ","๐Ÿ›ก๏ธ","๐Ÿšฉ","๐Ÿณ๏ธโ€๐ŸŒˆ","๐ŸŽŸ๏ธ","๐ŸŽซ"],rx=({workspace:r})=>{const[n,a]=t.useState(!1),[s,o]=t.useState("emoji"),[i,l]=t.useState(),[c,d]=t.useState(null),u=t.useRef(null),{updateWorkspace:f}=or();t.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const{user:p}=es(),m=zo({resolver:Hc(rf({name:_u().min(2,{message:"Workspace name must be at least 2 characters."}),image:_u().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Py,{});const h=nr(r,p?.id??null);return e.jsxs("div",{children:[c&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:c})]}),!h&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Gd,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await f(r,e),d("Workspace settings saved successfully"),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{d(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Hd,{control:m.control,name:"name",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Name"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"My Awesome Workspace",...t,disabled:!h})}),e.jsx(eu,{})]})}),r.billingCurrency?.trim()&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Bd,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[qy(r.billingCurrency)&&e.jsx("span",{className:"text-base",children:qy(r.billingCurrency)}),e.jsx("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Bd,{className:"text-sm font-medium",children:"Icon"}),e.jsx(Qd,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(tb,{value:s,disabled:!h,onValueChange:e=>o(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(rb,{value:"emoji",id:"emoji"}),e.jsxs(Bd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Rd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(rb,{value:"url",id:"url"}),e.jsxs(Bd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(jd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&m.watch("image")?.trim()&&e.jsx("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&e.jsx(Lb,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:tx.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),m.setValue("image",ex(e))})(t),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Hd,{control:m.control,name:"image",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Image URL"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"https://example.com/image.png",...t,disabled:!h})}),e.jsx(Qd,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(eu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:h&&e.jsx(zd,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var nx=.999,ax=/[\\\/_+.#"@\[\(\{&]/,sx=/[\\\/_+.#"@\[\(\{&]/g,ox=/[\s-]/,ix=/[\s-]/g;function lx(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?1:.99;var i=`${a},${s}`;if(void 0!==o[i])return o[i];for(var l,c,d,u,f=n.charAt(s),p=r.indexOf(f,a),m=0;p>=0;)(l=lx(e,t,r,n,p+1,s+1,o))>m&&(p===a?l*=1:ax.test(e.charAt(p-1))?(l*=.8,(d=e.slice(a,p-1).match(sx))&&a>0&&(l*=Math.pow(nx,d.length))):ox.test(e.charAt(p-1))?(l*=.9,(u=e.slice(a,p-1).match(ix))&&a>0&&(l*=Math.pow(nx,u.length))):(l*=.17,a>0&&(l*=Math.pow(nx,p-a))),e.charAt(p)!==t.charAt(s)&&(l*=.9999)),(l<.1&&r.charAt(p-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(p-1)!==n.charAt(s))&&(.1*(c=lx(e,t,r,n,p+1,s+2,o))>l&&(l=.1*c)),l>m&&(m=l),p=r.indexOf(f,p+1);return o[i]=m,m}function cx(e){return e.toLowerCase().replace(ix," ")}function dx(e,t,r){return lx(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,cx(e),cx(t),0,0,{})}var ux='[cmdk-group=""]',fx='[cmdk-group-items=""]',px='[cmdk-item=""]',mx=`${px}:not([aria-disabled="true"])`,hx="cmdk-item-select",gx="data-value",bx=(e,t,r)=>dx(e,t,r),yx=a.createContext(void 0),xx=()=>a.useContext(yx),vx=a.createContext(void 0),wx=()=>a.useContext(vx),Sx=a.createContext(void 0),kx=a.forwardRef((e,t)=>{let r=Fx(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Fx(()=>new Set),s=Fx(()=>new Map),o=Fx(()=>new Map),i=Fx(()=>new Set),l=Dx(e),{label:c,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...y}=e,x=Ep(),v=Ep(),w=Ep(),S=a.useRef(null),k=Lx();Ux(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,j.emit()}},[u]),Ux(()=>{k(6,T)},[]);let j=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),C(),k(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(x))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,j.emit()}),n||k(5,T),void 0!==(null==(s=l.current)?void 0:s.value)){let e=null!=t?t:"";return void(null==(i=(o=l.current).onValueChange)||i.call(o,e))}}j.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),N=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=o.current.get(e))?void 0:a.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,E(t,n)),k(2,()=>{C(),j.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),k(3,()=>{_(),C(),r.current.value||A(),j.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&A(),j.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:w,labelId:v,listInnerRef:S}),[]);function E(e,t){var n,a;let s=null!=(a=null==(n=l.current)?void 0:n.filter)?a:bx;return e?s(e,r.current.search,t):0}function C(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;P().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(fx);t?t.appendChild(e.parentElement===t?e:e.closest(`${fx} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${fx} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${ux}[${gx}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function A(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(gx);j.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=E(null!=(t=null==(e=o.current.get(s))?void 0:e.value)?t:"",null!=(i=null==(a=o.current.get(s))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.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=c}function T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(ux))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${px}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(mx))||[])}function O(e){let t=P()[e];t&&j.setState("value",t.getAttribute(gx))}function I(e){var t;let r=R(),n=P(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=l.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&j.setState("value",s.getAttribute(gx))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(ux);for(;n&&!t;)n=e>0?Ox(n,ux):Ix(n,ux),t=null==n?void 0:n.querySelector(mx);t?j.setState("value",t.getAttribute(gx)):I(e)}let U=()=>O(P().length-1),F=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},M=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Pp.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":b&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":b&&e.ctrlKey&&M(e);break;case"ArrowUp":M(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(hx);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:N.inputId,id:N.labelId,style:Wx},c),$x(e,e=>a.createElement(vx.Provider,{value:j},a.createElement(yx.Provider,{value:N},e))))}),jx=a.forwardRef((e,t)=>{var r,n;let s=Ep(),o=a.useRef(null),i=a.useContext(Sx),l=xx(),c=Dx(e),d=null!=(n=null==(r=c.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Ux(()=>{if(!d)return l.item(s,null==i?void 0:i.id)},[d]);let u=zx(s,o,[e.value,e.children,o],e.keywords),f=wx(),p=Mx(e=>e.value&&e.value===u.current),m=Mx(e=>!(!d&&!1!==l.filter())||(!e.search||e.filtered.items.get(s)>0));function h(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(a.useEffect(()=>{let t=o.current;if(t&&!e.disabled)return t.addEventListener(hx,h),()=>t.removeEventListener(hx,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:y,onSelect:x,forceMount:v,keywords:w,...S}=e;return a.createElement(Pp.div,{ref:qc(o,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||l.getDisablePointerSelection()?void 0:g,onClick:b?void 0:h},e.children)}),Nx=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...o}=e,i=Ep(),l=a.useRef(null),c=a.useRef(null),d=Ep(),u=xx(),f=Mx(e=>!(!s&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Ux(()=>u.group(i),[]),zx(i,l,[e.value,e.heading,c]);let p=a.useMemo(()=>({id:i,forceMount:s}),[s]);return a.createElement(Pp.div,{ref:qc(l,t),...o,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),$x(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(Sx.Provider,{value:p},e))))}),Ex=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=a.useRef(null),o=Mx(e=>!e.search);return r||o?a.createElement(Pp.div,{ref:qc(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),Cx=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=wx(),i=Mx(e=>e.search),l=Mx(e=>e.selectedItemId),c=xx();return a.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),a.createElement(Pp.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?e.value:i,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),Ax=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,o=a.useRef(null),i=a.useRef(null),l=Mx(e=>e.selectedItemId),c=xx();return a.useEffect(()=>{if(i.current&&o.current){let e,t=i.current,r=o.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),a.createElement(Pp.div,{ref:qc(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},$x(e,e=>a.createElement("div",{ref:qc(i,c.listInnerRef),"cmdk-list-sizer":""},e)))}),_x=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:i,...l}=e;return a.createElement(Oh,{open:r,onOpenChange:n},a.createElement(Dh,{container:i},a.createElement(Uh,{"cmdk-overlay":"",className:s}),a.createElement(Fh,{"aria-label":e.label,"cmdk-dialog":"",className:o},a.createElement(kx,{ref:t,...l}))))}),Tx=a.forwardRef((e,t)=>Mx(e=>0===e.filtered.count)?a.createElement(Pp.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Rx=a.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return a.createElement(Pp.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},$x(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Px=Object.assign(kx,{List:Ax,Item:jx,Input:Cx,Group:Nx,Separator:Ex,Dialog:_x,Empty:Tx,Loading:Rx});function Ox(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Ix(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Dx(e){let t=a.useRef(e);return Ux(()=>{t.current=e}),t}var Ux="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function Fx(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Mx(e){let t=wx(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function zx(e,t,r,n=[]){let s=a.useRef(),o=xx();return Ux(()=>{var a;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),l=n.map(e=>e.trim());o.value(e,i,l),null==(a=t.current)||a.setAttribute(gx,i),s.current=i}),s}var Lx=()=>{let[e,t]=a.useState(),r=Fx(()=>new Map);return Ux(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function $x({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var Wx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Vx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px,{ref:n,className:je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Vx.displayName=Px.displayName;const Bx=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(qh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Px.Input,{ref:n,className:je("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})]}));Bx.displayName=Px.Input.displayName;const Gx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px.List,{ref:n,className:je("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));Gx.displayName=Px.List.displayName;a.forwardRef((t,r)=>e.jsx(Px.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Px.Empty.displayName;const Kx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px.Group,{ref:n,className:je("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));Kx.displayName=Px.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Px.Separator,{ref:n,className:je("-mx-1 h-px bg-border",t),...r})).displayName=Px.Separator.displayName;const Hx=a.forwardRef(({className:t,...r},n)=>e.jsx(Px.Item,{ref:n,className:je("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r}));Hx.displayName=Px.Item.displayName;const Zx=["top","right","bottom","left"],qx=Math.min,Jx=Math.max,Yx=Math.round,Xx=Math.floor,Qx=e=>({x:e,y:e}),ev={left:"right",right:"left",bottom:"top",top:"bottom"},tv={start:"end",end:"start"};function rv(e,t,r){return Jx(e,qx(t,r))}function nv(e,t){return"function"==typeof e?e(t):e}function av(e){return e.split("-")[0]}function sv(e){return e.split("-")[1]}function ov(e){return"x"===e?"y":"x"}function iv(e){return"y"===e?"height":"width"}const lv=new Set(["top","bottom"]);function cv(e){return lv.has(av(e))?"y":"x"}function dv(e){return ov(cv(e))}function uv(e){return e.replace(/start|end/g,e=>tv[e])}const fv=["left","right"],pv=["right","left"],mv=["top","bottom"],hv=["bottom","top"];function gv(e,t,r,n){const a=sv(e);let s=function(e,t,r){switch(e){case"top":case"bottom":return r?t?pv:fv:t?fv:pv;case"left":case"right":return t?mv:hv;default:return[]}}(av(e),"start"===r,n);return a&&(s=s.map(e=>e+"-"+a),t&&(s=s.concat(s.map(uv)))),s}function bv(e){return e.replace(/left|right|bottom|top/g,e=>ev[e])}function yv(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 xv(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 vv(e,t,r){let{reference:n,floating:a}=e;const s=cv(t),o=dv(t),i=iv(o),l=av(t),c="y"===s,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/2;let p;switch(l){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(sv(t)){case"start":p[o]-=f*(r&&c?-1:1);break;case"end":p[o]+=f*(r&&c?-1:1)}return p}async function wv(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:s,rects:o,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=nv(t,e),m=yv(p),h=i[f?"floating"===u?"reference":"floating":u],g=xv(await s.getClippingRect({element:null==(r=await(null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),x=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},v=xv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-v.top+m.top)/x.y,bottom:(v.bottom-g.bottom+m.bottom)/x.y,left:(g.left-v.left+m.left)/x.x,right:(v.right-g.right+m.right)/x.x}}function Sv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kv(e){return Zx.some(t=>e[t]>=0)}const jv=new Set(["left","top"]);function Nv(){return"undefined"!=typeof window}function Ev(e){return _v(e)?(e.nodeName||"").toLowerCase():"#document"}function Cv(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Av(e){var t;return null==(t=(_v(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function _v(e){return!!Nv()&&(e instanceof Node||e instanceof Cv(e).Node)}function Tv(e){return!!Nv()&&(e instanceof Element||e instanceof Cv(e).Element)}function Rv(e){return!!Nv()&&(e instanceof HTMLElement||e instanceof Cv(e).HTMLElement)}function Pv(e){return!(!Nv()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Cv(e).ShadowRoot)}const Ov=new Set(["inline","contents"]);function Iv(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Kv(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Ov.has(a)}const Dv=new Set(["table","td","th"]);function Uv(e){return Dv.has(Ev(e))}const Fv=[":popover-open",":modal"];function Mv(e){return Fv.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const zv=["transform","translate","scale","rotate","perspective"],Lv=["transform","translate","scale","rotate","perspective","filter"],$v=["paint","layout","strict","content"];function Wv(e){const t=Vv(),r=Tv(e)?Kv(e):e;return zv.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||Lv.some(e=>(r.willChange||"").includes(e))||$v.some(e=>(r.contain||"").includes(e))}function Vv(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Bv=new Set(["html","body","#document"]);function Gv(e){return Bv.has(Ev(e))}function Kv(e){return Cv(e).getComputedStyle(e)}function Hv(e){return Tv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zv(e){if("html"===Ev(e))return e;const t=e.assignedSlot||e.parentNode||Pv(e)&&e.host||Av(e);return Pv(t)?t.host:t}function qv(e){const t=Zv(e);return Gv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Rv(t)&&Iv(t)?t:qv(t)}function Jv(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=qv(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),o=Cv(a);if(s){const e=Yv(o);return t.concat(o,o.visualViewport||[],Iv(a)?a:[],e&&r?Jv(e):[])}return t.concat(a,Jv(a,[],r))}function Yv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xv(e){const t=Kv(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Rv(e),s=a?e.offsetWidth:r,o=a?e.offsetHeight:n,i=Yx(r)!==s||Yx(n)!==o;return i&&(r=s,n=o),{width:r,height:n,$:i}}function Qv(e){return Tv(e)?e:e.contextElement}function ew(e){const t=Qv(e);if(!Rv(t))return Qx(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=Xv(t);let o=(s?Yx(r.width):r.width)/n,i=(s?Yx(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}const tw=Qx(0);function rw(e){const t=Cv(e);return Vv()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:tw}function nw(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),s=Qv(e);let o=Qx(1);t&&(n?Tv(n)&&(o=ew(n)):o=ew(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Cv(e))&&t}(s,r,n)?rw(s):Qx(0);let l=(a.left+i.x)/o.x,c=(a.top+i.y)/o.y,d=a.width/o.x,u=a.height/o.y;if(s){const e=Cv(s),t=n&&Tv(n)?Cv(n):n;let r=e,a=Yv(r);for(;a&&n&&t!==r;){const e=ew(a),t=a.getBoundingClientRect(),n=Kv(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=s,c+=o,r=Cv(a),a=Yv(r)}}return xv({width:d,height:u,x:l,y:c})}function aw(e,t){const r=Hv(e).scrollLeft;return t?t.left+r:nw(Av(e)).left+r}function sw(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-aw(e,r),y:r.top+t.scrollTop}}const ow=new Set(["absolute","fixed"]);function iw(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Cv(e),n=Av(e),a=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,i=0,l=0;if(a){s=a.width,o=a.height;const e=Vv();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,l=a.offsetTop)}const c=aw(n);if(c<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(s-=o)}else c<=25&&(s+=c);return{width:s,height:o,x:i,y:l}}(e,r);else if("document"===t)n=function(e){const t=Av(e),r=Hv(e),n=e.ownerDocument.body,a=Jx(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=Jx(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+aw(e);const i=-r.scrollTop;return"rtl"===Kv(n).direction&&(o+=Jx(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:o,y:i}}(Av(e));else if(Tv(t))n=function(e,t){const r=nw(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Rv(e)?ew(e):Qx(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:a*s.x,y:n*s.y}}(t,r);else{const r=rw(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return xv(n)}function lw(e,t){const r=Zv(e);return!(r===t||!Tv(r)||Gv(r))&&("fixed"===Kv(r).position||lw(r,t))}function cw(e,t,r){const n=Rv(t),a=Av(t),s="fixed"===r,o=nw(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const l=Qx(0);function c(){l.x=aw(a)}if(n||!n&&!s)if(("body"!==Ev(t)||Iv(a))&&(i=Hv(t)),n){const e=nw(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();s&&!n&&a&&c();const d=!a||n||s?Qx(0):sw(a,i);return{x:o.left+i.scrollLeft-l.x-d.x,y:o.top+i.scrollTop-l.y-d.y,width:o.width,height:o.height}}function dw(e){return"static"===Kv(e).position}function uw(e,t){if(!Rv(e)||"fixed"===Kv(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Av(e)===r&&(r=r.ownerDocument.body),r}function fw(e,t){const r=Cv(e);if(Mv(e))return r;if(!Rv(e)){let t=Zv(e);for(;t&&!Gv(t);){if(Tv(t)&&!dw(t))return t;t=Zv(t)}return r}let n=uw(e,t);for(;n&&Uv(n)&&dw(n);)n=uw(n,t);return n&&Gv(n)&&dw(n)&&!Wv(n)?r:n||function(e){let t=Zv(e);for(;Rv(t)&&!Gv(t);){if(Wv(t))return t;if(Mv(t))return null;t=Zv(t)}return null}(e)||r}const pw={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s="fixed"===a,o=Av(n),i=!!t&&Mv(t.floating);if(n===o||i&&s)return r;let l={scrollLeft:0,scrollTop:0},c=Qx(1);const d=Qx(0),u=Rv(n);if((u||!u&&!s)&&(("body"!==Ev(n)||Iv(o))&&(l=Hv(n)),Rv(n))){const e=nw(n);c=ew(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!o||u||s?Qx(0):sw(o,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:r.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:Av,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s="clippingAncestors"===r?Mv(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Jv(e,[],!1).filter(e=>Tv(e)&&"body"!==Ev(e)),a=null;const s="fixed"===Kv(e).position;let o=s?Zv(e):e;for(;Tv(o)&&!Gv(o);){const t=Kv(o),r=Wv(o);r||"fixed"!==t.position||(a=null),(s?!r&&!a:!r&&"static"===t.position&&a&&ow.has(a.position)||Iv(o)&&!r&&lw(e,o))?n=n.filter(e=>e!==o):a=t,o=Zv(o)}return t.set(e,n),n}(t,this._c):[].concat(r),o=[...s,n],i=o[0],l=o.reduce((e,r)=>{const n=iw(t,r,a);return e.top=Jx(n.top,e.top),e.right=qx(n.right,e.right),e.bottom=qx(n.bottom,e.bottom),e.left=Jx(n.left,e.left),e},iw(t,i,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:fw,getElementRects:async function(e){const t=this.getOffsetParent||fw,r=this.getDimensions,n=await r(e.floating);return{reference:cw(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}=Xv(e);return{width:t,height:r}},getScale:ew,isElement:Tv,isRTL:function(e){return"rtl"===Kv(e).direction}};function mw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hw(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Qv(e),d=a||s?[...c?Jv(c):[],...Jv(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});const u=c&&i?function(e,t){let r,n=null;const a=Av(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(i,l){void 0===i&&(i=!1),void 0===l&&(l=1),s();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(i||t(),!f||!p)return;const m={rootMargin:-Xx(u)+"px "+-Xx(a.clientWidth-(d+f))+"px "+-Xx(a.clientHeight-(u+p))+"px "+-Xx(d)+"px",threshold:Jx(0,qx(1,l))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||mw(c,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),s}(c,r):null;let f,p=-1,m=null;o&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!l&&m.observe(c),m.observe(t));let h=l?nw(e):null;return l&&function t(){const n=nw(e);h&&!mw(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const gw=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:o,middlewareData:i}=t,l=await async function(e,t){const{placement:r,platform:n,elements:a}=e,s=await(null==n.isRTL?void 0:n.isRTL(a.floating)),o=av(r),i=sv(r),l="y"===cv(r),c=jv.has(o)?-1:1,d=s&&l?-1:1,u=nv(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof m&&(p="end"===i?-1*m:m),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return o===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+l.x,y:s+l.y,data:{...l,placement:o}}}}},bw=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=nv(e,t),d={x:r,y:n},u=await s.detectOverflow(t,c),f=cv(av(a)),p=ov(f);let m=d[p],h=d[f];if(o){const e="y"===p?"bottom":"right";m=rv(m+u["y"===p?"top":"left"],m,m-u[e])}if(i){const e="y"===f?"bottom":"right";h=rv(h+u["y"===f?"top":"left"],h,h-u[e])}const g=l.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[p]:o,[f]:i}}}}}},yw=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:o,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=nv(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};const b=av(a),y=cv(i),x=av(i)===i,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=f||(x||!h?[bv(i)]:function(e){const t=bv(e);return[uv(e),t,uv(t)]}(i)),S="none"!==m;!f&&S&&w.push(...gv(i,h,m,v));const k=[i,...w],j=await l.detectOverflow(t,g),N=[];let E=(null==(n=s.flip)?void 0:n.overflows)||[];if(d&&N.push(j[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=sv(e),a=dv(e),s=iv(a);let o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=bv(o)),[o,bv(o)]}(a,o,v);N.push(j[e[0]],j[e[1]])}if(E=[...E,{placement:a,overflows:N}],!N.every(e=>e<=0)){var C,A;const e=((null==(C=s.flip)?void 0:C.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==cv(t))||E.every(e=>cv(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:E},reset:{placement:t}}}let r=null==(A=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=E.filter(e=>{if(S){const t=cv(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},xw=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:o,elements:i}=t,{apply:l=()=>{},...c}=nv(e,t),d=await o.detectOverflow(t,c),u=av(a),f=sv(a),p="y"===cv(a),{width:m,height:h}=s.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,x=m-d.left-d.right,v=qx(h-d[g],y),w=qx(m-d[b],x),S=!t.middlewareData.shift;let k=v,j=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(j=x),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=Jx(d.left,0),t=Jx(d.right,0),r=Jx(d.top,0),n=Jx(d.bottom,0);p?j=m-2*(0!==e||0!==t?e+t:Jx(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Jx(d.top,d.bottom))}await l({...t,availableWidth:j,availableHeight:k});const N=await o.getDimensions(i.floating);return m!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}},vw=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=nv(e,t);switch(a){case"referenceHidden":{const e=Sv(await n.detectOverflow(t,{...s,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kv(e)}}}case"escaped":{const e=Sv(await n.detectOverflow(t,{...s,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:kv(e)}}}default:return{}}}}},ww=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:o,elements:i,middlewareData:l}=t,{element:c,padding:d=0}=nv(e,t)||{};if(null==c)return{};const u=yv(d),f={x:r,y:n},p=dv(a),m=iv(p),h=await o.getDimensions(c),g="y"===p,b=g?"top":"left",y=g?"bottom":"right",x=g?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[p]-f[p]-s.floating[m],w=f[p]-s.reference[p],S=await(null==o.getOffsetParent?void 0:o.getOffsetParent(c));let k=S?S[x]:0;k&&await(null==o.isElement?void 0:o.isElement(S))||(k=i.floating[x]||s.floating[m]);const j=v/2-w/2,N=k/2-h[m]/2-1,E=qx(u[b],N),C=qx(u[y],N),A=E,_=k-h[m]-C,T=k/2-h[m]/2+j,R=rv(A,T,_),P=!l.arrow&&null!=sv(a)&&T!==R&&s.reference[m]/2-(T<A?E:C)-h[m]/2<0,O=P?T<A?T-A:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),Sw=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:o}=t,{offset:i=0,mainAxis:l=!0,crossAxis:c=!0}=nv(e,t),d={x:r,y:n},u=cv(a),f=ov(u);let p=d[f],m=d[u];const h=nv(i,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+g.mainAxis,r=s.reference[f]+s.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){var b,y;const e="y"===f?"width":"height",t=jv.has(av(a)),r=s.reference[u]-s.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=s.reference[u]+s.reference[e]+(t?0:(null==(y=o.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},kw=(e,t,r)=>{const n=new Map,a={platform:pw,...r},s={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:o}=r,i=s.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=vv(c,n,l),f=n,p={},m=0;for(let r=0;r<i.length;r++){var h;const{name:s,fn:g}=i[r],{x:b,y:y,data:x,reset:v}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:c,platform:{...o,detectOverflow:null!=(h=o.detectOverflow)?h:wv},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=y?y:u,p={...p,[s]:{...p[s],...x}},v&&m<=50&&(m++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(c=!0===v.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):v.rects),({x:d,y:u}=vv(c,f,l))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:s})};var jw="undefined"!=typeof document?t.useLayoutEffect:function(){};function Nw(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(!Nw(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)&&!Nw(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Ew(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cw(e,t){const r=Ew(e);return Math.round(t*r)/r}function Aw(e){const t=a.useRef(e);return jw(()=>{t.current=e}),t}const _w=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?ww({element:r.current,padding:n}).fn(t):{}:r?ww({element:r,padding:n}).fn(t):{};var a}}),Tw=(e,t)=>({...gw(e),options:[e,t]}),Rw=(e,t)=>({...bw(e),options:[e,t]}),Pw=(e,t)=>({...Sw(e),options:[e,t]}),Ow=(e,t)=>({...yw(e),options:[e,t]}),Iw=(e,t)=>({...xw(e),options:[e,t]}),Dw=(e,t)=>({...vw(e),options:[e,t]}),Uw=(e,t)=>({..._w(e),options:[e,t]});var Fw=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:s=5,...o}=t;return e.jsx(Pp.svg,{...o,ref:r,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fw.displayName="Arrow";var Mw=Fw,zw="Popper",[Lw,$w]=Sp(zw),[Ww,Vw]=Lw(zw),Bw=t=>{const{__scopePopper:r,children:n}=t,[s,o]=a.useState(null);return e.jsx(Ww,{scope:r,anchor:s,onAnchorChange:o,children:n})};Bw.displayName=zw;var Gw="PopperAnchor",Kw=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:s,...o}=t,i=Vw(Gw,n),l=a.useRef(null),c=Jc(r,l),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=s?.current||l.current,e!==d.current&&i.onAnchorChange(d.current)}),s?null:e.jsx(Pp.div,{...o,ref:c})});Kw.displayName=Gw;var Hw="PopperContent",[Zw,qw]=Lw(Hw),Jw=a.forwardRef((t,r)=>{const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=t,x=Vw(Hw,n),[v,w]=a.useState(null),S=Jc(r,e=>w(e)),[k,j]=a.useState(null),N=_g(k),E=N?.width??0,C=N?.height??0,A=o+("center"!==l?"-"+l:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(eS),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:F}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:l}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);Nw(m,n)||h(n);const[g,b]=a.useState(null),[y,x]=a.useState(null),v=a.useCallback(e=>{e!==j.current&&(j.current=e,b(e))},[]),w=a.useCallback(e=>{e!==N.current&&(N.current=e,x(e))},[]),S=i||g,k=l||y,j=a.useRef(null),N=a.useRef(null),E=a.useRef(f),C=null!=d,A=Aw(d),_=Aw(o),T=Aw(u),R=a.useCallback(()=>{if(!j.current||!N.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),kw(j.current,N.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!Nw(E.current,t)&&(E.current=t,s.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);jw(()=>{!1===u&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);jw(()=>(P.current=!0,()=>{P.current=!1}),[]),jw(()=>{if(S&&(j.current=S),k&&(N.current=k),S&&k){if(A.current)return A.current(S,k,R);R()}},[S,k,R,A,C]);const O=a.useMemo(()=>({reference:j,floating:N,setReference:v,setFloating:w}),[v,w]),I=a.useMemo(()=>({reference:S,floating:k}),[S,k]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Cw(I.floating,f.x),n=Cw(I.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Ew(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>hw(...e,{animationFrame:"always"===g}),elements:{reference:x.anchor},middleware:[Tw({mainAxis:i+C,alignmentAxis:c}),u&&Rw({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Pw():void 0,...P}),u&&Ow({...P}),Iw({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}}),k&&Uw({element:k,padding:d}),tS({arrowWidth:E,arrowHeight:C}),h&&Dw({strategy:"referenceHidden",...P})]}),[M,z]=rS(D),L=Gf(b);Hf(()=>{U&&L?.()},[U,L]);const $=F.arrow?.x,W=F.arrow?.y,V=0!==F.arrow?.centerOffset,[B,G]=a.useState();return Hf(()=>{v&&G(window.getComputedStyle(v).zIndex)},[v]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(Zw,{scope:n,placedSide:M,onArrowChange:j,arrowX:$,arrowY:W,shouldHideArrow:V,children:e.jsx(Pp.div,{"data-side":M,"data-align":z,...y,ref:S,style:{...y.style,animation:U?void 0:"none"}})})})});Jw.displayName=Hw;var Yw="PopperArrow",Xw={top:"bottom",right:"left",bottom:"top",left:"right"},Qw=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,s=qw(Yw,n),o=Xw[s.placedSide];return e.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:e.jsx(Mw,{...a,ref:r,style:{...a.style,display:"block"}})})});function eS(e){return null!==e}Qw.displayName=Yw;var tS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[l,c]=rS(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===l?(p=s?d:`${u}px`,m=-i+"px"):"top"===l?(p=s?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===l?(p=-i+"px",m=s?d:`${f}px`):"left"===l&&(p=`${n.floating.width+i}px`,m=s?d:`${f}px`),{data:{x:p,y:m}}}});function rS(e){const[t,r="center"]=e.split("-");return[t,r]}var nS=Bw,aS=Kw,sS=Jw,oS=Qw;function iS(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lS=Symbol("radix.slottable");function cS(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===lS}var dS="Popover",[uS]=Sp(dS,[$w]),fS=$w(),[pS,mS]=uS(dS),hS=t=>{const{__scopePopover:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!1}=t,c=fS(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=Ap({prop:s,defaultProp:o??!1,onChange:i,caller:dS});return e.jsx(nS,{...c,children:e.jsx(pS,{scope:r,contentId:Ep(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:l,children:n})})};hS.displayName=dS;var gS="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...s}=t,o=mS(gS,n),i=fS(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=o;return a.useEffect(()=>(l(),()=>c()),[l,c]),e.jsx(aS,{...i,...s,ref:r})}).displayName=gS;var bS="PopoverTrigger",yS=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=mS(bS,n),o=fS(n),i=Jc(r,s.triggerRef),l=e.jsx(Pp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":TS(s.open),...a,ref:i,onClick:wp(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:e.jsx(aS,{asChild:!0,...o,children:l})});yS.displayName=bS;var xS="PopoverPortal",[vS,wS]=uS(xS,{forceMount:void 0}),SS=t=>{const{__scopePopover:r,forceMount:n,children:a,container:s}=t,o=mS(xS,r);return e.jsx(vS,{scope:r,forceMount:n,children:e.jsx(Xp,{present:n||o.open,children:e.jsx(Yp,{asChild:!0,container:s,children:a})})})};SS.displayName=xS;var kS="PopoverContent",jS=a.forwardRef((t,r)=>{const n=wS(kS,t.__scopePopover),{forceMount:a=n.forceMount,...s}=t,o=mS(kS,t.__scopePopover);return e.jsx(Xp,{present:a||o.open,children:o.modal?e.jsx(ES,{...s,ref:r}):e.jsx(CS,{...s,ref:r})})});jS.displayName=kS;var NS=function(t){const r=iS(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(cS);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),ES=a.forwardRef((t,r)=>{const n=mS(kS,t.__scopePopover),s=a.useRef(null),o=Jc(r,s),i=a.useRef(!1);return a.useEffect(()=>{const e=s.current;if(e)return Jm(e)},[]),e.jsx(Vm,{as:NS,allowPinchZoom:!0,children:e.jsx(AS,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:wp(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:wp(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:wp(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),CS=a.forwardRef((t,r)=>{const n=mS(kS,t.__scopePopover),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(AS,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),AS=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=t,p=mS(kS,n),m=fS(n);return tm(),e.jsx(Bp,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:e.jsx(Mp,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(sS,{"data-state":TS(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)"}})})})}),_S="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=mS(_S,n);return e.jsx(Pp.button,{type:"button",...a,ref:r,onClick:wp(t.onClick,()=>s.onOpenChange(!1))})}).displayName=_S;function TS(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=fS(n);return e.jsx(oS,{...s,...a,ref:r})}).displayName="PopoverArrow";var RS=SS,PS=jS;const OS=hS,IS=yS,DS=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...s},o)=>{const{container:i}=a.useContext(ns);return e.jsx(RS,{container:i,children:e.jsx(PS,{ref:o,align:r,sideOffset:n,className:je("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),...s})})});function US({options:r,value:n,onChange:a,placeholder:s="Search...",emptyLabel:o="Choose option"}){const[i,l]=t.useState(n??""),[c,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&l(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs(OS,{open:c,onOpenChange:d,children:[e.jsx(IS,{asChild:!0,children:e.jsxs(zd,{variant:"outline",role:"combobox","aria-expanded":c,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:o}),e.jsx(xd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(DS,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Vx,{children:[e.jsx(Bx,{placeholder:s}),e.jsx(Gx,{children:e.jsx(Kx,{children:r.map(t=>e.jsxs(Hx,{className:je("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,l(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(yd,{className:je("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}DS.displayName=PS.displayName;const FS={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"},MS={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"},zS=[{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=MS[e.code]||"USD",r=FS[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 LS({value:t,onChange:r}){const n=zS.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const $S=zS.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),WS=Array.from(new Set($S.map(e=>e.value))).map(e=>$S.find(t=>t.value===e)).filter(e=>void 0!==e);function VS({value:t,onChange:r}){const n=WS.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let BS=[{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:"๐Ÿ‡ฎ๐Ÿ‡ฑ"}];BS=BS.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),BS.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const GS=BS.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 KS({value:t,onChange:r}){const n=GS.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const HS=[{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],s=t.text;let o=s.substring(s.indexOf("(")+1,s.indexOf(")"));-1!==o.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${o}) ${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 ZS({value:t,onChange:r}){const n=HS.map(e=>({value:e.value,label:e.text}));return e.jsx(US,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const qS=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=or(),[s,o]=t.useState(!1),[i,l]=t.useState(),[c,d]=t.useState(0),[u,f]=t.useState(null),p=t.useRef(null);t.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const m=zo({resolver:Hc(rf({name:_u().min(2,{message:"Name must be at least 2 characters."}),country:_u().optional(),timezone:_u().optional(),language:_u().optional(),currency:_u().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{l(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)})},[c]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(Gd,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(async function(e){o(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{f(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{o(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(tu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Hd,{disabled:s,control:m.control,name:"name",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Name"}),e.jsx(Xd,{children:e.jsx(tu,{...t})}),e.jsx(eu,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(KS,{value:m.watch("language"),onChange:e=>{m.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(LS,{value:m.watch("country"),onChange:e=>{m.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(VS,{value:m.watch("currency"),onChange:e=>{m.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(ZS,{value:m.watch("timezone"),onChange:e=>{m.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(zd,{type:"submit",progress:s,disabled:s,children:"Save"}),e.jsx(zd,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:s,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Py,{})};function JS(e,t){const r=e.pricingVariants;if(!r?.length)return null;const n=t.toLowerCase();return r.find(e=>e.currency?.toLowerCase()===n)??null}function YS(e,t,r){const n=JS(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function XS(e,t,r){const n=JS(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",s="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(s?n.stripePrices[s]:void 0)??null}function QS(e,t,r,n){const a=JS(e,t),s=a?.quotaOverages?.[r];if(s)return s[n]}function ek(e){const t=new Set;for(const r of e)r.pricingVariants?.forEach(e=>{e.currency&&t.add(e.currency.toLowerCase())});return Array.from(t).sort()}function tk(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const s=a[n];if(!s)return null;const o=QS(e,t,r,n);return{included:s.included,...void 0!==s.unitSize&&{unitSize:s.unitSize},...void 0!==o&&{overage:o}}}function rk(e,t){if(!e)return null;for(const r of t){const t=r.pricingVariants;if(t?.length)for(const r of t){const t=r.stripePrices;if(t){if(t.monthlyPriceId===e||t.monthly===e)return{interval:"monthly",currency:r.currency};if(t.yearlyPriceId===e||t.yearly===e)return{interval:"yearly",currency:r.currency};if(t.quarterlyPriceId===e)return{interval:"quarterly",currency:r.currency}}}}return null}function nk(e,t){const r=JS(e,t);return r?.seatPricing?.enabled?r.seatPricing:null}function ak(e,t,r){const n=nk(e,t);return n?.perSeat?n.perSeat[r]??null:null}function sk(e,t){return Math.max(0,e-(t||0))}function ok(e,t,r,n){const a=nk(e,t);if(!a)return null;return sk(n,a.includedSeats)*(ak(e,t,r)??0)}function ik(e,t){if(null==e)return null;const r=e[t??"monthly"];return r?{included:r.included,...void 0!==r.overage&&{overage:r.overage},...void 0!==r.unitSize&&{unitSize:r.unitSize}}:null}function lk(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,s=r.currencySymbol??Jy(a??"");if(null==e)return"โ€”";const{included:o,overage:i}=e,l=`${o} included`;if(null==i)return l;const c=n?i/100:i;return`${l}, then ${s}${"number"==typeof c&&Number.isFinite(c)?c.toFixed(2):String(i)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const ck=(e,t)=>{const r=(t??"").trim();return r?new Intl.NumberFormat("en-US",{style:"currency",currency:r.toUpperCase(),minimumFractionDigits:2}).format(e/100):(e/100).toFixed(2)},dk=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",uk=e=>{switch(e){case"paid":return"bg-green-100 text-green-800";case"open":return"bg-yellow-100 text-yellow-800";case"draft":case"void":default:return"bg-gray-100 text-gray-800";case"uncollectible":return"bg-red-100 text-red-800"}},fk=({workspaceId:t,hasActiveSubscription:r=!1,onViewPricingPlans:n,limit:a=20})=>{const{invoices:s,loading:o,error:i,refetch:l}=gr(t,a),c=s.length>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Billing History"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),e.jsx(zd,{variant:"ghost",size:"sm",progress:o,onClick:l,disabled:o,children:o?"Refreshing...":"Refresh"})]}),i&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm mt-1",children:i})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:l,disabled:o,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:o?"Retrying...":"Retry"})]}),o&&!c?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Py,{})}):c?e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(t);return e.jsx("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t.description||t.number||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${uk(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:ck(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"โ€ข"}),e.jsxs("span",{children:["Created: ",dk(t.created)]})]}),t.due_date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"โ€ข"}),e.jsxs("span",{children:["Due: ",dk(t.due_date)]})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"โ€ข"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",ck(t.amount_paid,t.currency)]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(zd,{size:"sm",disabled:!t.hosted_invoice_url,onClick:()=>t.hosted_invoice_url&&window.open(t.hosted_invoice_url,"_blank","noopener,noreferrer"),className:r.color,children:[r.text,e.jsx(Sd,{className:"h-3 w-3 ml-1.5"})]}),t.invoice_pdf&&e.jsxs(zd,{size:"sm",variant:"outline",onClick:()=>window.open(t.invoice_pdf,"_blank","noopener,noreferrer"),children:[e.jsx(wd,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]})},t.id)})}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(kd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:r?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!r&&n&&e.jsx(zd,{size:"sm",className:"mt-4",onClick:n,children:"View Pricing Plans"})]})]})},pk=t.lazy(()=>Promise.resolve().then(function(){return Xj}).then(e=>({default:e.default}))),mk=e=>{if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric"}).format(t)}catch{return""}},hk=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:s,error:o,updateSubscription:i,refetch:l}=hr(n),{createCheckoutSession:c}=pr(n),{cancelSubscription:d,loading:u}=br(n),{resumeSubscription:f,loading:p}=yr(n),{versions:m,loading:h,error:g,refetch:b}=fr(n),y=s||h,x=o||g,{currentVersion:v,latestVersion:w,isDeprecated:S,whatsNew:k,plansToShow:j}=t.useMemo(()=>{const e=m?.currentVersion,t=m?.availableVersions||[],r=null!=a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const s=!!(r&&n&&e)&&n.version>e.version,o=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:s,isDeprecated:s&&r,whatsNew:n?.whatsNew,plansToShow:o}},[m,a?.subscription]),[N,E]=t.useState(!1),[C,A]=t.useState(null),[_,T]=t.useState(null),R=t.useRef(null),[P,O]=t.useState(!1),[I,D]=t.useState(!1);t.useEffect(()=>()=>{R.current&&clearTimeout(R.current)},[]);const[U,F]=t.useState(!1),[M,z]=t.useState("subscription"),L=async()=>{await Promise.all([l(),b()])},$=t.useMemo(()=>rk(a?.subscription?.stripePriceId,j??[]),[a?.subscription?.stripePriceId,j]);if(y&&!a&&!m)return e.jsx(Py,{});const W=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[x&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm mt-1",children:x}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:L,disabled:y,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:y?"Retrying...":"Retry"})]}),C&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm mt-1",children:C})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>A(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),_&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm mt-1",children:_})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>T(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[e.jsx("button",{type:"button",onClick:()=>z("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===M?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),e.jsx("button",{type:"button",onClick:()=>z("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===M?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===M&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Nd,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading subscription and pricing plans..."})]}),S&&a?.subscription&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Dd,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),e.jsx("p",{className:"text-sm text-amber-700 mb-2",children:"A new version of the pricing plans is now available. Please upgrade to one of the new plans below to continue receiving updates and support."}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e.jsxs("span",{children:["Current: Version ",v?.version||"N/A"]}),e.jsx("span",{children:"โ€ข"}),e.jsxs("span",{children:["Latest: Version ",w?.version||"N/A"]})]}),k&&(k.newPlans.length>0||k.updatedPlans.length>0)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e.jsxs("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",w?.version,":"]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-amber-700",children:[k.newPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"New Plans: "}),e.jsx("span",{children:k.newPlans.map(e=>e.plan.name).join(", ")})]}),k.updatedPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Updated Plans: "}),e.jsx("span",{children:k.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?.cancelAtPeriodEnd||u?null:a?.subscription?e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>O(!0),children:"Change Plan"}):!a?.subscription&&j&&j.length>0?e.jsx(zd,{size:"sm",onClick:()=>O(!0),children:"View Pricing Plans"}):null,e.jsx(zd,{variant:"ghost",size:"sm",progress:y,onClick:L,disabled:y||N,children:y?"Refreshing...":"Refresh"})]})]}),a?.subscription?(()=>{const t=rk(a.subscription.stripePriceId,j??[]),n=t?.interval??null,s=t?.currency??a.plan?.currency??r?.billingCurrency??"",o=n&&a.planVersion?YS(a.planVersion,s,n):null,i=s,l=a.planVersion?nk(a.planVersion,s):null,c=l&&n?ak(a.planVersion,s,n):null,d=Array.isArray(r?.users)?r.users.length:1,f=l?.includedSeats??0,m=d,h=null!=o?0===o?"Free":Qy(o,i):null,g="monthly"===n?"/month":"quarterly"===n?"/quarter":"yearly"===n?"/year":"";return e.jsxs("div",{className:"border rounded-lg overflow-hidden "+(S?"border-amber-300":"border-gray-200"),children:["trialing"===a.subscription.subscriptionStatus&&(()=>{const t=a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd,r=t?new Date(t):null,n=r&&!isNaN(r.getTime())?r:null,s=n?Math.max(0,Math.ceil((n.getTime()-Date.now())/864e5)):null;return e.jsx("div",{className:"px-5 py-3 text-sm flex items-center justify-between "+(null!==s&&s<=3?"bg-amber-50 text-amber-800 border-b border-amber-200":"bg-blue-50 text-blue-800 border-b border-blue-200"),children:e.jsxs("span",{children:[null!==s&&s<=0?"Your trial has ended.":null!==s?`Your trial ends in ${s} day${1===s?"":"s"}.`:"You are on a trial."," ","Upgrade to keep access after the trial."]})})})(),e.jsxs("div",{className:"p-5 "+(S?"bg-amber-50/50":"bg-gray-50/50"),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.plan?.name||"No plan assigned"}),e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.subscription.subscriptionStatus?"bg-green-100 text-green-800":"trialing"===a.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===a.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===a.subscription.subscriptionStatus&&"Active","trialing"===a.subscription.subscriptionStatus&&"Trial","canceled"===a.subscription.subscriptionStatus&&"Canceled","past_due"===a.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===a.subscription.subscriptionStatus&&mk(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(ends"," ",mk(a.subscription.trialEnd||a.subscription.stripeCurrentPeriodEnd),")"]}),S&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800",children:[e.jsx(Dd,{className:"h-3 w-3"}),"Deprecated"]})]}),a.plan?.description&&e.jsx("p",{className:"text-sm text-gray-600",children:a.plan.description})]}),e.jsxs("div",{className:"text-right ml-4 shrink-0",children:[e.jsxs("div",{className:"flex items-baseline justify-end gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:h||"N/A"}),h&&"Free"!==h&&g&&e.jsx("span",{className:"text-sm text-gray-500",children:g})]}),l&&c&&c>0&&e.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["+ ",Qy(c,i),"/seat",g]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&!a.subscription.cancelAtPeriodEnd&&mk(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-500",children:[e.jsx(gd,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Next billing:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:mk(a.subscription.stripeCurrentPeriodEnd)})]})]})]})]}),S&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",v?.version||"N/A"," - A newer version is available"]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&e.jsx("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-200",children:"active"===a.subscription.subscriptionStatus&&a.subscription.cancelAtPeriodEnd?e.jsx(zd,{variant:"outline",size:"sm",onClick:()=>F(!0),disabled:N||u||p,progress:p,children:"Resume Subscription"}):e.jsx(zd,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>D(!0),disabled:N||u||p,progress:u||N,children:u||N?"Canceling...":"trialing"===a.subscription.subscriptionStatus?"Cancel Trial":"Cancel Subscription"})})]}),"past_due"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Dd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"Please update your payment method to avoid service interruption. Check your invoices for details."}),e.jsx(zd,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>z("invoices"),children:"View Invoices"})]})]})}),"past_due"===a.subscription.subscriptionStatus&&a.subscription.dunningState&&"none"!==a.subscription.dunningState&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Dd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"final"===a.subscription.dunningState?"Final warning: Subscription will be suspended":"suspended"===a.subscription.dunningState?"Subscription suspended":"Payment recovery in progress"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"suspended"===a.subscription.dunningState?"Your subscription has been suspended due to repeated payment failures. Update your payment method to restore access.":"We were unable to process your payment. Please update your payment method to avoid losing access."})]})]})}),"paused"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-blue-50 border-t border-blue-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(gd,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Subscription paused"}),e.jsx("p",{className:"text-sm text-blue-700 mt-0.5",children:"Your subscription is currently paused. Resume to restore full access."})]})]})}),a.subscription.cancelAtPeriodEnd&&e.jsx("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(gd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),e.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:mk(a.subscription.stripeCurrentPeriodEnd)?e.jsxs(e.Fragment,{children:["Your subscription will end on"," ",e.jsx("span",{className:"font-medium",children:mk(a.subscription.stripeCurrentPeriodEnd)}),". You'll retain access until then and won't be charged again."]}):"Your subscription will be canceled at the end of the current billing period. You won't be charged again."})]})]})}),a.planVersion&&(()=>{const t=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],s=[];return e.subscriptionItems.forEach(o=>{const i=o.slug;if("feature"===o.type){const t=e.features?.[i]??!1;n.push({item:o,enabled:t})}else if("limit"===o.type){const t=e.limits?.[i]??0;a.push({item:o,value:t})}else if("quota"===o.type){const n=t&&e.pricingVariants?.length?tk(e,t,i,r):ik(e.quotas?.[i],r);null!=n&&s.push({item:o,value:n})}}),{features:n,limits:a,quotas:s}})(a.planVersion,s,n??"monthly");return t.features.length>0||t.limits.length>0||t.quotas.length>0?e.jsx("div",{className:"p-5 border-t border-gray-100",children:e.jsxs("div",{className:"space-y-6",children:[t.features.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Features"}),e.jsx("ul",{className:"space-y-2",children:t.features.sort(e=>e.enabled?-1:1).map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"mt-0.5 flex-shrink-0 "+(r?"text-green-500":"text-gray-300"),children:r?"โœ“":"โ€”"}),e.jsx("span",{className:r?"text-gray-700":"text-gray-400",children:t.name})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Limits"}),e.jsx("ul",{className:"space-y-2",children:t.limits.map(({item:t,value:r})=>e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:r})]})},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Usage Quotas"}),e.jsx("ul",{className:"space-y-2",children:t.quotas.map(({item:t,value:r})=>{const n=lk(r,t.name.toLowerCase(),{currency:s});return e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:n})]})},t._id)})})]}),l&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Seats"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Current members"}),e.jsx("span",{className:"font-semibold text-gray-900",children:m})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Included with plan"}),e.jsx("span",{className:"text-gray-900",children:f})]}),c&&c>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Extra seat price"}),e.jsxs("span",{className:"text-gray-900",children:[Qy(c,s),g]})]}),l.maxSeats>0&&e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Seat limit"}),e.jsx("span",{className:"text-gray-900",children:l.maxSeats})]})]})]})]})}):null})()]})})():r.pendingOnboarding?e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(vd,{className:"h-12 w-12 mx-auto mb-3 text-blue-400"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"Start your free trial"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Try the full plan with no commitment. You can upgrade or cancel anytime."})]}),e.jsx(zd,{size:"sm",progress:N,onClick:async()=>{try{E(!0);const e=await c({planVersionId:r.pendingOnboarding?.planVersionId??""});e&&"checkoutUrl"in e&&e.checkoutUrl&&(window.location.href=e.checkoutUrl)}catch(e){}finally{E(!1)}},children:"Start Free Trial"}),j&&j.length>0&&e.jsx(zd,{variant:"ghost",size:"sm",className:"ml-2",onClick:()=>O(!0),children:"View All Plans"})]}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(vd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),j&&j.length>0&&e.jsx(zd,{size:"sm",onClick:()=>O(!0),children:"View Pricing Plans"})]})]}),!m&&!y&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),x&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",x]}),!x&&e.jsx("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e.jsx(zd,{variant:"outline",size:"sm",progress:y,onClick:L,disabled:y,className:"mt-4",children:y?"Refreshing...":"Refresh"})]})]}),"invoices"===M&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(Nd,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading invoices..."})]}),e.jsx(fk,{workspaceId:n,hasActiveSubscription:null!==a?.subscription,onViewPricingPlans:()=>z("subscription"),limit:20})]}),j&&j.length>0&&e.jsx(t.Suspense,{fallback:P?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Nd,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading plans..."})]})}):null,children:e.jsx(pk,{open:P,onOpenChange:O,planVersions:j,currentPlanVersionId:W||null,currentStripePriceId:a?.subscription?.stripePriceId,billingCurrency:r.billingCurrency,onSelectPlan:async(e,t="monthly",s)=>{if(!n)return;const o=j?.find(t=>t._id===e),l=s??$?.currency??a?.plan?.currency??r?.billingCurrency??"",d=o?XS(o,l,t):null,u=a?.subscription?.stripePriceId;if(!d||!u||d!==u){E(!0),A(null),T(null);try{let r,n,s;try{const e=new URL(window.location.href);r=e.toString(),n=e.toString()}catch{const e=window.location.protocol||"https:",t=window.location.host||window.location.hostname||"",a=`${e}//${t}${window.location.pathname||"/"}`;r=a,n=a}if(s=a?.subscription?await i(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await c({planVersionId:e,billingInterval:t,currency:l||void 0,successUrl:r,cancelUrl:n}),s&&"checkoutUrl"in s&&s.checkoutUrl)return void(window.location.href=s.checkoutUrl);T("Subscription updated successfully!"),await L()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";A(t)}finally{E(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{A(null),T(null)},5e3)}}},loading:N||y})}),e.jsx(wy,{open:U,onOpenChange:F,children:e.jsxs(Ny,{children:[e.jsxs(Ey,{children:[e.jsx(Ay,{children:"Resume Subscription"}),e.jsx(_y,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to resume your subscription?"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Dd,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("span",{children:["You will be charged again on"," ",a?.subscription?.stripeCurrentPeriodEnd&&mk(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:mk(a.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-0.5",children:"โ€ข"}),e.jsx("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),e.jsx("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e.jsxs(Cy,{children:[e.jsx(Ry,{disabled:p,children:"Keep Canceled"}),e.jsx(Ty,{onClick:async()=>{if(n){F(!1),E(!0),A(null),T(null);try{await f(),T("Subscription has been resumed."),await L()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";A(t)}finally{E(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{A(null),T(null)},5e3)}}},disabled:p,children:p?"Resuming...":"Yes, Resume Subscription"})]})]})}),e.jsx(wy,{open:I,onOpenChange:D,children:e.jsxs(Ny,{children:[e.jsxs(Ey,{children:[e.jsx(Ay,{children:"Cancel Subscription"}),e.jsx(_y,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to cancel your subscription?"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),e.jsxs("span",{children:["You'll retain full access to this plan until"," ",a?.subscription?.stripeCurrentPeriodEnd&&mk(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:mk(a.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),e.jsx("span",{children:"You won't be charged again after cancellation"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),e.jsx("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e.jsxs(Cy,{children:[e.jsx(Ry,{disabled:u,children:"Keep Subscription"}),e.jsx(Ty,{onClick:async()=>{if(n){D(!1),E(!0),A(null),T(null);try{await d(),T("Subscription will be canceled at the end of the billing period."),await L()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";A(t)}finally{E(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{A(null),T(null)},5e3)}}},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function gk(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toLocaleString()}function bk(e){return e.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function yk(e,t){return t+e.toFixed(2)}function xk(e){try{const t=new Date(e);if(isNaN(t.getTime()))return null;const r=new Date;return Math.ceil((t.getTime()-r.getTime())/864e5)}catch{return null}}const vk=()=>{const{quotas:r,loading:n,error:a,refetch:s}=Cr(),{response:o}=Sr(),[i,l]=t.useState(!1),c=t.useMemo(()=>{const e={};if(!o?.planVersion||!o?.subscription)return e;const t=o.planVersion,n=o.subscription,a=n.billingInterval??"monthly",s=n.plan?.currency??"usd",i=Jy(s);if(!r)return e;for(const n of Object.keys(r)){const o=QS(t,s,n,a);if(null==o||o<=0)continue;const l=t.quotas?.[n],c=l?.[a],d=c?.unitSize??1,u=r[n].overage,f=(d>1?Math.ceil(u/d):u)*o/100;e[n]={overageCents:o,unitSize:d,currency:s,currencySymbol:i,estimatedCost:f}}return e},[o,r]),d=t.useMemo(()=>{const e=o?.subscription?.stripeCurrentPeriodEnd;if(!e)return null;const t=function(e){try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}catch{return""}}(e);return t?{endDate:t,daysRemaining:xk(e)}:null},[o]),u=async()=>{l(!0);try{await s()}finally{l(!1)}};if(n&&!r)return e.jsx(Py,{});if(a)return e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Failed to load usage data"}),e.jsx("p",{className:"text-sm mt-1",children:a})]}),e.jsx(zd,{variant:"outline",size:"sm",onClick:u,disabled:i,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:i?"Retrying...":"Retry"})]});const f=function(e){return[...e].sort(([,e],[,t])=>{if(e.hasOverage&&!t.hasOverage)return-1;if(!e.hasOverage&&t.hasOverage)return 1;const r=e.included>0?e.consumed/e.included:e.consumed>0?1:0;return(t.included>0?t.consumed/t.included:t.consumed>0?1:0)-r})}(r?Object.entries(r):[]);if(0===f.length)return e.jsxs("div",{className:"border rounded-lg p-8 text-center",children:[e.jsx(bd,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-600",children:"No quota usage data available for this workspace."}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Quotas will appear here once your plan includes metered resources."})]});const p=f.filter(([,e])=>e.hasOverage).length,m=f.length>0?Math.round(f.reduce((e,[,t])=>e+(t.included>0?t.consumed/t.included*100:0),0)/f.length):0,h=Object.values(c).reduce((e,t)=>e+t.estimatedCost,0),g=Object.values(c)[0]?.currencySymbol??"$";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Monitor your resource consumption and quotas"}),e.jsxs(zd,{variant:"ghost",size:"sm",onClick:u,disabled:i,children:[e.jsx(Ad,{className:je("h-3.5 w-3.5 mr-1.5",i&&"animate-spin")}),i?"Refreshing...":"Refresh"]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50/50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(gd,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e.jsxs("span",{children:["Usage resets on ",e.jsx("span",{className:"font-medium text-gray-900",children:d.endDate}),null!==d.daysRemaining&&d.daysRemaining>0&&e.jsxs("span",{className:"text-gray-500",children:[" (",d.daysRemaining," ",1===d.daysRemaining?"day":"days"," remaining)"]}),null!==d.daysRemaining&&d.daysRemaining<=0&&e.jsx("span",{className:"text-amber-600 font-medium",children:" (renewing soon)"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:[e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Total Resources"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:f.length})]}),e.jsxs("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Overall Usage"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:m+"%"})]}),e.jsxs("div",{className:je("border rounded-lg p-3 sm:p-4",p>0?"border-red-200 bg-red-50":"border-gray-200"),children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"In Overage"}),e.jsx("p",{className:je("text-lg sm:text-xl font-semibold mt-1",p>0?"text-red-600":"text-gray-900"),children:p})]}),p>0&&h>0&&e.jsxs("div",{className:"border border-red-200 bg-red-50 rounded-lg p-3 sm:p-4",children:[e.jsx("p",{className:"text-xs text-gray-500 font-medium",children:"Est. Overage Cost"}),e.jsx("p",{className:"text-lg sm:text-xl font-semibold mt-1 text-red-600",children:yk(h,g)})]})]}),p>0&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Dd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5 hidden sm:block"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Overage Detected"}),e.jsxs("p",{className:"text-sm text-amber-700",children:[p," ",1===p?"resource has":"resources have"," exceeded the included quota. Additional usage will be billed as overage on your next invoice."]}),h>0&&e.jsxs("p",{className:"text-sm text-amber-700 font-medium mt-1",children:["Estimated overage charges this period: ",yk(h,g)]})]})]})}),e.jsx("div",{className:"space-y-3",children:f.map(([t,r])=>{const n=(a=r.consumed,(s=r.included)<=0?a>0?100:0:Math.min(a/s*100,100));var a,s;const o=function(e,t){return t?{bar:"bg-red-500",bg:"bg-red-100",badge:"bg-red-100",badgeText:"text-red-800"}:e>=90?{bar:"bg-amber-500",bg:"bg-amber-100",badge:"bg-amber-100",badgeText:"text-amber-800"}:e>=75?{bar:"bg-yellow-500",bg:"bg-yellow-100",badge:"bg-yellow-100",badgeText:"text-yellow-800"}:{bar:"bg-blue-500",bg:"bg-blue-100",badge:"bg-blue-100",badgeText:"text-blue-800"}}(n,r.hasOverage),i=c[t];return e.jsx(wk,{slug:t,quota:r,percent:n,colors:o,pricing:i},t)})})]})};function wk({slug:t,quota:r,percent:n,colors:a,pricing:s}){return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:bk(t)}),r.hasOverage&&e.jsx("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Overage"}),!r.hasOverage&&n>=90&&e.jsx("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",a.badge,a.badgeText),children:"Almost full"})]}),e.jsxs("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:[gk(r.consumed)," / ",gk(r.included)]})]}),e.jsx("div",{className:je("h-2 rounded-full w-full",a.bg),children:e.jsx("div",{className:je("h-2 rounded-full transition-all duration-500",a.bar),style:{width:`${n}%`}})}),e.jsxs("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-500",children:[e.jsxs("span",{children:[Math.round(n),"% used"]}),e.jsx("span",{children:r.available>0?`${gk(r.available)} remaining`:r.hasOverage?`${gk(r.overage)} over limit`:"Fully used"})]}),r.hasOverage&&s&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Overage units"}),e.jsx("span",{className:"font-medium text-gray-900",children:gk(r.overage)})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Rate"}),e.jsxs("span",{className:"font-medium text-gray-900",children:[s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]}),s.unitSize>1&&e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Billable blocks"}),e.jsx("span",{className:"font-medium text-gray-900",children:Math.ceil(r.overage/s.unitSize).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs pt-2 border-t border-gray-200",children:[e.jsx("span",{className:"font-medium text-red-600",children:"Estimated charge"}),e.jsx("span",{className:"font-semibold text-red-600",children:yk(s.estimatedCost,s.currencySymbol)})]})]}),!r.hasOverage&&s&&e.jsxs("div",{className:"mt-2 text-xs text-gray-500",children:["Overage rate: ",s.currencySymbol,(s.overageCents/100).toFixed(2),s.unitSize>1?` / ${s.unitSize.toLocaleString()} units`:" / unit"]})]})}function Sk(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?qc(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kk=Symbol("radix.slottable");function jk(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===kk}var Nk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});a.forwardRef((t,r)=>e.jsx(Pp.span,{...t,ref:r,style:{...Nk,...t.style}})).displayName="VisuallyHidden";var Ek=[" ","Enter","ArrowUp","ArrowDown"],Ck=[" ","Enter"],Ak="Select",[_k,Tk,Rk]=lg(Ak),[Pk]=Sp(Ak,[Rk,$w]),Ok=$w(),[Ik,Dk]=Pk(Ak),[Uk,Fk]=Pk(Ak),Mk=t=>{const{__scopeSelect:r,children:n,open:s,defaultOpen:o,onOpenChange:i,value:l,defaultValue:c,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,b=Ok(r),[y,x]=a.useState(null),[v,w]=a.useState(null),[S,k]=a.useState(!1),j=dg(u),[N,E]=Ap({prop:s,defaultProp:o??!1,onChange:i,caller:Ak}),[C,A]=Ap({prop:l,defaultProp:c,onChange:d,caller:Ak}),_=a.useRef(null),T=!y||(g||!!y.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(nS,{...b,children:e.jsxs(Ik,{required:h,scope:r,trigger:y,onTriggerChange:x,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Ep(),value:C,onValueChange:A,open:N,onOpenChange:E,dir:j,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(_k.Provider,{scope:r,children:e.jsx(Uk,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(Sj,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:C,onChange:e=>A(e.target.value),disabled:m,form:g,children:[void 0===C?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};Mk.displayName=Ak;var zk="SelectTrigger",Lk=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:s=!1,...o}=t,i=Ok(n),l=Dk(zk,n),c=l.disabled||s,d=Jc(r,l.onTriggerChange),u=Tk(n),f=a.useRef("touch"),[p,m,h]=jj(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),n=Nj(t,e,r);void 0!==n&&l.onValueChange(n.value)}),g=e=>{c||(l.onOpenChange(!0),h()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return e.jsx(aS,{asChild:!0,...i,children:e.jsx(Pp.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":kj(l.value)?"":void 0,...o,ref:d,onClick:wp(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:wp(o.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:wp(o.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Ek.includes(e.key)&&(g(),e.preventDefault())})})})});Lk.displayName=zk;var $k="SelectValue",Wk=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:i="",...l}=t,c=Dk($k,n),{onValueNodeHasChildrenChange:d}=c,u=void 0!==o,f=Jc(r,c.onValueNodeChange);return Hf(()=>{d(u)},[d,u]),e.jsx(Pp.span,{...l,ref:f,style:{pointerEvents:"none"},children:kj(c.value)?e.jsx(e.Fragment,{children:i}):o})});Wk.displayName=$k;var Vk=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(Pp.span,{"aria-hidden":!0,...s,ref:r,children:a||"โ–ผ"})});Vk.displayName="SelectIcon";var Bk=t=>e.jsx(Yp,{asChild:!0,...t});Bk.displayName="SelectPortal";var Gk="SelectContent",Kk=a.forwardRef((t,r)=>{const n=Dk(Gk,t.__scopeSelect),[o,i]=a.useState();if(Hf(()=>{i(new DocumentFragment)},[]),!n.open){const r=o;return r?s.createPortal(e.jsx(Zk,{scope:t.__scopeSelect,children:e.jsx(_k.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(Yk,{...t,ref:r})});Kk.displayName=Gk;var Hk=10,[Zk,qk]=Pk(Gk),Jk=function(t){const r=Sk(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),l=i.find(jk);if(l){const t=l.props.children,s=i.map(e=>e===l?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),Yk=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:l,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y,...x}=t,v=Dk(Gk,n),[w,S]=a.useState(null),[k,j]=a.useState(null),N=Jc(r,e=>S(e)),[E,C]=a.useState(null),[A,_]=a.useState(null),T=Tk(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return Jm(w)},[w]),tm();const I=a.useCallback(e=>{const[t,...r]=T().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[T,k]),D=a.useCallback(()=>I([E,w]),[I,E,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:F}=v;a.useEffect(()=>{if(w){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))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),F.current=null};return null!==F.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,F]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[M,z]=jj(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Nj(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&(C(e),n&&(O.current=!0))},[v.value]),$=a.useCallback(()=>w?.focus(),[w]),W=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==v.value&&v.value===t||n)&&_(e)},[v.value]),V="popper"===s?Qk:Xk,B=V===Qk?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y}:{};return e.jsx(Zk,{scope:n,content:w,viewport:k,onViewportChange:j,itemRefCallback:L,selectedItem:E,onItemLeave:$,itemTextRefCallback:W,focusSelectedItem:D,selectedItemText:A,position:s,isPositioned:R,searchRef:M,children:e.jsx(Vm,{as:Jk,allowPinchZoom:!0,children:e.jsx(Bp,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:wp(o,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(Mp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:e.jsx(V,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:e=>e.preventDefault(),...x,...B,onPlaced:()=>P(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:wp(x.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});Yk.displayName="SelectContentImpl";var Xk=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:s,...o}=t,i=Dk(Gk,n),l=qk(Gk,n),[c,d]=a.useState(null),[u,f]=a.useState(null),p=Jc(r,e=>f(e)),m=Tk(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:x,focusSelectedItem:v}=l,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&u&&b&&y&&x){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=x.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,s=r.left-a,o=e.left-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-Hk,u=nb(s,[Hk,Math.max(Hk,d-l)]);c.style.minWidth=i+"px",c.style.left=u+"px"}else{const a=t.right-n.right,s=window.innerWidth-r.right-a,o=window.innerWidth-e.right-s,i=e.width+o,l=Math.max(i,t.width),d=window.innerWidth-Hk,u=nb(s,[Hk,Math.max(Hk,d-l)]);c.style.minWidth=i+"px",c.style.right=u+"px"}const a=m(),o=window.innerHeight-2*Hk,l=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),v=f+p+l+parseInt(d.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,v),S=window.getComputedStyle(b),k=parseInt(S.paddingTop,10),j=parseInt(S.paddingBottom,10),N=e.top+e.height/2-Hk,E=o-N,C=y.offsetHeight/2,A=f+p+(y.offsetTop+C),_=v-A;if(A<=N){const e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=A+Math.max(E,C+(e?j:0)+t+g);c.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;c.style.top="0px";const t=Math.max(N,f+b.offsetTop+(e?k:0)+C)+_;c.style.height=t+"px",b.scrollTop=A-N+b.offsetTop}c.style.margin=`${Hk}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=o+"px",s?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,c,u,b,y,x,i.dir,s]);Hf(()=>w(),[w]);const[S,k]=a.useState();Hf(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const j=a.useCallback(e=>{e&&!0===g.current&&(w(),v?.(),g.current=!1)},[w,v]);return e.jsx(ej,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Pp.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Xk.displayName="SelectItemAlignedPosition";var Qk=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=Hk,...o}=t,i=Ok(n);return e.jsx(sS,{...i,...o,ref:r,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});Qk.displayName="SelectPopperPosition";var[ej,tj]=Pk(Gk,{}),rj="SelectViewport",nj=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:s,...o}=t,i=qk(rj,n),l=tj(rj,n),c=Jc(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e.jsx(_k.Slot,{scope:n,children:e.jsx(Pp.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:wp(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=l;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*Hk,a=parseFloat(r.style.minHeight),s=parseFloat(r.style.height),o=Math.max(a,s);if(o<n){const a=o+e,s=Math.min(n,a),i=a-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});nj.displayName=rj;var aj="SelectGroup",[sj,oj]=Pk(aj);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Ep();return e.jsx(sj,{scope:n,id:s,children:e.jsx(Pp.div,{role:"group","aria-labelledby":s,...a,ref:r})})}).displayName=aj;var ij="SelectLabel",lj=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=oj(ij,n);return e.jsx(Pp.div,{id:s.id,...a,ref:r})});lj.displayName=ij;var cj="SelectItem",[dj,uj]=Pk(cj),fj=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...l}=t,c=Dk(cj,n),d=qk(cj,n),u=c.value===s,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Jc(r,e=>d.itemRefCallback?.(e,s,o)),b=Ep(),y=a.useRef("touch"),x=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(dj,{scope:n,value:s,disabled:o,textId:b,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(_k.ItemSlot,{scope:n,value:s,disabled:o,textValue:f,children:e.jsx(Pp.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:wp(l.onFocus,()=>h(!0)),onBlur:wp(l.onBlur,()=>h(!1)),onClick:wp(l.onClick,()=>{"mouse"!==y.current&&x()}),onPointerUp:wp(l.onPointerUp,()=>{"mouse"===y.current&&x()}),onPointerDown:wp(l.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:wp(l.onPointerMove,e=>{y.current=e.pointerType,o?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:wp(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:wp(l.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Ck.includes(e.key)&&x()," "===e.key&&e.preventDefault())})})})})});fj.displayName=cj;var pj="SelectItemText",mj=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:o,style:i,...l}=t,c=Dk(pj,n),d=qk(pj,n),u=uj(pj,n),f=Fk(pj,n),[p,m]=a.useState(null),h=Jc(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,b=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:x}=f;return Hf(()=>(y(b),()=>x(b)),[y,x,b]),e.jsxs(e.Fragment,{children:[e.jsx(Pp.span,{id:u.textId,...l,ref:h}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren?s.createPortal(l.children,c.valueNode):null]})});mj.displayName=pj;var hj="SelectItemIndicator",gj=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return uj(hj,n).isSelected?e.jsx(Pp.span,{"aria-hidden":!0,...a,ref:r}):null});gj.displayName=hj;var bj="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=qk(bj,t.__scopeSelect),s=tj(bj,t.__scopeSelect),[o,i]=a.useState(!1),l=Jc(r,s.onScrollButtonChange);return Hf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(xj,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=bj;var yj="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=qk(yj,t.__scopeSelect),s=tj(yj,t.__scopeSelect),[o,i]=a.useState(!1),l=Jc(r,s.onScrollButtonChange);return Hf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(xj,{...t,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=yj;var xj=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=t,i=qk("SelectScrollButton",n),l=a.useRef(null),c=Tk(n),d=a.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),Hf(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),e.jsx(Pp.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:wp(o.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(s,50))}),onPointerMove:wp(o.onPointerMove,()=>{i.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(s,50))}),onPointerLeave:wp(o.onPointerLeave,()=>{d()})})}),vj=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Pp.div,{"aria-hidden":!0,...a,ref:r})});vj.displayName="SelectSeparator";var wj="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Ok(n),o=Dk(wj,n),i=qk(wj,n);return o.open&&"popper"===i.position?e.jsx(oS,{...s,...a,ref:r}):null}).displayName=wj;var Sj=a.forwardRef(({__scopeSelect:t,value:r,...n},s)=>{const o=a.useRef(null),i=Jc(s,o),l=Tg(r);return a.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[l,r]),e.jsx(Pp.select,{...n,style:{...Nk,...n.style},ref:i,defaultValue:r})});function kj(e){return""===e||void 0===e}function jj(e){const t=Gf(e),r=a.useRef(""),n=a.useRef(0),s=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function Nj(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 s=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(s=s.filter(e=>e!==r));const o=s.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}Sj.displayName="SelectBubbleInput";var Ej=Lk,Cj=Vk,Aj=Bk,_j=Kk,Tj=nj,Rj=lj,Pj=fj,Oj=mj,Ij=gj,Dj=vj;const Uj=Mk,Fj=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Ej,{ref:a,className:je("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[r,e.jsx(Cj,{asChild:!0,children:e.jsx(Vh,{className:"h-4 w-4 opacity-50"})})]}));Fj.displayName=Ej.displayName;const Mj=a.forwardRef(({className:t,children:r,position:n="popper",...s},o)=>{const{container:i}=a.useContext(ns);return e.jsx(Aj,{container:i,children:e.jsx(_j,{ref:o,className:je("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:e.jsx(Tj,{className:je("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});Mj.displayName=_j.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Rj,{ref:n,className:je("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=Rj.displayName;const zj=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Pj,{ref:a,className:je("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ij,{children:e.jsx(Gh,{className:"h-4 w-4"})})}),e.jsx(Oj,{children:r})]}));zj.displayName=Pj.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Dj,{ref:n,className:je("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=Dj.displayName;const Lj=({workspace:r})=>{const{user:n}=es(),[a,s]=t.useState(0),[o,i]=t.useState(!1),[l,c]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=or(),{settings:h}=Yt(),{response:g}=Sr();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{c(e)}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const b=()=>{s(e=>e+1)};if(o||!r)return e.jsx(Py,{});const y=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},x=l.map(e=>({...e,...y(e.user)})),v=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,w="admin"===v,S=g?.subscription,k=g?.planVersion,j=S?.seatPricingEnabled,N=r?.billingCurrency||"usd",E=k?nk(k,N):null,C=E?.includedSeats??0,A=E?.maxSeats??0,_=l.length,T=j&&A>0&&_>=A,R=h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE,P=j?!T:R>_,O=S?.billingInterval??"monthly",I=k?ak(k,N,O):null,D=j&&_>=C;return e.jsxs("div",{children:[!w&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),w&&e.jsx("div",{className:"mb-4",children:P?e.jsxs("div",{children:[e.jsx($j,{onInvite:b,workspaceId:r._id}),D&&I&&I>0&&e.jsx("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-amber-600 bg-amber-50 px-3 py-1.5 rounded-md",children:e.jsxs("span",{children:["Each additional member adds ",e.jsxs("span",{className:"font-medium",children:[Qy(I,N),"/","yearly"===O?"yr":"quarterly"===O?"qtr":"mo"]})," to your subscription"]})})]}):e.jsx("div",{className:"flex items-center justify-between p-3 bg-red-50 border border-red-100 rounded-md",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-700",children:T?"Seat limit reached":"Member limit reached"}),e.jsx("p",{className:"text-xs text-red-600 mt-0.5",children:T?`Your plan allows up to ${A} members. Upgrade for more seats.`:"Contact your admin to increase the workspace member limit."})]})})}),j&&E&&e.jsxs("div",{className:"mb-4 rounded-lg border bg-gray-50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900",children:"Seats"}),A>0&&e.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full "+(_>=A?"bg-red-100 text-red-700":_>=.8*A?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"),children:[_," / ",A]})]}),A>0&&e.jsx("div",{className:"w-full h-1.5 bg-gray-200 rounded-full mb-3",children:e.jsx("div",{className:"h-1.5 rounded-full transition-all "+(_>=A?"bg-red-500":_>=.8*A?"bg-amber-500":"bg-emerald-500"),style:{width:`${Math.min(100,_/A*100)}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-900 font-medium",children:C})," included",I&&I>0&&e.jsxs("span",{className:"text-gray-400",children:[" ยท ",Qy(I,N),"/extra seat"]})]}),A>0?e.jsxs("span",{children:[Math.max(0,A-_)," available"]}):e.jsx("span",{className:"text-gray-400",children:"No seat limit"})]})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600",children:[_," member",1!==_?"s":""]})}),e.jsx("div",{children:e.jsx(zd,{variant:"ghost",size:"sm",onClick:b,progress:o,children:o?"Refreshing...":"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:x.map((t,a)=>{const s=t.id===n?.id,o=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"flex items-center justify-between border rounded p-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(Uj,{disabled:s||!w||o||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,s=e,void(nr(r,a)?De(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}}):(u(a),m(n,a,{role:s}).then(()=>{b()}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}})}).finally(()=>{u(null)})));var n,a,s},children:[e.jsx(Fj,{children:e.jsx(Wk,{placeholder:"Select a role"})}),e.jsx(Mj,{children:r?.roles.map(t=>e.jsx(zj,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(Nd,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),s&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),o&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!s&&!o&&w&&e.jsx(zd,{variant:"destructive",size:"sm",startIcon:e.jsx(Id,{}),onClick:()=>{var e;e=t.id,nr(r,e)?De(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{b()}).catch(t=>{De(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},a)})}),0===l.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function $j({onInvite:r,workspaceId:n}){const[a,s]=t.useState(""),[o,i]=t.useState("admin"),[l,c]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),m=t.useRef(null),{addUser:h,getWorkspace:g}=or();t.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const[b,y]=t.useState(null),{settings:x}=Yt(),v=x?.workspace.roles??b?.roles??[];t.useEffect(()=>{n&&g(n).then(y)},[n]);const w=()=>{u(null),p(null),s(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Bd,{children:"Invite member by email"}),e.jsx(tu,{type:"email",value:a,onChange:e=>s(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Bd,{children:"Role"}),e.jsxs(Uj,{value:o,onValueChange:i,children:[e.jsx(Fj,{children:e.jsx(Wk,{placeholder:"Select a role"})}),e.jsx(Mj,{children:v.map(t=>e.jsx(zj,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(zd,{progress:l,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(c(!0),await h(n,e,o).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{De(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:o}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{c(!1),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{w()},6e3)})):u("Invalid email address format")},disabled:l||!a||!o,children:l?"Inviting...":`Invite as ${o}`})})]})}const Wj=({workspace:t,section:r,setSection:n})=>{const{user:a}=es(),s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id,o=ar(t,a?.id??null),i=s||"admin"===o?.toLowerCase();return e.jsxs("div",{className:"w-44 sm:w-56 h-full flex flex-col space-y-4 sm:space-y-6 shrink-0",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:je("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(Vj,{title:"Account",children:e.jsx(Bj,{activeSection:r,icon:e.jsx(Ud,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(Vj,{title:"Workspace",children:[e.jsx(Bj,{activeSection:r,icon:e.jsx(Td,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(Fd,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(vd,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>n("subscription")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(bd,{className:"h-3.5 w-3.5"}),label:"Usage",section:"usage",onClick:()=>n("usage")}),e.jsx(Bj,{activeSection:r,icon:e.jsx(Pd,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),i&&e.jsx(Bj,{activeSection:r,icon:e.jsx(Dd,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function Vj({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function Bj({icon:t,label:r,section:n,onClick:a,activeSection:s}){return e.jsxs("button",{className:je("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===s?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const Gj=({workspace:r,onClose:n,open:a,onOpenChange:s,defaultSection:o="profile",section:i,onSectionChange:l,showTrigger:c=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(o),h=void 0!==a?a:u,g=s||f,b=void 0!==i?i:p,y=l||m;if(!r)return null;const x=e.jsx(zd,{variant:"outline",size:"icon",children:e.jsx(Td,{className:"h-4 w-4"})});return e.jsxs(Jh,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[c&&e.jsx(Yh,{asChild:!0,children:d||x}),e.jsxs(eg,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[e.jsx(ng,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(Wj,{workspace:r,section:b,setSection:y}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(rg,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","subscription"===b&&"Plan & Billing","usage"===b&&"Usage","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===b&&e.jsx(qS,{workspace:r}),"general"===b&&e.jsx(rx,{workspace:r}),"users"===b&&e.jsx(Lj,{workspace:r}),"subscription"===b&&e.jsx(hk,{workspace:r}),"usage"===b&&e.jsx(vk,{}),"features"===b&&e.jsx(Ky,{workspaceId:r._id?.toString()}),"danger"===b&&e.jsx(Oy,{workspace:r})]})]})]})]})};var Kj=Object.freeze({__proto__:null,WorkspaceSettingsDialog:Gj,default:Gj});function Hj(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:s,switchingToId:o}=t,i=t.isCurrentWorkspace??!1,l=o===r._id,c=r.subscription??null,d=null!=c&&"object"==typeof c?c.plan??null:null,u=d?.name??"";return e.jsxs("div",{className:je("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(yp,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(xp,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(vp,{children:(f=r.name,f.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Fd,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]}),u&&e.jsx("div",{className:"max-w-fit",children:e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground bg-green-500 text-white rounded-full px-2 py-0.5",children:e.jsx("span",{className:"text-xs",children:u})})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(zd,{size:"sm",disabled:null!==o||l,progress:l,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{De(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(Gj,{workspace:r,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(s[e])}}})]})]});var f}function Zj(r){const{switching:n}=or(),[a,s]=t.useState(!1),[o,i]=t.useState("emoji"),[l,c]=t.useState("๐Ÿข"),[d,u]=t.useState(!1),{createWorkspace:f}=or(),p=zo({resolver:Hc(rf({name:_u().min(2,{message:"Workspace name must be at least 2 characters."}),image:_u().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(Jh,{open:a,onOpenChange:s,children:[e.jsx(Yh,{asChild:!0,children:e.jsxs(zd,{className:"w-full rounded-none",disabled:n,children:[e.jsx(Ed,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(eg,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(tg,{children:[e.jsx(rg,{children:"Create New Workspace"}),e.jsx(ng,{children:"Create a new workspace to get started."})]}),e.jsx(Gd,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===o)t=ex(l);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),s(!1),p.reset(),c("๐Ÿข"),i("emoji"),r?.onCreated?.()}catch(t){De(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(Hd,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Workspace Name"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"My Awesome Workspace",...t})}),e.jsx(eu,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Bd,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(Qd,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(tb,{value:o,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(rb,{value:"emoji",id:"emoji"}),e.jsxs(Bd,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(Rd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(rb,{value:"url",id:"url"}),e.jsxs(Bd,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(jd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:l})]}),e.jsx(Lb,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:tx.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",ex(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Hd,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Jd,{children:[e.jsx(Yd,{children:"Image URL"}),e.jsx(Xd,{children:e.jsx(tu,{placeholder:"https://example.com/image.png",...t})}),e.jsx(Qd,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(eu,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(zd,{type:"button",variant:"outline",onClick:()=>{s(!1),p.reset(),c("๐Ÿข"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(zd,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(Nd,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}function qj(e){if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t}const Jj=(e,t)=>null==e||0===e?"Free":Qy(e,t),Yj=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}};var Xj=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:s,currentStripePriceId:o,billingCurrency:i,onSelectPlan:l,loading:c=!1})=>{const[d,u]=t.useState(!1),[f,p]=t.useState(null),m=t.useRef(!1),h=t.useMemo(()=>rk(o,a),[o,a]),g=h?.interval??null,b=h?.currency??null,y=t.useMemo(()=>ek(a),[a]),x=t.useMemo(()=>{const e=i?.trim().toLowerCase();return e?y.includes(e)?[e]:[]:y},[i,y]),[v,w]=t.useState(g||"monthly"),[S,k]=t.useState(()=>b&&x.includes(b)?b:x.length>0?x[0]:""),j=i?.trim()||S;t.useEffect(()=>{r&&(w(g||"monthly"),b&&x.includes(b)?k(b):x.length>0&&!x.includes(S)&&k(x[0]))},[r,g,b,x]);const N=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),E=(e=>{const t=new Map;return e.forEach(e=>{e.subscriptionItems?.forEach(e=>{t.has(e._id)||t.set(e._id,e)})}),Array.from(t.values())})(N),C=E.filter(e=>"feature"===e.type),A=E.filter(e=>"limit"===e.type),_=E.filter(e=>"quota"===e.type),T=c||d,R=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},P=(e,t,r="monthly")=>{if("feature"===t.type)return e.features?.[t.slug]??!1;if("limit"===t.type)return e.limits?.[t.slug]??null;if("quota"===t.type){const n=tk(e,j,t.slug,r);return n||ik(e.quotas?.[t.slug],r)}return null},O=(e,t,r)=>{if("feature"===t.type)return!0===e?"โœ“":"โ€”";if("limit"===t.type)return null!=e?String(e):"โ€”";if("quota"===t.type){return lk("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"โ€”"};return e.jsx(Jh,{open:r,onOpenChange:n,children:e.jsxs(eg,{className:"inset-0 w-screen h-screen max-w-none rounded-none translate-x-0 translate-y-0 p-0 flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-6 border-b space-y-4",children:[e.jsxs("div",{children:[e.jsx(rg,{className:"text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(ng,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:!i?.trim()&&x.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Currency"}),e.jsx("select",{"aria-label":"Select billing currency",value:S,onChange:e=>k(e.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm font-medium text-slate-900 shadow-sm focus:outline-none focus:ring-2 focus:ring-primary",children:x.map(t=>{const r=qy(t);return e.jsx("option",{value:t,children:r?`${r} ${t.toUpperCase()}`:t.toUpperCase()},t)})})]})}),e.jsx("div",{className:"flex items-center gap-1 p-1 bg-slate-100 rounded-lg",role:"group","aria-label":"Billing interval",children:["monthly","quarterly","yearly"].map(t=>{const r=g===t;return e.jsx("button",{onClick:()=>w(t),className:"px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(v===t?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e.jsxs("span",{className:"flex items-center gap-1.5",children:["monthly"===t&&"Monthly","quarterly"===t&&"Quarterly","yearly"===t&&"Yearly","yearly"===t&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),r&&s&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},t)})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:i?.trim()&&0===x.length?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===N.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:e.jsx("div",{className:"overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e.jsxs("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*N.length+"px",borderCollapse:"separate"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:280,minWidth:280}}),N.map(t=>e.jsx("col",{style:{width:200,minWidth:200}},t._id))]}),e.jsx("thead",{children:e.jsxs("tr",{className:"align-top",children:[e.jsx("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),N.map(t=>{const r=t._id===s,a=(e=>{const t=e._id===s,r=g===v;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${R(v)}`,variant:"default",disabled:!1};if(!s)return{label:"Subscribe",variant:"default",disabled:!1};const n=N.findIndex(e=>e._id===s),a=N.findIndex(t=>t._id===e._id);return-1===n||-1===a?{label:"Select",variant:"default",disabled:!1}:a<n?{label:"Downgrade",variant:"outline",disabled:!1}:a>n?{label:"Upgrade",variant:"default",disabled:!1}:{label:"Select",variant:"default",disabled:!1}})(t),o=T&&t._id===f,i=(e=>YS(e,j,v))(t),h=YS(t,j,"monthly")??0,b="monthly"!==v&&null!==i?((e,t,r)=>{if(!e||0===e)return null;let n;switch(r){case"yearly":n=t/12;break;case"quarterly":n=t/3;break;default:return null}const a=(e-n)/e*100;return a>0?Math.round(a):null})(h,i,v):null,y=(e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===j.toLowerCase()))(t),x=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===j.toLowerCase())?j:t.plan?.currency??j??"";return e.jsx("th",{className:"sticky top-0 z-20 border-b border-slate-200 p-3 shadow-[0_2px_4px_-2px_rgba(0,0,0,0.06)] "+(t._id===s?"bg-blue-50/80":"bg-white"),children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 truncate",children:t.plan.name}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:y&&null!==i||y?Jj(i,x):"โ€”"}),null!==i&&i>0&&y&&e.jsx("span",{className:"text-sm text-slate-500",children:Yj(v)})]}),null!==b&&b>0&&y&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",b,"% vs monthly"]}),(()=>{const r=nk(t,j);if(!r)return null;const n=ak(t,j,v);return!n||n<=0?null:e.jsxs("div",{className:"text-xs text-slate-500 mt-1 border-t border-slate-100 pt-1",children:[e.jsxs("span",{children:["+ ",Qy(n,x),"/seat",Yj(v)]}),r.includedSeats>0&&e.jsxs("span",{className:"text-slate-400",children:[" (",r.includedSeats," included)"]})]})})()]}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:t.plan.description}),e.jsx(zd,{className:"mt-auto w-full",variant:a.variant,disabled:a.disabled||T||!y,progress:o,onClick:()=>(async e=>{if(!(e===s&&g===v||c||d||m.current)){m.current=!0,u(!0),p(e);try{await l(e,v,j),n(!1)}catch(e){}finally{m.current=!1,u(!1),p(null)}}})(t._id),children:o?"Processing...":y?a.label:"Unavailable"})]})},t._id)})]})}),e.jsxs("tbody",{children:[C.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Features"}),e.jsx("td",{colSpan:N.length,className:"border-t border-slate-200 bg-slate-100"})]}),C.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),N.map(r=>{const n=P(r,t,v),a=r.pricingVariants?.length?j:r.plan?.currency??j??"",o=O(n,t,a),i="feature"===t.type&&!0===n;return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+(i?"text-emerald-600":"โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),A.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Limits"}),e.jsx("td",{colSpan:N.length,className:"border-t border-slate-200 bg-slate-100"})]}),A.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),N.map(r=>{const n=P(r,t,v),a=r.pricingVariants?.length?j:r.plan?.currency??j??"",o=O(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),_.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Quotas"}),e.jsx("td",{colSpan:N.length,className:"border-t border-slate-200 bg-slate-100"})]}),_.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),N.map(r=>{const n=P(r,t,v),a=r.pricingVariants?.length?j:r.plan?.currency??j??"",o=O(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),N.some(e=>{const t=nk(e,j);return t?.enabled})&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-emerald-200 bg-emerald-50 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-emerald-700 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Seats"}),e.jsx("td",{colSpan:N.length,className:"border-t border-emerald-200 bg-emerald-50"})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Included seats"}),e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:"Free with base price"})]}),N.map(t=>{const r=nk(t,j);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.includedSeats||0:"โ€”"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Max seats"})}),N.map(t=>{const r=nk(t,j);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.maxSeats>0?r.maxSeats:"Unlimited":"โ€”"})},t._id)})]}),e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:e.jsx("div",{className:"font-medium text-sm text-slate-900",children:"Per extra seat"})}),N.map(t=>{const r=ak(t,j,v),n=t.pricingVariants?.length?j:t.plan?.currency??j??"";return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(t._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r&&r>0?`${Qy(r,n)}${Yj(v)}`:"โ€”"})},t._id)})]})]})]})]})})})})]})})}});exports.BaseApi=Zt,exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:s="flex flex-col gap-1.5 w-full",language:o,customTexts:i={},autoFocus:l=!0,showSuccessMessage:c=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,b]=t.useState(!1),{submitBetaForm:y,isLoading:x,isSubmitting:v,error:w,config:S,success:k,message:j}=(()=>{const e=Jt(),[r,n]=t.useState(null),[a,s]=t.useState(!0),[o,i]=t.useState(!1),[l,c]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{let t=!1;return(async()=>{s(!0),c(null);try{const r=new au(e),a=await r.fetchConfig();t||n(a)}catch(e){t||c(e instanceof Error?e.message:"Failed to load beta form config")}finally{t||s(!1)}})(),()=>{t=!0}},[e]),{isLoading:a,isSubmitting:o,config:r,error:l,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),u(!1),p(null);const r=new au(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Sf).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&c&&(h(!0),b(!0)),w&&b(!0)},[k,c,w]);const N={...Sf[o||f],...i},E=zo({resolver:Hc(wf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{l&&E.setFocus("name")},[l,E]);const C=E.formState.isValid&&!v;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:x?e.jsxs("div",{className:je("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",a),children:[e.jsx(ru,{className:"h-24 w-24 rounded-lg"}),e.jsx(ru,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ru,{className:"h-4 w-16"}),e.jsx(ru,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ru,{className:"h-4 w-16"}),e.jsx(ru,{className:"h-10 w-full"})]}),e.jsx(ru,{className:"h-10 w-full"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(jf,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(ro,{...E,children:e.jsxs("form",{onSubmit:E.handleSubmit(async e=>{try{const t=await y(e);t.success?(r?.(),E.reset(),c&&h(!0),b(!0)):(n?.(t.message),b(!0))}catch(e){n?.(e instanceof Error?e.message:N.errorMessage),b(!0)}}),className:a,noValidate:!0,"aria-busy":v,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(kf,{screen:S?.screen?.register}),e.jsx(Hd,{control:E.control,name:"name",render:({field:t})=>e.jsxs(Jd,{className:s,children:[e.jsx(Yd,{children:N.nameLabel}),e.jsx(Xd,{children:e.jsx(tu,{...t})}),e.jsx(Qd,{}),e.jsx(eu,{})]})}),e.jsx(Hd,{control:E.control,name:"email",render:({field:t})=>e.jsxs(Jd,{className:s,children:[e.jsx(Yd,{children:N.emailLabel}),e.jsx(Xd,{children:e.jsx(tu,{...t})}),e.jsx(Qd,{}),e.jsx(eu,{})]})}),e.jsx(zd,{type:"submit",disabled:!C,className:s,children:v?N.submittingText:N.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"โ—"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(zd,{type:"button",onClick:()=>{b(!1),E.reset()},className:s,children:"Try Again"})})]}),g&&m&&j&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(kf,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.CURRENCY_DISPLAY=Hy,exports.CURRENCY_FLAG=Zy,exports.PLAN_CURRENCY_CODES=Yy,exports.PLAN_CURRENCY_OPTIONS=Xy,exports.PricingPage=function({slug:t,children:r,loadingFallback:n,errorFallback:a}){const{items:s,plans:o,notes:i,loading:l,error:c,refetch:d}=cr(t);return l?void 0!==n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(ru,{className:"h-8 w-48"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(t=>e.jsx(ru,{className:"h-64 rounded-lg"},t))})]}):c?a?e.jsx(e.Fragment,{children:a(c)}):e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:c}):e.jsx(e.Fragment,{children:r({loading:l,error:c,items:s,plans:o,notes:i,refetch:d})})},exports.QuotaUsageContextProvider=Er,exports.SaaSOSProvider=fs,exports.SettingsApi=qt,exports.SubscriptionContextProvider=wr,exports.UserApi=ss,exports.WhenAuthenticated=Nf,exports.WhenNoSubscription=Df,exports.WhenNotTrialing=Mf,exports.WhenQuotaAvailable=Lf,exports.WhenQuotaExhausted=$f,exports.WhenQuotaOverage=Wf,exports.WhenQuotaThreshold=Vf,exports.WhenRoles=Cf,exports.WhenSubscription=If,exports.WhenSubscriptionToPlans=Uf,exports.WhenTrialEnding=zf,exports.WhenTrialing=Ff,exports.WhenUnauthenticated=Ef,exports.WhenUserFeatureDisabled=Of,exports.WhenUserFeatureEnabled=Pf,exports.WhenWorkspaceFeatureDisabled=Rf,exports.WhenWorkspaceFeatureEnabled=Tf,exports.WhenWorkspaceRoles=Af,exports.WorkspaceApi=Xt,exports.WorkspaceSwitcher=function(r){const{isAuthenticated:n,user:a}=es(),s=o(Jt()),{workspaces:i,currentWorkspace:l,loading:c,refreshing:d,switchingToId:u,fetchWorkspaces:f,getFeatures:p,refreshWorkspaces:m,setCurrentWorkspace:h,switchToWorkspace:g}=or(),{settings:b}=Yt(),[y,x]=t.useState(!1),[v,w]=t.useState(0),[S,k]=t.useState(""),j=c||d;t.useEffect(()=>{n&&s&&(0===i.length?(f(),p()):p())},[n,s]),t.useEffect(()=>{n&&s&&v>0&&m()},[v,n,s]);const N=i,E=N.filter(e=>e._id!==l?._id).filter(e=>e.name.toLowerCase().includes(S.toLowerCase())),C=b?.workspace.maxWorkspaces??Number.MAX_VALUE,A=N?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===a?.id?.toString()).length,_=C>(A??0);return e.jsxs(Jh,{open:y,onOpenChange:x,children:[e.jsx(Yh,{children:r.trigger?.(j,l)}),e.jsxs(eg,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(tg,{children:[e.jsxs(rg,{className:"flex items-center gap-2",children:[e.jsx(hd,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(ng,{children:"Select a workspace to switch to or create a new one."})]}),!a&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),a&&e.jsxs("div",{className:"flex flex-col gap-4",children:[l&&e.jsx(Hj,{workspace:l,isCurrentWorkspace:!0,switchToWorkspace:g,switchingToId:u,onClose:()=>x(!1),setCurrentWorkspace:h,setOpen:x,workspacesToUse:N}),e.jsx(Hb,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",E.length,")"]}),e.jsx("div",{children:e.jsx(zd,{progress:d,disabled:d,variant:"ghost",onClick:function(){n&&s&&w(e=>e+1)},startIcon:e.jsx(Cd,{}),children:d?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(_d,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(tu,{placeholder:"Search workspaces...",value:S,onChange:e=>k(e.target.value),className:"pl-10"})]}),c?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Nd,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===E.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(hd,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:S?"No workspaces found":"No workspaces available"})]}):e.jsx(Lb,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:E.map(t=>{const r=t._id===l?._id;return e.jsx(Hj,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:g,switchingToId:u,onClose:()=>x(!1),setCurrentWorkspace:h,setOpen:x,workspacesToUse:N},t._id)})})})]}),_&&e.jsxs(e.Fragment,{children:[e.jsx(Hb,{}),e.jsx(Zj,{onCreated:()=>{f()}})]})]})]})]})},exports.calculateBillableSeats=sk,exports.calculateSeatOverageCents=ok,exports.calculateTotalSubscriptionCents=function(e,t,r,n){const a=YS(e,t,r);return null===a?null:void 0===n?a:a+(ok(e,t,r,n)??0)},exports.eventEmitter=Pt,exports.formatCents=Qy,exports.formatOverageRate=function(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=Jy(r),s=(e/100).toFixed(2);return 1===n?`${a}${s}/unit`:`${a}${s}/${n.toLocaleString()} units`},exports.formatOverageRateWithLabel=function(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,s=Jy(n),o=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${s}${o}/${a.toLocaleString()} ${e}`:`${s}${o}/${r}`}return 1===a?`${s}${o}/unit`:`${s}${o}/${a.toLocaleString()} units`},exports.formatQuotaIncludedOverage=function(e,t,r,n,a){const s=r.endsWith("s")?r:`${r}s`,o=null!=a&&a>=2?`${a.toLocaleString()} ${s}`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${Qy(t,n)}/${o}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${Qy(t,n)}/${o}`:"โ€”"},exports.formatQuotaWithPrice=lk,exports.getAvailableCurrenciesFromPlans=ek,exports.getBasePriceCents=YS,exports.getBillingIntervalAndCurrencyFromPriceId=rk,exports.getCurrencyFlag=qy,exports.getCurrencySymbol=Jy,exports.getDisplayCurrency=function(e,t){const r=JS(e,t);return r?r.currency:e.plan?.currency??""},exports.getPerSeatPriceCents=ak,exports.getPricingVariant=JS,exports.getQuotaDisplayValue=ik,exports.getQuotaDisplayWithVariant=tk,exports.getQuotaOverageCents=QS,exports.getQuotaUnitLabelFromName=function(e){const t=(e||"").trim().toLowerCase();if(!t)return"unit";const r=t.split(/\s+/)[0]??t;return new Set(["series","species","status","analysis","basis","bus","campus","corpus","axis"]).has(r)?r:r.endsWith("ies")&&r.length>3?r.slice(0,-3)+"y":r.endsWith("ses")||r.endsWith("xes")||r.endsWith("zes")||r.endsWith("ches")||r.endsWith("shes")?r.slice(0,-2):r.endsWith("s")&&!r.endsWith("ss")&&r.length>1?r.slice(0,-1):r||"unit"},exports.getSeatPricing=nk,exports.getStripePriceIdForInterval=XS,exports.invalidateQuotaUsage=lr,exports.invalidateSubscription=Rt,exports.useAllQuotaUsage=xr,exports.useCancelSubscription=br,exports.useCreateCheckoutSession=pr,exports.useInvoice=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";c(n),De(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{invoice:a,loading:o,error:l,refetch:d}},exports.useInvoices=gr,exports.usePlanGroup=ur,exports.usePlanGroupVersions=fr,exports.usePublicPlanGroupVersion=e=>{const{api:r}=sr(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,l]=t.useState(null),c=t.useCallback(async()=>{if(e){o(!0),l(null);try{const t=await r.getPlanGroupVersion(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";l(r),De(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{c()},[c]),{planGroupVersion:n,loading:s,error:i,refetch:c}},exports.usePublicPlans=cr,exports.useQuotaUsageContext=Cr,exports.useQuotaUsageStatus=(e,r)=>{const{api:n}=sr(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[l,c]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),c(null);try{const t=await n.getQuotaUsageStatus(e,r);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch quota usage status";c(n),De(t,{component:"useQuotaUsageStatus",action:"fetchStatus",metadata:{workspaceId:e,quotaSlug:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{status:a,loading:o,error:l,refetch:d}},exports.useRecordUsage=e=>{const{api:r}=sr(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{recordUsage:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const n=await r.recordUsage(e,t);return lr(),n}catch(r){const n=r instanceof Error?r.message:"Failed to record usage";throw o(n),De(r,{component:"useRecordUsage",action:"recordUsage",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},exports.useResumeSubscription=yr,exports.useSaaSAuth=es,exports.useSaaSOs=Jt,exports.useSaaSSettings=Yt,exports.useSaaSWorkspaces=or,exports.useSeatStatus=function(e){const{response:r}=Sr();return t.useMemo(()=>{const t={hasSeatPricing:!1,memberCount:0,includedSeats:0,maxSeats:0,billableSeats:0,availableSeats:1/0,isAtMax:!1,isNearMax:!1,perSeatPriceCents:null,currency:""};if(!r?.subscription||!e)return t;const n=r.subscription;if(!n.seatPricingEnabled)return{...t,memberCount:e.users?.length??0};const a=r.planVersion,s=e.billingCurrency||"usd",o=a?nk(a,s):null;if(!o)return{...t,hasSeatPricing:!0,memberCount:e.users?.length??0};const i=e.users?.length??0,l=o.includedSeats??0,c=o.maxSeats??0,d=Math.max(0,i-l),u=c>0?Math.max(0,c-i):1/0,f=c>0&&i>=c,p=c>0&&i>=.8*c&&!f,m=n.billingInterval??"monthly";return{hasSeatPricing:!0,memberCount:i,includedSeats:l,maxSeats:c,billableSeats:d,availableSeats:u,isAtMax:f,isNearMax:p,perSeatPriceCents:a?ak(a,s,m):null,currency:s}},[r,e])},exports.useSubscription=dr,exports.useSubscriptionContext=Sr,exports.useSubscriptionManagement=hr,exports.useTrialStatus=function(){const{response:e}=Sr();return t.useMemo(()=>{const t=e?.subscription;if(!t||"trialing"!==t.subscriptionStatus)return{isTrialing:!1,daysRemaining:0,trialEndsAt:null,trialStartedAt:null,isTrialEnding:!1};const r=qj(t.trialEnd)??qj(t.stripeCurrentPeriodEnd),n=qj(t.trialStart),a=r?Math.max(0,Math.ceil((r.getTime()-Date.now())/864e5)):0;return{isTrialing:!0,daysRemaining:a,trialEndsAt:r,trialStartedAt:n,isTrialEnding:a<=3}},[e])},exports.useUpdateSubscription=mr,exports.useUsageLogs=(e,r,n)=>{const{api:a}=sr(),[s,o]=t.useState([]),[i,l]=t.useState(0),[c,d]=t.useState(0),[u,f]=t.useState(1),[p,m]=t.useState(!1),[h,g]=t.useState(!1),[b,y]=t.useState(!1),[x,v]=t.useState(null),w=n?.from,S=n?.to,k=n?.source,j=n?.page,N=n?.limit,E=t.useCallback(async()=>{if(!e)return o([]),l(0),d(0),f(1),m(!1),void g(!1);y(!0),v(null);try{const t={...r&&{quotaSlug:r},...w&&{from:w},...S&&{to:S},...k&&{source:k},...j&&{page:j},...N&&{limit:N}},n=await a.getUsageLogs(e,t);o(n.docs||[]),l(n.totalDocs||0),d(n.totalPages||0),f(n.page||1),m(n.hasNextPage||!1),g(n.hasPrevPage||!1)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch usage logs";v(n),De(t,{component:"useUsageLogs",action:"fetchLogs",metadata:{workspaceId:e,quotaSlug:r}})}finally{y(!1)}},[a,e,r,w,S,k,j,N]);return t.useEffect(()=>{E()},[E]),{logs:s,totalDocs:i,totalPages:c,page:u,hasNextPage:p,hasPrevPage:h,loading:b,error:x,refetch:E}},exports.useUserAttributes=function(){const e=t.useContext(os);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=_f;
30
30
  //# sourceMappingURL=index.js.map