@elizaos/cli 1.0.0-alpha.19 → 1.0.0-alpha.20

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.
@@ -261,6 +261,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${r.do
261
261
  * @license MIT
262
262
  */var g0="popstate";function _j(t={}){function r(s,o){let{pathname:c,search:f,hash:d}=s.location;return Cm("",{pathname:c,search:f,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function a(s,o){return typeof o=="string"?o:$l(o)}return zj(r,a,null,t)}function We(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function $n(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function Lj(){return Math.random().toString(36).substring(2,10)}function v0(t,r){return{usr:t.state,key:t.key,idx:r}}function Cm(t,r,a=null,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof r=="string"?Rs(r):r,state:a,key:r&&r.key||s||Lj()}}function $l({pathname:t="/",search:r="",hash:a=""}){return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(t+=a.charAt(0)==="#"?a:"#"+a),t}function Rs(t){let r={};if(t){let a=t.indexOf("#");a>=0&&(r.hash=t.substring(a),t=t.substring(0,a));let s=t.indexOf("?");s>=0&&(r.search=t.substring(s),t=t.substring(0,s)),t&&(r.pathname=t)}return r}function zj(t,r,a,s={}){let{window:o=document.defaultView,v5Compat:c=!1}=s,f=o.history,d="POP",m=null,p=v();p==null&&(p=0,f.replaceState({...f.state,idx:p},""));function v(){return(f.state||{idx:null}).idx}function b(){d="POP";let w=v(),C=w==null?null:w-p;p=w,m&&m({action:d,location:S.location,delta:C})}function x(w,C){d="PUSH";let N=Cm(S.location,w,C);p=v()+1;let O=v0(N,p),_=S.createHref(N);try{f.pushState(O,"",_)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;o.location.assign(_)}c&&m&&m({action:d,location:S.location,delta:1})}function E(w,C){d="REPLACE";let N=Cm(S.location,w,C);p=v();let O=v0(N,p),_=S.createHref(N);f.replaceState(O,"",_),c&&m&&m({action:d,location:S.location,delta:0})}function T(w){let C=o.location.origin!=="null"?o.location.origin:o.location.href,N=typeof w=="string"?w:$l(w);return N=N.replace(/ $/,"%20"),We(C,`No window.location.(origin|href) available to create URL for href: ${N}`),new URL(N,C)}let S={get action(){return d},get location(){return t(o,f)},listen(w){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(g0,b),m=w,()=>{o.removeEventListener(g0,b),m=null}},createHref(w){return r(o,w)},createURL:T,encodeLocation(w){let C=T(w);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:E,go(w){return f.go(w)}};return S}function Yw(t,r,a="/"){return Pj(t,r,a,!1)}function Pj(t,r,a,s){let o=typeof r=="string"?Rs(r):r,c=Tr(o.pathname||"/",a);if(c==null)return null;let f=Fw(t);Uj(f);let d=null;for(let m=0;d==null&&m<f.length;++m){let p=Qj(c);d=Fj(f[m],p,s)}return d}function Fw(t,r=[],a=[],s=""){let o=(c,f,d)=>{let m={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};m.relativePath.startsWith("/")&&(We(m.relativePath.startsWith(s),`Absolute route path "${m.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(s.length));let p=Sr([s,m.relativePath]),v=a.concat(m);c.children&&c.children.length>0&&(We(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Fw(c.children,r,v,p)),!(c.path==null&&!c.index)&&r.push({path:p,score:Vj(p,c.index),routesMeta:v})};return t.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,f);else for(let m of Gw(c.path))o(c,f,m)}),r}function Gw(t){let r=t.split("/");if(r.length===0)return[];let[a,...s]=r,o=a.endsWith("?"),c=a.replace(/\?$/,"");if(s.length===0)return o?[c,""]:[c];let f=Gw(s.join("/")),d=[];return d.push(...f.map(m=>m===""?c:[c,m].join("/"))),o&&d.push(...f),d.map(m=>t.startsWith("/")&&m===""?"/":m)}function Uj(t){t.sort((r,a)=>r.score!==a.score?a.score-r.score:Yj(r.routesMeta.map(s=>s.childrenIndex),a.routesMeta.map(s=>s.childrenIndex)))}var kj=/^:[\w-]+$/,Hj=3,$j=2,qj=1,Bj=10,Ij=-2,y0=t=>t==="*";function Vj(t,r){let a=t.split("/"),s=a.length;return a.some(y0)&&(s+=Ij),r&&(s+=$j),a.filter(o=>!y0(o)).reduce((o,c)=>o+(kj.test(c)?Hj:c===""?qj:Bj),s)}function Yj(t,r){return t.length===r.length&&t.slice(0,-1).every((s,o)=>s===r[o])?t[t.length-1]-r[r.length-1]:0}function Fj(t,r,a=!1){let{routesMeta:s}=t,o={},c="/",f=[];for(let d=0;d<s.length;++d){let m=s[d],p=d===s.length-1,v=c==="/"?r:r.slice(c.length)||"/",b=Xc({path:m.relativePath,caseSensitive:m.caseSensitive,end:p},v),x=m.route;if(!b&&p&&a&&!s[s.length-1].route.index&&(b=Xc({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(o,b.params),f.push({params:o,pathname:Sr([c,b.pathname]),pathnameBase:Zj(Sr([c,b.pathnameBase])),route:x}),b.pathnameBase!=="/"&&(c=Sr([c,b.pathnameBase]))}return f}function Xc(t,r){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[a,s]=Gj(t.path,t.caseSensitive,t.end),o=r.match(a);if(!o)return null;let c=o[0],f=c.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:s.reduce((p,{paramName:v,isOptional:b},x)=>{if(v==="*"){let T=d[x]||"";f=c.slice(0,c.length-T.length).replace(/(.)\/+$/,"$1")}const E=d[x];return b&&!E?p[v]=void 0:p[v]=(E||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:f,pattern:t}}function Gj(t,r=!1,a=!0){$n(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let s=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,d,m)=>(s.push({paramName:d,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,r?void 0:"i"),s]}function Qj(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return $n(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),t}}function Tr(t,r){if(r==="/")return t;if(!t.toLowerCase().startsWith(r.toLowerCase()))return null;let a=r.endsWith("/")?r.length-1:r.length,s=t.charAt(a);return s&&s!=="/"?null:t.slice(a)||"/"}function Xj(t,r="/"){let{pathname:a,search:s="",hash:o=""}=typeof t=="string"?Rs(t):t;return{pathname:a?a.startsWith("/")?a:Kj(a,r):r,search:Jj(s),hash:eD(o)}}function Kj(t,r){let a=r.replace(/\/+$/,"").split("/");return t.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function ih(t,r,a,s){return`Cannot include a '${t}' character in a manually specified \`to.${r}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Wj(t){return t.filter((r,a)=>a===0||r.route.path&&r.route.path.length>0)}function Qw(t){let r=Wj(t);return r.map((a,s)=>s===r.length-1?a.pathname:a.pathnameBase)}function Xw(t,r,a,s=!1){let o;typeof t=="string"?o=Rs(t):(o={...t},We(!o.pathname||!o.pathname.includes("?"),ih("?","pathname","search",o)),We(!o.pathname||!o.pathname.includes("#"),ih("#","pathname","hash",o)),We(!o.search||!o.search.includes("#"),ih("#","search","hash",o)));let c=t===""||o.pathname==="",f=c?"/":o.pathname,d;if(f==null)d=a;else{let b=r.length-1;if(!s&&f.startsWith("..")){let x=f.split("/");for(;x[0]==="..";)x.shift(),b-=1;o.pathname=x.join("/")}d=b>=0?r[b]:"/"}let m=Xj(o,d),p=f&&f!=="/"&&f.endsWith("/"),v=(c||f===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(p||v)&&(m.pathname+="/"),m}var Sr=t=>t.join("/").replace(/\/\/+/g,"/"),Zj=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Jj=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,eD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function tD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var Kw=["POST","PUT","PATCH","DELETE"];new Set(Kw);var nD=["GET",...Kw];new Set(nD);var Ts=y.createContext(null);Ts.displayName="DataRouter";var mu=y.createContext(null);mu.displayName="DataRouterState";var Ww=y.createContext({isTransitioning:!1});Ww.displayName="ViewTransition";var rD=y.createContext(new Map);rD.displayName="Fetchers";var aD=y.createContext(null);aD.displayName="Await";var Vn=y.createContext(null);Vn.displayName="Navigation";var Jl=y.createContext(null);Jl.displayName="Location";var Yn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Yn.displayName="Route";var fp=y.createContext(null);fp.displayName="RouteError";function iD(t,{relative:r}={}){We(eo(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:s}=y.useContext(Vn),{hash:o,pathname:c,search:f}=no(t,{relative:r}),d=c;return a!=="/"&&(d=c==="/"?a:Sr([a,c])),s.createHref({pathname:d,search:f,hash:o})}function eo(){return y.useContext(Jl)!=null}function pa(){return We(eo(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Jl).location}var Zw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Jw(t){y.useContext(Vn).static||y.useLayoutEffect(t)}function to(){let{isDataRoute:t}=y.useContext(Yn);return t?yD():sD()}function sD(){We(eo(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Ts),{basename:r,navigator:a}=y.useContext(Vn),{matches:s}=y.useContext(Yn),{pathname:o}=pa(),c=JSON.stringify(Qw(s)),f=y.useRef(!1);return Jw(()=>{f.current=!0}),y.useCallback((m,p={})=>{if($n(f.current,Zw),!f.current)return;if(typeof m=="number"){a.go(m);return}let v=Xw(m,JSON.parse(c),o,p.relative==="path");t==null&&r!=="/"&&(v.pathname=v.pathname==="/"?r:Sr([r,v.pathname])),(p.replace?a.replace:a.push)(v,p.state,p)},[r,a,c,o,t])}y.createContext(null);function eE(){let{matches:t}=y.useContext(Yn),r=t[t.length-1];return r?r.params:{}}function no(t,{relative:r}={}){let{matches:a}=y.useContext(Yn),{pathname:s}=pa(),o=JSON.stringify(Qw(a));return y.useMemo(()=>Xw(t,JSON.parse(o),s,r==="path"),[t,o,s,r])}function lD(t,r){return tE(t,r)}function tE(t,r,a,s){var N;We(eo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o,static:c}=y.useContext(Vn),{matches:f}=y.useContext(Yn),d=f[f.length-1],m=d?d.params:{},p=d?d.pathname:"/",v=d?d.pathnameBase:"/",b=d&&d.route;{let O=b&&b.path||"";nE(p,!b||O.endsWith("*")||O.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${O}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
263
263
 
264
- Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let x=pa(),E;if(r){let O=typeof r=="string"?Rs(r):r;We(v==="/"||((N=O.pathname)==null?void 0:N.startsWith(v)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${v}" but pathname "${O.pathname}" was given in the \`location\` prop.`),E=O}else E=x;let T=E.pathname||"/",S=T;if(v!=="/"){let O=v.replace(/^\//,"").split("/");S="/"+T.replace(/^\//,"").split("/").slice(O.length).join("/")}let w=!c&&a&&a.matches&&a.matches.length>0?a.matches:Yw(t,{pathname:S});$n(b||w!=null,`No routes matched location "${E.pathname}${E.search}${E.hash}" `),$n(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${E.pathname}${E.search}${E.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=dD(w&&w.map(O=>Object.assign({},O,{params:Object.assign({},m,O.params),pathname:Sr([v,o.encodeLocation?o.encodeLocation(O.pathname).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?v:Sr([v,o.encodeLocation?o.encodeLocation(O.pathnameBase).pathname:O.pathnameBase])})),f,a,s);return r&&C?y.createElement(Jl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...E},navigationType:"POP"}},C):C}function oD(){let t=vD(),r=tD(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},f=null;return console.error("Error handled by React Router default ErrorBoundary:",t),f=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:c},"ErrorBoundary")," or"," ",y.createElement("code",{style:c},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},r),a?y.createElement("pre",{style:o},a):null,f)}var cD=y.createElement(oD,null),uD=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?y.createElement(Yn.Provider,{value:this.props.routeContext},y.createElement(fp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function fD({routeContext:t,match:r,children:a}){let s=y.useContext(Ts);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(Yn.Provider,{value:t},a)}function dD(t,r=[],a=null,s=null){if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let o=t,c=a==null?void 0:a.errors;if(c!=null){let m=o.findIndex(p=>p.route.id&&(c==null?void 0:c[p.route.id])!==void 0);We(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,m+1))}let f=!1,d=-1;if(a)for(let m=0;m<o.length;m++){let p=o[m];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=m),p.route.id){let{loaderData:v,errors:b}=a,x=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||x){f=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((m,p,v)=>{let b,x=!1,E=null,T=null;a&&(b=c&&p.route.id?c[p.route.id]:void 0,E=p.route.errorElement||cD,f&&(d<0&&v===0?(nE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,T=null):d===v&&(x=!0,T=p.route.hydrateFallbackElement||null)));let S=r.concat(o.slice(0,v+1)),w=()=>{let C;return b?C=E:x?C=T:p.route.Component?C=y.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=m,y.createElement(fD,{match:p,routeContext:{outlet:m,matches:S,isDataRoute:a!=null},children:C})};return a&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?y.createElement(uD,{location:a.location,revalidation:a.revalidation,component:E,error:b,children:w(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):w()},null)}function dp(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hD(t){let r=y.useContext(Ts);return We(r,dp(t)),r}function mD(t){let r=y.useContext(mu);return We(r,dp(t)),r}function pD(t){let r=y.useContext(Yn);return We(r,dp(t)),r}function hp(t){let r=pD(t),a=r.matches[r.matches.length-1];return We(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function gD(){return hp("useRouteId")}function vD(){var s;let t=y.useContext(fp),r=mD("useRouteError"),a=hp("useRouteError");return t!==void 0?t:(s=r.errors)==null?void 0:s[a]}function yD(){let{router:t}=hD("useNavigate"),r=hp("useNavigate"),a=y.useRef(!1);return Jw(()=>{a.current=!0}),y.useCallback(async(o,c={})=>{$n(a.current,Zw),a.current&&(typeof o=="number"?t.navigate(o):await t.navigate(o,{fromRouteId:r,...c}))},[t,r])}var b0={};function nE(t,r,a){!r&&!b0[t]&&(b0[t]=!0,$n(!1,a))}y.memo(bD);function bD({routes:t,future:r,state:a}){return tE(t,void 0,a,r)}function qa(t){We(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function xD({basename:t="/",children:r=null,location:a,navigationType:s="POP",navigator:o,static:c=!1}){We(!eo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=t.replace(/^\/*/,"/"),d=y.useMemo(()=>({basename:f,navigator:o,static:c,future:{}}),[f,o,c]);typeof a=="string"&&(a=Rs(a));let{pathname:m="/",search:p="",hash:v="",state:b=null,key:x="default"}=a,E=y.useMemo(()=>{let T=Tr(m,f);return T==null?null:{location:{pathname:T,search:p,hash:v,state:b,key:x},navigationType:s}},[f,m,p,v,b,x,s]);return $n(E!=null,`<Router basename="${f}"> is not able to match the URL "${m}${p}${v}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:y.createElement(Vn.Provider,{value:d},y.createElement(Jl.Provider,{children:r,value:E}))}function SD({children:t,location:r}){return lD(Am(t),r)}function Am(t,r=[]){let a=[];return y.Children.forEach(t,(s,o)=>{if(!y.isValidElement(s))return;let c=[...r,o];if(s.type===y.Fragment){a.push.apply(a,Am(s.props.children,c));return}We(s.type===qa,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),We(!s.props.index||!s.props.children,"An index route cannot have child routes.");let f={id:s.props.id||c.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(f.children=Am(s.props.children,c)),a.push(f)}),a}var Pc="get",Uc="application/x-www-form-urlencoded";function pu(t){return t!=null&&typeof t.tagName=="string"}function wD(t){return pu(t)&&t.tagName.toLowerCase()==="button"}function ED(t){return pu(t)&&t.tagName.toLowerCase()==="form"}function RD(t){return pu(t)&&t.tagName.toLowerCase()==="input"}function TD(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function CD(t,r){return t.button===0&&(!r||r==="_self")&&!TD(t)}var Tc=null;function AD(){if(Tc===null)try{new FormData(document.createElement("form"),0),Tc=!1}catch{Tc=!0}return Tc}var ND=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sh(t){return t!=null&&!ND.has(t)?($n(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Uc}"`),null):t}function OD(t,r){let a,s,o,c,f;if(ED(t)){let d=t.getAttribute("action");s=d?Tr(d,r):null,a=t.getAttribute("method")||Pc,o=sh(t.getAttribute("enctype"))||Uc,c=new FormData(t)}else if(wD(t)||RD(t)&&(t.type==="submit"||t.type==="image")){let d=t.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||d.getAttribute("action");if(s=m?Tr(m,r):null,a=t.getAttribute("formmethod")||d.getAttribute("method")||Pc,o=sh(t.getAttribute("formenctype"))||sh(d.getAttribute("enctype"))||Uc,c=new FormData(d,t),!AD()){let{name:p,type:v,value:b}=t;if(v==="image"){let x=p?`${p}.`:"";c.append(`${x}x`,"0"),c.append(`${x}y`,"0")}else p&&c.append(p,b)}}else{if(pu(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Pc,s=null,o=Uc,f=t}return c&&o==="text/plain"&&(f=c,c=void 0),{action:s,method:a.toLowerCase(),encType:o,formData:c,body:f}}function mp(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}async function MD(t,r){if(t.id in r)return r[t.id];try{let a=await import(t.module);return r[t.id]=a,a}catch(a){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function jD(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function DD(t,r,a){let s=await Promise.all(t.map(async o=>{let c=r.routes[o.route.id];if(c){let f=await MD(c,a);return f.links?f.links():[]}return[]}));return PD(s.flat(1).filter(jD).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function x0(t,r,a,s,o,c){let f=(m,p)=>a[p]?m.route.id!==a[p].route.id:!0,d=(m,p)=>{var v;return a[p].pathname!==m.pathname||((v=a[p].route.path)==null?void 0:v.endsWith("*"))&&a[p].params["*"]!==m.params["*"]};return c==="assets"?r.filter((m,p)=>f(m,p)||d(m,p)):c==="data"?r.filter((m,p)=>{var b;let v=s.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(f(m,p)||d(m,p))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((b=a[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function _D(t,r,{includeHydrateFallback:a}={}){return LD(t.map(s=>{let o=r.routes[s.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function LD(t){return[...new Set(t)]}function zD(t){let r={},a=Object.keys(t).sort();for(let s of a)r[s]=t[s];return r}function PD(t,r){let a=new Set;return new Set(r),t.reduce((s,o)=>{let c=JSON.stringify(zD(o));return a.has(c)||(a.add(c),s.push({key:c,link:o})),s},[])}function UD(t,r){let a=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return a.pathname==="/"?a.pathname="_root.data":r&&Tr(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.data`:a.pathname=`${a.pathname.replace(/\/$/,"")}.data`,a}function rE(){let t=y.useContext(Ts);return mp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function kD(){let t=y.useContext(mu);return mp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var pp=y.createContext(void 0);pp.displayName="FrameworkContext";function aE(){let t=y.useContext(pp);return mp(t,"You must render this element inside a <HydratedRouter> element"),t}function HD(t,r){let a=y.useContext(pp),[s,o]=y.useState(!1),[c,f]=y.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:p,onMouseLeave:v,onTouchStart:b}=r,x=y.useRef(null);y.useEffect(()=>{if(t==="render"&&f(!0),t==="viewport"){let S=C=>{C.forEach(N=>{f(N.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return x.current&&w.observe(x.current),()=>{w.disconnect()}}},[t]),y.useEffect(()=>{if(s){let S=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(S)}}},[s]);let E=()=>{o(!0)},T=()=>{o(!1),f(!1)};return a?t!=="intent"?[c,x,{}]:[c,x,{onFocus:Ol(d,E),onBlur:Ol(m,T),onMouseEnter:Ol(p,E),onMouseLeave:Ol(v,T),onTouchStart:Ol(b,E)}]:[!1,x,{}]}function Ol(t,r){return a=>{t&&t(a),a.defaultPrevented||r(a)}}function $D({page:t,...r}){let{router:a}=rE(),s=y.useMemo(()=>Yw(a.routes,t,a.basename),[a.routes,t,a.basename]);return s?y.createElement(BD,{page:t,matches:s,...r}):null}function qD(t){let{manifest:r,routeModules:a}=aE(),[s,o]=y.useState([]);return y.useEffect(()=>{let c=!1;return DD(t,r,a).then(f=>{c||o(f)}),()=>{c=!0}},[t,r,a]),s}function BD({page:t,matches:r,...a}){let s=pa(),{manifest:o,routeModules:c}=aE(),{basename:f}=rE(),{loaderData:d,matches:m}=kD(),p=y.useMemo(()=>x0(t,r,m,o,s,"data"),[t,r,m,o,s]),v=y.useMemo(()=>x0(t,r,m,o,s,"assets"),[t,r,m,o,s]),b=y.useMemo(()=>{if(t===s.pathname+s.search+s.hash)return[];let T=new Set,S=!1;if(r.forEach(C=>{var O;let N=o.routes[C.route.id];!N||!N.hasLoader||(!p.some(_=>_.route.id===C.route.id)&&C.route.id in d&&((O=c[C.route.id])!=null&&O.shouldRevalidate)||N.hasClientLoader?S=!0:T.add(C.route.id))}),T.size===0)return[];let w=UD(t,f);return S&&T.size>0&&w.searchParams.set("_routes",r.filter(C=>T.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[f,d,s,o,p,r,t,c]),x=y.useMemo(()=>_D(v,o),[v,o]),E=qD(v);return y.createElement(y.Fragment,null,b.map(T=>y.createElement("link",{key:T,rel:"prefetch",as:"fetch",href:T,...a})),x.map(T=>y.createElement("link",{key:T,rel:"modulepreload",href:T,...a})),E.map(({key:T,link:S})=>y.createElement("link",{key:T,...S})))}function ID(...t){return r=>{t.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var iE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{iE&&(window.__reactRouterVersion="7.3.0")}catch{}function VD({basename:t,children:r,window:a}){let s=y.useRef();s.current==null&&(s.current=_j({window:a,v5Compat:!0}));let o=s.current,[c,f]=y.useState({action:o.action,location:o.location}),d=y.useCallback(m=>{y.startTransition(()=>f(m))},[f]);return y.useLayoutEffect(()=>o.listen(d),[o,d]),y.createElement(xD,{basename:t,children:r,location:c.location,navigationType:c.action,navigator:o})}var sE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,lE=y.forwardRef(function({onClick:r,discover:a="render",prefetch:s="none",relative:o,reloadDocument:c,replace:f,state:d,target:m,to:p,preventScrollReset:v,viewTransition:b,...x},E){let{basename:T}=y.useContext(Vn),S=typeof p=="string"&&sE.test(p),w,C=!1;if(typeof p=="string"&&S&&(w=p,iE))try{let U=new URL(window.location.href),K=p.startsWith("//")?new URL(U.protocol+p):new URL(p),te=Tr(K.pathname,T);K.origin===U.origin&&te!=null?p=te+K.search+K.hash:C=!0}catch{$n(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let N=iD(p,{relative:o}),[O,_,L]=HD(s,x),k=GD(p,{replace:f,state:d,target:m,preventScrollReset:v,relative:o,viewTransition:b});function V(U){r&&r(U),U.defaultPrevented||k(U)}let H=y.createElement("a",{...x,...L,href:w||N,onClick:C||c?r:V,ref:ID(E,_),target:m,"data-discover":!S&&a==="render"?"true":void 0});return O&&!S?y.createElement(y.Fragment,null,H,y.createElement($D,{page:N})):H});lE.displayName="Link";var Va=y.forwardRef(function({"aria-current":r="page",caseSensitive:a=!1,className:s="",end:o=!1,style:c,to:f,viewTransition:d,children:m,...p},v){let b=no(f,{relative:p.relative}),x=pa(),E=y.useContext(mu),{navigator:T,basename:S}=y.useContext(Vn),w=E!=null&&ZD(b)&&d===!0,C=T.encodeLocation?T.encodeLocation(b).pathname:b.pathname,N=x.pathname,O=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;a||(N=N.toLowerCase(),O=O?O.toLowerCase():null,C=C.toLowerCase()),O&&S&&(O=Tr(O,S)||O);const _=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let L=N===C||!o&&N.startsWith(C)&&N.charAt(_)==="/",k=O!=null&&(O===C||!o&&O.startsWith(C)&&O.charAt(C.length)==="/"),V={isActive:L,isPending:k,isTransitioning:w},H=L?r:void 0,U;typeof s=="function"?U=s(V):U=[s,L?"active":null,k?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let K=typeof c=="function"?c(V):c;return y.createElement(lE,{...p,"aria-current":H,className:U,ref:v,style:K,to:f,viewTransition:d},typeof m=="function"?m(V):m)});Va.displayName="NavLink";var YD=y.forwardRef(({discover:t="render",fetcherKey:r,navigate:a,reloadDocument:s,replace:o,state:c,method:f=Pc,action:d,onSubmit:m,relative:p,preventScrollReset:v,viewTransition:b,...x},E)=>{let T=KD(),S=WD(d,{relative:p}),w=f.toLowerCase()==="get"?"get":"post",C=typeof d=="string"&&sE.test(d),N=O=>{if(m&&m(O),O.defaultPrevented)return;O.preventDefault();let _=O.nativeEvent.submitter,L=(_==null?void 0:_.getAttribute("formmethod"))||f;T(_||O.currentTarget,{fetcherKey:r,method:L,navigate:a,replace:o,state:c,relative:p,preventScrollReset:v,viewTransition:b})};return y.createElement("form",{ref:E,method:w,action:S,onSubmit:s?m:N,...x,"data-discover":!C&&t==="render"?"true":void 0})});YD.displayName="Form";function FD(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oE(t){let r=y.useContext(Ts);return We(r,FD(t)),r}function GD(t,{target:r,replace:a,state:s,preventScrollReset:o,relative:c,viewTransition:f}={}){let d=to(),m=pa(),p=no(t,{relative:c});return y.useCallback(v=>{if(CD(v,r)){v.preventDefault();let b=a!==void 0?a:$l(m)===$l(p);d(t,{replace:b,state:s,preventScrollReset:o,relative:c,viewTransition:f})}},[m,d,p,a,s,r,t,o,c,f])}var QD=0,XD=()=>`__${String(++QD)}__`;function KD(){let{router:t}=oE("useSubmit"),{basename:r}=y.useContext(Vn),a=gD();return y.useCallback(async(s,o={})=>{let{action:c,method:f,encType:d,formData:m,body:p}=OD(s,r);if(o.navigate===!1){let v=o.fetcherKey||XD();await t.fetch(v,a,o.action||c,{preventScrollReset:o.preventScrollReset,formData:m,body:p,formMethod:o.method||f,formEncType:o.encType||d,flushSync:o.flushSync})}else await t.navigate(o.action||c,{preventScrollReset:o.preventScrollReset,formData:m,body:p,formMethod:o.method||f,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:a,flushSync:o.flushSync,viewTransition:o.viewTransition})},[t,r,a])}function WD(t,{relative:r}={}){let{basename:a}=y.useContext(Vn),s=y.useContext(Yn);We(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),c={...no(t||".",{relative:r})},f=pa();if(t==null){c.search=f.search;let d=new URLSearchParams(c.search),m=d.getAll("index");if(m.some(v=>v==="")){d.delete("index"),m.filter(b=>b).forEach(b=>d.append("index",b));let v=d.toString();c.search=v?`?${v}`:""}}return(!t||t===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:Sr([a,c.pathname])),$l(c)}function ZD(t,r={}){let a=y.useContext(Ww);We(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=oE("useViewTransitionState"),o=no(t,{relative:r.relative});if(!a.isTransitioning)return!1;let c=Tr(a.currentLocation.pathname,s)||a.currentLocation.pathname,f=Tr(a.nextLocation.pathname,s)||a.nextLocation.pathname;return Xc(o.pathname,f)!=null||Xc(o.pathname,c)!=null}new TextEncoder;const JD=ma("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Nm({className:t,variant:r,...a}){return g.jsx("div",{className:le(JD({variant:r}),t),...a})}var e_="Label",cE=y.forwardRef((t,r)=>g.jsx(we.label,{...t,ref:r,onMouseDown:a=>{var o;a.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));cE.displayName=e_;var uE=cE;const t_=ma("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Kc=y.forwardRef(({className:t,...r},a)=>g.jsx(uE,{ref:a,className:le(t_(),t),...r}));Kc.displayName=uE.displayName;const n_=({tag:t,onRemove:r})=>g.jsxs(Nm,{variant:"outline",className:"flex items-center gap-1.5 pr-1.5 text-sm py-1 px-2 transition-colors hover:bg-white hover:text-black dark:hover:text-black",children:[t,g.jsxs(Qe,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(t),className:"hover:bg-muted/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[g.jsx(bs,{className:"h-3 w-3"}),g.jsxs("span",{className:"sr-only",children:["Remove ",t]})]})]}),r_=({tags:t,onRemove:r})=>g.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(a=>g.jsx(n_,{tag:a,onRemove:r},a))}),a_=({value:t,onChange:r,onKeyDown:a})=>g.jsx(vr,{value:t,onChange:r,onKeyDown:a,placeholder:"Type and press Enter to add...",className:le("bg-background",!t&&"text-muted-foreground")});function i_({title:t,data:r,onChange:a}){const[s,o]=y.useState(""),c=d=>{if(d.key==="Enter"){d.preventDefault();const m=s.trim();m&&!r.includes(m)&&(a([...r,m]),o(""))}},f=d=>{a(r.filter(m=>m!==d))};return g.jsxs("div",{className:"space-y-2",children:[g.jsx(Kc,{children:t}),g.jsxs("div",{className:"p-2 bg-card rounded-md border",children:[g.jsx(r_,{tags:r,onRemove:f}),g.jsx(a_,{value:s,onChange:d=>o(d.target.value),onKeyDown:c})]})]})}const gu=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("rounded-xl border bg-card text-card-foreground shadow",t),...r}));gu.displayName="Card";const fE=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("flex flex-col space-y-1.5 p-6",t),...r}));fE.displayName="CardHeader";const dE=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("font-semibold leading-none tracking-tight",t),...r}));dE.displayName="CardTitle";const s_=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("text-sm text-muted-foreground",t),...r}));s_.displayName="CardDescription";const gp=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("p-6 pt-0",t),...r}));gp.displayName="CardContent";const hE=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("flex items-center p-6 pt-0",t),...r}));hE.displayName="CardFooter";function vp(t){const r=t+"CollectionProvider",[a,s]=qn(r),[o,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),f=E=>{const{scope:T,children:S}=E,w=hr.useRef(null),C=hr.useRef(new Map).current;return g.jsx(o,{scope:T,itemMap:C,collectionRef:w,children:S})};f.displayName=r;const d=t+"CollectionSlot",m=hr.forwardRef((E,T)=>{const{scope:S,children:w}=E,C=c(d,S),N=Ue(T,C.collectionRef);return g.jsx(sn,{ref:N,children:w})});m.displayName=d;const p=t+"CollectionItemSlot",v="data-radix-collection-item",b=hr.forwardRef((E,T)=>{const{scope:S,children:w,...C}=E,N=hr.useRef(null),O=Ue(T,N),_=c(p,S);return hr.useEffect(()=>(_.itemMap.set(N,{ref:N,...C}),()=>void _.itemMap.delete(N))),g.jsx(sn,{[v]:"",ref:O,children:w})});b.displayName=p;function x(E){const T=c(t+"CollectionConsumer",E);return hr.useCallback(()=>{const w=T.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${v}]`));return Array.from(T.itemMap.values()).sort((_,L)=>C.indexOf(_.ref.current)-C.indexOf(L.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:f,Slot:m,ItemSlot:b},x,s]}var l_=y.createContext(void 0);function vu(t){const r=y.useContext(l_);return t||r||"ltr"}var lh="rovingFocusGroup.onEntryFocus",o_={bubbles:!1,cancelable:!0},yu="RovingFocusGroup",[Om,mE,c_]=vp(yu),[u_,pE]=qn(yu,[c_]),[f_,d_]=u_(yu),gE=y.forwardRef((t,r)=>g.jsx(Om.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(Om.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(h_,{...t,ref:r})})}));gE.displayName=yu;var h_=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,orientation:s,loop:o=!1,dir:c,currentTabStopId:f,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:p,preventScrollOnEntryFocus:v=!1,...b}=t,x=y.useRef(null),E=Ue(r,x),T=vu(c),[S=null,w]=ei({prop:f,defaultProp:d,onChange:m}),[C,N]=y.useState(!1),O=nt(p),_=mE(a),L=y.useRef(!1),[k,V]=y.useState(0);return y.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(lh,O),()=>H.removeEventListener(lh,O)},[O]),g.jsx(f_,{scope:a,orientation:s,dir:T,loop:o,currentTabStopId:S,onItemFocus:y.useCallback(H=>w(H),[w]),onItemShiftTab:y.useCallback(()=>N(!0),[]),onFocusableItemAdd:y.useCallback(()=>V(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>V(H=>H-1),[]),children:g.jsx(we.div,{tabIndex:C||k===0?-1:0,"data-orientation":s,...b,ref:E,style:{outline:"none",...t.style},onMouseDown:ve(t.onMouseDown,()=>{L.current=!0}),onFocus:ve(t.onFocus,H=>{const U=!L.current;if(H.target===H.currentTarget&&U&&!C){const K=new CustomEvent(lh,o_);if(H.currentTarget.dispatchEvent(K),!K.defaultPrevented){const te=_().filter(j=>j.focusable),se=te.find(j=>j.active),de=te.find(j=>j.id===S),$=[se,de,...te].filter(Boolean).map(j=>j.ref.current);bE($,v)}}L.current=!1}),onBlur:ve(t.onBlur,()=>N(!1))})})}),vE="RovingFocusGroupItem",yE=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,focusable:s=!0,active:o=!1,tabStopId:c,...f}=t,d=yr(),m=c||d,p=d_(vE,a),v=p.currentTabStopId===m,b=mE(a),{onFocusableItemAdd:x,onFocusableItemRemove:E}=p;return y.useEffect(()=>{if(s)return x(),()=>E()},[s,x,E]),g.jsx(Om.ItemSlot,{scope:a,id:m,focusable:s,active:o,children:g.jsx(we.span,{tabIndex:v?0:-1,"data-orientation":p.orientation,...f,ref:r,onMouseDown:ve(t.onMouseDown,T=>{s?p.onItemFocus(m):T.preventDefault()}),onFocus:ve(t.onFocus,()=>p.onItemFocus(m)),onKeyDown:ve(t.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){p.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const S=g_(T,p.orientation,p.dir);if(S!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let C=b().filter(N=>N.focusable).map(N=>N.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const N=C.indexOf(T.currentTarget);C=p.loop?v_(C,N+1):C.slice(N+1)}setTimeout(()=>bE(C))}})})})});yE.displayName=vE;var m_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function p_(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function g_(t,r,a){const s=p_(t.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return m_[s]}function bE(t,r=!1){const a=document.activeElement;for(const s of t)if(s===a||(s.focus({preventScroll:r}),document.activeElement!==a))return}function v_(t,r){return t.map((a,s)=>t[(r+s)%t.length])}var y_=gE,b_=yE,yp="Tabs",[x_,pz]=qn(yp,[pE]),xE=pE(),[S_,bp]=x_(yp),SE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,onValueChange:o,defaultValue:c,orientation:f="horizontal",dir:d,activationMode:m="automatic",...p}=t,v=vu(d),[b,x]=ei({prop:s,onChange:o,defaultProp:c});return g.jsx(S_,{scope:a,baseId:yr(),value:b,onValueChange:x,orientation:f,dir:v,activationMode:m,children:g.jsx(we.div,{dir:v,"data-orientation":f,...p,ref:r})})});SE.displayName=yp;var wE="TabsList",EE=y.forwardRef((t,r)=>{const{__scopeTabs:a,loop:s=!0,...o}=t,c=bp(wE,a),f=xE(a);return g.jsx(y_,{asChild:!0,...f,orientation:c.orientation,dir:c.dir,loop:s,children:g.jsx(we.div,{role:"tablist","aria-orientation":c.orientation,...o,ref:r})})});EE.displayName=wE;var RE="TabsTrigger",TE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,disabled:o=!1,...c}=t,f=bp(RE,a),d=xE(a),m=NE(f.baseId,s),p=OE(f.baseId,s),v=s===f.value;return g.jsx(b_,{asChild:!0,...d,focusable:!o,active:v,children:g.jsx(we.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":p,"data-state":v?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:m,...c,ref:r,onMouseDown:ve(t.onMouseDown,b=>{!o&&b.button===0&&b.ctrlKey===!1?f.onValueChange(s):b.preventDefault()}),onKeyDown:ve(t.onKeyDown,b=>{[" ","Enter"].includes(b.key)&&f.onValueChange(s)}),onFocus:ve(t.onFocus,()=>{const b=f.activationMode!=="manual";!v&&!o&&b&&f.onValueChange(s)})})})});TE.displayName=RE;var CE="TabsContent",AE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,forceMount:o,children:c,...f}=t,d=bp(CE,a),m=NE(d.baseId,s),p=OE(d.baseId,s),v=s===d.value,b=y.useRef(v);return y.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),g.jsx(ln,{present:o||v,children:({present:x})=>g.jsx(we.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!x,id:p,tabIndex:0,...f,ref:r,style:{...t.style,animationDuration:b.current?"0s":void 0},children:x&&c})})});AE.displayName=CE;function NE(t,r){return`${t}-trigger-${r}`}function OE(t,r){return`${t}-content-${r}`}var w_=SE,ME=EE,jE=TE,DE=AE;const E_=w_,_E=y.forwardRef(({className:t,...r},a)=>g.jsx(ME,{ref:a,className:le("inline-flex h-9 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));_E.displayName=ME.displayName;const Mm=y.forwardRef(({className:t,...r},a)=>g.jsx(jE,{ref:a,className:le("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...r}));Mm.displayName=jE.displayName;const jm=y.forwardRef(({className:t,...r},a)=>g.jsx(DE,{ref:a,className:le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));jm.displayName=DE.displayName;const xp=y.forwardRef(({className:t,...r},a)=>g.jsx("textarea",{className:le("flex min-h-[60px] select-none w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...r}));xp.displayName="Textarea";const R_=1,T_=1e6;let oh=0;function C_(){return oh=(oh+1)%Number.MAX_SAFE_INTEGER,oh.toString()}const ch=new Map,S0=t=>{if(ch.has(t))return;const r=setTimeout(()=>{ch.delete(t),Pl({type:"REMOVE_TOAST",toastId:t})},T_);ch.set(t,r)},A_=(t,r)=>{switch(r.type){case"ADD_TOAST":return{...t,toasts:[r.toast,...t.toasts].slice(0,R_)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===r.toast.id?{...a,...r.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=r;if(a)S0(a);else for(const s of t.toasts)S0(s.id);return{...t,toasts:t.toasts.map(s=>s.id===a||a===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return r.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==r.toastId)}}},kc=[];let Hc={toasts:[]};function Pl(t){Hc=A_(Hc,t);for(const r of kc)r(Hc)}function N_({...t}){const r=C_(),a=o=>Pl({type:"UPDATE_TOAST",toast:{...o,id:r}}),s=()=>Pl({type:"DISMISS_TOAST",toastId:r});return Pl({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:o=>{o||s()}}}),{id:r,dismiss:s,update:a}}function xn(){const[t,r]=y.useState(Hc);return y.useEffect(()=>(kc.push(r),()=>{const a=kc.indexOf(r);a>-1&&kc.splice(a,1)}),[]),{...t,toast:N_,dismiss:a=>Pl({type:"DISMISS_TOAST",toastId:a})}}const w0=[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The display name of your character",fieldType:"text",getValue:t=>t.name||""},{title:"Username",name:"username",description:"Unique identifier for your character",fieldType:"text",getValue:t=>t.username||""},{title:"System",name:"system",description:"System prompt for character behavior",fieldType:"textarea",getValue:t=>t.system||""},{title:"Voice Model",name:"settings.voice.model",description:"Voice model used for speech synthesis",fieldType:"text",getValue:t=>{var r,a;return((a=(r=t.settings)==null?void 0:r.voice)==null?void 0:a.model)||""}}]},{sectionTitle:"Content",sectionValue:"content",sectionType:"array",fields:[{title:"Bio",description:"Key information about your character",path:"bio",getData:t=>Array.isArray(t.bio)?t.bio:[]},{title:"Topics",description:"Topics your character is knowledgeable about",path:"topics",getData:t=>t.topics||[]},{title:"Adjectives",description:"Words that describe your character's personality",path:"adjectives",getData:t=>t.adjectives||[]}]},{sectionTitle:"Style",sectionValue:"style",sectionType:"array",fields:[{title:"All",description:"Style rules applied to all interactions",path:"style.all",getData:t=>{var r;return((r=t.style)==null?void 0:r.all)||[]}},{title:"Chat",description:"Style rules for chat interactions",path:"style.chat",getData:t=>{var r;return((r=t.style)==null?void 0:r.chat)||[]}},{title:"Post",description:"Style rules for social media posts",path:"style.post",getData:t=>{var r;return((r=t.style)==null?void 0:r.post)||[]}}]}];function LE({characterValue:t,setCharacterValue:r,title:a,description:s,onSubmit:o,onDelete:c,onReset:f,customComponents:d=[]}){const{toast:m}=xn(),[p,v]=y.useState(!1),b=w=>{const{name:C,value:N,type:O}=w.target,_=w.target.checked;if(C.includes(".")){const L=C.split(".");r(k=>{const V={...k};let H=V;for(let U=0;U<L.length-1;U++)H[L[U]]||(H[L[U]]={}),H=H[L[U]];return H[L[L.length-1]]=O==="checkbox"?_:N,V})}else r(L=>({...L,[C]:O==="checkbox"?_:N}))},x=(w,C)=>{r(N=>{const O={...N},_=w.split(".");let L=O;for(let k=0;k<_.length-1;k++){const V=_[k];(!L[V]||typeof L[V]!="object")&&(L[V]={}),L=L[V]}return L[_[_.length-1]]=C,O})},E=async w=>{w.preventDefault(),v(!0);try{await o(t)}catch(C){m({title:"Error",description:C instanceof Error?C.message:"Failed to update",variant:"destructive"})}finally{v(!1)}},T=w=>g.jsxs("div",{className:"space-y-2",children:[g.jsx(Kc,{htmlFor:w.name,children:w.title}),w.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),w.fieldType==="textarea"?g.jsx(xp,{id:w.name,name:w.name,value:w.getValue(t),onChange:b,className:"min-h-[120px] resize-y"}):w.fieldType==="checkbox"?g.jsx(vr,{id:w.name,name:w.name,type:"checkbox",checked:t[w.name]==="true",onChange:b}):g.jsx(vr,{id:w.name,name:w.name,type:w.fieldType,value:w.getValue(t),onChange:b})]},w.name),S=w=>g.jsxs("div",{className:"space-y-2",children:[g.jsx(Kc,{htmlFor:w.path,children:w.title}),w.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),g.jsx(i_,{data:w.getData(t),onChange:C=>x(w.path,C)})]},w.path);return g.jsxs("div",{className:"container max-w-4xl mx-auto p-6",children:[g.jsx("div",{className:"flex items-center justify-between mb-6",children:g.jsxs("div",{children:[g.jsx("h1",{className:"text-3xl font-bold",children:a}),g.jsx("p",{className:"text-muted-foreground mt-1",children:s})]})}),g.jsxs("form",{onSubmit:E,children:[g.jsxs(E_,{defaultValue:"basic",className:"w-full",children:[g.jsxs(_E,{className:"grid w-full mb-6",style:{gridTemplateColumns:`repeat(${d.length+3}, minmax(0, 1fr))`},children:[w0.map(w=>g.jsx(Mm,{value:w.sectionValue,children:w.sectionTitle},w.sectionValue)),d.map(w=>g.jsx(Mm,{value:`custom-${w.name}`,children:w.name},`custom-${w.name}`))]}),g.jsx(gu,{children:g.jsxs(gp,{className:"p-6",children:[w0.map(w=>g.jsx(jm,{value:w.sectionValue,className:"space-y-6",children:w.sectionType==="input"?w.fields.map(T):w.fields.map(S)},w.sectionValue)),d.map(w=>g.jsx(jm,{value:`custom-${w.name}`,children:w.component},`custom-${w.name}`))]})})]}),g.jsxs("div",{className:"flex justify-between gap-4 mt-6",children:[g.jsx("div",{className:"flex gap-4 text-red-500",children:g.jsx(Qe,{type:"button",variant:"outline",onClick:()=>{c==null||c()},children:"Delete Character"})}),g.jsxs("div",{className:"flex gap-4",children:[g.jsx(Qe,{type:"button",variant:"outline",onClick:()=>{f==null||f()},children:"Reset Changes"}),g.jsx(Qe,{type:"submit",disabled:p,children:p?"Saving...":"Save Changes"})]})]})]})]})}const uh="elizaos-world-id",Ya={getWorldId:()=>{const t=localStorage.getItem(uh);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(uh,r),r},resetWorldId:()=>{const t=crypto.randomUUID();return localStorage.setItem(uh,t),t},getRoomStorageKey:t=>`room-${Ya.getWorldId()}-${t}`},O_="http://localhost:3000",lt=async({url:t,method:r,body:a,headers:s})=>{const o={method:r??"GET",headers:s||{Accept:"application/json","Content-Type":"application/json"}};return(r==="POST"||r==="PUT"||r==="PATCH")&&(a instanceof FormData?(o.headers&&typeof o.headers=="object"&&(o.headers=Object.fromEntries(Object.entries(o.headers).filter(([c])=>c!=="Content-Type"))),o.body=a):o.body=JSON.stringify(a)),fetch(`${O_}${t}`,o).then(async c=>{if(c.headers.get("Content-Type")==="audio/mpeg")return await c.blob();if(!c.ok){const d=await c.text();console.error("Error: ",d);let m="An error occurred.";try{m=JSON.parse(d).message||m}catch{m=d||m}throw new Error(m)}try{return await c.json()}catch(d){return console.error("JSON Parse Error:",d),null}})},Lt={sendMessage:(t,r,a,s)=>{const o=Ya.getWorldId();if(a){const c=new FormData;return c.append("text",r),c.append("name","Anon"),c.append("file",a),s&&c.append("roomId",s),c.append("worldId",o),lt({url:`/agents/${t}/messages`,method:"POST",body:c})}return lt({url:`/agents/${t}/messages`,method:"POST",body:{text:r,name:"Anon",roomId:s||void 0,worldId:o}})},getAgents:()=>lt({url:"/agents"}),getAgent:t=>lt({url:`/agents/${t}`}),tts:(t,r)=>lt({url:`/agents/${t}/speech/generate`,method:"POST",body:{text:r},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),whisper:async(t,r)=>{const a=new FormData;return a.append("file",r,"recording.wav"),lt({url:`/agents/${t}/transcriptions`,method:"POST",body:a})},sendAudioMessage:async(t,r,a)=>{const s=new FormData;if(s.append("file",r,"recording.wav"),a)for(const[o,c]of Object.entries(a))c&&s.append(o,c);return lt({url:`/agents/${t}/audio-messages`,method:"POST",body:s})},speechConversation:async(t,r,a)=>lt({url:`/agents/${t}/speech/conversation`,method:"POST",body:{text:r,...a},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),deleteAgent:t=>lt({url:`/agents/${t}`,method:"DELETE"}),updateAgent:(t,r)=>lt({url:`/agents/${t}`,method:"PATCH",body:r}),createAgent:t=>lt({url:"/agents/",method:"POST",body:t}),startAgent:t=>lt({url:`/agents/${t}`,method:"POST",body:{start:!0}}),stopAgent:t=>lt({url:`/agents/${t}`,method:"PUT"}),getMemories:(t,r,a)=>{const o={worldId:Ya.getWorldId()};return a!=null&&a.limit&&(o.limit=a.limit),a!=null&&a.before&&(o.end=a.before),lt({url:`/agents/${t}/rooms/${r}/memories`,method:"GET",body:o})},getRooms:t=>{const r=Ya.getWorldId();return lt({url:`/agents/${t}/rooms`,method:"GET",body:{worldId:r}})},createRoom:(t,r)=>{const a=Ya.getWorldId();return lt({url:`/agents/${t}/rooms`,method:"POST",body:{name:r,worldId:a}})},getRoom:(t,r)=>lt({url:`/agents/${t}/rooms/${r}`,method:"GET"}),updateRoom:(t,r,a)=>lt({url:`/agents/${t}/rooms/${r}`,method:"PATCH",body:a}),deleteRoom:(t,r)=>lt({url:`/agents/${t}/rooms/${r}`,method:"DELETE"}),getLogs:t=>lt({url:`/logs?level=${t}`,method:"GET"})},M_=jS,j_=zO,D_=DS,zE=y.forwardRef(({className:t,...r},a)=>g.jsx(nu,{ref:a,className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));zE.displayName=nu.displayName;const PE=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(D_,{children:[g.jsx(zE,{}),g.jsxs(ru,{ref:s,className:le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[r,g.jsxs(_S,{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:[g.jsx(bs,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));PE.displayName=ru.displayName;const UE=({className:t,...r})=>g.jsx("div",{className:le("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});UE.displayName="DialogHeader";const kE=y.forwardRef(({className:t,...r},a)=>g.jsx(au,{ref:a,className:le("text-lg font-semibold leading-none tracking-tight",t),...r}));kE.displayName=au.displayName;const __=y.forwardRef(({className:t,...r},a)=>g.jsx(iu,{ref:a,className:le("text-sm text-muted-foreground",t),...r}));__.displayName=iu.displayName;function L_(){return Es({queryKey:["plugins"],queryFn:async()=>(await fetch("https://raw.githubusercontent.com/elizaos-plugins/registry/refs/heads/main/index.json")).json()})}function HE({characterValue:t,setCharacterValue:r}){const{data:a,error:s}=L_(),[o,c]=y.useState(""),[f,d]=y.useState(!1),m=y.useMemo(()=>a?Object.keys(a).map(x=>x.replace(/^@elizaos-plugins\//,"@elizaos/")):[],[a]),p=y.useMemo(()=>Array.isArray(t==null?void 0:t.plugins)?t.plugins:[],[t==null?void 0:t.plugins]),v=y.useMemo(()=>m.filter(x=>!p.includes(x)).filter(x=>x.toLowerCase().includes(o.toLowerCase())),[m,p,o]),b=x=>{r(E=>{const T=Array.isArray(E.plugins)?E.plugins:[],S=T.includes(x)?T.filter(w=>w!==x):[...T,x];return{...E,plugins:S}})};return g.jsx("div",{className:"space-y-6",children:g.jsx("div",{className:"space-y-4",children:g.jsxs("div",{children:[g.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),s?g.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",s.message]}):g.jsxs("div",{className:"space-y-4",children:[p.length>0&&g.jsxs("div",{className:"rounded-md bg-muted p-4",children:[g.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),g.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(x=>g.jsxs(Qe,{type:"button",variant:"ghost",size:"sm",className:"inline-flex items-center rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20 h-auto",onClick:()=>b(x),children:[x," ×"]},x))})]}),g.jsx("div",{className:"space-y-2",children:g.jsxs(M_,{open:f,onOpenChange:d,children:[g.jsx(j_,{asChild:!0,children:g.jsx(Qe,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),g.jsxs(PE,{className:"max-w-[400px]",children:[g.jsx(UE,{children:g.jsx(kE,{children:"Add Plugins"})}),g.jsxs("div",{className:"space-y-4 py-4",children:[g.jsx("div",{className:"space-y-2",children:g.jsx(vr,{type:"search",placeholder:"Search plugins...",value:o,onChange:x=>c(x.target.value)})}),g.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:v.length===0?g.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):v.map(x=>g.jsx(Qe,{variant:"ghost",className:"w-full justify-start font-normal",onClick:()=>{b(x),c(""),d(!1)},children:x},x))})]})]})]})})]})]})})})}function $E({characterValue:t,setCharacterValue:r}){var L;const[a,s]=y.useState(Object.entries(((L=t==null?void 0:t.settings)==null?void 0:L.secrets)||{}).map(([k,V])=>({name:k,value:String(V)}))),[o,c]=y.useState(""),[f,d]=y.useState(""),[m,p]=y.useState(!1),[v,b]=y.useState(null),[x,E]=y.useState(null),[T,S]=y.useState(""),w=y.useRef(null),C=()=>{o&&f&&(s([...a,{name:o,value:f}]),c(""),d(""))},N=k=>{E(k),S(a[k].value),b(null)},O=k=>{const V=[...a];V[k].value=T,s(V),E(null)},_=k=>{s(a.filter((V,H)=>H!==k)),b(null),E(null)};return y.useEffect(()=>{const k=V=>{w.current&&!w.current.contains(V.target)&&b(null)};return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[]),y.useEffect(()=>{r(k=>({...k,settings:{...k.settings,secrets:Object.fromEntries(a.map(({name:V,value:H})=>[V,H]))}}))},[a,r]),g.jsxs("div",{className:"rounded-lg w-full",children:[g.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Environment Settings"}),g.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-end w-full pb-4",children:[g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx("label",{htmlFor:"secret-name",className:"ml-2 text-xs font-medium text-gray-400",children:"NAME"}),g.jsx(vr,{id:"secret-name",placeholder:"VARIABLE_NAME",value:o,onChange:k=>c(k.target.value)})]}),g.jsxs("div",{className:"flex flex-col gap-1 relative",children:[g.jsx("label",{htmlFor:"secret-value",className:"ml-2 text-xs font-medium text-gray-400",children:"VALUE"}),g.jsxs("div",{className:"relative",children:[g.jsx(vr,{id:"secret-value",type:m?"text":"password",placeholder:"i9ju23nfsdf56",value:f,onChange:k=>d(k.target.value),className:"pr-10"}),g.jsx("div",{className:"absolute inset-y-0 right-3 flex items-center cursor-pointer text-gray-500",onClick:()=>p(!m),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&p(!m)},children:m?g.jsx(FO,{}):g.jsx(GO,{})})]})]}),g.jsx(Qe,{className:"shrink-0",onClick:C,children:"Add"})]}),a.length>0&&g.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 mt-6 font-medium text-gray-400 border-b pb-2 ml-1",children:[g.jsx("div",{children:"Name"}),g.jsx("div",{children:"Value"}),g.jsx("div",{children:"Action"})]}),g.jsx("div",{className:"mt-2",children:a.map((k,V)=>g.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-center border-b py-2 ml-1 relative",children:[g.jsx("div",{children:k.name}),g.jsx("div",{children:x===V?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(vr,{value:T,onChange:H=>S(H.target.value),className:"w-full"}),g.jsx(Qe,{variant:"ghost",onClick:()=>O(V),children:g.jsx(Xm,{className:"w-5 h-5 text-green-500"})}),g.jsx(Qe,{variant:"ghost",onClick:()=>E(null),children:g.jsx(bs,{className:"w-5 h-5 text-red-500"})})]}):g.jsx("div",{className:"truncate text-gray-500",children:"Encrypted"})}),g.jsxs("div",{className:"relative",children:[g.jsx(Qe,{variant:"ghost",className:"p-2 text-gray-500",onClick:()=>b(v===V?null:V),children:g.jsx(YO,{className:"w-5 h-5"})}),v===V&&g.jsxs("div",{className:"absolute right-0 -top-2 mt-2 w-24 bg-muted border rounded shadow-md z-10",ref:w,children:[g.jsx("button",{className:"w-full px-4 py-2 text-left hover:opacity-50",onClick:()=>N(V),type:"button",children:"Edit"}),g.jsx("div",{className:"w-full px-4 py-2 text-left text-red-500 hover:opacity-50 cursor-pointer",onClick:()=>_(V),children:"Remove"})]})]})]},V))})]})}const E0={name:"",username:"",system:"",bio:[],topics:[],adjectives:[]};function qE(){const t=to(),{toast:r}=xn(),a=In(),[s,o]=y.useState({...E0}),c=d=>{var m,p,v;return{...d,bio:d.bio??[],messageExamples:d.messageExamples??[],postExamples:d.postExamples??[],topics:d.topics??[],adjectives:d.adjectives??[],plugins:d.plugins??[],style:{all:((m=d.style)==null?void 0:m.all)??[],chat:((p=d.style)==null?void 0:p.chat)??[],post:((v=d.style)==null?void 0:v.post)??[]}}},f=async d=>{try{const m=c(d);await Lt.createAgent({characterJson:m}),a.invalidateQueries({queryKey:["characters"]}),r({title:"Success",description:"Character created successfully!"}),a.invalidateQueries({queryKey:["agents"]}),t("/")}catch(m){r({title:"Error",description:m instanceof Error?m.message:"Failed to create character",variant:"destructive"})}};return g.jsx(LE,{characterValue:s,setCharacterValue:o,title:"Character Settings",description:"Configure your AI character's behavior and capabilities",onSubmit:f,onReset:()=>o(E0),onDelete:()=>{t("/")},isAgent:!0,customComponents:[{name:"Plugins",component:g.jsx(HE,{characterValue:s,setCharacterValue:o})},{name:"Secret",component:g.jsx($E,{characterValue:s,setCharacterValue:o})}]})}const kn={FREQUENT:30*1e3,STANDARD:2*60*1e3,RARE:10*60*1e3,NEVER:Number.POSITIVE_INFINITY},BE=()=>{const t=typeof navigator<"u"&&"connection"in navigator?navigator.connection:null;return{isOffline:typeof navigator<"u"&&!navigator.onLine,effectiveType:(t==null?void 0:t.effectiveType)||"unknown",saveData:(t==null?void 0:t.saveData)||!1}};function IE(t={}){const r=BE();return Es({queryKey:["agents"],queryFn:()=>Lt.getAgents(),staleTime:kn.FREQUENT,refetchInterval:r.isOffline?!1:kn.FREQUENT,refetchIntervalInBackground:!1,...!r.isOffline&&r.effectiveType==="slow-2g"&&{refetchInterval:kn.STANDARD},...t})}function z_(t,r={}){const a=BE();return Es({queryKey:["agent",t],queryFn:()=>Lt.getAgent(t||""),staleTime:kn.FREQUENT,enabled:!!t,refetchInterval:!a.isOffline&&t?kn.FREQUENT:!1,refetchIntervalInBackground:!1,...!a.isOffline&&a.effectiveType==="slow-2g"&&{refetchInterval:kn.STANDARD},...r})}function P_(){const t=In(),{toast:r}=xn();return Zl({mutationFn:async a=>{try{return await Lt.startAgent(a)}catch(s){if(s instanceof Error){if(s.message.includes("network"))throw new Error("Network error: Please check your connection and try again.");if(s.message.includes("already running"))throw new Error("Agent is already running.")}throw s}},onMutate:async a=>(r({title:"Starting Agent",description:"Initializing agent..."}),{agentId:a}),onSuccess:a=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["active-agents"]}),a!=null&&a.id&&t.invalidateQueries({queryKey:["agent",a.id]}),r({title:"Agent Started",description:`${(a==null?void 0:a.name)||"Agent"} is now running`})},onError:a=>{const s=a instanceof Error?a.message:"Failed to start agent";r({title:"Error Starting Agent",description:`${s}. Please try again.`,variant:"destructive"})}})}function U_(){const t=In(),{toast:r}=xn();return Zl({mutationFn:a=>Lt.stopAgent(a),onMutate:async a=>{const s=t.getQueryData(["agent",a]);s&&r({title:"Stopping Agent",description:`Stopping ${s.name}...`})},onSuccess:(a,s)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",s]}),r({title:"Agent Stopped",description:"The agent has been successfully stopped"})},onError:(a,s)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",s]}),r({title:"Error",description:a instanceof Error?a.message:"Failed to stop agent",variant:"destructive"})}})}function k_(t){const r=In(),a=Ya.getWorldId();return{messages:r.getQueryData(["messages",t,a])||[]}}const H_="1.0.0-alpha.18",Ji={version:H_};function $_(){const[t,r]=y.useState(null),[a,s]=y.useState(!0),[o,c]=y.useState(typeof navigator<"u"?navigator.onLine:!0),[f,d]=y.useState(!1),m=In(),[p,v]=y.useState(Date.now()),b=y.useRef(0),x=y.useRef(Date.now());y.useEffect(()=>{const k=()=>{s(document.visibilityState==="visible"),document.visibilityState==="visible"&&(b.current=0,Date.now()-p>1e4&&m.invalidateQueries({queryKey:["status"]}))},V=()=>{c(navigator.onLine),navigator.onLine&&(b.current=0,m.invalidateQueries({queryKey:["status"]}))};return document.addEventListener("visibilitychange",k),window.addEventListener("online",V),window.addEventListener("offline",V),s(document.visibilityState==="visible"),()=>{document.removeEventListener("visibilitychange",k),window.removeEventListener("online",V),window.removeEventListener("offline",V)}},[m,p]);const T=Es({queryKey:["status"],queryFn:async()=>{try{const k=performance.now(),V=await Lt.getAgents(),H=performance.now();return b.current=0,x.current=Date.now(),r(H-k),v(Date.now()),V}catch(k){throw b.current+=1,console.error("Connection check failed:",k),k}},refetchInterval:o?b.current>0?Math.min(5e3*2**(b.current-1),6e4):a?3e3:15e3:!1,retry:3,retryDelay:k=>Math.min(1e3*1.5**k,1e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0,staleTime:500,gcTime:kn.STANDARD}),S=(T==null?void 0:T.isSuccess)&&!(T!=null&&T.isError),w=(T==null?void 0:T.isRefetching)||(T==null?void 0:T.isPending),C=S===!1&&b.current>5&&Date.now()-x.current>6e4,N=()=>o?C?"bg-yellow-600":w?"bg-muted-foreground":S?"bg-green-600":"bg-red-600":"bg-orange-600",O=()=>o?C?"Reconnecting...":w?"Connecting...":S?"Connected":"Disconnected":"Offline",_=()=>o?C?"text-yellow-600":w?"text-muted-foreground":S?"text-green-600":"text-red-600":"text-orange-600",L=()=>{b.current=0,m.invalidateQueries({queryKey:["agents"]}),m.invalidateQueries({queryKey:["status"]})};return g.jsx(mr,{children:g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx(Ia,{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:L,children:g.jsx("div",{className:"flex flex-col gap-1 select-none transition-all duration-200",children:g.jsxs("div",{className:"flex items-center gap-1",children:[f?g.jsx(e2,{className:"h-3.5 w-3.5 text-muted-foreground animate-pulse"}):g.jsx("div",{className:le(["h-2.5 w-2.5 rounded-full",N()])}),g.jsx("span",{className:le(["text-xs",f?"text-muted-foreground":_()]),children:f?"Refresh":O()})]})})})}),S&&!f?g.jsx(Un,{side:"top",children:g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(HO,{className:"size-4"}),g.jsxs("span",{children:[t==null?void 0:t.toFixed(2)," ms"]})]})}):null]})})}function q_(){const t=pa(),{data:{data:r}={},isPending:a}=IE();return g.jsxs(Ew,{className:"bg-background",children:[g.jsx(Tw,{className:"pb-4",children:g.jsx(Lc,{children:g.jsx(mr,{children:g.jsx(Ia,{size:"lg",asChild:!0,children:g.jsxs(Va,{to:"/",className:"px-6 py-4",children:[g.jsx("img",{alt:"elizaos-icon",src:"/elizaos-icon.png",width:"100%",height:"100%",className:"size-9"}),g.jsxs("div",{className:"flex flex-col leading-none ",children:[g.jsx("span",{className:"font-semibold text-lg",children:"ElizaOS"}),g.jsxs("span",{className:"text-sm -mt-0.5 text-muted-foreground",children:["v",Ji==null?void 0:Ji.version]})]})]})})})})}),g.jsx(Aw,{children:g.jsxs(Nw,{children:[g.jsx(Ow,{className:"px-6 py-2 text-sm font-medium text-muted-foreground",children:g.jsx(Va,{to:"/",children:"AGENTS"})}),g.jsx(Mw,{className:"px-2",children:g.jsx(Lc,{children:a?g.jsx("div",{children:Array.from({length:5}).map((s,o)=>g.jsx(mr,{children:g.jsx(jw,{})},`skeleton-item-${o}`))}):g.jsx("div",{children:(()=>{const s=[...(r==null?void 0:r.agents)||[]].sort((f,d)=>f.enabled&&!d.enabled?-1:!f.enabled&&d.enabled?1:f.name.localeCompare(d.name)),o=s.filter(f=>f.status==="active"),c=s.filter(f=>f.status==="inactive");return g.jsxs(g.Fragment,{children:[o.length>0&&g.jsx("div",{className:"px-4 py-2 mt-4",children:g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx("div",{className:"size-2.5 rounded-full bg-green-500"}),g.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Active"})]})}),o.map(f=>g.jsx(mr,{children:g.jsx(Va,{to:`/chat/${f.id}`,children:g.jsx(Ia,{isActive:t.pathname.includes(f.id),className:"transition-colors px-4 py-2 my-1 rounded-md",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Kb,{className:"size-5"}),g.jsx("span",{className:"text-base",children:f.name})]})})})},f.id)),c.length>0&&g.jsx("div",{className:"px-4 py-2 mt-4",children:g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx("div",{className:"size-2.5 rounded-full bg-muted-foreground/50"}),g.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Inactive"})]})}),c.map(f=>g.jsx(mr,{children:g.jsx("div",{className:"px-4 py-2 my-1 rounded-md",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Kb,{className:"size-5"}),g.jsx("span",{className:"text-base",children:f.name})]})})},f.id))]})})()})})})]})}),g.jsx(Cw,{className:"px-4 py-4",children:g.jsxs(Lc,{children:[g.jsx(mr,{children:g.jsx(Va,{to:"https://elizaos.github.io/eliza/docs/intro/",target:"_blank",children:g.jsxs(Ia,{className:"text-muted-foreground rounded-md",children:[g.jsx(qO,{className:"size-5"}),g.jsx("span",{children:"Documentation"})]})})}),g.jsx(mr,{children:g.jsx(Va,{to:"/logs",children:g.jsxs(Ia,{className:"text-muted-foreground rounded-md",children:[g.jsx(t2,{className:"size-5"}),g.jsx("span",{children:"Logs"})]})})}),g.jsx(mr,{children:g.jsxs(Ia,{disabled:!0,className:"text-muted-foreground/50 rounded-md",children:[g.jsx(PS,{className:"size-5"}),g.jsx("span",{children:"Settings"})]})}),g.jsx($_,{})]})})]})}const VE=6048e5,B_=864e5,R0=Symbol.for("constructDateFrom");function ha(t,r){return typeof t=="function"?t(r):t&&typeof t=="object"&&R0 in t?t[R0](r):t instanceof Date?new t.constructor(r):new Date(r)}function Sn(t,r){return ha(r||t,t)}let I_={};function bu(){return I_}function ql(t,r){var d,m,p,v;const a=bu(),s=(r==null?void 0:r.weekStartsOn)??((m=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:m.weekStartsOn)??a.weekStartsOn??((v=(p=a.locale)==null?void 0:p.options)==null?void 0:v.weekStartsOn)??0,o=Sn(t,r==null?void 0:r.in),c=o.getDay(),f=(c<s?7:0)+c-s;return o.setDate(o.getDate()-f),o.setHours(0,0,0,0),o}function Wc(t,r){return ql(t,{...r,weekStartsOn:1})}function YE(t,r){const a=Sn(t,r==null?void 0:r.in),s=a.getFullYear(),o=ha(a,0);o.setFullYear(s+1,0,4),o.setHours(0,0,0,0);const c=Wc(o),f=ha(a,0);f.setFullYear(s,0,4),f.setHours(0,0,0,0);const d=Wc(f);return a.getTime()>=c.getTime()?s+1:a.getTime()>=d.getTime()?s:s-1}function T0(t){const r=Sn(t),a=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return a.setUTCFullYear(r.getFullYear()),+t-+a}function V_(t,...r){const a=ha.bind(null,r.find(s=>typeof s=="object"));return r.map(a)}function C0(t,r){const a=Sn(t,r==null?void 0:r.in);return a.setHours(0,0,0,0),a}function Y_(t,r,a){const[s,o]=V_(a==null?void 0:a.in,t,r),c=C0(s),f=C0(o),d=+c-T0(c),m=+f-T0(f);return Math.round((d-m)/B_)}function F_(t,r){const a=YE(t,r),s=ha(t,0);return s.setFullYear(a,0,4),s.setHours(0,0,0,0),Wc(s)}function G_(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Q_(t){return!(!G_(t)&&typeof t!="number"||isNaN(+Sn(t)))}function X_(t,r){const a=Sn(t,r==null?void 0:r.in);return a.setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a}const K_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},W_=(t,r,a)=>{let s;const o=K_[t];return typeof o=="string"?s=o:r===1?s=o.one:s=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+s:s+" ago":s};function fh(t){return(r={})=>{const a=r.width?String(r.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const Z_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},J_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},eL={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tL={date:fh({formats:Z_,defaultWidth:"full"}),time:fh({formats:J_,defaultWidth:"full"}),dateTime:fh({formats:eL,defaultWidth:"full"})},nL={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},rL=(t,r,a,s)=>nL[t];function Ml(t){return(r,a)=>{const s=a!=null&&a.context?String(a.context):"standalone";let o;if(s==="formatting"&&t.formattingValues){const f=t.defaultFormattingWidth||t.defaultWidth,d=a!=null&&a.width?String(a.width):f;o=t.formattingValues[d]||t.formattingValues[f]}else{const f=t.defaultWidth,d=a!=null&&a.width?String(a.width):t.defaultWidth;o=t.values[d]||t.values[f]}const c=t.argumentCallback?t.argumentCallback(r):r;return o[c]}}const aL={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},iL={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},sL={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},lL={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},oL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},cL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},uL=(t,r)=>{const a=Number(t),s=a%100;if(s>20||s<10)switch(s%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},fL={ordinalNumber:uL,era:Ml({values:aL,defaultWidth:"wide"}),quarter:Ml({values:iL,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ml({values:sL,defaultWidth:"wide"}),day:Ml({values:lL,defaultWidth:"wide"}),dayPeriod:Ml({values:oL,defaultWidth:"wide",formattingValues:cL,defaultFormattingWidth:"wide"})};function jl(t){return(r,a={})=>{const s=a.width,o=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],c=r.match(o);if(!c)return null;const f=c[0],d=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],m=Array.isArray(d)?hL(d,b=>b.test(f)):dL(d,b=>b.test(f));let p;p=t.valueCallback?t.valueCallback(m):m,p=a.valueCallback?a.valueCallback(p):p;const v=r.slice(f.length);return{value:p,rest:v}}}function dL(t,r){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r(t[a]))return a}function hL(t,r){for(let a=0;a<t.length;a++)if(r(t[a]))return a}function mL(t){return(r,a={})=>{const s=r.match(t.matchPattern);if(!s)return null;const o=s[0],c=r.match(t.parsePattern);if(!c)return null;let f=t.valueCallback?t.valueCallback(c[0]):c[0];f=a.valueCallback?a.valueCallback(f):f;const d=r.slice(o.length);return{value:f,rest:d}}}const pL=/^(\d+)(th|st|nd|rd)?/i,gL=/\d+/i,vL={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},yL={any:[/^b/i,/^(a|c)/i]},bL={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xL={any:[/1/i,/2/i,/3/i,/4/i]},SL={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},wL={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},EL={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},RL={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},TL={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},CL={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},AL={ordinalNumber:mL({matchPattern:pL,parsePattern:gL,valueCallback:t=>parseInt(t,10)}),era:jl({matchPatterns:vL,defaultMatchWidth:"wide",parsePatterns:yL,defaultParseWidth:"any"}),quarter:jl({matchPatterns:bL,defaultMatchWidth:"wide",parsePatterns:xL,defaultParseWidth:"any",valueCallback:t=>t+1}),month:jl({matchPatterns:SL,defaultMatchWidth:"wide",parsePatterns:wL,defaultParseWidth:"any"}),day:jl({matchPatterns:EL,defaultMatchWidth:"wide",parsePatterns:RL,defaultParseWidth:"any"}),dayPeriod:jl({matchPatterns:TL,defaultMatchWidth:"any",parsePatterns:CL,defaultParseWidth:"any"})},NL={code:"en-US",formatDistance:W_,formatLong:tL,formatRelative:rL,localize:fL,match:AL,options:{weekStartsOn:0,firstWeekContainsDate:1}};function OL(t,r){const a=Sn(t,r==null?void 0:r.in);return Y_(a,X_(a))+1}function ML(t,r){const a=Sn(t,r==null?void 0:r.in),s=+Wc(a)-+F_(a);return Math.round(s/VE)+1}function FE(t,r){var v,b,x,E;const a=Sn(t,r==null?void 0:r.in),s=a.getFullYear(),o=bu(),c=(r==null?void 0:r.firstWeekContainsDate)??((b=(v=r==null?void 0:r.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((E=(x=o.locale)==null?void 0:x.options)==null?void 0:E.firstWeekContainsDate)??1,f=ha((r==null?void 0:r.in)||t,0);f.setFullYear(s+1,0,c),f.setHours(0,0,0,0);const d=ql(f,r),m=ha((r==null?void 0:r.in)||t,0);m.setFullYear(s,0,c),m.setHours(0,0,0,0);const p=ql(m,r);return+a>=+d?s+1:+a>=+p?s:s-1}function jL(t,r){var d,m,p,v;const a=bu(),s=(r==null?void 0:r.firstWeekContainsDate)??((m=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((v=(p=a.locale)==null?void 0:p.options)==null?void 0:v.firstWeekContainsDate)??1,o=FE(t,r),c=ha((r==null?void 0:r.in)||t,0);return c.setFullYear(o,0,s),c.setHours(0,0,0,0),ql(c,r)}function DL(t,r){const a=Sn(t,r==null?void 0:r.in),s=+ql(a,r)-+jL(a,r);return Math.round(s/VE)+1}function He(t,r){const a=t<0?"-":"",s=Math.abs(t).toString().padStart(r,"0");return a+s}const Zr={y(t,r){const a=t.getFullYear(),s=a>0?a:1-a;return He(r==="yy"?s%100:s,r.length)},M(t,r){const a=t.getMonth();return r==="M"?String(a+1):He(a+1,2)},d(t,r){return He(t.getDate(),r.length)},a(t,r){const a=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h(t,r){return He(t.getHours()%12||12,r.length)},H(t,r){return He(t.getHours(),r.length)},m(t,r){return He(t.getMinutes(),r.length)},s(t,r){return He(t.getSeconds(),r.length)},S(t,r){const a=r.length,s=t.getMilliseconds(),o=Math.trunc(s*Math.pow(10,a-3));return He(o,r.length)}},Yi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},A0={G:function(t,r,a){const s=t.getFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(s,{width:"abbreviated"});case"GGGGG":return a.era(s,{width:"narrow"});case"GGGG":default:return a.era(s,{width:"wide"})}},y:function(t,r,a){if(r==="yo"){const s=t.getFullYear(),o=s>0?s:1-s;return a.ordinalNumber(o,{unit:"year"})}return Zr.y(t,r)},Y:function(t,r,a,s){const o=FE(t,s),c=o>0?o:1-o;if(r==="YY"){const f=c%100;return He(f,2)}return r==="Yo"?a.ordinalNumber(c,{unit:"year"}):He(c,r.length)},R:function(t,r){const a=YE(t);return He(a,r.length)},u:function(t,r){const a=t.getFullYear();return He(a,r.length)},Q:function(t,r,a){const s=Math.ceil((t.getMonth()+1)/3);switch(r){case"Q":return String(s);case"QQ":return He(s,2);case"Qo":return a.ordinalNumber(s,{unit:"quarter"});case"QQQ":return a.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,r,a){const s=Math.ceil((t.getMonth()+1)/3);switch(r){case"q":return String(s);case"qq":return He(s,2);case"qo":return a.ordinalNumber(s,{unit:"quarter"});case"qqq":return a.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,r,a){const s=t.getMonth();switch(r){case"M":case"MM":return Zr.M(t,r);case"Mo":return a.ordinalNumber(s+1,{unit:"month"});case"MMM":return a.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(s,{width:"wide",context:"formatting"})}},L:function(t,r,a){const s=t.getMonth();switch(r){case"L":return String(s+1);case"LL":return He(s+1,2);case"Lo":return a.ordinalNumber(s+1,{unit:"month"});case"LLL":return a.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(s,{width:"wide",context:"standalone"})}},w:function(t,r,a,s){const o=DL(t,s);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):He(o,r.length)},I:function(t,r,a){const s=ML(t);return r==="Io"?a.ordinalNumber(s,{unit:"week"}):He(s,r.length)},d:function(t,r,a){return r==="do"?a.ordinalNumber(t.getDate(),{unit:"date"}):Zr.d(t,r)},D:function(t,r,a){const s=OL(t);return r==="Do"?a.ordinalNumber(s,{unit:"dayOfYear"}):He(s,r.length)},E:function(t,r,a){const s=t.getDay();switch(r){case"E":case"EE":case"EEE":return a.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(s,{width:"short",context:"formatting"});case"EEEE":default:return a.day(s,{width:"wide",context:"formatting"})}},e:function(t,r,a,s){const o=t.getDay(),c=(o-s.weekStartsOn+8)%7||7;switch(r){case"e":return String(c);case"ee":return He(c,2);case"eo":return a.ordinalNumber(c,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(t,r,a,s){const o=t.getDay(),c=(o-s.weekStartsOn+8)%7||7;switch(r){case"c":return String(c);case"cc":return He(c,r.length);case"co":return a.ordinalNumber(c,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(t,r,a){const s=t.getDay(),o=s===0?7:s;switch(r){case"i":return String(o);case"ii":return He(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(s,{width:"short",context:"formatting"});case"iiii":default:return a.day(s,{width:"wide",context:"formatting"})}},a:function(t,r,a){const o=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,r,a){const s=t.getHours();let o;switch(s===12?o=Yi.noon:s===0?o=Yi.midnight:o=s/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,r,a){const s=t.getHours();let o;switch(s>=17?o=Yi.evening:s>=12?o=Yi.afternoon:s>=4?o=Yi.morning:o=Yi.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,r,a){if(r==="ho"){let s=t.getHours()%12;return s===0&&(s=12),a.ordinalNumber(s,{unit:"hour"})}return Zr.h(t,r)},H:function(t,r,a){return r==="Ho"?a.ordinalNumber(t.getHours(),{unit:"hour"}):Zr.H(t,r)},K:function(t,r,a){const s=t.getHours()%12;return r==="Ko"?a.ordinalNumber(s,{unit:"hour"}):He(s,r.length)},k:function(t,r,a){let s=t.getHours();return s===0&&(s=24),r==="ko"?a.ordinalNumber(s,{unit:"hour"}):He(s,r.length)},m:function(t,r,a){return r==="mo"?a.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zr.m(t,r)},s:function(t,r,a){return r==="so"?a.ordinalNumber(t.getSeconds(),{unit:"second"}):Zr.s(t,r)},S:function(t,r){return Zr.S(t,r)},X:function(t,r,a){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(r){case"X":return O0(s);case"XXXX":case"XX":return Ba(s);case"XXXXX":case"XXX":default:return Ba(s,":")}},x:function(t,r,a){const s=t.getTimezoneOffset();switch(r){case"x":return O0(s);case"xxxx":case"xx":return Ba(s);case"xxxxx":case"xxx":default:return Ba(s,":")}},O:function(t,r,a){const s=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+N0(s,":");case"OOOO":default:return"GMT"+Ba(s,":")}},z:function(t,r,a){const s=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+N0(s,":");case"zzzz":default:return"GMT"+Ba(s,":")}},t:function(t,r,a){const s=Math.trunc(+t/1e3);return He(s,r.length)},T:function(t,r,a){return He(+t,r.length)}};function N0(t,r=""){const a=t>0?"-":"+",s=Math.abs(t),o=Math.trunc(s/60),c=s%60;return c===0?a+String(o):a+String(o)+r+He(c,2)}function O0(t,r){return t%60===0?(t>0?"-":"+")+He(Math.abs(t)/60,2):Ba(t,r)}function Ba(t,r=""){const a=t>0?"-":"+",s=Math.abs(t),o=He(Math.trunc(s/60),2),c=He(s%60,2);return a+o+r+c}const M0=(t,r)=>{switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},GE=(t,r)=>{switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},_L=(t,r)=>{const a=t.match(/(P+)(p+)?/)||[],s=a[1],o=a[2];if(!o)return M0(t,r);let c;switch(s){case"P":c=r.dateTime({width:"short"});break;case"PP":c=r.dateTime({width:"medium"});break;case"PPP":c=r.dateTime({width:"long"});break;case"PPPP":default:c=r.dateTime({width:"full"});break}return c.replace("{{date}}",M0(s,r)).replace("{{time}}",GE(o,r))},LL={p:GE,P:_L},zL=/^D+$/,PL=/^Y+$/,UL=["D","DD","YY","YYYY"];function kL(t){return zL.test(t)}function HL(t){return PL.test(t)}function $L(t,r,a){const s=qL(t,r,a);if(console.warn(s),UL.includes(t))throw new RangeError(s)}function qL(t,r,a){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${s} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BL=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,IL=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,VL=/^'([^]*?)'?$/,YL=/''/g,FL=/[a-zA-Z]/;function GL(t,r,a){var v,b,x,E;const s=bu(),o=s.locale??NL,c=s.firstWeekContainsDate??((b=(v=s.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,f=s.weekStartsOn??((E=(x=s.locale)==null?void 0:x.options)==null?void 0:E.weekStartsOn)??0,d=Sn(t,a==null?void 0:a.in);if(!Q_(d))throw new RangeError("Invalid time value");let m=r.match(IL).map(T=>{const S=T[0];if(S==="p"||S==="P"){const w=LL[S];return w(T,o.formatLong)}return T}).join("").match(BL).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const S=T[0];if(S==="'")return{isToken:!1,value:QL(T)};if(A0[S])return{isToken:!0,value:T};if(S.match(FL))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:T}});o.localize.preprocessor&&(m=o.localize.preprocessor(d,m));const p={firstWeekContainsDate:c,weekStartsOn:f,locale:o};return m.map(T=>{if(!T.isToken)return T.value;const S=T.value;(HL(S)||kL(S))&&$L(S,r,String(t));const w=A0[S[0]];return w(d,S,o.localize,p)}).join("")}function QL(t){const r=t.match(VL);return r?r[1].replace(YL,"'"):t}function QE({title:t,subtitle:r}){return g.jsxs("div",{className:"space-y-0.5",children:[g.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:t}),r?g.jsx("p",{className:"text-muted-foreground",children:r}):null]})}function Dm(t,[r,a]){return Math.min(a,Math.max(r,t))}function XL(t,r){return y.useReducer((a,s)=>r[a][s]??a,t)}var Sp="ScrollArea",[XE,gz]=qn(Sp),[KL,on]=XE(Sp),KE=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,type:s="hover",dir:o,scrollHideDelay:c=600,...f}=t,[d,m]=y.useState(null),[p,v]=y.useState(null),[b,x]=y.useState(null),[E,T]=y.useState(null),[S,w]=y.useState(null),[C,N]=y.useState(0),[O,_]=y.useState(0),[L,k]=y.useState(!1),[V,H]=y.useState(!1),U=Ue(r,te=>m(te)),K=vu(o);return g.jsx(KL,{scope:a,type:s,dir:K,scrollHideDelay:c,scrollArea:d,viewport:p,onViewportChange:v,content:b,onContentChange:x,scrollbarX:E,onScrollbarXChange:T,scrollbarXEnabled:L,onScrollbarXEnabledChange:k,scrollbarY:S,onScrollbarYChange:w,scrollbarYEnabled:V,onScrollbarYEnabledChange:H,onCornerWidthChange:N,onCornerHeightChange:_,children:g.jsx(we.div,{dir:K,...f,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":O+"px",...t.style}})})});KE.displayName=Sp;var WE="ScrollAreaViewport",ZE=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,children:s,nonce:o,...c}=t,f=on(WE,a),d=y.useRef(null),m=Ue(r,d,f.onViewportChange);return g.jsxs(g.Fragment,{children:[g.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}),g.jsx(we.div,{"data-radix-scroll-area-viewport":"",...c,ref:m,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...t.style},children:g.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});ZE.displayName=WE;var Fn="ScrollAreaScrollbar",wp=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=on(Fn,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:f}=o,d=t.orientation==="horizontal";return y.useEffect(()=>(d?c(!0):f(!0),()=>{d?c(!1):f(!1)}),[d,c,f]),o.type==="hover"?g.jsx(WL,{...s,ref:r,forceMount:a}):o.type==="scroll"?g.jsx(ZL,{...s,ref:r,forceMount:a}):o.type==="auto"?g.jsx(JE,{...s,ref:r,forceMount:a}):o.type==="always"?g.jsx(Ep,{...s,ref:r}):null});wp.displayName=Fn;var WL=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=on(Fn,t.__scopeScrollArea),[c,f]=y.useState(!1);return y.useEffect(()=>{const d=o.scrollArea;let m=0;if(d){const p=()=>{window.clearTimeout(m),f(!0)},v=()=>{m=window.setTimeout(()=>f(!1),o.scrollHideDelay)};return d.addEventListener("pointerenter",p),d.addEventListener("pointerleave",v),()=>{window.clearTimeout(m),d.removeEventListener("pointerenter",p),d.removeEventListener("pointerleave",v)}}},[o.scrollArea,o.scrollHideDelay]),g.jsx(ln,{present:a||c,children:g.jsx(JE,{"data-state":c?"visible":"hidden",...s,ref:r})})}),ZL=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=on(Fn,t.__scopeScrollArea),c=t.orientation==="horizontal",f=Su(()=>m("SCROLL_END"),100),[d,m]=XL("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(d==="idle"){const p=window.setTimeout(()=>m("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[d,o.scrollHideDelay,m]),y.useEffect(()=>{const p=o.viewport,v=c?"scrollLeft":"scrollTop";if(p){let b=p[v];const x=()=>{const E=p[v];b!==E&&(m("SCROLL"),f()),b=E};return p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[o.viewport,c,m,f]),g.jsx(ln,{present:a||d!=="hidden",children:g.jsx(Ep,{"data-state":d==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:ve(t.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:ve(t.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),JE=y.forwardRef((t,r)=>{const a=on(Fn,t.__scopeScrollArea),{forceMount:s,...o}=t,[c,f]=y.useState(!1),d=t.orientation==="horizontal",m=Su(()=>{if(a.viewport){const p=a.viewport.offsetWidth<a.viewport.scrollWidth,v=a.viewport.offsetHeight<a.viewport.scrollHeight;f(d?p:v)}},10);return ps(a.viewport,m),ps(a.content,m),g.jsx(ln,{present:s||c,children:g.jsx(Ep,{"data-state":c?"visible":"hidden",...o,ref:r})})}),Ep=y.forwardRef((t,r)=>{const{orientation:a="vertical",...s}=t,o=on(Fn,t.__scopeScrollArea),c=y.useRef(null),f=y.useRef(0),[d,m]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=a1(d.viewport,d.content),v={...s,sizes:d,onSizesChange:m,hasThumb:p>0&&p<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:x=>f.current=x};function b(x,E){return a4(x,f.current,d,E)}return a==="horizontal"?g.jsx(JL,{...v,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollLeft,E=j0(x,d,o.dir);c.current.style.transform=`translate3d(${E}px, 0, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollLeft=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollLeft=b(x,o.dir))}}):a==="vertical"?g.jsx(e4,{...v,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollTop,E=j0(x,d);c.current.style.transform=`translate3d(0, ${E}px, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollTop=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollTop=b(x))}}):null}),JL=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:s,...o}=t,c=on(Fn,t.__scopeScrollArea),[f,d]=y.useState(),m=y.useRef(null),p=Ue(r,m,c.onScrollbarXChange);return y.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),g.jsx(t1,{"data-orientation":"horizontal",...o,ref:p,sizes:a,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xu(a)+"px",...t.style},onThumbPointerDown:v=>t.onThumbPointerDown(v.x),onDragScroll:v=>t.onDragScroll(v.x),onWheelScroll:(v,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+v.deltaX;t.onWheelScroll(x),s1(x,b)&&v.preventDefault()}},onResize:()=>{m.current&&c.viewport&&f&&s({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:Jc(f.paddingLeft),paddingEnd:Jc(f.paddingRight)}})}})}),e4=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:s,...o}=t,c=on(Fn,t.__scopeScrollArea),[f,d]=y.useState(),m=y.useRef(null),p=Ue(r,m,c.onScrollbarYChange);return y.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),g.jsx(t1,{"data-orientation":"vertical",...o,ref:p,sizes:a,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xu(a)+"px",...t.style},onThumbPointerDown:v=>t.onThumbPointerDown(v.y),onDragScroll:v=>t.onDragScroll(v.y),onWheelScroll:(v,b)=>{if(c.viewport){const x=c.viewport.scrollTop+v.deltaY;t.onWheelScroll(x),s1(x,b)&&v.preventDefault()}},onResize:()=>{m.current&&c.viewport&&f&&s({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:Jc(f.paddingTop),paddingEnd:Jc(f.paddingBottom)}})}})}),[t4,e1]=XE(Fn),t1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,sizes:s,hasThumb:o,onThumbChange:c,onThumbPointerUp:f,onThumbPointerDown:d,onThumbPositionChange:m,onDragScroll:p,onWheelScroll:v,onResize:b,...x}=t,E=on(Fn,a),[T,S]=y.useState(null),w=Ue(r,U=>S(U)),C=y.useRef(null),N=y.useRef(""),O=E.viewport,_=s.content-s.viewport,L=nt(v),k=nt(m),V=Su(b,10);function H(U){if(C.current){const K=U.clientX-C.current.left,te=U.clientY-C.current.top;p({x:K,y:te})}}return y.useEffect(()=>{const U=K=>{const te=K.target;(T==null?void 0:T.contains(te))&&L(K,_)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[O,T,_,L]),y.useEffect(k,[s,k]),ps(T,V),ps(E.content,V),g.jsx(t4,{scope:a,scrollbar:T,hasThumb:o,onThumbChange:nt(c),onThumbPointerUp:nt(f),onThumbPositionChange:k,onThumbPointerDown:nt(d),children:g.jsx(we.div,{...x,ref:w,style:{position:"absolute",...x.style},onPointerDown:ve(t.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),C.current=T.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",E.viewport&&(E.viewport.style.scrollBehavior="auto"),H(U))}),onPointerMove:ve(t.onPointerMove,H),onPointerUp:ve(t.onPointerUp,U=>{const K=U.target;K.hasPointerCapture(U.pointerId)&&K.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=N.current,E.viewport&&(E.viewport.style.scrollBehavior=""),C.current=null})})})}),Zc="ScrollAreaThumb",n1=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=e1(Zc,t.__scopeScrollArea);return g.jsx(ln,{present:a||o.hasThumb,children:g.jsx(n4,{ref:r,...s})})}),n4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,style:s,...o}=t,c=on(Zc,a),f=e1(Zc,a),{onThumbPositionChange:d}=f,m=Ue(r,b=>f.onThumbChange(b)),p=y.useRef(void 0),v=Su(()=>{p.current&&(p.current(),p.current=void 0)},100);return y.useEffect(()=>{const b=c.viewport;if(b){const x=()=>{if(v(),!p.current){const E=i4(b,d);p.current=E,d()}};return d(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,v,d]),g.jsx(we.div,{"data-state":f.hasThumb?"visible":"hidden",...o,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:ve(t.onPointerDownCapture,b=>{const E=b.target.getBoundingClientRect(),T=b.clientX-E.left,S=b.clientY-E.top;f.onThumbPointerDown({x:T,y:S})}),onPointerUp:ve(t.onPointerUp,f.onThumbPointerUp)})});n1.displayName=Zc;var Rp="ScrollAreaCorner",r1=y.forwardRef((t,r)=>{const a=on(Rp,t.__scopeScrollArea),s=!!(a.scrollbarX&&a.scrollbarY);return a.type!=="scroll"&&s?g.jsx(r4,{...t,ref:r}):null});r1.displayName=Rp;var r4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,...s}=t,o=on(Rp,a),[c,f]=y.useState(0),[d,m]=y.useState(0),p=!!(c&&d);return ps(o.scrollbarX,()=>{var b;const v=((b=o.scrollbarX)==null?void 0:b.offsetHeight)||0;o.onCornerHeightChange(v),m(v)}),ps(o.scrollbarY,()=>{var b;const v=((b=o.scrollbarY)==null?void 0:b.offsetWidth)||0;o.onCornerWidthChange(v),f(v)}),p?g.jsx(we.div,{...s,ref:r,style:{width:c,height:d,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Jc(t){return t?parseInt(t,10):0}function a1(t,r){const a=t/r;return isNaN(a)?0:a}function xu(t){const r=a1(t.viewport,t.content),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-a)*r;return Math.max(s,18)}function a4(t,r,a,s="ltr"){const o=xu(a),c=o/2,f=r||c,d=o-f,m=a.scrollbar.paddingStart+f,p=a.scrollbar.size-a.scrollbar.paddingEnd-d,v=a.content-a.viewport,b=s==="ltr"?[0,v]:[v*-1,0];return i1([m,p],b)(t)}function j0(t,r,a="ltr"){const s=xu(r),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,c=r.scrollbar.size-o,f=r.content-r.viewport,d=c-s,m=a==="ltr"?[0,f]:[f*-1,0],p=Dm(t,m);return i1([0,f],[0,d])(p)}function i1(t,r){return a=>{if(t[0]===t[1]||r[0]===r[1])return r[0];const s=(r[1]-r[0])/(t[1]-t[0]);return r[0]+s*(a-t[0])}}function s1(t,r){return t>0&&t<r}var i4=(t,r=()=>{})=>{let a={left:t.scrollLeft,top:t.scrollTop},s=0;return function o(){const c={left:t.scrollLeft,top:t.scrollTop},f=a.left!==c.left,d=a.top!==c.top;(f||d)&&r(),a=c,s=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(s)};function Su(t,r){const a=nt(t),s=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),y.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(a,r)},[a,r])}function ps(t,r){const a=nt(r);ft(()=>{let s=0;if(t){const o=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(a)});return o.observe(t),()=>{window.cancelAnimationFrame(s),o.unobserve(t)}}},[t,a])}var l1=KE,s4=ZE,l4=r1;const o1=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(l1,{ref:s,className:le("relative overflow-hidden",t),...a,children:[g.jsx(s4,{className:"h-full w-full rounded-[inherit]",children:r}),g.jsx(c1,{}),g.jsx(l4,{})]}));o1.displayName=l1.displayName;const c1=y.forwardRef(({className:t,orientation:r="vertical",...a},s)=>g.jsx(wp,{ref:s,orientation:r,className:le("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:g.jsx(n1,{className:"relative flex-1 rounded-full bg-border"})}));c1.displayName=wp.displayName;function o4(t){const r=y.useRef({value:t,previous:t});return y.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var c4=[" ","Enter","ArrowUp","ArrowDown"],u4=[" ","Enter"],ro="Select",[wu,Eu,f4]=vp(ro),[Cs,vz]=qn(ro,[f4,cu]),Ru=cu(),[d4,ga]=Cs(ro),[h4,m4]=Cs(ro),u1=t=>{const{__scopeSelect:r,children:a,open:s,defaultOpen:o,onOpenChange:c,value:f,defaultValue:d,onValueChange:m,dir:p,name:v,autoComplete:b,disabled:x,required:E,form:T}=t,S=Ru(r),[w,C]=y.useState(null),[N,O]=y.useState(null),[_,L]=y.useState(!1),k=vu(p),[V=!1,H]=ei({prop:s,defaultProp:o,onChange:c}),[U,K]=ei({prop:f,defaultProp:d,onChange:m}),te=y.useRef(null),se=w?T||!!w.closest("form"):!0,[de,q]=y.useState(new Set),$=Array.from(de).map(j=>j.props.value).join(";");return g.jsx(lw,{...S,children:g.jsxs(d4,{required:E,scope:r,trigger:w,onTriggerChange:C,valueNode:N,onValueNodeChange:O,valueNodeHasChildren:_,onValueNodeHasChildrenChange:L,contentId:yr(),value:U,onValueChange:K,open:V,onOpenChange:H,dir:k,triggerPointerDownPosRef:te,disabled:x,children:[g.jsx(wu.Provider,{scope:r,children:g.jsx(h4,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(j=>{q(B=>new Set(B).add(j))},[]),onNativeOptionRemove:y.useCallback(j=>{q(B=>{const z=new Set(B);return z.delete(j),z})},[]),children:a})}),se?g.jsxs(z1,{"aria-hidden":!0,required:E,tabIndex:-1,name:v,autoComplete:b,value:U,onChange:j=>K(j.target.value),disabled:x,form:T,children:[U===void 0?g.jsx("option",{value:""}):null,Array.from(de)]},$):null]})})};u1.displayName=ro;var f1="SelectTrigger",d1=y.forwardRef((t,r)=>{const{__scopeSelect:a,disabled:s=!1,...o}=t,c=Ru(a),f=ga(f1,a),d=f.disabled||s,m=Ue(r,f.onTriggerChange),p=Eu(a),v=y.useRef("touch"),[b,x,E]=P1(S=>{const w=p().filter(O=>!O.disabled),C=w.find(O=>O.value===f.value),N=U1(w,S,C);N!==void 0&&f.onValueChange(N.value)}),T=S=>{d||(f.onOpenChange(!0),E()),S&&(f.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return g.jsx(ow,{asChild:!0,...c,children:g.jsx(we.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":L1(f.value)?"":void 0,...o,ref:m,onClick:ve(o.onClick,S=>{S.currentTarget.focus(),v.current!=="mouse"&&T(S)}),onPointerDown:ve(o.onPointerDown,S=>{v.current=S.pointerType;const w=S.target;w.hasPointerCapture(S.pointerId)&&w.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(T(S),S.preventDefault())}),onKeyDown:ve(o.onKeyDown,S=>{const w=b.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(w&&S.key===" ")&&c4.includes(S.key)&&(T(),S.preventDefault())})})})});d1.displayName=f1;var h1="SelectValue",m1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:s,style:o,children:c,placeholder:f="",...d}=t,m=ga(h1,a),{onValueNodeHasChildrenChange:p}=m,v=c!==void 0,b=Ue(r,m.onValueNodeChange);return ft(()=>{p(v)},[p,v]),g.jsx(we.span,{...d,ref:b,style:{pointerEvents:"none"},children:L1(m.value)?g.jsx(g.Fragment,{children:f}):c})});m1.displayName=h1;var p4="SelectIcon",p1=y.forwardRef((t,r)=>{const{__scopeSelect:a,children:s,...o}=t;return g.jsx(we.span,{"aria-hidden":!0,...o,ref:r,children:s||"▼"})});p1.displayName=p4;var g4="SelectPortal",g1=t=>g.jsx(Ql,{asChild:!0,...t});g1.displayName=g4;var ii="SelectContent",v1=y.forwardRef((t,r)=>{const a=ga(ii,t.__scopeSelect),[s,o]=y.useState();if(ft(()=>{o(new DocumentFragment)},[]),!a.open){const c=s;return c?ys.createPortal(g.jsx(y1,{scope:t.__scopeSelect,children:g.jsx(wu.Slot,{scope:t.__scopeSelect,children:g.jsx("div",{children:t.children})})}),c):null}return g.jsx(b1,{...t,ref:r})});v1.displayName=ii;var hn=10,[y1,va]=Cs(ii),v4="SelectContentImpl",b1=y.forwardRef((t,r)=>{const{__scopeSelect:a,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:c,onPointerDownOutside:f,side:d,sideOffset:m,align:p,alignOffset:v,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:T,hideWhenDetached:S,avoidCollisions:w,...C}=t,N=ga(ii,a),[O,_]=y.useState(null),[L,k]=y.useState(null),V=Ue(r,ue=>_(ue)),[H,U]=y.useState(null),[K,te]=y.useState(null),se=Eu(a),[de,q]=y.useState(!1),$=y.useRef(!1);y.useEffect(()=>{if(O)return mS(O)},[O]),iS();const j=y.useCallback(ue=>{const[me,...Ee]=se().map(Ae=>Ae.ref.current),[fe]=Ee.slice(-1),Se=document.activeElement;for(const Ae of ue)if(Ae===Se||(Ae==null||Ae.scrollIntoView({block:"nearest"}),Ae===me&&L&&(L.scrollTop=0),Ae===fe&&L&&(L.scrollTop=L.scrollHeight),Ae==null||Ae.focus(),document.activeElement!==Se))return},[se,L]),B=y.useCallback(()=>j([H,O]),[j,H,O]);y.useEffect(()=>{de&&B()},[de,B]);const{onOpenChange:z,triggerPointerDownPosRef:Q}=N;y.useEffect(()=>{if(O){let ue={x:0,y:0};const me=fe=>{var Se,Ae;ue={x:Math.abs(Math.round(fe.pageX)-(((Se=Q.current)==null?void 0:Se.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((Ae=Q.current)==null?void 0:Ae.y)??0))}},Ee=fe=>{ue.x<=10&&ue.y<=10?fe.preventDefault():O.contains(fe.target)||z(!1),document.removeEventListener("pointermove",me),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[O,z,Q]),y.useEffect(()=>{const ue=()=>z(!1);return window.addEventListener("blur",ue),window.addEventListener("resize",ue),()=>{window.removeEventListener("blur",ue),window.removeEventListener("resize",ue)}},[z]);const[M,F]=P1(ue=>{const me=se().filter(Se=>!Se.disabled),Ee=me.find(Se=>Se.ref.current===document.activeElement),fe=U1(me,ue,Ee);fe&&setTimeout(()=>fe.ref.current.focus())}),ee=y.useCallback((ue,me,Ee)=>{const fe=!$.current&&!Ee;(N.value!==void 0&&N.value===me||fe)&&(U(ue),fe&&($.current=!0))},[N.value]),ae=y.useCallback(()=>O==null?void 0:O.focus(),[O]),re=y.useCallback((ue,me,Ee)=>{const fe=!$.current&&!Ee;(N.value!==void 0&&N.value===me||fe)&&te(ue)},[N.value]),oe=s==="popper"?_m:x1,pe=oe===_m?{side:d,sideOffset:m,align:p,alignOffset:v,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:T,hideWhenDetached:S,avoidCollisions:w}:{};return g.jsx(y1,{scope:a,content:O,viewport:L,onViewportChange:k,itemRefCallback:ee,selectedItem:H,onItemLeave:ae,itemTextRefCallback:re,focusSelectedItem:B,selectedItemText:K,position:s,isPositioned:de,searchRef:M,children:g.jsx(Vm,{as:sn,allowPinchZoom:!0,children:g.jsx(Im,{asChild:!0,trapped:N.open,onMountAutoFocus:ue=>{ue.preventDefault()},onUnmountAutoFocus:ve(o,ue=>{var me;(me=N.trigger)==null||me.focus({preventScroll:!0}),ue.preventDefault()}),children:g.jsx(Gl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:ue=>ue.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:g.jsx(oe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:ue=>ue.preventDefault(),...C,...pe,onPlaced:()=>q(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ve(C.onKeyDown,ue=>{const me=ue.ctrlKey||ue.altKey||ue.metaKey;if(ue.key==="Tab"&&ue.preventDefault(),!me&&ue.key.length===1&&F(ue.key),["ArrowUp","ArrowDown","Home","End"].includes(ue.key)){let fe=se().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(ue.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ue.key)){const Se=ue.target,Ae=fe.indexOf(Se);fe=fe.slice(Ae+1)}setTimeout(()=>j(fe)),ue.preventDefault()}})})})})})})});b1.displayName=v4;var y4="SelectItemAlignedPosition",x1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onPlaced:s,...o}=t,c=ga(ii,a),f=va(ii,a),[d,m]=y.useState(null),[p,v]=y.useState(null),b=Ue(r,V=>v(V)),x=Eu(a),E=y.useRef(!1),T=y.useRef(!0),{viewport:S,selectedItem:w,selectedItemText:C,focusSelectedItem:N}=f,O=y.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&p&&S&&w&&C){const V=c.trigger.getBoundingClientRect(),H=p.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),K=C.getBoundingClientRect();if(c.dir!=="rtl"){const Se=K.left-H.left,Ae=U.left-Se,Ie=V.left-Ae,Et=V.width+Ie,Rn=Math.max(Et,H.width),Vt=window.innerWidth-hn,Gn=Dm(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Et+"px",d.style.left=Gn+"px"}else{const Se=H.right-K.right,Ae=window.innerWidth-U.right-Se,Ie=window.innerWidth-V.right-Ae,Et=V.width+Ie,Rn=Math.max(Et,H.width),Vt=window.innerWidth-hn,Gn=Dm(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Et+"px",d.style.right=Gn+"px"}const te=x(),se=window.innerHeight-hn*2,de=S.scrollHeight,q=window.getComputedStyle(p),$=parseInt(q.borderTopWidth,10),j=parseInt(q.paddingTop,10),B=parseInt(q.borderBottomWidth,10),z=parseInt(q.paddingBottom,10),Q=$+j+de+z+B,M=Math.min(w.offsetHeight*5,Q),F=window.getComputedStyle(S),ee=parseInt(F.paddingTop,10),ae=parseInt(F.paddingBottom,10),re=V.top+V.height/2-hn,oe=se-re,pe=w.offsetHeight/2,ue=w.offsetTop+pe,me=$+j+ue,Ee=Q-me;if(me<=re){const Se=te.length>0&&w===te[te.length-1].ref.current;d.style.bottom="0px";const Ae=p.clientHeight-S.offsetTop-S.offsetHeight,Ie=Math.max(oe,pe+(Se?ae:0)+Ae+B),Et=me+Ie;d.style.height=Et+"px"}else{const Se=te.length>0&&w===te[0].ref.current;d.style.top="0px";const Ie=Math.max(re,$+S.offsetTop+(Se?ee:0)+pe)+Ee;d.style.height=Ie+"px",S.scrollTop=me-re+S.offsetTop}d.style.margin=`${hn}px 0`,d.style.minHeight=M+"px",d.style.maxHeight=se+"px",s==null||s(),requestAnimationFrame(()=>E.current=!0)}},[x,c.trigger,c.valueNode,d,p,S,w,C,c.dir,s]);ft(()=>O(),[O]);const[_,L]=y.useState();ft(()=>{p&&L(window.getComputedStyle(p).zIndex)},[p]);const k=y.useCallback(V=>{V&&T.current===!0&&(O(),N==null||N(),T.current=!1)},[O,N]);return g.jsx(x4,{scope:a,contentWrapper:d,shouldExpandOnScrollRef:E,onScrollButtonChange:k,children:g.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:g.jsx(we.div,{...o,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});x1.displayName=y4;var b4="SelectPopperPosition",_m=y.forwardRef((t,r)=>{const{__scopeSelect:a,align:s="start",collisionPadding:o=hn,...c}=t,f=Ru(a);return g.jsx(cw,{...f,...c,ref:r,align:s,collisionPadding:o,style:{boxSizing:"border-box",...c.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)"}})});_m.displayName=b4;var[x4,Tp]=Cs(ii,{}),Lm="SelectViewport",S1=y.forwardRef((t,r)=>{const{__scopeSelect:a,nonce:s,...o}=t,c=va(Lm,a),f=Tp(Lm,a),d=Ue(r,c.onViewportChange),m=y.useRef(0);return g.jsxs(g.Fragment,{children:[g.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}),g.jsx(wu.Slot,{scope:a,children:g.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,p=>{const v=p.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:x}=f;if(x!=null&&x.current&&b){const E=Math.abs(m.current-v.scrollTop);if(E>0){const T=window.innerHeight-hn*2,S=parseFloat(b.style.minHeight),w=parseFloat(b.style.height),C=Math.max(S,w);if(C<T){const N=C+E,O=Math.min(T,N),_=N-O;b.style.height=O+"px",b.style.bottom==="0px"&&(v.scrollTop=_>0?_:0,b.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});S1.displayName=Lm;var w1="SelectGroup",[S4,w4]=Cs(w1),E4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t,o=yr();return g.jsx(S4,{scope:a,id:o,children:g.jsx(we.div,{role:"group","aria-labelledby":o,...s,ref:r})})});E4.displayName=w1;var E1="SelectLabel",R1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t,o=w4(E1,a);return g.jsx(we.div,{id:o.id,...s,ref:r})});R1.displayName=E1;var eu="SelectItem",[R4,T1]=Cs(eu),C1=y.forwardRef((t,r)=>{const{__scopeSelect:a,value:s,disabled:o=!1,textValue:c,...f}=t,d=ga(eu,a),m=va(eu,a),p=d.value===s,[v,b]=y.useState(c??""),[x,E]=y.useState(!1),T=Ue(r,N=>{var O;return(O=m.itemRefCallback)==null?void 0:O.call(m,N,s,o)}),S=yr(),w=y.useRef("touch"),C=()=>{o||(d.onValueChange(s),d.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 g.jsx(R4,{scope:a,value:s,disabled:o,textId:S,isSelected:p,onItemTextChange:y.useCallback(N=>{b(O=>O||((N==null?void 0:N.textContent)??"").trim())},[]),children:g.jsx(wu.ItemSlot,{scope:a,value:s,disabled:o,textValue:v,children:g.jsx(we.div,{role:"option","aria-labelledby":S,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...f,ref:T,onFocus:ve(f.onFocus,()=>E(!0)),onBlur:ve(f.onBlur,()=>E(!1)),onClick:ve(f.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:ve(f.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:ve(f.onPointerDown,N=>{w.current=N.pointerType}),onPointerMove:ve(f.onPointerMove,N=>{var O;w.current=N.pointerType,o?(O=m.onItemLeave)==null||O.call(m):w.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(f.onPointerLeave,N=>{var O;N.currentTarget===document.activeElement&&((O=m.onItemLeave)==null||O.call(m))}),onKeyDown:ve(f.onKeyDown,N=>{var _;((_=m.searchRef)==null?void 0:_.current)!==""&&N.key===" "||(u4.includes(N.key)&&C(),N.key===" "&&N.preventDefault())})})})})});C1.displayName=eu;var zl="SelectItemText",A1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:s,style:o,...c}=t,f=ga(zl,a),d=va(zl,a),m=T1(zl,a),p=m4(zl,a),[v,b]=y.useState(null),x=Ue(r,C=>b(C),m.onItemTextChange,C=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,C,m.value,m.disabled)}),E=v==null?void 0:v.textContent,T=y.useMemo(()=>g.jsx("option",{value:m.value,disabled:m.disabled,children:E},m.value),[m.disabled,m.value,E]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=p;return ft(()=>(S(T),()=>w(T)),[S,w,T]),g.jsxs(g.Fragment,{children:[g.jsx(we.span,{id:m.textId,...c,ref:x}),m.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ys.createPortal(c.children,f.valueNode):null]})});A1.displayName=zl;var N1="SelectItemIndicator",O1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t;return T1(N1,a).isSelected?g.jsx(we.span,{"aria-hidden":!0,...s,ref:r}):null});O1.displayName=N1;var zm="SelectScrollUpButton",M1=y.forwardRef((t,r)=>{const a=va(zm,t.__scopeSelect),s=Tp(zm,t.__scopeSelect),[o,c]=y.useState(!1),f=Ue(r,s.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=m.scrollTop>0;c(p)};const m=a.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?g.jsx(D1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=a;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});M1.displayName=zm;var Pm="SelectScrollDownButton",j1=y.forwardRef((t,r)=>{const a=va(Pm,t.__scopeSelect),s=Tp(Pm,t.__scopeSelect),[o,c]=y.useState(!1),f=Ue(r,s.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<p;c(v)};const m=a.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?g.jsx(D1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=a;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});j1.displayName=Pm;var D1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onAutoScroll:s,...o}=t,c=va("SelectScrollButton",a),f=y.useRef(null),d=Eu(a),m=y.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return y.useEffect(()=>()=>m(),[m]),ft(()=>{var v;const p=d().find(b=>b.ref.current===document.activeElement);(v=p==null?void 0:p.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),g.jsx(we.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(s,50))}),onPointerMove:ve(o.onPointerMove,()=>{var p;(p=c.onItemLeave)==null||p.call(c),f.current===null&&(f.current=window.setInterval(s,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{m()})})}),T4="SelectSeparator",_1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t;return g.jsx(we.div,{"aria-hidden":!0,...s,ref:r})});_1.displayName=T4;var Um="SelectArrow",C4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t,o=Ru(a),c=ga(Um,a),f=va(Um,a);return c.open&&f.position==="popper"?g.jsx(uw,{...o,...s,ref:r}):null});C4.displayName=Um;function L1(t){return t===""||t===void 0}var z1=y.forwardRef((t,r)=>{const{value:a,...s}=t,o=y.useRef(null),c=Ue(r,o),f=o4(a);return y.useEffect(()=>{const d=o.current,m=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(m,"value").set;if(f!==a&&v){const b=new Event("change",{bubbles:!0});v.call(d,a),d.dispatchEvent(b)}},[f,a]),g.jsx(Kl,{asChild:!0,children:g.jsx("select",{...s,ref:c,defaultValue:a})})});z1.displayName="BubbleSelect";function P1(t){const r=nt(t),a=y.useRef(""),s=y.useRef(0),o=y.useCallback(f=>{const d=a.current+f;r(d),function m(p){a.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>m(""),1e3))}(d)},[r]),c=y.useCallback(()=>{a.current="",window.clearTimeout(s.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),[a,o,c]}function U1(t,r,a){const o=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,c=a?t.indexOf(a):-1;let f=A4(t,Math.max(c,0));o.length===1&&(f=f.filter(p=>p!==a));const m=f.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return m!==a?m:void 0}function A4(t,r){return t.map((a,s)=>t[(r+s)%t.length])}var N4=u1,k1=d1,O4=m1,M4=p1,j4=g1,H1=v1,D4=S1,$1=R1,q1=C1,_4=A1,L4=O1,B1=M1,I1=j1,V1=_1;const z4=N4,P4=O4,Y1=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(k1,{ref:s,className:le("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[r,g.jsx(M4,{asChild:!0,children:g.jsx(zS,{className:"h-4 w-4 opacity-50"})})]}));Y1.displayName=k1.displayName;const F1=y.forwardRef(({className:t,...r},a)=>g.jsx(B1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:g.jsx(BO,{className:"h-4 w-4"})}));F1.displayName=B1.displayName;const G1=y.forwardRef(({className:t,...r},a)=>g.jsx(I1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:g.jsx(zS,{className:"h-4 w-4"})}));G1.displayName=I1.displayName;const Q1=y.forwardRef(({className:t,children:r,position:a="popper",...s},o)=>g.jsx(j4,{children:g.jsxs(H1,{ref:o,className:le("relative z-50 max-h-96 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",a==="popper"&&"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:a,...s,children:[g.jsx(F1,{}),g.jsx(D4,{className:le("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),g.jsx(G1,{})]})}));Q1.displayName=H1.displayName;const U4=y.forwardRef(({className:t,...r},a)=>g.jsx($1,{ref:a,className:le("px-2 py-1.5 text-sm font-semibold",t),...r}));U4.displayName=$1.displayName;const km=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(q1,{ref:s,className:le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[g.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:g.jsx(L4,{children:g.jsx(Xm,{className:"h-4 w-4"})})}),g.jsx(_4,{children:r})]}));km.displayName=q1.displayName;const k4=y.forwardRef(({className:t,...r},a)=>g.jsx(V1,{ref:a,className:le("-mx-1 my-1 h-px bg-muted",t),...r}));k4.displayName=V1.displayName;const H4={10:"TRACE",20:"DEBUG",27:"SUCCESS",28:"PROGRESS",29:"LOG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"},$4={10:"text-gray-400",20:"text-blue-400",27:"text-green-600",28:"text-purple-400",29:"text-gray-300",30:"text-emerald-400",40:"text-yellow-400",50:"text-red-400",60:"text-red-600"};function q4(){const[t,r]=y.useState("all"),[a,s]=y.useState(!0),o=y.useRef(null),c=y.useRef(!1),f=y.useRef(""),{data:d,error:m,isLoading:p}=Es({queryKey:["logs",t],queryFn:()=>Lt.getLogs(t==="all"?"":t),refetchInterval:1e3,staleTime:1e3}),v=()=>{if(!o.current)return;const w=o.current,C=w.scrollHeight,N=w.clientHeight;w.scrollTo({top:C-N,behavior:"instant"})};y.useEffect(()=>{var N;if(!((N=d==null?void 0:d.logs)!=null&&N.length))return;const w=d.logs[d.logs.length-1],C=`${w.time}-${w.msg}`;a&&C!==f.current&&(setTimeout(v,0),f.current=C)},[d==null?void 0:d.logs,a]);const b=w=>{if(c.current)return;const{scrollTop:C,scrollHeight:N,clientHeight:O}=w.currentTarget,L=N-(C+O)<100;s(L),c.current=!0,setTimeout(()=>{c.current=!1},150)},x=()=>{s(!0),v()};y.useEffect(()=>{setTimeout(v,100)},[d==null?void 0:d.logs]);const E=w=>H4[w]||"UNKNOWN",T=w=>$4[w]||"text-gray-400",S=w=>{const C=GL(w.time,"yyyy-MM-dd HH:mm:ss"),N=E(w.level),O=Object.entries(w).filter(([L])=>!Number.isNaN(Number(L))).sort((L,k)=>Number(L[0])-Number(k[0])),_=O.length>0?`
264
+ Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let x=pa(),E;if(r){let O=typeof r=="string"?Rs(r):r;We(v==="/"||((N=O.pathname)==null?void 0:N.startsWith(v)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${v}" but pathname "${O.pathname}" was given in the \`location\` prop.`),E=O}else E=x;let T=E.pathname||"/",S=T;if(v!=="/"){let O=v.replace(/^\//,"").split("/");S="/"+T.replace(/^\//,"").split("/").slice(O.length).join("/")}let w=!c&&a&&a.matches&&a.matches.length>0?a.matches:Yw(t,{pathname:S});$n(b||w!=null,`No routes matched location "${E.pathname}${E.search}${E.hash}" `),$n(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${E.pathname}${E.search}${E.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=dD(w&&w.map(O=>Object.assign({},O,{params:Object.assign({},m,O.params),pathname:Sr([v,o.encodeLocation?o.encodeLocation(O.pathname).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?v:Sr([v,o.encodeLocation?o.encodeLocation(O.pathnameBase).pathname:O.pathnameBase])})),f,a,s);return r&&C?y.createElement(Jl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...E},navigationType:"POP"}},C):C}function oD(){let t=vD(),r=tD(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},f=null;return console.error("Error handled by React Router default ErrorBoundary:",t),f=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:c},"ErrorBoundary")," or"," ",y.createElement("code",{style:c},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},r),a?y.createElement("pre",{style:o},a):null,f)}var cD=y.createElement(oD,null),uD=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?y.createElement(Yn.Provider,{value:this.props.routeContext},y.createElement(fp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function fD({routeContext:t,match:r,children:a}){let s=y.useContext(Ts);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(Yn.Provider,{value:t},a)}function dD(t,r=[],a=null,s=null){if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let o=t,c=a==null?void 0:a.errors;if(c!=null){let m=o.findIndex(p=>p.route.id&&(c==null?void 0:c[p.route.id])!==void 0);We(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,m+1))}let f=!1,d=-1;if(a)for(let m=0;m<o.length;m++){let p=o[m];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=m),p.route.id){let{loaderData:v,errors:b}=a,x=p.route.loader&&!v.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||x){f=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((m,p,v)=>{let b,x=!1,E=null,T=null;a&&(b=c&&p.route.id?c[p.route.id]:void 0,E=p.route.errorElement||cD,f&&(d<0&&v===0?(nE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,T=null):d===v&&(x=!0,T=p.route.hydrateFallbackElement||null)));let S=r.concat(o.slice(0,v+1)),w=()=>{let C;return b?C=E:x?C=T:p.route.Component?C=y.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=m,y.createElement(fD,{match:p,routeContext:{outlet:m,matches:S,isDataRoute:a!=null},children:C})};return a&&(p.route.ErrorBoundary||p.route.errorElement||v===0)?y.createElement(uD,{location:a.location,revalidation:a.revalidation,component:E,error:b,children:w(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):w()},null)}function dp(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hD(t){let r=y.useContext(Ts);return We(r,dp(t)),r}function mD(t){let r=y.useContext(mu);return We(r,dp(t)),r}function pD(t){let r=y.useContext(Yn);return We(r,dp(t)),r}function hp(t){let r=pD(t),a=r.matches[r.matches.length-1];return We(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function gD(){return hp("useRouteId")}function vD(){var s;let t=y.useContext(fp),r=mD("useRouteError"),a=hp("useRouteError");return t!==void 0?t:(s=r.errors)==null?void 0:s[a]}function yD(){let{router:t}=hD("useNavigate"),r=hp("useNavigate"),a=y.useRef(!1);return Jw(()=>{a.current=!0}),y.useCallback(async(o,c={})=>{$n(a.current,Zw),a.current&&(typeof o=="number"?t.navigate(o):await t.navigate(o,{fromRouteId:r,...c}))},[t,r])}var b0={};function nE(t,r,a){!r&&!b0[t]&&(b0[t]=!0,$n(!1,a))}y.memo(bD);function bD({routes:t,future:r,state:a}){return tE(t,void 0,a,r)}function qa(t){We(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function xD({basename:t="/",children:r=null,location:a,navigationType:s="POP",navigator:o,static:c=!1}){We(!eo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=t.replace(/^\/*/,"/"),d=y.useMemo(()=>({basename:f,navigator:o,static:c,future:{}}),[f,o,c]);typeof a=="string"&&(a=Rs(a));let{pathname:m="/",search:p="",hash:v="",state:b=null,key:x="default"}=a,E=y.useMemo(()=>{let T=Tr(m,f);return T==null?null:{location:{pathname:T,search:p,hash:v,state:b,key:x},navigationType:s}},[f,m,p,v,b,x,s]);return $n(E!=null,`<Router basename="${f}"> is not able to match the URL "${m}${p}${v}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:y.createElement(Vn.Provider,{value:d},y.createElement(Jl.Provider,{children:r,value:E}))}function SD({children:t,location:r}){return lD(Am(t),r)}function Am(t,r=[]){let a=[];return y.Children.forEach(t,(s,o)=>{if(!y.isValidElement(s))return;let c=[...r,o];if(s.type===y.Fragment){a.push.apply(a,Am(s.props.children,c));return}We(s.type===qa,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),We(!s.props.index||!s.props.children,"An index route cannot have child routes.");let f={id:s.props.id||c.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(f.children=Am(s.props.children,c)),a.push(f)}),a}var Pc="get",Uc="application/x-www-form-urlencoded";function pu(t){return t!=null&&typeof t.tagName=="string"}function wD(t){return pu(t)&&t.tagName.toLowerCase()==="button"}function ED(t){return pu(t)&&t.tagName.toLowerCase()==="form"}function RD(t){return pu(t)&&t.tagName.toLowerCase()==="input"}function TD(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function CD(t,r){return t.button===0&&(!r||r==="_self")&&!TD(t)}var Tc=null;function AD(){if(Tc===null)try{new FormData(document.createElement("form"),0),Tc=!1}catch{Tc=!0}return Tc}var ND=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function sh(t){return t!=null&&!ND.has(t)?($n(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Uc}"`),null):t}function OD(t,r){let a,s,o,c,f;if(ED(t)){let d=t.getAttribute("action");s=d?Tr(d,r):null,a=t.getAttribute("method")||Pc,o=sh(t.getAttribute("enctype"))||Uc,c=new FormData(t)}else if(wD(t)||RD(t)&&(t.type==="submit"||t.type==="image")){let d=t.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||d.getAttribute("action");if(s=m?Tr(m,r):null,a=t.getAttribute("formmethod")||d.getAttribute("method")||Pc,o=sh(t.getAttribute("formenctype"))||sh(d.getAttribute("enctype"))||Uc,c=new FormData(d,t),!AD()){let{name:p,type:v,value:b}=t;if(v==="image"){let x=p?`${p}.`:"";c.append(`${x}x`,"0"),c.append(`${x}y`,"0")}else p&&c.append(p,b)}}else{if(pu(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Pc,s=null,o=Uc,f=t}return c&&o==="text/plain"&&(f=c,c=void 0),{action:s,method:a.toLowerCase(),encType:o,formData:c,body:f}}function mp(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}async function MD(t,r){if(t.id in r)return r[t.id];try{let a=await import(t.module);return r[t.id]=a,a}catch(a){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function jD(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function DD(t,r,a){let s=await Promise.all(t.map(async o=>{let c=r.routes[o.route.id];if(c){let f=await MD(c,a);return f.links?f.links():[]}return[]}));return PD(s.flat(1).filter(jD).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function x0(t,r,a,s,o,c){let f=(m,p)=>a[p]?m.route.id!==a[p].route.id:!0,d=(m,p)=>{var v;return a[p].pathname!==m.pathname||((v=a[p].route.path)==null?void 0:v.endsWith("*"))&&a[p].params["*"]!==m.params["*"]};return c==="assets"?r.filter((m,p)=>f(m,p)||d(m,p)):c==="data"?r.filter((m,p)=>{var b;let v=s.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(f(m,p)||d(m,p))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((b=a[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function _D(t,r,{includeHydrateFallback:a}={}){return LD(t.map(s=>{let o=r.routes[s.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function LD(t){return[...new Set(t)]}function zD(t){let r={},a=Object.keys(t).sort();for(let s of a)r[s]=t[s];return r}function PD(t,r){let a=new Set;return new Set(r),t.reduce((s,o)=>{let c=JSON.stringify(zD(o));return a.has(c)||(a.add(c),s.push({key:c,link:o})),s},[])}function UD(t,r){let a=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return a.pathname==="/"?a.pathname="_root.data":r&&Tr(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.data`:a.pathname=`${a.pathname.replace(/\/$/,"")}.data`,a}function rE(){let t=y.useContext(Ts);return mp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function kD(){let t=y.useContext(mu);return mp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var pp=y.createContext(void 0);pp.displayName="FrameworkContext";function aE(){let t=y.useContext(pp);return mp(t,"You must render this element inside a <HydratedRouter> element"),t}function HD(t,r){let a=y.useContext(pp),[s,o]=y.useState(!1),[c,f]=y.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:p,onMouseLeave:v,onTouchStart:b}=r,x=y.useRef(null);y.useEffect(()=>{if(t==="render"&&f(!0),t==="viewport"){let S=C=>{C.forEach(N=>{f(N.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return x.current&&w.observe(x.current),()=>{w.disconnect()}}},[t]),y.useEffect(()=>{if(s){let S=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(S)}}},[s]);let E=()=>{o(!0)},T=()=>{o(!1),f(!1)};return a?t!=="intent"?[c,x,{}]:[c,x,{onFocus:Ol(d,E),onBlur:Ol(m,T),onMouseEnter:Ol(p,E),onMouseLeave:Ol(v,T),onTouchStart:Ol(b,E)}]:[!1,x,{}]}function Ol(t,r){return a=>{t&&t(a),a.defaultPrevented||r(a)}}function $D({page:t,...r}){let{router:a}=rE(),s=y.useMemo(()=>Yw(a.routes,t,a.basename),[a.routes,t,a.basename]);return s?y.createElement(BD,{page:t,matches:s,...r}):null}function qD(t){let{manifest:r,routeModules:a}=aE(),[s,o]=y.useState([]);return y.useEffect(()=>{let c=!1;return DD(t,r,a).then(f=>{c||o(f)}),()=>{c=!0}},[t,r,a]),s}function BD({page:t,matches:r,...a}){let s=pa(),{manifest:o,routeModules:c}=aE(),{basename:f}=rE(),{loaderData:d,matches:m}=kD(),p=y.useMemo(()=>x0(t,r,m,o,s,"data"),[t,r,m,o,s]),v=y.useMemo(()=>x0(t,r,m,o,s,"assets"),[t,r,m,o,s]),b=y.useMemo(()=>{if(t===s.pathname+s.search+s.hash)return[];let T=new Set,S=!1;if(r.forEach(C=>{var O;let N=o.routes[C.route.id];!N||!N.hasLoader||(!p.some(_=>_.route.id===C.route.id)&&C.route.id in d&&((O=c[C.route.id])!=null&&O.shouldRevalidate)||N.hasClientLoader?S=!0:T.add(C.route.id))}),T.size===0)return[];let w=UD(t,f);return S&&T.size>0&&w.searchParams.set("_routes",r.filter(C=>T.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[f,d,s,o,p,r,t,c]),x=y.useMemo(()=>_D(v,o),[v,o]),E=qD(v);return y.createElement(y.Fragment,null,b.map(T=>y.createElement("link",{key:T,rel:"prefetch",as:"fetch",href:T,...a})),x.map(T=>y.createElement("link",{key:T,rel:"modulepreload",href:T,...a})),E.map(({key:T,link:S})=>y.createElement("link",{key:T,...S})))}function ID(...t){return r=>{t.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var iE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{iE&&(window.__reactRouterVersion="7.3.0")}catch{}function VD({basename:t,children:r,window:a}){let s=y.useRef();s.current==null&&(s.current=_j({window:a,v5Compat:!0}));let o=s.current,[c,f]=y.useState({action:o.action,location:o.location}),d=y.useCallback(m=>{y.startTransition(()=>f(m))},[f]);return y.useLayoutEffect(()=>o.listen(d),[o,d]),y.createElement(xD,{basename:t,children:r,location:c.location,navigationType:c.action,navigator:o})}var sE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,lE=y.forwardRef(function({onClick:r,discover:a="render",prefetch:s="none",relative:o,reloadDocument:c,replace:f,state:d,target:m,to:p,preventScrollReset:v,viewTransition:b,...x},E){let{basename:T}=y.useContext(Vn),S=typeof p=="string"&&sE.test(p),w,C=!1;if(typeof p=="string"&&S&&(w=p,iE))try{let U=new URL(window.location.href),K=p.startsWith("//")?new URL(U.protocol+p):new URL(p),te=Tr(K.pathname,T);K.origin===U.origin&&te!=null?p=te+K.search+K.hash:C=!0}catch{$n(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let N=iD(p,{relative:o}),[O,_,L]=HD(s,x),k=GD(p,{replace:f,state:d,target:m,preventScrollReset:v,relative:o,viewTransition:b});function V(U){r&&r(U),U.defaultPrevented||k(U)}let H=y.createElement("a",{...x,...L,href:w||N,onClick:C||c?r:V,ref:ID(E,_),target:m,"data-discover":!S&&a==="render"?"true":void 0});return O&&!S?y.createElement(y.Fragment,null,H,y.createElement($D,{page:N})):H});lE.displayName="Link";var Va=y.forwardRef(function({"aria-current":r="page",caseSensitive:a=!1,className:s="",end:o=!1,style:c,to:f,viewTransition:d,children:m,...p},v){let b=no(f,{relative:p.relative}),x=pa(),E=y.useContext(mu),{navigator:T,basename:S}=y.useContext(Vn),w=E!=null&&ZD(b)&&d===!0,C=T.encodeLocation?T.encodeLocation(b).pathname:b.pathname,N=x.pathname,O=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;a||(N=N.toLowerCase(),O=O?O.toLowerCase():null,C=C.toLowerCase()),O&&S&&(O=Tr(O,S)||O);const _=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let L=N===C||!o&&N.startsWith(C)&&N.charAt(_)==="/",k=O!=null&&(O===C||!o&&O.startsWith(C)&&O.charAt(C.length)==="/"),V={isActive:L,isPending:k,isTransitioning:w},H=L?r:void 0,U;typeof s=="function"?U=s(V):U=[s,L?"active":null,k?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let K=typeof c=="function"?c(V):c;return y.createElement(lE,{...p,"aria-current":H,className:U,ref:v,style:K,to:f,viewTransition:d},typeof m=="function"?m(V):m)});Va.displayName="NavLink";var YD=y.forwardRef(({discover:t="render",fetcherKey:r,navigate:a,reloadDocument:s,replace:o,state:c,method:f=Pc,action:d,onSubmit:m,relative:p,preventScrollReset:v,viewTransition:b,...x},E)=>{let T=KD(),S=WD(d,{relative:p}),w=f.toLowerCase()==="get"?"get":"post",C=typeof d=="string"&&sE.test(d),N=O=>{if(m&&m(O),O.defaultPrevented)return;O.preventDefault();let _=O.nativeEvent.submitter,L=(_==null?void 0:_.getAttribute("formmethod"))||f;T(_||O.currentTarget,{fetcherKey:r,method:L,navigate:a,replace:o,state:c,relative:p,preventScrollReset:v,viewTransition:b})};return y.createElement("form",{ref:E,method:w,action:S,onSubmit:s?m:N,...x,"data-discover":!C&&t==="render"?"true":void 0})});YD.displayName="Form";function FD(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oE(t){let r=y.useContext(Ts);return We(r,FD(t)),r}function GD(t,{target:r,replace:a,state:s,preventScrollReset:o,relative:c,viewTransition:f}={}){let d=to(),m=pa(),p=no(t,{relative:c});return y.useCallback(v=>{if(CD(v,r)){v.preventDefault();let b=a!==void 0?a:$l(m)===$l(p);d(t,{replace:b,state:s,preventScrollReset:o,relative:c,viewTransition:f})}},[m,d,p,a,s,r,t,o,c,f])}var QD=0,XD=()=>`__${String(++QD)}__`;function KD(){let{router:t}=oE("useSubmit"),{basename:r}=y.useContext(Vn),a=gD();return y.useCallback(async(s,o={})=>{let{action:c,method:f,encType:d,formData:m,body:p}=OD(s,r);if(o.navigate===!1){let v=o.fetcherKey||XD();await t.fetch(v,a,o.action||c,{preventScrollReset:o.preventScrollReset,formData:m,body:p,formMethod:o.method||f,formEncType:o.encType||d,flushSync:o.flushSync})}else await t.navigate(o.action||c,{preventScrollReset:o.preventScrollReset,formData:m,body:p,formMethod:o.method||f,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:a,flushSync:o.flushSync,viewTransition:o.viewTransition})},[t,r,a])}function WD(t,{relative:r}={}){let{basename:a}=y.useContext(Vn),s=y.useContext(Yn);We(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),c={...no(t||".",{relative:r})},f=pa();if(t==null){c.search=f.search;let d=new URLSearchParams(c.search),m=d.getAll("index");if(m.some(v=>v==="")){d.delete("index"),m.filter(b=>b).forEach(b=>d.append("index",b));let v=d.toString();c.search=v?`?${v}`:""}}return(!t||t===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:Sr([a,c.pathname])),$l(c)}function ZD(t,r={}){let a=y.useContext(Ww);We(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=oE("useViewTransitionState"),o=no(t,{relative:r.relative});if(!a.isTransitioning)return!1;let c=Tr(a.currentLocation.pathname,s)||a.currentLocation.pathname,f=Tr(a.nextLocation.pathname,s)||a.nextLocation.pathname;return Xc(o.pathname,f)!=null||Xc(o.pathname,c)!=null}new TextEncoder;const JD=ma("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Nm({className:t,variant:r,...a}){return g.jsx("div",{className:le(JD({variant:r}),t),...a})}var e_="Label",cE=y.forwardRef((t,r)=>g.jsx(we.label,{...t,ref:r,onMouseDown:a=>{var o;a.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));cE.displayName=e_;var uE=cE;const t_=ma("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Kc=y.forwardRef(({className:t,...r},a)=>g.jsx(uE,{ref:a,className:le(t_(),t),...r}));Kc.displayName=uE.displayName;const n_=({tag:t,onRemove:r})=>g.jsxs(Nm,{variant:"outline",className:"flex items-center gap-1.5 pr-1.5 text-sm py-1 px-2 transition-colors hover:bg-white hover:text-black dark:hover:text-black",children:[t,g.jsxs(Qe,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(t),className:"hover:bg-muted/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[g.jsx(bs,{className:"h-3 w-3"}),g.jsxs("span",{className:"sr-only",children:["Remove ",t]})]})]}),r_=({tags:t,onRemove:r})=>g.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(a=>g.jsx(n_,{tag:a,onRemove:r},a))}),a_=({value:t,onChange:r,onKeyDown:a})=>g.jsx(vr,{value:t,onChange:r,onKeyDown:a,placeholder:"Type and press Enter to add...",className:le("bg-background",!t&&"text-muted-foreground")});function i_({title:t,data:r,onChange:a}){const[s,o]=y.useState(""),c=d=>{if(d.key==="Enter"){d.preventDefault();const m=s.trim();m&&!r.includes(m)&&(a([...r,m]),o(""))}},f=d=>{a(r.filter(m=>m!==d))};return g.jsxs("div",{className:"space-y-2",children:[g.jsx(Kc,{children:t}),g.jsxs("div",{className:"p-2 bg-card rounded-md border",children:[g.jsx(r_,{tags:r,onRemove:f}),g.jsx(a_,{value:s,onChange:d=>o(d.target.value),onKeyDown:c})]})]})}const gu=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("rounded-xl border bg-card text-card-foreground shadow",t),...r}));gu.displayName="Card";const fE=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("flex flex-col space-y-1.5 p-6",t),...r}));fE.displayName="CardHeader";const dE=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("font-semibold leading-none tracking-tight",t),...r}));dE.displayName="CardTitle";const s_=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("text-sm text-muted-foreground",t),...r}));s_.displayName="CardDescription";const gp=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("p-6 pt-0",t),...r}));gp.displayName="CardContent";const hE=y.forwardRef(({className:t,...r},a)=>g.jsx("div",{ref:a,className:le("flex items-center p-6 pt-0",t),...r}));hE.displayName="CardFooter";function vp(t){const r=t+"CollectionProvider",[a,s]=qn(r),[o,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),f=E=>{const{scope:T,children:S}=E,w=hr.useRef(null),C=hr.useRef(new Map).current;return g.jsx(o,{scope:T,itemMap:C,collectionRef:w,children:S})};f.displayName=r;const d=t+"CollectionSlot",m=hr.forwardRef((E,T)=>{const{scope:S,children:w}=E,C=c(d,S),N=Ue(T,C.collectionRef);return g.jsx(sn,{ref:N,children:w})});m.displayName=d;const p=t+"CollectionItemSlot",v="data-radix-collection-item",b=hr.forwardRef((E,T)=>{const{scope:S,children:w,...C}=E,N=hr.useRef(null),O=Ue(T,N),_=c(p,S);return hr.useEffect(()=>(_.itemMap.set(N,{ref:N,...C}),()=>void _.itemMap.delete(N))),g.jsx(sn,{[v]:"",ref:O,children:w})});b.displayName=p;function x(E){const T=c(t+"CollectionConsumer",E);return hr.useCallback(()=>{const w=T.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${v}]`));return Array.from(T.itemMap.values()).sort((_,L)=>C.indexOf(_.ref.current)-C.indexOf(L.ref.current))},[T.collectionRef,T.itemMap])}return[{Provider:f,Slot:m,ItemSlot:b},x,s]}var l_=y.createContext(void 0);function vu(t){const r=y.useContext(l_);return t||r||"ltr"}var lh="rovingFocusGroup.onEntryFocus",o_={bubbles:!1,cancelable:!0},yu="RovingFocusGroup",[Om,mE,c_]=vp(yu),[u_,pE]=qn(yu,[c_]),[f_,d_]=u_(yu),gE=y.forwardRef((t,r)=>g.jsx(Om.Provider,{scope:t.__scopeRovingFocusGroup,children:g.jsx(Om.Slot,{scope:t.__scopeRovingFocusGroup,children:g.jsx(h_,{...t,ref:r})})}));gE.displayName=yu;var h_=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,orientation:s,loop:o=!1,dir:c,currentTabStopId:f,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:p,preventScrollOnEntryFocus:v=!1,...b}=t,x=y.useRef(null),E=Ue(r,x),T=vu(c),[S=null,w]=ei({prop:f,defaultProp:d,onChange:m}),[C,N]=y.useState(!1),O=nt(p),_=mE(a),L=y.useRef(!1),[k,V]=y.useState(0);return y.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(lh,O),()=>H.removeEventListener(lh,O)},[O]),g.jsx(f_,{scope:a,orientation:s,dir:T,loop:o,currentTabStopId:S,onItemFocus:y.useCallback(H=>w(H),[w]),onItemShiftTab:y.useCallback(()=>N(!0),[]),onFocusableItemAdd:y.useCallback(()=>V(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>V(H=>H-1),[]),children:g.jsx(we.div,{tabIndex:C||k===0?-1:0,"data-orientation":s,...b,ref:E,style:{outline:"none",...t.style},onMouseDown:ve(t.onMouseDown,()=>{L.current=!0}),onFocus:ve(t.onFocus,H=>{const U=!L.current;if(H.target===H.currentTarget&&U&&!C){const K=new CustomEvent(lh,o_);if(H.currentTarget.dispatchEvent(K),!K.defaultPrevented){const te=_().filter(j=>j.focusable),se=te.find(j=>j.active),de=te.find(j=>j.id===S),$=[se,de,...te].filter(Boolean).map(j=>j.ref.current);bE($,v)}}L.current=!1}),onBlur:ve(t.onBlur,()=>N(!1))})})}),vE="RovingFocusGroupItem",yE=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,focusable:s=!0,active:o=!1,tabStopId:c,...f}=t,d=yr(),m=c||d,p=d_(vE,a),v=p.currentTabStopId===m,b=mE(a),{onFocusableItemAdd:x,onFocusableItemRemove:E}=p;return y.useEffect(()=>{if(s)return x(),()=>E()},[s,x,E]),g.jsx(Om.ItemSlot,{scope:a,id:m,focusable:s,active:o,children:g.jsx(we.span,{tabIndex:v?0:-1,"data-orientation":p.orientation,...f,ref:r,onMouseDown:ve(t.onMouseDown,T=>{s?p.onItemFocus(m):T.preventDefault()}),onFocus:ve(t.onFocus,()=>p.onItemFocus(m)),onKeyDown:ve(t.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){p.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const S=g_(T,p.orientation,p.dir);if(S!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let C=b().filter(N=>N.focusable).map(N=>N.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const N=C.indexOf(T.currentTarget);C=p.loop?v_(C,N+1):C.slice(N+1)}setTimeout(()=>bE(C))}})})})});yE.displayName=vE;var m_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function p_(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function g_(t,r,a){const s=p_(t.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return m_[s]}function bE(t,r=!1){const a=document.activeElement;for(const s of t)if(s===a||(s.focus({preventScroll:r}),document.activeElement!==a))return}function v_(t,r){return t.map((a,s)=>t[(r+s)%t.length])}var y_=gE,b_=yE,yp="Tabs",[x_,pz]=qn(yp,[pE]),xE=pE(),[S_,bp]=x_(yp),SE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,onValueChange:o,defaultValue:c,orientation:f="horizontal",dir:d,activationMode:m="automatic",...p}=t,v=vu(d),[b,x]=ei({prop:s,onChange:o,defaultProp:c});return g.jsx(S_,{scope:a,baseId:yr(),value:b,onValueChange:x,orientation:f,dir:v,activationMode:m,children:g.jsx(we.div,{dir:v,"data-orientation":f,...p,ref:r})})});SE.displayName=yp;var wE="TabsList",EE=y.forwardRef((t,r)=>{const{__scopeTabs:a,loop:s=!0,...o}=t,c=bp(wE,a),f=xE(a);return g.jsx(y_,{asChild:!0,...f,orientation:c.orientation,dir:c.dir,loop:s,children:g.jsx(we.div,{role:"tablist","aria-orientation":c.orientation,...o,ref:r})})});EE.displayName=wE;var RE="TabsTrigger",TE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,disabled:o=!1,...c}=t,f=bp(RE,a),d=xE(a),m=NE(f.baseId,s),p=OE(f.baseId,s),v=s===f.value;return g.jsx(b_,{asChild:!0,...d,focusable:!o,active:v,children:g.jsx(we.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":p,"data-state":v?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:m,...c,ref:r,onMouseDown:ve(t.onMouseDown,b=>{!o&&b.button===0&&b.ctrlKey===!1?f.onValueChange(s):b.preventDefault()}),onKeyDown:ve(t.onKeyDown,b=>{[" ","Enter"].includes(b.key)&&f.onValueChange(s)}),onFocus:ve(t.onFocus,()=>{const b=f.activationMode!=="manual";!v&&!o&&b&&f.onValueChange(s)})})})});TE.displayName=RE;var CE="TabsContent",AE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:s,forceMount:o,children:c,...f}=t,d=bp(CE,a),m=NE(d.baseId,s),p=OE(d.baseId,s),v=s===d.value,b=y.useRef(v);return y.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),g.jsx(ln,{present:o||v,children:({present:x})=>g.jsx(we.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!x,id:p,tabIndex:0,...f,ref:r,style:{...t.style,animationDuration:b.current?"0s":void 0},children:x&&c})})});AE.displayName=CE;function NE(t,r){return`${t}-trigger-${r}`}function OE(t,r){return`${t}-content-${r}`}var w_=SE,ME=EE,jE=TE,DE=AE;const E_=w_,_E=y.forwardRef(({className:t,...r},a)=>g.jsx(ME,{ref:a,className:le("inline-flex h-9 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));_E.displayName=ME.displayName;const Mm=y.forwardRef(({className:t,...r},a)=>g.jsx(jE,{ref:a,className:le("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...r}));Mm.displayName=jE.displayName;const jm=y.forwardRef(({className:t,...r},a)=>g.jsx(DE,{ref:a,className:le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));jm.displayName=DE.displayName;const xp=y.forwardRef(({className:t,...r},a)=>g.jsx("textarea",{className:le("flex min-h-[60px] select-none w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...r}));xp.displayName="Textarea";const R_=1,T_=1e6;let oh=0;function C_(){return oh=(oh+1)%Number.MAX_SAFE_INTEGER,oh.toString()}const ch=new Map,S0=t=>{if(ch.has(t))return;const r=setTimeout(()=>{ch.delete(t),Pl({type:"REMOVE_TOAST",toastId:t})},T_);ch.set(t,r)},A_=(t,r)=>{switch(r.type){case"ADD_TOAST":return{...t,toasts:[r.toast,...t.toasts].slice(0,R_)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===r.toast.id?{...a,...r.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=r;if(a)S0(a);else for(const s of t.toasts)S0(s.id);return{...t,toasts:t.toasts.map(s=>s.id===a||a===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return r.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==r.toastId)}}},kc=[];let Hc={toasts:[]};function Pl(t){Hc=A_(Hc,t);for(const r of kc)r(Hc)}function N_({...t}){const r=C_(),a=o=>Pl({type:"UPDATE_TOAST",toast:{...o,id:r}}),s=()=>Pl({type:"DISMISS_TOAST",toastId:r});return Pl({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:o=>{o||s()}}}),{id:r,dismiss:s,update:a}}function xn(){const[t,r]=y.useState(Hc);return y.useEffect(()=>(kc.push(r),()=>{const a=kc.indexOf(r);a>-1&&kc.splice(a,1)}),[]),{...t,toast:N_,dismiss:a=>Pl({type:"DISMISS_TOAST",toastId:a})}}const w0=[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The display name of your character",fieldType:"text",getValue:t=>t.name||""},{title:"Username",name:"username",description:"Unique identifier for your character",fieldType:"text",getValue:t=>t.username||""},{title:"System",name:"system",description:"System prompt for character behavior",fieldType:"textarea",getValue:t=>t.system||""},{title:"Voice Model",name:"settings.voice.model",description:"Voice model used for speech synthesis",fieldType:"text",getValue:t=>{var r,a;return((a=(r=t.settings)==null?void 0:r.voice)==null?void 0:a.model)||""}}]},{sectionTitle:"Content",sectionValue:"content",sectionType:"array",fields:[{title:"Bio",description:"Key information about your character",path:"bio",getData:t=>Array.isArray(t.bio)?t.bio:[]},{title:"Topics",description:"Topics your character is knowledgeable about",path:"topics",getData:t=>t.topics||[]},{title:"Adjectives",description:"Words that describe your character's personality",path:"adjectives",getData:t=>t.adjectives||[]}]},{sectionTitle:"Style",sectionValue:"style",sectionType:"array",fields:[{title:"All",description:"Style rules applied to all interactions",path:"style.all",getData:t=>{var r;return((r=t.style)==null?void 0:r.all)||[]}},{title:"Chat",description:"Style rules for chat interactions",path:"style.chat",getData:t=>{var r;return((r=t.style)==null?void 0:r.chat)||[]}},{title:"Post",description:"Style rules for social media posts",path:"style.post",getData:t=>{var r;return((r=t.style)==null?void 0:r.post)||[]}}]}];function LE({characterValue:t,setCharacterValue:r,title:a,description:s,onSubmit:o,onDelete:c,onReset:f,customComponents:d=[]}){const{toast:m}=xn(),[p,v]=y.useState(!1),b=w=>{const{name:C,value:N,type:O}=w.target,_=w.target.checked;if(C.includes(".")){const L=C.split(".");r(k=>{const V={...k};let H=V;for(let U=0;U<L.length-1;U++)H[L[U]]||(H[L[U]]={}),H=H[L[U]];return H[L[L.length-1]]=O==="checkbox"?_:N,V})}else r(L=>({...L,[C]:O==="checkbox"?_:N}))},x=(w,C)=>{r(N=>{const O={...N},_=w.split(".");let L=O;for(let k=0;k<_.length-1;k++){const V=_[k];(!L[V]||typeof L[V]!="object")&&(L[V]={}),L=L[V]}return L[_[_.length-1]]=C,O})},E=async w=>{w.preventDefault(),v(!0);try{await o(t)}catch(C){m({title:"Error",description:C instanceof Error?C.message:"Failed to update",variant:"destructive"})}finally{v(!1)}},T=w=>g.jsxs("div",{className:"space-y-2",children:[g.jsx(Kc,{htmlFor:w.name,children:w.title}),w.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),w.fieldType==="textarea"?g.jsx(xp,{id:w.name,name:w.name,value:w.getValue(t),onChange:b,className:"min-h-[120px] resize-y"}):w.fieldType==="checkbox"?g.jsx(vr,{id:w.name,name:w.name,type:"checkbox",checked:t[w.name]==="true",onChange:b}):g.jsx(vr,{id:w.name,name:w.name,type:w.fieldType,value:w.getValue(t),onChange:b})]},w.name),S=w=>g.jsxs("div",{className:"space-y-2",children:[g.jsx(Kc,{htmlFor:w.path,children:w.title}),w.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),g.jsx(i_,{data:w.getData(t),onChange:C=>x(w.path,C)})]},w.path);return g.jsxs("div",{className:"container max-w-4xl mx-auto p-6",children:[g.jsx("div",{className:"flex items-center justify-between mb-6",children:g.jsxs("div",{children:[g.jsx("h1",{className:"text-3xl font-bold",children:a}),g.jsx("p",{className:"text-muted-foreground mt-1",children:s})]})}),g.jsxs("form",{onSubmit:E,children:[g.jsxs(E_,{defaultValue:"basic",className:"w-full",children:[g.jsxs(_E,{className:"grid w-full mb-6",style:{gridTemplateColumns:`repeat(${d.length+3}, minmax(0, 1fr))`},children:[w0.map(w=>g.jsx(Mm,{value:w.sectionValue,children:w.sectionTitle},w.sectionValue)),d.map(w=>g.jsx(Mm,{value:`custom-${w.name}`,children:w.name},`custom-${w.name}`))]}),g.jsx(gu,{children:g.jsxs(gp,{className:"p-6",children:[w0.map(w=>g.jsx(jm,{value:w.sectionValue,className:"space-y-6",children:w.sectionType==="input"?w.fields.map(T):w.fields.map(S)},w.sectionValue)),d.map(w=>g.jsx(jm,{value:`custom-${w.name}`,children:w.component},`custom-${w.name}`))]})})]}),g.jsxs("div",{className:"flex justify-between gap-4 mt-6",children:[g.jsx("div",{className:"flex gap-4 text-red-500",children:g.jsx(Qe,{type:"button",variant:"outline",onClick:()=>{c==null||c()},children:"Delete Character"})}),g.jsxs("div",{className:"flex gap-4",children:[g.jsx(Qe,{type:"button",variant:"outline",onClick:()=>{f==null||f()},children:"Reset Changes"}),g.jsx(Qe,{type:"submit",disabled:p,children:p?"Saving...":"Save Changes"})]})]})]})]})}const uh="elizaos-world-id",Ya={getWorldId:()=>{const t=localStorage.getItem(uh);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(uh,r),r},resetWorldId:()=>{const t=crypto.randomUUID();return localStorage.setItem(uh,t),t},getRoomStorageKey:t=>`room-${Ya.getWorldId()}-${t}`},O_="http://localhost:3000",lt=async({url:t,method:r,body:a,headers:s})=>{const o={method:r??"GET",headers:s||{Accept:"application/json","Content-Type":"application/json"}};return(r==="POST"||r==="PUT"||r==="PATCH")&&(a instanceof FormData?(o.headers&&typeof o.headers=="object"&&(o.headers=Object.fromEntries(Object.entries(o.headers).filter(([c])=>c!=="Content-Type"))),o.body=a):o.body=JSON.stringify(a)),fetch(`${O_}${t}`,o).then(async c=>{if(c.headers.get("Content-Type")==="audio/mpeg")return await c.blob();if(!c.ok){const d=await c.text();console.error("Error: ",d);let m="An error occurred.";try{m=JSON.parse(d).message||m}catch{m=d||m}throw new Error(m)}try{return await c.json()}catch(d){return console.error("JSON Parse Error:",d),null}})},Lt={sendMessage:(t,r,a,s)=>{const o=Ya.getWorldId();if(a){const c=new FormData;return c.append("text",r),c.append("name","Anon"),c.append("file",a),s&&c.append("roomId",s),c.append("worldId",o),lt({url:`/agents/${t}/messages`,method:"POST",body:c})}return lt({url:`/agents/${t}/messages`,method:"POST",body:{text:r,name:"Anon",roomId:s||void 0,worldId:o}})},getAgents:()=>lt({url:"/agents"}),getAgent:t=>lt({url:`/agents/${t}`}),tts:(t,r)=>lt({url:`/agents/${t}/speech/generate`,method:"POST",body:{text:r},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),whisper:async(t,r)=>{const a=new FormData;return a.append("file",r,"recording.wav"),lt({url:`/agents/${t}/transcriptions`,method:"POST",body:a})},sendAudioMessage:async(t,r,a)=>{const s=new FormData;if(s.append("file",r,"recording.wav"),a)for(const[o,c]of Object.entries(a))c&&s.append(o,c);return lt({url:`/agents/${t}/audio-messages`,method:"POST",body:s})},speechConversation:async(t,r,a)=>lt({url:`/agents/${t}/speech/conversation`,method:"POST",body:{text:r,...a},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),deleteAgent:t=>lt({url:`/agents/${t}`,method:"DELETE"}),updateAgent:(t,r)=>lt({url:`/agents/${t}`,method:"PATCH",body:r}),createAgent:t=>lt({url:"/agents/",method:"POST",body:t}),startAgent:t=>lt({url:`/agents/${t}`,method:"POST",body:{start:!0}}),stopAgent:t=>lt({url:`/agents/${t}`,method:"PUT"}),getMemories:(t,r,a)=>{const o={worldId:Ya.getWorldId()};return a!=null&&a.limit&&(o.limit=a.limit),a!=null&&a.before&&(o.end=a.before),lt({url:`/agents/${t}/rooms/${r}/memories`,method:"GET",body:o})},getRooms:t=>{const r=Ya.getWorldId();return lt({url:`/agents/${t}/rooms`,method:"GET",body:{worldId:r}})},createRoom:(t,r)=>{const a=Ya.getWorldId();return lt({url:`/agents/${t}/rooms`,method:"POST",body:{name:r,worldId:a}})},getRoom:(t,r)=>lt({url:`/agents/${t}/rooms/${r}`,method:"GET"}),updateRoom:(t,r,a)=>lt({url:`/agents/${t}/rooms/${r}`,method:"PATCH",body:a}),deleteRoom:(t,r)=>lt({url:`/agents/${t}/rooms/${r}`,method:"DELETE"}),getLogs:t=>lt({url:`/logs?level=${t}`,method:"GET"})},M_=jS,j_=zO,D_=DS,zE=y.forwardRef(({className:t,...r},a)=>g.jsx(nu,{ref:a,className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));zE.displayName=nu.displayName;const PE=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(D_,{children:[g.jsx(zE,{}),g.jsxs(ru,{ref:s,className:le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[r,g.jsxs(_S,{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:[g.jsx(bs,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));PE.displayName=ru.displayName;const UE=({className:t,...r})=>g.jsx("div",{className:le("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});UE.displayName="DialogHeader";const kE=y.forwardRef(({className:t,...r},a)=>g.jsx(au,{ref:a,className:le("text-lg font-semibold leading-none tracking-tight",t),...r}));kE.displayName=au.displayName;const __=y.forwardRef(({className:t,...r},a)=>g.jsx(iu,{ref:a,className:le("text-sm text-muted-foreground",t),...r}));__.displayName=iu.displayName;function L_(){return Es({queryKey:["plugins"],queryFn:async()=>(await fetch("https://raw.githubusercontent.com/elizaos-plugins/registry/refs/heads/main/index.json")).json()})}function HE({characterValue:t,setCharacterValue:r}){const{data:a,error:s}=L_(),[o,c]=y.useState(""),[f,d]=y.useState(!1),m=y.useMemo(()=>a?Object.keys(a).map(x=>x.replace(/^@elizaos-plugins\//,"@elizaos/")):[],[a]),p=y.useMemo(()=>Array.isArray(t==null?void 0:t.plugins)?t.plugins:[],[t==null?void 0:t.plugins]),v=y.useMemo(()=>m.filter(x=>!p.includes(x)).filter(x=>x.toLowerCase().includes(o.toLowerCase())),[m,p,o]),b=x=>{r(E=>{const T=Array.isArray(E.plugins)?E.plugins:[],S=T.includes(x)?T.filter(w=>w!==x):[...T,x];return{...E,plugins:S}})};return g.jsx("div",{className:"space-y-6",children:g.jsx("div",{className:"space-y-4",children:g.jsxs("div",{children:[g.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),s?g.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",s.message]}):g.jsxs("div",{className:"space-y-4",children:[p.length>0&&g.jsxs("div",{className:"rounded-md bg-muted p-4",children:[g.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),g.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(x=>g.jsxs(Qe,{type:"button",variant:"ghost",size:"sm",className:"inline-flex items-center rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20 h-auto",onClick:()=>b(x),children:[x," ×"]},x))})]}),g.jsx("div",{className:"space-y-2",children:g.jsxs(M_,{open:f,onOpenChange:d,children:[g.jsx(j_,{asChild:!0,children:g.jsx(Qe,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),g.jsxs(PE,{className:"max-w-[400px]",children:[g.jsx(UE,{children:g.jsx(kE,{children:"Add Plugins"})}),g.jsxs("div",{className:"space-y-4 py-4",children:[g.jsx("div",{className:"space-y-2",children:g.jsx(vr,{type:"search",placeholder:"Search plugins...",value:o,onChange:x=>c(x.target.value)})}),g.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:v.length===0?g.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):v.map(x=>g.jsx(Qe,{variant:"ghost",className:"w-full justify-start font-normal",onClick:()=>{b(x),c(""),d(!1)},children:x},x))})]})]})]})})]})]})})})}function $E({characterValue:t,setCharacterValue:r}){var L;const[a,s]=y.useState(Object.entries(((L=t==null?void 0:t.settings)==null?void 0:L.secrets)||{}).map(([k,V])=>({name:k,value:String(V)}))),[o,c]=y.useState(""),[f,d]=y.useState(""),[m,p]=y.useState(!1),[v,b]=y.useState(null),[x,E]=y.useState(null),[T,S]=y.useState(""),w=y.useRef(null),C=()=>{o&&f&&(s([...a,{name:o,value:f}]),c(""),d(""))},N=k=>{E(k),S(a[k].value),b(null)},O=k=>{const V=[...a];V[k].value=T,s(V),E(null)},_=k=>{s(a.filter((V,H)=>H!==k)),b(null),E(null)};return y.useEffect(()=>{const k=V=>{w.current&&!w.current.contains(V.target)&&b(null)};return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[]),y.useEffect(()=>{r(k=>({...k,settings:{...k.settings,secrets:Object.fromEntries(a.map(({name:V,value:H})=>[V,H]))}}))},[a,r]),g.jsxs("div",{className:"rounded-lg w-full",children:[g.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Environment Settings"}),g.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-end w-full pb-4",children:[g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx("label",{htmlFor:"secret-name",className:"ml-2 text-xs font-medium text-gray-400",children:"NAME"}),g.jsx(vr,{id:"secret-name",placeholder:"VARIABLE_NAME",value:o,onChange:k=>c(k.target.value)})]}),g.jsxs("div",{className:"flex flex-col gap-1 relative",children:[g.jsx("label",{htmlFor:"secret-value",className:"ml-2 text-xs font-medium text-gray-400",children:"VALUE"}),g.jsxs("div",{className:"relative",children:[g.jsx(vr,{id:"secret-value",type:m?"text":"password",placeholder:"i9ju23nfsdf56",value:f,onChange:k=>d(k.target.value),className:"pr-10"}),g.jsx("div",{className:"absolute inset-y-0 right-3 flex items-center cursor-pointer text-gray-500",onClick:()=>p(!m),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&p(!m)},children:m?g.jsx(FO,{}):g.jsx(GO,{})})]})]}),g.jsx(Qe,{className:"shrink-0",onClick:C,children:"Add"})]}),a.length>0&&g.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 mt-6 font-medium text-gray-400 border-b pb-2 ml-1",children:[g.jsx("div",{children:"Name"}),g.jsx("div",{children:"Value"}),g.jsx("div",{children:"Action"})]}),g.jsx("div",{className:"mt-2",children:a.map((k,V)=>g.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-center border-b py-2 ml-1 relative",children:[g.jsx("div",{children:k.name}),g.jsx("div",{children:x===V?g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(vr,{value:T,onChange:H=>S(H.target.value),className:"w-full"}),g.jsx(Qe,{variant:"ghost",onClick:()=>O(V),children:g.jsx(Xm,{className:"w-5 h-5 text-green-500"})}),g.jsx(Qe,{variant:"ghost",onClick:()=>E(null),children:g.jsx(bs,{className:"w-5 h-5 text-red-500"})})]}):g.jsx("div",{className:"truncate text-gray-500",children:"Encrypted"})}),g.jsxs("div",{className:"relative",children:[g.jsx(Qe,{variant:"ghost",className:"p-2 text-gray-500",onClick:()=>b(v===V?null:V),children:g.jsx(YO,{className:"w-5 h-5"})}),v===V&&g.jsxs("div",{className:"absolute right-0 -top-2 mt-2 w-24 bg-muted border rounded shadow-md z-10",ref:w,children:[g.jsx("button",{className:"w-full px-4 py-2 text-left hover:opacity-50",onClick:()=>N(V),type:"button",children:"Edit"}),g.jsx("div",{className:"w-full px-4 py-2 text-left text-red-500 hover:opacity-50 cursor-pointer",onClick:()=>_(V),children:"Remove"})]})]})]},V))})]})}const E0={name:"",username:"",system:"",bio:[],topics:[],adjectives:[]};function qE(){const t=to(),{toast:r}=xn(),a=In(),[s,o]=y.useState({...E0}),c=d=>{var m,p,v;return{...d,bio:d.bio??[],messageExamples:d.messageExamples??[],postExamples:d.postExamples??[],topics:d.topics??[],adjectives:d.adjectives??[],plugins:d.plugins??[],style:{all:((m=d.style)==null?void 0:m.all)??[],chat:((p=d.style)==null?void 0:p.chat)??[],post:((v=d.style)==null?void 0:v.post)??[]}}},f=async d=>{try{const m=c(d);await Lt.createAgent({characterJson:m}),a.invalidateQueries({queryKey:["characters"]}),r({title:"Success",description:"Character created successfully!"}),a.invalidateQueries({queryKey:["agents"]}),t("/")}catch(m){r({title:"Error",description:m instanceof Error?m.message:"Failed to create character",variant:"destructive"})}};return g.jsx(LE,{characterValue:s,setCharacterValue:o,title:"Character Settings",description:"Configure your AI character's behavior and capabilities",onSubmit:f,onReset:()=>o(E0),onDelete:()=>{t("/")},isAgent:!0,customComponents:[{name:"Plugins",component:g.jsx(HE,{characterValue:s,setCharacterValue:o})},{name:"Secret",component:g.jsx($E,{characterValue:s,setCharacterValue:o})}]})}const kn={FREQUENT:30*1e3,STANDARD:2*60*1e3,RARE:10*60*1e3,NEVER:Number.POSITIVE_INFINITY},BE=()=>{const t=typeof navigator<"u"&&"connection"in navigator?navigator.connection:null;return{isOffline:typeof navigator<"u"&&!navigator.onLine,effectiveType:(t==null?void 0:t.effectiveType)||"unknown",saveData:(t==null?void 0:t.saveData)||!1}};function IE(t={}){const r=BE();return Es({queryKey:["agents"],queryFn:()=>Lt.getAgents(),staleTime:kn.FREQUENT,refetchInterval:r.isOffline?!1:kn.FREQUENT,refetchIntervalInBackground:!1,...!r.isOffline&&r.effectiveType==="slow-2g"&&{refetchInterval:kn.STANDARD},...t})}function z_(t,r={}){const a=BE();return Es({queryKey:["agent",t],queryFn:()=>Lt.getAgent(t||""),staleTime:kn.FREQUENT,enabled:!!t,refetchInterval:!a.isOffline&&t?kn.FREQUENT:!1,refetchIntervalInBackground:!1,...!a.isOffline&&a.effectiveType==="slow-2g"&&{refetchInterval:kn.STANDARD},...r})}function P_(){const t=In(),{toast:r}=xn();return Zl({mutationFn:async a=>{try{return await Lt.startAgent(a)}catch(s){if(s instanceof Error){if(s.message.includes("network"))throw new Error("Network error: Please check your connection and try again.");if(s.message.includes("already running"))throw new Error("Agent is already running.")}throw s}},onMutate:async a=>(r({title:"Starting Agent",description:"Initializing agent..."}),{agentId:a}),onSuccess:a=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["active-agents"]}),a!=null&&a.id&&t.invalidateQueries({queryKey:["agent",a.id]}),r({title:"Agent Started",description:`${(a==null?void 0:a.name)||"Agent"} is now running`})},onError:a=>{const s=a instanceof Error?a.message:"Failed to start agent";r({title:"Error Starting Agent",description:`${s}. Please try again.`,variant:"destructive"})}})}function U_(){const t=In(),{toast:r}=xn();return Zl({mutationFn:a=>Lt.stopAgent(a),onMutate:async a=>{const s=t.getQueryData(["agent",a]);s&&r({title:"Stopping Agent",description:`Stopping ${s.name}...`})},onSuccess:(a,s)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",s]}),r({title:"Agent Stopped",description:"The agent has been successfully stopped"})},onError:(a,s)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",s]}),r({title:"Error",description:a instanceof Error?a.message:"Failed to stop agent",variant:"destructive"})}})}function k_(t){const r=In(),a=Ya.getWorldId();return{messages:r.getQueryData(["messages",t,a])||[]}}const H_="1.0.0-alpha.19",Ji={version:H_};function $_(){const[t,r]=y.useState(null),[a,s]=y.useState(!0),[o,c]=y.useState(typeof navigator<"u"?navigator.onLine:!0),[f,d]=y.useState(!1),m=In(),[p,v]=y.useState(Date.now()),b=y.useRef(0),x=y.useRef(Date.now());y.useEffect(()=>{const k=()=>{s(document.visibilityState==="visible"),document.visibilityState==="visible"&&(b.current=0,Date.now()-p>1e4&&m.invalidateQueries({queryKey:["status"]}))},V=()=>{c(navigator.onLine),navigator.onLine&&(b.current=0,m.invalidateQueries({queryKey:["status"]}))};return document.addEventListener("visibilitychange",k),window.addEventListener("online",V),window.addEventListener("offline",V),s(document.visibilityState==="visible"),()=>{document.removeEventListener("visibilitychange",k),window.removeEventListener("online",V),window.removeEventListener("offline",V)}},[m,p]);const T=Es({queryKey:["status"],queryFn:async()=>{try{const k=performance.now(),V=await Lt.getAgents(),H=performance.now();return b.current=0,x.current=Date.now(),r(H-k),v(Date.now()),V}catch(k){throw b.current+=1,console.error("Connection check failed:",k),k}},refetchInterval:o?b.current>0?Math.min(5e3*2**(b.current-1),6e4):a?3e3:15e3:!1,retry:3,retryDelay:k=>Math.min(1e3*1.5**k,1e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0,staleTime:500,gcTime:kn.STANDARD}),S=(T==null?void 0:T.isSuccess)&&!(T!=null&&T.isError),w=(T==null?void 0:T.isRefetching)||(T==null?void 0:T.isPending),C=S===!1&&b.current>5&&Date.now()-x.current>6e4,N=()=>o?C?"bg-yellow-600":w?"bg-muted-foreground":S?"bg-green-600":"bg-red-600":"bg-orange-600",O=()=>o?C?"Reconnecting...":w?"Connecting...":S?"Connected":"Disconnected":"Offline",_=()=>o?C?"text-yellow-600":w?"text-muted-foreground":S?"text-green-600":"text-red-600":"text-orange-600",L=()=>{b.current=0,m.invalidateQueries({queryKey:["agents"]}),m.invalidateQueries({queryKey:["status"]})};return g.jsx(mr,{children:g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx(Ia,{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:L,children:g.jsx("div",{className:"flex flex-col gap-1 select-none transition-all duration-200",children:g.jsxs("div",{className:"flex items-center gap-1",children:[f?g.jsx(e2,{className:"h-3.5 w-3.5 text-muted-foreground animate-pulse"}):g.jsx("div",{className:le(["h-2.5 w-2.5 rounded-full",N()])}),g.jsx("span",{className:le(["text-xs",f?"text-muted-foreground":_()]),children:f?"Refresh":O()})]})})})}),S&&!f?g.jsx(Un,{side:"top",children:g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(HO,{className:"size-4"}),g.jsxs("span",{children:[t==null?void 0:t.toFixed(2)," ms"]})]})}):null]})})}function q_(){const t=pa(),{data:{data:r}={},isPending:a}=IE();return g.jsxs(Ew,{className:"bg-background",children:[g.jsx(Tw,{className:"pb-4",children:g.jsx(Lc,{children:g.jsx(mr,{children:g.jsx(Ia,{size:"lg",asChild:!0,children:g.jsxs(Va,{to:"/",className:"px-6 py-4",children:[g.jsx("img",{alt:"elizaos-icon",src:"/elizaos-icon.png",width:"100%",height:"100%",className:"size-9"}),g.jsxs("div",{className:"flex flex-col leading-none ",children:[g.jsx("span",{className:"font-semibold text-lg",children:"ElizaOS"}),g.jsxs("span",{className:"text-sm -mt-0.5 text-muted-foreground",children:["v",Ji==null?void 0:Ji.version]})]})]})})})})}),g.jsx(Aw,{children:g.jsxs(Nw,{children:[g.jsx(Ow,{className:"px-6 py-2 text-sm font-medium text-muted-foreground",children:g.jsx(Va,{to:"/",children:"AGENTS"})}),g.jsx(Mw,{className:"px-2",children:g.jsx(Lc,{children:a?g.jsx("div",{children:Array.from({length:5}).map((s,o)=>g.jsx(mr,{children:g.jsx(jw,{})},`skeleton-item-${o}`))}):g.jsx("div",{children:(()=>{const s=[...(r==null?void 0:r.agents)||[]].sort((f,d)=>f.enabled&&!d.enabled?-1:!f.enabled&&d.enabled?1:f.name.localeCompare(d.name)),o=s.filter(f=>f.status==="active"),c=s.filter(f=>f.status==="inactive");return g.jsxs(g.Fragment,{children:[o.length>0&&g.jsx("div",{className:"px-4 py-2 mt-4",children:g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx("div",{className:"size-2.5 rounded-full bg-green-500"}),g.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Active"})]})}),o.map(f=>g.jsx(mr,{children:g.jsx(Va,{to:`/chat/${f.id}`,children:g.jsx(Ia,{isActive:t.pathname.includes(f.id),className:"transition-colors px-4 py-2 my-1 rounded-md",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Kb,{className:"size-5"}),g.jsx("span",{className:"text-base",children:f.name})]})})})},f.id)),c.length>0&&g.jsx("div",{className:"px-4 py-2 mt-4",children:g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx("div",{className:"size-2.5 rounded-full bg-muted-foreground/50"}),g.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Inactive"})]})}),c.map(f=>g.jsx(mr,{children:g.jsx("div",{className:"px-4 py-2 my-1 rounded-md",children:g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Kb,{className:"size-5"}),g.jsx("span",{className:"text-base",children:f.name})]})})},f.id))]})})()})})})]})}),g.jsx(Cw,{className:"px-4 py-4",children:g.jsxs(Lc,{children:[g.jsx(mr,{children:g.jsx(Va,{to:"https://elizaos.github.io/eliza/docs/intro/",target:"_blank",children:g.jsxs(Ia,{className:"text-muted-foreground rounded-md",children:[g.jsx(qO,{className:"size-5"}),g.jsx("span",{children:"Documentation"})]})})}),g.jsx(mr,{children:g.jsx(Va,{to:"/logs",children:g.jsxs(Ia,{className:"text-muted-foreground rounded-md",children:[g.jsx(t2,{className:"size-5"}),g.jsx("span",{children:"Logs"})]})})}),g.jsx(mr,{children:g.jsxs(Ia,{disabled:!0,className:"text-muted-foreground/50 rounded-md",children:[g.jsx(PS,{className:"size-5"}),g.jsx("span",{children:"Settings"})]})}),g.jsx($_,{})]})})]})}const VE=6048e5,B_=864e5,R0=Symbol.for("constructDateFrom");function ha(t,r){return typeof t=="function"?t(r):t&&typeof t=="object"&&R0 in t?t[R0](r):t instanceof Date?new t.constructor(r):new Date(r)}function Sn(t,r){return ha(r||t,t)}let I_={};function bu(){return I_}function ql(t,r){var d,m,p,v;const a=bu(),s=(r==null?void 0:r.weekStartsOn)??((m=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:m.weekStartsOn)??a.weekStartsOn??((v=(p=a.locale)==null?void 0:p.options)==null?void 0:v.weekStartsOn)??0,o=Sn(t,r==null?void 0:r.in),c=o.getDay(),f=(c<s?7:0)+c-s;return o.setDate(o.getDate()-f),o.setHours(0,0,0,0),o}function Wc(t,r){return ql(t,{...r,weekStartsOn:1})}function YE(t,r){const a=Sn(t,r==null?void 0:r.in),s=a.getFullYear(),o=ha(a,0);o.setFullYear(s+1,0,4),o.setHours(0,0,0,0);const c=Wc(o),f=ha(a,0);f.setFullYear(s,0,4),f.setHours(0,0,0,0);const d=Wc(f);return a.getTime()>=c.getTime()?s+1:a.getTime()>=d.getTime()?s:s-1}function T0(t){const r=Sn(t),a=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return a.setUTCFullYear(r.getFullYear()),+t-+a}function V_(t,...r){const a=ha.bind(null,r.find(s=>typeof s=="object"));return r.map(a)}function C0(t,r){const a=Sn(t,r==null?void 0:r.in);return a.setHours(0,0,0,0),a}function Y_(t,r,a){const[s,o]=V_(a==null?void 0:a.in,t,r),c=C0(s),f=C0(o),d=+c-T0(c),m=+f-T0(f);return Math.round((d-m)/B_)}function F_(t,r){const a=YE(t,r),s=ha(t,0);return s.setFullYear(a,0,4),s.setHours(0,0,0,0),Wc(s)}function G_(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Q_(t){return!(!G_(t)&&typeof t!="number"||isNaN(+Sn(t)))}function X_(t,r){const a=Sn(t,r==null?void 0:r.in);return a.setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a}const K_={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},W_=(t,r,a)=>{let s;const o=K_[t];return typeof o=="string"?s=o:r===1?s=o.one:s=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+s:s+" ago":s};function fh(t){return(r={})=>{const a=r.width?String(r.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const Z_={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},J_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},eL={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tL={date:fh({formats:Z_,defaultWidth:"full"}),time:fh({formats:J_,defaultWidth:"full"}),dateTime:fh({formats:eL,defaultWidth:"full"})},nL={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},rL=(t,r,a,s)=>nL[t];function Ml(t){return(r,a)=>{const s=a!=null&&a.context?String(a.context):"standalone";let o;if(s==="formatting"&&t.formattingValues){const f=t.defaultFormattingWidth||t.defaultWidth,d=a!=null&&a.width?String(a.width):f;o=t.formattingValues[d]||t.formattingValues[f]}else{const f=t.defaultWidth,d=a!=null&&a.width?String(a.width):t.defaultWidth;o=t.values[d]||t.values[f]}const c=t.argumentCallback?t.argumentCallback(r):r;return o[c]}}const aL={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},iL={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},sL={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},lL={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},oL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},cL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},uL=(t,r)=>{const a=Number(t),s=a%100;if(s>20||s<10)switch(s%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},fL={ordinalNumber:uL,era:Ml({values:aL,defaultWidth:"wide"}),quarter:Ml({values:iL,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ml({values:sL,defaultWidth:"wide"}),day:Ml({values:lL,defaultWidth:"wide"}),dayPeriod:Ml({values:oL,defaultWidth:"wide",formattingValues:cL,defaultFormattingWidth:"wide"})};function jl(t){return(r,a={})=>{const s=a.width,o=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],c=r.match(o);if(!c)return null;const f=c[0],d=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],m=Array.isArray(d)?hL(d,b=>b.test(f)):dL(d,b=>b.test(f));let p;p=t.valueCallback?t.valueCallback(m):m,p=a.valueCallback?a.valueCallback(p):p;const v=r.slice(f.length);return{value:p,rest:v}}}function dL(t,r){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r(t[a]))return a}function hL(t,r){for(let a=0;a<t.length;a++)if(r(t[a]))return a}function mL(t){return(r,a={})=>{const s=r.match(t.matchPattern);if(!s)return null;const o=s[0],c=r.match(t.parsePattern);if(!c)return null;let f=t.valueCallback?t.valueCallback(c[0]):c[0];f=a.valueCallback?a.valueCallback(f):f;const d=r.slice(o.length);return{value:f,rest:d}}}const pL=/^(\d+)(th|st|nd|rd)?/i,gL=/\d+/i,vL={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},yL={any:[/^b/i,/^(a|c)/i]},bL={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xL={any:[/1/i,/2/i,/3/i,/4/i]},SL={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},wL={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},EL={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},RL={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},TL={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},CL={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},AL={ordinalNumber:mL({matchPattern:pL,parsePattern:gL,valueCallback:t=>parseInt(t,10)}),era:jl({matchPatterns:vL,defaultMatchWidth:"wide",parsePatterns:yL,defaultParseWidth:"any"}),quarter:jl({matchPatterns:bL,defaultMatchWidth:"wide",parsePatterns:xL,defaultParseWidth:"any",valueCallback:t=>t+1}),month:jl({matchPatterns:SL,defaultMatchWidth:"wide",parsePatterns:wL,defaultParseWidth:"any"}),day:jl({matchPatterns:EL,defaultMatchWidth:"wide",parsePatterns:RL,defaultParseWidth:"any"}),dayPeriod:jl({matchPatterns:TL,defaultMatchWidth:"any",parsePatterns:CL,defaultParseWidth:"any"})},NL={code:"en-US",formatDistance:W_,formatLong:tL,formatRelative:rL,localize:fL,match:AL,options:{weekStartsOn:0,firstWeekContainsDate:1}};function OL(t,r){const a=Sn(t,r==null?void 0:r.in);return Y_(a,X_(a))+1}function ML(t,r){const a=Sn(t,r==null?void 0:r.in),s=+Wc(a)-+F_(a);return Math.round(s/VE)+1}function FE(t,r){var v,b,x,E;const a=Sn(t,r==null?void 0:r.in),s=a.getFullYear(),o=bu(),c=(r==null?void 0:r.firstWeekContainsDate)??((b=(v=r==null?void 0:r.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((E=(x=o.locale)==null?void 0:x.options)==null?void 0:E.firstWeekContainsDate)??1,f=ha((r==null?void 0:r.in)||t,0);f.setFullYear(s+1,0,c),f.setHours(0,0,0,0);const d=ql(f,r),m=ha((r==null?void 0:r.in)||t,0);m.setFullYear(s,0,c),m.setHours(0,0,0,0);const p=ql(m,r);return+a>=+d?s+1:+a>=+p?s:s-1}function jL(t,r){var d,m,p,v;const a=bu(),s=(r==null?void 0:r.firstWeekContainsDate)??((m=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((v=(p=a.locale)==null?void 0:p.options)==null?void 0:v.firstWeekContainsDate)??1,o=FE(t,r),c=ha((r==null?void 0:r.in)||t,0);return c.setFullYear(o,0,s),c.setHours(0,0,0,0),ql(c,r)}function DL(t,r){const a=Sn(t,r==null?void 0:r.in),s=+ql(a,r)-+jL(a,r);return Math.round(s/VE)+1}function He(t,r){const a=t<0?"-":"",s=Math.abs(t).toString().padStart(r,"0");return a+s}const Zr={y(t,r){const a=t.getFullYear(),s=a>0?a:1-a;return He(r==="yy"?s%100:s,r.length)},M(t,r){const a=t.getMonth();return r==="M"?String(a+1):He(a+1,2)},d(t,r){return He(t.getDate(),r.length)},a(t,r){const a=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h(t,r){return He(t.getHours()%12||12,r.length)},H(t,r){return He(t.getHours(),r.length)},m(t,r){return He(t.getMinutes(),r.length)},s(t,r){return He(t.getSeconds(),r.length)},S(t,r){const a=r.length,s=t.getMilliseconds(),o=Math.trunc(s*Math.pow(10,a-3));return He(o,r.length)}},Yi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},A0={G:function(t,r,a){const s=t.getFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(s,{width:"abbreviated"});case"GGGGG":return a.era(s,{width:"narrow"});case"GGGG":default:return a.era(s,{width:"wide"})}},y:function(t,r,a){if(r==="yo"){const s=t.getFullYear(),o=s>0?s:1-s;return a.ordinalNumber(o,{unit:"year"})}return Zr.y(t,r)},Y:function(t,r,a,s){const o=FE(t,s),c=o>0?o:1-o;if(r==="YY"){const f=c%100;return He(f,2)}return r==="Yo"?a.ordinalNumber(c,{unit:"year"}):He(c,r.length)},R:function(t,r){const a=YE(t);return He(a,r.length)},u:function(t,r){const a=t.getFullYear();return He(a,r.length)},Q:function(t,r,a){const s=Math.ceil((t.getMonth()+1)/3);switch(r){case"Q":return String(s);case"QQ":return He(s,2);case"Qo":return a.ordinalNumber(s,{unit:"quarter"});case"QQQ":return a.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,r,a){const s=Math.ceil((t.getMonth()+1)/3);switch(r){case"q":return String(s);case"qq":return He(s,2);case"qo":return a.ordinalNumber(s,{unit:"quarter"});case"qqq":return a.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,r,a){const s=t.getMonth();switch(r){case"M":case"MM":return Zr.M(t,r);case"Mo":return a.ordinalNumber(s+1,{unit:"month"});case"MMM":return a.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(s,{width:"wide",context:"formatting"})}},L:function(t,r,a){const s=t.getMonth();switch(r){case"L":return String(s+1);case"LL":return He(s+1,2);case"Lo":return a.ordinalNumber(s+1,{unit:"month"});case"LLL":return a.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(s,{width:"wide",context:"standalone"})}},w:function(t,r,a,s){const o=DL(t,s);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):He(o,r.length)},I:function(t,r,a){const s=ML(t);return r==="Io"?a.ordinalNumber(s,{unit:"week"}):He(s,r.length)},d:function(t,r,a){return r==="do"?a.ordinalNumber(t.getDate(),{unit:"date"}):Zr.d(t,r)},D:function(t,r,a){const s=OL(t);return r==="Do"?a.ordinalNumber(s,{unit:"dayOfYear"}):He(s,r.length)},E:function(t,r,a){const s=t.getDay();switch(r){case"E":case"EE":case"EEE":return a.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(s,{width:"short",context:"formatting"});case"EEEE":default:return a.day(s,{width:"wide",context:"formatting"})}},e:function(t,r,a,s){const o=t.getDay(),c=(o-s.weekStartsOn+8)%7||7;switch(r){case"e":return String(c);case"ee":return He(c,2);case"eo":return a.ordinalNumber(c,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(t,r,a,s){const o=t.getDay(),c=(o-s.weekStartsOn+8)%7||7;switch(r){case"c":return String(c);case"cc":return He(c,r.length);case"co":return a.ordinalNumber(c,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(t,r,a){const s=t.getDay(),o=s===0?7:s;switch(r){case"i":return String(o);case"ii":return He(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(s,{width:"short",context:"formatting"});case"iiii":default:return a.day(s,{width:"wide",context:"formatting"})}},a:function(t,r,a){const o=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,r,a){const s=t.getHours();let o;switch(s===12?o=Yi.noon:s===0?o=Yi.midnight:o=s/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,r,a){const s=t.getHours();let o;switch(s>=17?o=Yi.evening:s>=12?o=Yi.afternoon:s>=4?o=Yi.morning:o=Yi.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,r,a){if(r==="ho"){let s=t.getHours()%12;return s===0&&(s=12),a.ordinalNumber(s,{unit:"hour"})}return Zr.h(t,r)},H:function(t,r,a){return r==="Ho"?a.ordinalNumber(t.getHours(),{unit:"hour"}):Zr.H(t,r)},K:function(t,r,a){const s=t.getHours()%12;return r==="Ko"?a.ordinalNumber(s,{unit:"hour"}):He(s,r.length)},k:function(t,r,a){let s=t.getHours();return s===0&&(s=24),r==="ko"?a.ordinalNumber(s,{unit:"hour"}):He(s,r.length)},m:function(t,r,a){return r==="mo"?a.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zr.m(t,r)},s:function(t,r,a){return r==="so"?a.ordinalNumber(t.getSeconds(),{unit:"second"}):Zr.s(t,r)},S:function(t,r){return Zr.S(t,r)},X:function(t,r,a){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(r){case"X":return O0(s);case"XXXX":case"XX":return Ba(s);case"XXXXX":case"XXX":default:return Ba(s,":")}},x:function(t,r,a){const s=t.getTimezoneOffset();switch(r){case"x":return O0(s);case"xxxx":case"xx":return Ba(s);case"xxxxx":case"xxx":default:return Ba(s,":")}},O:function(t,r,a){const s=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+N0(s,":");case"OOOO":default:return"GMT"+Ba(s,":")}},z:function(t,r,a){const s=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+N0(s,":");case"zzzz":default:return"GMT"+Ba(s,":")}},t:function(t,r,a){const s=Math.trunc(+t/1e3);return He(s,r.length)},T:function(t,r,a){return He(+t,r.length)}};function N0(t,r=""){const a=t>0?"-":"+",s=Math.abs(t),o=Math.trunc(s/60),c=s%60;return c===0?a+String(o):a+String(o)+r+He(c,2)}function O0(t,r){return t%60===0?(t>0?"-":"+")+He(Math.abs(t)/60,2):Ba(t,r)}function Ba(t,r=""){const a=t>0?"-":"+",s=Math.abs(t),o=He(Math.trunc(s/60),2),c=He(s%60,2);return a+o+r+c}const M0=(t,r)=>{switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},GE=(t,r)=>{switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},_L=(t,r)=>{const a=t.match(/(P+)(p+)?/)||[],s=a[1],o=a[2];if(!o)return M0(t,r);let c;switch(s){case"P":c=r.dateTime({width:"short"});break;case"PP":c=r.dateTime({width:"medium"});break;case"PPP":c=r.dateTime({width:"long"});break;case"PPPP":default:c=r.dateTime({width:"full"});break}return c.replace("{{date}}",M0(s,r)).replace("{{time}}",GE(o,r))},LL={p:GE,P:_L},zL=/^D+$/,PL=/^Y+$/,UL=["D","DD","YY","YYYY"];function kL(t){return zL.test(t)}function HL(t){return PL.test(t)}function $L(t,r,a){const s=qL(t,r,a);if(console.warn(s),UL.includes(t))throw new RangeError(s)}function qL(t,r,a){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${s} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BL=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,IL=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,VL=/^'([^]*?)'?$/,YL=/''/g,FL=/[a-zA-Z]/;function GL(t,r,a){var v,b,x,E;const s=bu(),o=s.locale??NL,c=s.firstWeekContainsDate??((b=(v=s.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,f=s.weekStartsOn??((E=(x=s.locale)==null?void 0:x.options)==null?void 0:E.weekStartsOn)??0,d=Sn(t,a==null?void 0:a.in);if(!Q_(d))throw new RangeError("Invalid time value");let m=r.match(IL).map(T=>{const S=T[0];if(S==="p"||S==="P"){const w=LL[S];return w(T,o.formatLong)}return T}).join("").match(BL).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const S=T[0];if(S==="'")return{isToken:!1,value:QL(T)};if(A0[S])return{isToken:!0,value:T};if(S.match(FL))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:T}});o.localize.preprocessor&&(m=o.localize.preprocessor(d,m));const p={firstWeekContainsDate:c,weekStartsOn:f,locale:o};return m.map(T=>{if(!T.isToken)return T.value;const S=T.value;(HL(S)||kL(S))&&$L(S,r,String(t));const w=A0[S[0]];return w(d,S,o.localize,p)}).join("")}function QL(t){const r=t.match(VL);return r?r[1].replace(YL,"'"):t}function QE({title:t,subtitle:r}){return g.jsxs("div",{className:"space-y-0.5",children:[g.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:t}),r?g.jsx("p",{className:"text-muted-foreground",children:r}):null]})}function Dm(t,[r,a]){return Math.min(a,Math.max(r,t))}function XL(t,r){return y.useReducer((a,s)=>r[a][s]??a,t)}var Sp="ScrollArea",[XE,gz]=qn(Sp),[KL,on]=XE(Sp),KE=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,type:s="hover",dir:o,scrollHideDelay:c=600,...f}=t,[d,m]=y.useState(null),[p,v]=y.useState(null),[b,x]=y.useState(null),[E,T]=y.useState(null),[S,w]=y.useState(null),[C,N]=y.useState(0),[O,_]=y.useState(0),[L,k]=y.useState(!1),[V,H]=y.useState(!1),U=Ue(r,te=>m(te)),K=vu(o);return g.jsx(KL,{scope:a,type:s,dir:K,scrollHideDelay:c,scrollArea:d,viewport:p,onViewportChange:v,content:b,onContentChange:x,scrollbarX:E,onScrollbarXChange:T,scrollbarXEnabled:L,onScrollbarXEnabledChange:k,scrollbarY:S,onScrollbarYChange:w,scrollbarYEnabled:V,onScrollbarYEnabledChange:H,onCornerWidthChange:N,onCornerHeightChange:_,children:g.jsx(we.div,{dir:K,...f,ref:U,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":O+"px",...t.style}})})});KE.displayName=Sp;var WE="ScrollAreaViewport",ZE=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,children:s,nonce:o,...c}=t,f=on(WE,a),d=y.useRef(null),m=Ue(r,d,f.onViewportChange);return g.jsxs(g.Fragment,{children:[g.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}),g.jsx(we.div,{"data-radix-scroll-area-viewport":"",...c,ref:m,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...t.style},children:g.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});ZE.displayName=WE;var Fn="ScrollAreaScrollbar",wp=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=on(Fn,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:f}=o,d=t.orientation==="horizontal";return y.useEffect(()=>(d?c(!0):f(!0),()=>{d?c(!1):f(!1)}),[d,c,f]),o.type==="hover"?g.jsx(WL,{...s,ref:r,forceMount:a}):o.type==="scroll"?g.jsx(ZL,{...s,ref:r,forceMount:a}):o.type==="auto"?g.jsx(JE,{...s,ref:r,forceMount:a}):o.type==="always"?g.jsx(Ep,{...s,ref:r}):null});wp.displayName=Fn;var WL=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=on(Fn,t.__scopeScrollArea),[c,f]=y.useState(!1);return y.useEffect(()=>{const d=o.scrollArea;let m=0;if(d){const p=()=>{window.clearTimeout(m),f(!0)},v=()=>{m=window.setTimeout(()=>f(!1),o.scrollHideDelay)};return d.addEventListener("pointerenter",p),d.addEventListener("pointerleave",v),()=>{window.clearTimeout(m),d.removeEventListener("pointerenter",p),d.removeEventListener("pointerleave",v)}}},[o.scrollArea,o.scrollHideDelay]),g.jsx(ln,{present:a||c,children:g.jsx(JE,{"data-state":c?"visible":"hidden",...s,ref:r})})}),ZL=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=on(Fn,t.__scopeScrollArea),c=t.orientation==="horizontal",f=Su(()=>m("SCROLL_END"),100),[d,m]=XL("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(d==="idle"){const p=window.setTimeout(()=>m("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[d,o.scrollHideDelay,m]),y.useEffect(()=>{const p=o.viewport,v=c?"scrollLeft":"scrollTop";if(p){let b=p[v];const x=()=>{const E=p[v];b!==E&&(m("SCROLL"),f()),b=E};return p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[o.viewport,c,m,f]),g.jsx(ln,{present:a||d!=="hidden",children:g.jsx(Ep,{"data-state":d==="hidden"?"hidden":"visible",...s,ref:r,onPointerEnter:ve(t.onPointerEnter,()=>m("POINTER_ENTER")),onPointerLeave:ve(t.onPointerLeave,()=>m("POINTER_LEAVE"))})})}),JE=y.forwardRef((t,r)=>{const a=on(Fn,t.__scopeScrollArea),{forceMount:s,...o}=t,[c,f]=y.useState(!1),d=t.orientation==="horizontal",m=Su(()=>{if(a.viewport){const p=a.viewport.offsetWidth<a.viewport.scrollWidth,v=a.viewport.offsetHeight<a.viewport.scrollHeight;f(d?p:v)}},10);return ps(a.viewport,m),ps(a.content,m),g.jsx(ln,{present:s||c,children:g.jsx(Ep,{"data-state":c?"visible":"hidden",...o,ref:r})})}),Ep=y.forwardRef((t,r)=>{const{orientation:a="vertical",...s}=t,o=on(Fn,t.__scopeScrollArea),c=y.useRef(null),f=y.useRef(0),[d,m]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=a1(d.viewport,d.content),v={...s,sizes:d,onSizesChange:m,hasThumb:p>0&&p<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:x=>f.current=x};function b(x,E){return a4(x,f.current,d,E)}return a==="horizontal"?g.jsx(JL,{...v,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollLeft,E=j0(x,d,o.dir);c.current.style.transform=`translate3d(${E}px, 0, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollLeft=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollLeft=b(x,o.dir))}}):a==="vertical"?g.jsx(e4,{...v,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollTop,E=j0(x,d);c.current.style.transform=`translate3d(0, ${E}px, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollTop=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollTop=b(x))}}):null}),JL=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:s,...o}=t,c=on(Fn,t.__scopeScrollArea),[f,d]=y.useState(),m=y.useRef(null),p=Ue(r,m,c.onScrollbarXChange);return y.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),g.jsx(t1,{"data-orientation":"horizontal",...o,ref:p,sizes:a,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xu(a)+"px",...t.style},onThumbPointerDown:v=>t.onThumbPointerDown(v.x),onDragScroll:v=>t.onDragScroll(v.x),onWheelScroll:(v,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+v.deltaX;t.onWheelScroll(x),s1(x,b)&&v.preventDefault()}},onResize:()=>{m.current&&c.viewport&&f&&s({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:m.current.clientWidth,paddingStart:Jc(f.paddingLeft),paddingEnd:Jc(f.paddingRight)}})}})}),e4=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:s,...o}=t,c=on(Fn,t.__scopeScrollArea),[f,d]=y.useState(),m=y.useRef(null),p=Ue(r,m,c.onScrollbarYChange);return y.useEffect(()=>{m.current&&d(getComputedStyle(m.current))},[m]),g.jsx(t1,{"data-orientation":"vertical",...o,ref:p,sizes:a,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xu(a)+"px",...t.style},onThumbPointerDown:v=>t.onThumbPointerDown(v.y),onDragScroll:v=>t.onDragScroll(v.y),onWheelScroll:(v,b)=>{if(c.viewport){const x=c.viewport.scrollTop+v.deltaY;t.onWheelScroll(x),s1(x,b)&&v.preventDefault()}},onResize:()=>{m.current&&c.viewport&&f&&s({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:m.current.clientHeight,paddingStart:Jc(f.paddingTop),paddingEnd:Jc(f.paddingBottom)}})}})}),[t4,e1]=XE(Fn),t1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,sizes:s,hasThumb:o,onThumbChange:c,onThumbPointerUp:f,onThumbPointerDown:d,onThumbPositionChange:m,onDragScroll:p,onWheelScroll:v,onResize:b,...x}=t,E=on(Fn,a),[T,S]=y.useState(null),w=Ue(r,U=>S(U)),C=y.useRef(null),N=y.useRef(""),O=E.viewport,_=s.content-s.viewport,L=nt(v),k=nt(m),V=Su(b,10);function H(U){if(C.current){const K=U.clientX-C.current.left,te=U.clientY-C.current.top;p({x:K,y:te})}}return y.useEffect(()=>{const U=K=>{const te=K.target;(T==null?void 0:T.contains(te))&&L(K,_)};return document.addEventListener("wheel",U,{passive:!1}),()=>document.removeEventListener("wheel",U,{passive:!1})},[O,T,_,L]),y.useEffect(k,[s,k]),ps(T,V),ps(E.content,V),g.jsx(t4,{scope:a,scrollbar:T,hasThumb:o,onThumbChange:nt(c),onThumbPointerUp:nt(f),onThumbPositionChange:k,onThumbPointerDown:nt(d),children:g.jsx(we.div,{...x,ref:w,style:{position:"absolute",...x.style},onPointerDown:ve(t.onPointerDown,U=>{U.button===0&&(U.target.setPointerCapture(U.pointerId),C.current=T.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",E.viewport&&(E.viewport.style.scrollBehavior="auto"),H(U))}),onPointerMove:ve(t.onPointerMove,H),onPointerUp:ve(t.onPointerUp,U=>{const K=U.target;K.hasPointerCapture(U.pointerId)&&K.releasePointerCapture(U.pointerId),document.body.style.webkitUserSelect=N.current,E.viewport&&(E.viewport.style.scrollBehavior=""),C.current=null})})})}),Zc="ScrollAreaThumb",n1=y.forwardRef((t,r)=>{const{forceMount:a,...s}=t,o=e1(Zc,t.__scopeScrollArea);return g.jsx(ln,{present:a||o.hasThumb,children:g.jsx(n4,{ref:r,...s})})}),n4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,style:s,...o}=t,c=on(Zc,a),f=e1(Zc,a),{onThumbPositionChange:d}=f,m=Ue(r,b=>f.onThumbChange(b)),p=y.useRef(void 0),v=Su(()=>{p.current&&(p.current(),p.current=void 0)},100);return y.useEffect(()=>{const b=c.viewport;if(b){const x=()=>{if(v(),!p.current){const E=i4(b,d);p.current=E,d()}};return d(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,v,d]),g.jsx(we.div,{"data-state":f.hasThumb?"visible":"hidden",...o,ref:m,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:ve(t.onPointerDownCapture,b=>{const E=b.target.getBoundingClientRect(),T=b.clientX-E.left,S=b.clientY-E.top;f.onThumbPointerDown({x:T,y:S})}),onPointerUp:ve(t.onPointerUp,f.onThumbPointerUp)})});n1.displayName=Zc;var Rp="ScrollAreaCorner",r1=y.forwardRef((t,r)=>{const a=on(Rp,t.__scopeScrollArea),s=!!(a.scrollbarX&&a.scrollbarY);return a.type!=="scroll"&&s?g.jsx(r4,{...t,ref:r}):null});r1.displayName=Rp;var r4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,...s}=t,o=on(Rp,a),[c,f]=y.useState(0),[d,m]=y.useState(0),p=!!(c&&d);return ps(o.scrollbarX,()=>{var b;const v=((b=o.scrollbarX)==null?void 0:b.offsetHeight)||0;o.onCornerHeightChange(v),m(v)}),ps(o.scrollbarY,()=>{var b;const v=((b=o.scrollbarY)==null?void 0:b.offsetWidth)||0;o.onCornerWidthChange(v),f(v)}),p?g.jsx(we.div,{...s,ref:r,style:{width:c,height:d,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Jc(t){return t?parseInt(t,10):0}function a1(t,r){const a=t/r;return isNaN(a)?0:a}function xu(t){const r=a1(t.viewport,t.content),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-a)*r;return Math.max(s,18)}function a4(t,r,a,s="ltr"){const o=xu(a),c=o/2,f=r||c,d=o-f,m=a.scrollbar.paddingStart+f,p=a.scrollbar.size-a.scrollbar.paddingEnd-d,v=a.content-a.viewport,b=s==="ltr"?[0,v]:[v*-1,0];return i1([m,p],b)(t)}function j0(t,r,a="ltr"){const s=xu(r),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,c=r.scrollbar.size-o,f=r.content-r.viewport,d=c-s,m=a==="ltr"?[0,f]:[f*-1,0],p=Dm(t,m);return i1([0,f],[0,d])(p)}function i1(t,r){return a=>{if(t[0]===t[1]||r[0]===r[1])return r[0];const s=(r[1]-r[0])/(t[1]-t[0]);return r[0]+s*(a-t[0])}}function s1(t,r){return t>0&&t<r}var i4=(t,r=()=>{})=>{let a={left:t.scrollLeft,top:t.scrollTop},s=0;return function o(){const c={left:t.scrollLeft,top:t.scrollTop},f=a.left!==c.left,d=a.top!==c.top;(f||d)&&r(),a=c,s=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(s)};function Su(t,r){const a=nt(t),s=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),y.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(a,r)},[a,r])}function ps(t,r){const a=nt(r);ft(()=>{let s=0;if(t){const o=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(a)});return o.observe(t),()=>{window.cancelAnimationFrame(s),o.unobserve(t)}}},[t,a])}var l1=KE,s4=ZE,l4=r1;const o1=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(l1,{ref:s,className:le("relative overflow-hidden",t),...a,children:[g.jsx(s4,{className:"h-full w-full rounded-[inherit]",children:r}),g.jsx(c1,{}),g.jsx(l4,{})]}));o1.displayName=l1.displayName;const c1=y.forwardRef(({className:t,orientation:r="vertical",...a},s)=>g.jsx(wp,{ref:s,orientation:r,className:le("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:g.jsx(n1,{className:"relative flex-1 rounded-full bg-border"})}));c1.displayName=wp.displayName;function o4(t){const r=y.useRef({value:t,previous:t});return y.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var c4=[" ","Enter","ArrowUp","ArrowDown"],u4=[" ","Enter"],ro="Select",[wu,Eu,f4]=vp(ro),[Cs,vz]=qn(ro,[f4,cu]),Ru=cu(),[d4,ga]=Cs(ro),[h4,m4]=Cs(ro),u1=t=>{const{__scopeSelect:r,children:a,open:s,defaultOpen:o,onOpenChange:c,value:f,defaultValue:d,onValueChange:m,dir:p,name:v,autoComplete:b,disabled:x,required:E,form:T}=t,S=Ru(r),[w,C]=y.useState(null),[N,O]=y.useState(null),[_,L]=y.useState(!1),k=vu(p),[V=!1,H]=ei({prop:s,defaultProp:o,onChange:c}),[U,K]=ei({prop:f,defaultProp:d,onChange:m}),te=y.useRef(null),se=w?T||!!w.closest("form"):!0,[de,q]=y.useState(new Set),$=Array.from(de).map(j=>j.props.value).join(";");return g.jsx(lw,{...S,children:g.jsxs(d4,{required:E,scope:r,trigger:w,onTriggerChange:C,valueNode:N,onValueNodeChange:O,valueNodeHasChildren:_,onValueNodeHasChildrenChange:L,contentId:yr(),value:U,onValueChange:K,open:V,onOpenChange:H,dir:k,triggerPointerDownPosRef:te,disabled:x,children:[g.jsx(wu.Provider,{scope:r,children:g.jsx(h4,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(j=>{q(B=>new Set(B).add(j))},[]),onNativeOptionRemove:y.useCallback(j=>{q(B=>{const z=new Set(B);return z.delete(j),z})},[]),children:a})}),se?g.jsxs(z1,{"aria-hidden":!0,required:E,tabIndex:-1,name:v,autoComplete:b,value:U,onChange:j=>K(j.target.value),disabled:x,form:T,children:[U===void 0?g.jsx("option",{value:""}):null,Array.from(de)]},$):null]})})};u1.displayName=ro;var f1="SelectTrigger",d1=y.forwardRef((t,r)=>{const{__scopeSelect:a,disabled:s=!1,...o}=t,c=Ru(a),f=ga(f1,a),d=f.disabled||s,m=Ue(r,f.onTriggerChange),p=Eu(a),v=y.useRef("touch"),[b,x,E]=P1(S=>{const w=p().filter(O=>!O.disabled),C=w.find(O=>O.value===f.value),N=U1(w,S,C);N!==void 0&&f.onValueChange(N.value)}),T=S=>{d||(f.onOpenChange(!0),E()),S&&(f.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return g.jsx(ow,{asChild:!0,...c,children:g.jsx(we.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":L1(f.value)?"":void 0,...o,ref:m,onClick:ve(o.onClick,S=>{S.currentTarget.focus(),v.current!=="mouse"&&T(S)}),onPointerDown:ve(o.onPointerDown,S=>{v.current=S.pointerType;const w=S.target;w.hasPointerCapture(S.pointerId)&&w.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(T(S),S.preventDefault())}),onKeyDown:ve(o.onKeyDown,S=>{const w=b.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(w&&S.key===" ")&&c4.includes(S.key)&&(T(),S.preventDefault())})})})});d1.displayName=f1;var h1="SelectValue",m1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:s,style:o,children:c,placeholder:f="",...d}=t,m=ga(h1,a),{onValueNodeHasChildrenChange:p}=m,v=c!==void 0,b=Ue(r,m.onValueNodeChange);return ft(()=>{p(v)},[p,v]),g.jsx(we.span,{...d,ref:b,style:{pointerEvents:"none"},children:L1(m.value)?g.jsx(g.Fragment,{children:f}):c})});m1.displayName=h1;var p4="SelectIcon",p1=y.forwardRef((t,r)=>{const{__scopeSelect:a,children:s,...o}=t;return g.jsx(we.span,{"aria-hidden":!0,...o,ref:r,children:s||"▼"})});p1.displayName=p4;var g4="SelectPortal",g1=t=>g.jsx(Ql,{asChild:!0,...t});g1.displayName=g4;var ii="SelectContent",v1=y.forwardRef((t,r)=>{const a=ga(ii,t.__scopeSelect),[s,o]=y.useState();if(ft(()=>{o(new DocumentFragment)},[]),!a.open){const c=s;return c?ys.createPortal(g.jsx(y1,{scope:t.__scopeSelect,children:g.jsx(wu.Slot,{scope:t.__scopeSelect,children:g.jsx("div",{children:t.children})})}),c):null}return g.jsx(b1,{...t,ref:r})});v1.displayName=ii;var hn=10,[y1,va]=Cs(ii),v4="SelectContentImpl",b1=y.forwardRef((t,r)=>{const{__scopeSelect:a,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:c,onPointerDownOutside:f,side:d,sideOffset:m,align:p,alignOffset:v,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:T,hideWhenDetached:S,avoidCollisions:w,...C}=t,N=ga(ii,a),[O,_]=y.useState(null),[L,k]=y.useState(null),V=Ue(r,ue=>_(ue)),[H,U]=y.useState(null),[K,te]=y.useState(null),se=Eu(a),[de,q]=y.useState(!1),$=y.useRef(!1);y.useEffect(()=>{if(O)return mS(O)},[O]),iS();const j=y.useCallback(ue=>{const[me,...Ee]=se().map(Ae=>Ae.ref.current),[fe]=Ee.slice(-1),Se=document.activeElement;for(const Ae of ue)if(Ae===Se||(Ae==null||Ae.scrollIntoView({block:"nearest"}),Ae===me&&L&&(L.scrollTop=0),Ae===fe&&L&&(L.scrollTop=L.scrollHeight),Ae==null||Ae.focus(),document.activeElement!==Se))return},[se,L]),B=y.useCallback(()=>j([H,O]),[j,H,O]);y.useEffect(()=>{de&&B()},[de,B]);const{onOpenChange:z,triggerPointerDownPosRef:Q}=N;y.useEffect(()=>{if(O){let ue={x:0,y:0};const me=fe=>{var Se,Ae;ue={x:Math.abs(Math.round(fe.pageX)-(((Se=Q.current)==null?void 0:Se.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((Ae=Q.current)==null?void 0:Ae.y)??0))}},Ee=fe=>{ue.x<=10&&ue.y<=10?fe.preventDefault():O.contains(fe.target)||z(!1),document.removeEventListener("pointermove",me),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[O,z,Q]),y.useEffect(()=>{const ue=()=>z(!1);return window.addEventListener("blur",ue),window.addEventListener("resize",ue),()=>{window.removeEventListener("blur",ue),window.removeEventListener("resize",ue)}},[z]);const[M,F]=P1(ue=>{const me=se().filter(Se=>!Se.disabled),Ee=me.find(Se=>Se.ref.current===document.activeElement),fe=U1(me,ue,Ee);fe&&setTimeout(()=>fe.ref.current.focus())}),ee=y.useCallback((ue,me,Ee)=>{const fe=!$.current&&!Ee;(N.value!==void 0&&N.value===me||fe)&&(U(ue),fe&&($.current=!0))},[N.value]),ae=y.useCallback(()=>O==null?void 0:O.focus(),[O]),re=y.useCallback((ue,me,Ee)=>{const fe=!$.current&&!Ee;(N.value!==void 0&&N.value===me||fe)&&te(ue)},[N.value]),oe=s==="popper"?_m:x1,pe=oe===_m?{side:d,sideOffset:m,align:p,alignOffset:v,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:T,hideWhenDetached:S,avoidCollisions:w}:{};return g.jsx(y1,{scope:a,content:O,viewport:L,onViewportChange:k,itemRefCallback:ee,selectedItem:H,onItemLeave:ae,itemTextRefCallback:re,focusSelectedItem:B,selectedItemText:K,position:s,isPositioned:de,searchRef:M,children:g.jsx(Vm,{as:sn,allowPinchZoom:!0,children:g.jsx(Im,{asChild:!0,trapped:N.open,onMountAutoFocus:ue=>{ue.preventDefault()},onUnmountAutoFocus:ve(o,ue=>{var me;(me=N.trigger)==null||me.focus({preventScroll:!0}),ue.preventDefault()}),children:g.jsx(Gl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:ue=>ue.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:g.jsx(oe,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:ue=>ue.preventDefault(),...C,...pe,onPlaced:()=>q(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ve(C.onKeyDown,ue=>{const me=ue.ctrlKey||ue.altKey||ue.metaKey;if(ue.key==="Tab"&&ue.preventDefault(),!me&&ue.key.length===1&&F(ue.key),["ArrowUp","ArrowDown","Home","End"].includes(ue.key)){let fe=se().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(ue.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ue.key)){const Se=ue.target,Ae=fe.indexOf(Se);fe=fe.slice(Ae+1)}setTimeout(()=>j(fe)),ue.preventDefault()}})})})})})})});b1.displayName=v4;var y4="SelectItemAlignedPosition",x1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onPlaced:s,...o}=t,c=ga(ii,a),f=va(ii,a),[d,m]=y.useState(null),[p,v]=y.useState(null),b=Ue(r,V=>v(V)),x=Eu(a),E=y.useRef(!1),T=y.useRef(!0),{viewport:S,selectedItem:w,selectedItemText:C,focusSelectedItem:N}=f,O=y.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&p&&S&&w&&C){const V=c.trigger.getBoundingClientRect(),H=p.getBoundingClientRect(),U=c.valueNode.getBoundingClientRect(),K=C.getBoundingClientRect();if(c.dir!=="rtl"){const Se=K.left-H.left,Ae=U.left-Se,Ie=V.left-Ae,Et=V.width+Ie,Rn=Math.max(Et,H.width),Vt=window.innerWidth-hn,Gn=Dm(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Et+"px",d.style.left=Gn+"px"}else{const Se=H.right-K.right,Ae=window.innerWidth-U.right-Se,Ie=window.innerWidth-V.right-Ae,Et=V.width+Ie,Rn=Math.max(Et,H.width),Vt=window.innerWidth-hn,Gn=Dm(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Et+"px",d.style.right=Gn+"px"}const te=x(),se=window.innerHeight-hn*2,de=S.scrollHeight,q=window.getComputedStyle(p),$=parseInt(q.borderTopWidth,10),j=parseInt(q.paddingTop,10),B=parseInt(q.borderBottomWidth,10),z=parseInt(q.paddingBottom,10),Q=$+j+de+z+B,M=Math.min(w.offsetHeight*5,Q),F=window.getComputedStyle(S),ee=parseInt(F.paddingTop,10),ae=parseInt(F.paddingBottom,10),re=V.top+V.height/2-hn,oe=se-re,pe=w.offsetHeight/2,ue=w.offsetTop+pe,me=$+j+ue,Ee=Q-me;if(me<=re){const Se=te.length>0&&w===te[te.length-1].ref.current;d.style.bottom="0px";const Ae=p.clientHeight-S.offsetTop-S.offsetHeight,Ie=Math.max(oe,pe+(Se?ae:0)+Ae+B),Et=me+Ie;d.style.height=Et+"px"}else{const Se=te.length>0&&w===te[0].ref.current;d.style.top="0px";const Ie=Math.max(re,$+S.offsetTop+(Se?ee:0)+pe)+Ee;d.style.height=Ie+"px",S.scrollTop=me-re+S.offsetTop}d.style.margin=`${hn}px 0`,d.style.minHeight=M+"px",d.style.maxHeight=se+"px",s==null||s(),requestAnimationFrame(()=>E.current=!0)}},[x,c.trigger,c.valueNode,d,p,S,w,C,c.dir,s]);ft(()=>O(),[O]);const[_,L]=y.useState();ft(()=>{p&&L(window.getComputedStyle(p).zIndex)},[p]);const k=y.useCallback(V=>{V&&T.current===!0&&(O(),N==null||N(),T.current=!1)},[O,N]);return g.jsx(x4,{scope:a,contentWrapper:d,shouldExpandOnScrollRef:E,onScrollButtonChange:k,children:g.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:g.jsx(we.div,{...o,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});x1.displayName=y4;var b4="SelectPopperPosition",_m=y.forwardRef((t,r)=>{const{__scopeSelect:a,align:s="start",collisionPadding:o=hn,...c}=t,f=Ru(a);return g.jsx(cw,{...f,...c,ref:r,align:s,collisionPadding:o,style:{boxSizing:"border-box",...c.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)"}})});_m.displayName=b4;var[x4,Tp]=Cs(ii,{}),Lm="SelectViewport",S1=y.forwardRef((t,r)=>{const{__scopeSelect:a,nonce:s,...o}=t,c=va(Lm,a),f=Tp(Lm,a),d=Ue(r,c.onViewportChange),m=y.useRef(0);return g.jsxs(g.Fragment,{children:[g.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}),g.jsx(wu.Slot,{scope:a,children:g.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,p=>{const v=p.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:x}=f;if(x!=null&&x.current&&b){const E=Math.abs(m.current-v.scrollTop);if(E>0){const T=window.innerHeight-hn*2,S=parseFloat(b.style.minHeight),w=parseFloat(b.style.height),C=Math.max(S,w);if(C<T){const N=C+E,O=Math.min(T,N),_=N-O;b.style.height=O+"px",b.style.bottom==="0px"&&(v.scrollTop=_>0?_:0,b.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});S1.displayName=Lm;var w1="SelectGroup",[S4,w4]=Cs(w1),E4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t,o=yr();return g.jsx(S4,{scope:a,id:o,children:g.jsx(we.div,{role:"group","aria-labelledby":o,...s,ref:r})})});E4.displayName=w1;var E1="SelectLabel",R1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t,o=w4(E1,a);return g.jsx(we.div,{id:o.id,...s,ref:r})});R1.displayName=E1;var eu="SelectItem",[R4,T1]=Cs(eu),C1=y.forwardRef((t,r)=>{const{__scopeSelect:a,value:s,disabled:o=!1,textValue:c,...f}=t,d=ga(eu,a),m=va(eu,a),p=d.value===s,[v,b]=y.useState(c??""),[x,E]=y.useState(!1),T=Ue(r,N=>{var O;return(O=m.itemRefCallback)==null?void 0:O.call(m,N,s,o)}),S=yr(),w=y.useRef("touch"),C=()=>{o||(d.onValueChange(s),d.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 g.jsx(R4,{scope:a,value:s,disabled:o,textId:S,isSelected:p,onItemTextChange:y.useCallback(N=>{b(O=>O||((N==null?void 0:N.textContent)??"").trim())},[]),children:g.jsx(wu.ItemSlot,{scope:a,value:s,disabled:o,textValue:v,children:g.jsx(we.div,{role:"option","aria-labelledby":S,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...f,ref:T,onFocus:ve(f.onFocus,()=>E(!0)),onBlur:ve(f.onBlur,()=>E(!1)),onClick:ve(f.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:ve(f.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:ve(f.onPointerDown,N=>{w.current=N.pointerType}),onPointerMove:ve(f.onPointerMove,N=>{var O;w.current=N.pointerType,o?(O=m.onItemLeave)==null||O.call(m):w.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(f.onPointerLeave,N=>{var O;N.currentTarget===document.activeElement&&((O=m.onItemLeave)==null||O.call(m))}),onKeyDown:ve(f.onKeyDown,N=>{var _;((_=m.searchRef)==null?void 0:_.current)!==""&&N.key===" "||(u4.includes(N.key)&&C(),N.key===" "&&N.preventDefault())})})})})});C1.displayName=eu;var zl="SelectItemText",A1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:s,style:o,...c}=t,f=ga(zl,a),d=va(zl,a),m=T1(zl,a),p=m4(zl,a),[v,b]=y.useState(null),x=Ue(r,C=>b(C),m.onItemTextChange,C=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,C,m.value,m.disabled)}),E=v==null?void 0:v.textContent,T=y.useMemo(()=>g.jsx("option",{value:m.value,disabled:m.disabled,children:E},m.value),[m.disabled,m.value,E]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=p;return ft(()=>(S(T),()=>w(T)),[S,w,T]),g.jsxs(g.Fragment,{children:[g.jsx(we.span,{id:m.textId,...c,ref:x}),m.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ys.createPortal(c.children,f.valueNode):null]})});A1.displayName=zl;var N1="SelectItemIndicator",O1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t;return T1(N1,a).isSelected?g.jsx(we.span,{"aria-hidden":!0,...s,ref:r}):null});O1.displayName=N1;var zm="SelectScrollUpButton",M1=y.forwardRef((t,r)=>{const a=va(zm,t.__scopeSelect),s=Tp(zm,t.__scopeSelect),[o,c]=y.useState(!1),f=Ue(r,s.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=m.scrollTop>0;c(p)};const m=a.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?g.jsx(D1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=a;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});M1.displayName=zm;var Pm="SelectScrollDownButton",j1=y.forwardRef((t,r)=>{const a=va(Pm,t.__scopeSelect),s=Tp(Pm,t.__scopeSelect),[o,c]=y.useState(!1),f=Ue(r,s.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<p;c(v)};const m=a.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?g.jsx(D1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=a;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});j1.displayName=Pm;var D1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onAutoScroll:s,...o}=t,c=va("SelectScrollButton",a),f=y.useRef(null),d=Eu(a),m=y.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return y.useEffect(()=>()=>m(),[m]),ft(()=>{var v;const p=d().find(b=>b.ref.current===document.activeElement);(v=p==null?void 0:p.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),g.jsx(we.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(s,50))}),onPointerMove:ve(o.onPointerMove,()=>{var p;(p=c.onItemLeave)==null||p.call(c),f.current===null&&(f.current=window.setInterval(s,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{m()})})}),T4="SelectSeparator",_1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t;return g.jsx(we.div,{"aria-hidden":!0,...s,ref:r})});_1.displayName=T4;var Um="SelectArrow",C4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...s}=t,o=Ru(a),c=ga(Um,a),f=va(Um,a);return c.open&&f.position==="popper"?g.jsx(uw,{...o,...s,ref:r}):null});C4.displayName=Um;function L1(t){return t===""||t===void 0}var z1=y.forwardRef((t,r)=>{const{value:a,...s}=t,o=y.useRef(null),c=Ue(r,o),f=o4(a);return y.useEffect(()=>{const d=o.current,m=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(m,"value").set;if(f!==a&&v){const b=new Event("change",{bubbles:!0});v.call(d,a),d.dispatchEvent(b)}},[f,a]),g.jsx(Kl,{asChild:!0,children:g.jsx("select",{...s,ref:c,defaultValue:a})})});z1.displayName="BubbleSelect";function P1(t){const r=nt(t),a=y.useRef(""),s=y.useRef(0),o=y.useCallback(f=>{const d=a.current+f;r(d),function m(p){a.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>m(""),1e3))}(d)},[r]),c=y.useCallback(()=>{a.current="",window.clearTimeout(s.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(s.current),[]),[a,o,c]}function U1(t,r,a){const o=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,c=a?t.indexOf(a):-1;let f=A4(t,Math.max(c,0));o.length===1&&(f=f.filter(p=>p!==a));const m=f.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return m!==a?m:void 0}function A4(t,r){return t.map((a,s)=>t[(r+s)%t.length])}var N4=u1,k1=d1,O4=m1,M4=p1,j4=g1,H1=v1,D4=S1,$1=R1,q1=C1,_4=A1,L4=O1,B1=M1,I1=j1,V1=_1;const z4=N4,P4=O4,Y1=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(k1,{ref:s,className:le("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[r,g.jsx(M4,{asChild:!0,children:g.jsx(zS,{className:"h-4 w-4 opacity-50"})})]}));Y1.displayName=k1.displayName;const F1=y.forwardRef(({className:t,...r},a)=>g.jsx(B1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:g.jsx(BO,{className:"h-4 w-4"})}));F1.displayName=B1.displayName;const G1=y.forwardRef(({className:t,...r},a)=>g.jsx(I1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:g.jsx(zS,{className:"h-4 w-4"})}));G1.displayName=I1.displayName;const Q1=y.forwardRef(({className:t,children:r,position:a="popper",...s},o)=>g.jsx(j4,{children:g.jsxs(H1,{ref:o,className:le("relative z-50 max-h-96 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",a==="popper"&&"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:a,...s,children:[g.jsx(F1,{}),g.jsx(D4,{className:le("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),g.jsx(G1,{})]})}));Q1.displayName=H1.displayName;const U4=y.forwardRef(({className:t,...r},a)=>g.jsx($1,{ref:a,className:le("px-2 py-1.5 text-sm font-semibold",t),...r}));U4.displayName=$1.displayName;const km=y.forwardRef(({className:t,children:r,...a},s)=>g.jsxs(q1,{ref:s,className:le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[g.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:g.jsx(L4,{children:g.jsx(Xm,{className:"h-4 w-4"})})}),g.jsx(_4,{children:r})]}));km.displayName=q1.displayName;const k4=y.forwardRef(({className:t,...r},a)=>g.jsx(V1,{ref:a,className:le("-mx-1 my-1 h-px bg-muted",t),...r}));k4.displayName=V1.displayName;const H4={10:"TRACE",20:"DEBUG",27:"SUCCESS",28:"PROGRESS",29:"LOG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"},$4={10:"text-gray-400",20:"text-blue-400",27:"text-green-600",28:"text-purple-400",29:"text-gray-300",30:"text-emerald-400",40:"text-yellow-400",50:"text-red-400",60:"text-red-600"};function q4(){const[t,r]=y.useState("all"),[a,s]=y.useState(!0),o=y.useRef(null),c=y.useRef(!1),f=y.useRef(""),{data:d,error:m,isLoading:p}=Es({queryKey:["logs",t],queryFn:()=>Lt.getLogs(t==="all"?"":t),refetchInterval:1e3,staleTime:1e3}),v=()=>{if(!o.current)return;const w=o.current,C=w.scrollHeight,N=w.clientHeight;w.scrollTo({top:C-N,behavior:"instant"})};y.useEffect(()=>{var N;if(!((N=d==null?void 0:d.logs)!=null&&N.length))return;const w=d.logs[d.logs.length-1],C=`${w.time}-${w.msg}`;a&&C!==f.current&&(setTimeout(v,0),f.current=C)},[d==null?void 0:d.logs,a]);const b=w=>{if(c.current)return;const{scrollTop:C,scrollHeight:N,clientHeight:O}=w.currentTarget,L=N-(C+O)<100;s(L),c.current=!0,setTimeout(()=>{c.current=!1},150)},x=()=>{s(!0),v()};y.useEffect(()=>{setTimeout(v,100)},[d==null?void 0:d.logs]);const E=w=>H4[w]||"UNKNOWN",T=w=>$4[w]||"text-gray-400",S=w=>{const C=GL(w.time,"yyyy-MM-dd HH:mm:ss"),N=E(w.level),O=Object.entries(w).filter(([L])=>!Number.isNaN(Number(L))).sort((L,k)=>Number(L[0])-Number(k[0])),_=O.length>0?`
265
265
  ${O.map(([L,k])=>k).join(`
266
266
  `)}`:"";return g.jsxs("div",{className:"whitespace-pre-wrap font-mono",children:[g.jsxs("span",{className:"text-gray-500",children:["[",C,"]"]})," ",g.jsxs("span",{className:T(w.level),children:[N,":"]})," ",g.jsx("span",{className:"text-white",children:w.msg}),g.jsx("span",{className:"text-gray-300",children:_})]},`${w.time}-${w.msg}`)};return g.jsxs("div",{className:"p-4",children:[g.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[g.jsx(QE,{title:"System Logs"}),g.jsxs("div",{className:"flex items-center gap-4",children:[!a&&g.jsx("button",{type:"button",onClick:x,className:"text-xs text-gray-400 hover:text-white transition-colors",children:"Resume auto-scroll"}),g.jsxs(z4,{value:t,onValueChange:r,children:[g.jsx(Y1,{className:"w-32",children:g.jsx(P4,{placeholder:"Select level"})}),g.jsxs(Q1,{children:[g.jsx(km,{value:"all",children:"ALL"}),d==null?void 0:d.levels.map(w=>g.jsx(km,{value:w,children:w.toUpperCase()},w))]})]})]})]}),p?g.jsx("div",{className:"font-mono p-4",children:"Loading logs..."}):m?g.jsx("div",{className:"text-red-500 font-mono p-4",children:m instanceof Error?m.message:"Failed to fetch logs"}):g.jsx(o1,{className:"h-[600px] rounded-md border bg-black",children:g.jsx("div",{ref:o,onScroll:b,className:"p-4 text-sm space-y-1 h-full overflow-auto",children:(d==null?void 0:d.logs.length)===0?g.jsxs("div",{className:"text-gray-500 font-mono",children:["No ",t==="all"?"":t.toUpperCase()," ","logs found"]}):d==null?void 0:d.logs.map(w=>S(w))})})]})}var Cp="ToastProvider",[Ap,B4,I4]=vp("Toast"),[X1,yz]=qn("Toast",[I4]),[V4,Tu]=X1(Cp),K1=t=>{const{__scopeToast:r,label:a="Notification",duration:s=5e3,swipeDirection:o="right",swipeThreshold:c=50,children:f}=t,[d,m]=y.useState(null),[p,v]=y.useState(0),b=y.useRef(!1),x=y.useRef(!1);return a.trim()||console.error(`Invalid prop \`label\` supplied to \`${Cp}\`. Expected non-empty \`string\`.`),g.jsx(Ap.Provider,{scope:r,children:g.jsx(V4,{scope:r,label:a,duration:s,swipeDirection:o,swipeThreshold:c,toastCount:p,viewport:d,onViewportChange:m,onToastAdd:y.useCallback(()=>v(E=>E+1),[]),onToastRemove:y.useCallback(()=>v(E=>E-1),[]),isFocusedToastEscapeKeyDownRef:b,isClosePausedRef:x,children:f})})};K1.displayName=Cp;var W1="ToastViewport",Y4=["F8"],Hm="toast.viewportPause",$m="toast.viewportResume",Z1=y.forwardRef((t,r)=>{const{__scopeToast:a,hotkey:s=Y4,label:o="Notifications ({hotkey})",...c}=t,f=Tu(W1,a),d=B4(a),m=y.useRef(null),p=y.useRef(null),v=y.useRef(null),b=y.useRef(null),x=Ue(r,b,f.onViewportChange),E=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),T=f.toastCount>0;y.useEffect(()=>{const w=C=>{var O;s.length!==0&&s.every(_=>C[_]||C.code===_)&&((O=b.current)==null||O.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[s]),y.useEffect(()=>{const w=m.current,C=b.current;if(T&&w&&C){const N=()=>{if(!f.isClosePausedRef.current){const k=new CustomEvent(Hm);C.dispatchEvent(k),f.isClosePausedRef.current=!0}},O=()=>{if(f.isClosePausedRef.current){const k=new CustomEvent($m);C.dispatchEvent(k),f.isClosePausedRef.current=!1}},_=k=>{!w.contains(k.relatedTarget)&&O()},L=()=>{w.contains(document.activeElement)||O()};return w.addEventListener("focusin",N),w.addEventListener("focusout",_),w.addEventListener("pointermove",N),w.addEventListener("pointerleave",L),window.addEventListener("blur",N),window.addEventListener("focus",O),()=>{w.removeEventListener("focusin",N),w.removeEventListener("focusout",_),w.removeEventListener("pointermove",N),w.removeEventListener("pointerleave",L),window.removeEventListener("blur",N),window.removeEventListener("focus",O)}}},[T,f.isClosePausedRef]);const S=y.useCallback(({tabbingDirection:w})=>{const N=d().map(O=>{const _=O.ref.current,L=[_,...a3(_)];return w==="forwards"?L:L.reverse()});return(w==="forwards"?N.reverse():N).flat()},[d]);return y.useEffect(()=>{const w=b.current;if(w){const C=N=>{var L,k,V;const O=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!O){const H=document.activeElement,U=N.shiftKey;if(N.target===w&&U){(L=p.current)==null||L.focus();return}const se=S({tabbingDirection:U?"backwards":"forwards"}),de=se.findIndex(q=>q===H);dh(se.slice(de+1))?N.preventDefault():U?(k=p.current)==null||k.focus():(V=v.current)==null||V.focus()}};return w.addEventListener("keydown",C),()=>w.removeEventListener("keydown",C)}},[d,S]),g.jsxs(MN,{ref:m,role:"region","aria-label":o.replace("{hotkey}",E),tabIndex:-1,style:{pointerEvents:T?void 0:"none"},children:[T&&g.jsx(qm,{ref:p,onFocusFromOutsideViewport:()=>{const w=S({tabbingDirection:"forwards"});dh(w)}}),g.jsx(Ap.Slot,{scope:a,children:g.jsx(we.ol,{tabIndex:-1,...c,ref:x})}),T&&g.jsx(qm,{ref:v,onFocusFromOutsideViewport:()=>{const w=S({tabbingDirection:"backwards"});dh(w)}})]})});Z1.displayName=W1;var J1="ToastFocusProxy",qm=y.forwardRef((t,r)=>{const{__scopeToast:a,onFocusFromOutsideViewport:s,...o}=t,c=Tu(J1,a);return g.jsx(Kl,{"aria-hidden":!0,tabIndex:0,...o,ref:r,style:{position:"fixed"},onFocus:f=>{var p;const d=f.relatedTarget;!((p=c.viewport)!=null&&p.contains(d))&&s()}})});qm.displayName=J1;var Cu="Toast",F4="toast.swipeStart",G4="toast.swipeMove",Q4="toast.swipeCancel",X4="toast.swipeEnd",eR=y.forwardRef((t,r)=>{const{forceMount:a,open:s,defaultOpen:o,onOpenChange:c,...f}=t,[d=!0,m]=ei({prop:s,defaultProp:o,onChange:c});return g.jsx(ln,{present:a||d,children:g.jsx(Z4,{open:d,...f,ref:r,onClose:()=>m(!1),onPause:nt(t.onPause),onResume:nt(t.onResume),onSwipeStart:ve(t.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ve(t.onSwipeMove,p=>{const{x:v,y:b}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","move"),p.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${v}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${b}px`)}),onSwipeCancel:ve(t.onSwipeCancel,p=>{p.currentTarget.setAttribute("data-swipe","cancel"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ve(t.onSwipeEnd,p=>{const{x:v,y:b}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${v}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${b}px`),m(!1)})})})});eR.displayName=Cu;var[K4,W4]=X1(Cu,{onClose(){}}),Z4=y.forwardRef((t,r)=>{const{__scopeToast:a,type:s="foreground",duration:o,open:c,onClose:f,onEscapeKeyDown:d,onPause:m,onResume:p,onSwipeStart:v,onSwipeMove:b,onSwipeCancel:x,onSwipeEnd:E,...T}=t,S=Tu(Cu,a),[w,C]=y.useState(null),N=Ue(r,q=>C(q)),O=y.useRef(null),_=y.useRef(null),L=o||S.duration,k=y.useRef(0),V=y.useRef(L),H=y.useRef(0),{onToastAdd:U,onToastRemove:K}=S,te=nt(()=>{var $;(w==null?void 0:w.contains(document.activeElement))&&(($=S.viewport)==null||$.focus()),f()}),se=y.useCallback(q=>{!q||q===1/0||(window.clearTimeout(H.current),k.current=new Date().getTime(),H.current=window.setTimeout(te,q))},[te]);y.useEffect(()=>{const q=S.viewport;if(q){const $=()=>{se(V.current),p==null||p()},j=()=>{const B=new Date().getTime()-k.current;V.current=V.current-B,window.clearTimeout(H.current),m==null||m()};return q.addEventListener(Hm,j),q.addEventListener($m,$),()=>{q.removeEventListener(Hm,j),q.removeEventListener($m,$)}}},[S.viewport,L,m,p,se]),y.useEffect(()=>{c&&!S.isClosePausedRef.current&&se(L)},[c,L,S.isClosePausedRef,se]),y.useEffect(()=>(U(),()=>K()),[U,K]);const de=y.useMemo(()=>w?lR(w):null,[w]);return S.viewport?g.jsxs(g.Fragment,{children:[de&&g.jsx(J4,{__scopeToast:a,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:de}),g.jsx(K4,{scope:a,onClose:te,children:ys.createPortal(g.jsx(Ap.ItemSlot,{scope:a,children:g.jsx(ON,{asChild:!0,onEscapeKeyDown:ve(d,()=>{S.isFocusedToastEscapeKeyDownRef.current||te(),S.isFocusedToastEscapeKeyDownRef.current=!1}),children:g.jsx(we.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":S.swipeDirection,...T,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ve(t.onKeyDown,q=>{q.key==="Escape"&&(d==null||d(q.nativeEvent),q.nativeEvent.defaultPrevented||(S.isFocusedToastEscapeKeyDownRef.current=!0,te()))}),onPointerDown:ve(t.onPointerDown,q=>{q.button===0&&(O.current={x:q.clientX,y:q.clientY})}),onPointerMove:ve(t.onPointerMove,q=>{if(!O.current)return;const $=q.clientX-O.current.x,j=q.clientY-O.current.y,B=!!_.current,z=["left","right"].includes(S.swipeDirection),Q=["left","up"].includes(S.swipeDirection)?Math.min:Math.max,M=z?Q(0,$):0,F=z?0:Q(0,j),ee=q.pointerType==="touch"?10:2,ae={x:M,y:F},re={originalEvent:q,delta:ae};B?(_.current=ae,Cc(G4,b,re,{discrete:!1})):D0(ae,S.swipeDirection,ee)?(_.current=ae,Cc(F4,v,re,{discrete:!1}),q.target.setPointerCapture(q.pointerId)):(Math.abs($)>ee||Math.abs(j)>ee)&&(O.current=null)}),onPointerUp:ve(t.onPointerUp,q=>{const $=_.current,j=q.target;if(j.hasPointerCapture(q.pointerId)&&j.releasePointerCapture(q.pointerId),_.current=null,O.current=null,$){const B=q.currentTarget,z={originalEvent:q,delta:$};D0($,S.swipeDirection,S.swipeThreshold)?Cc(X4,E,z,{discrete:!0}):Cc(Q4,x,z,{discrete:!0}),B.addEventListener("click",Q=>Q.preventDefault(),{once:!0})}})})})}),S.viewport)})]}):null}),J4=t=>{const{__scopeToast:r,children:a,...s}=t,o=Tu(Cu,r),[c,f]=y.useState(!1),[d,m]=y.useState(!1);return n3(()=>f(!0)),y.useEffect(()=>{const p=window.setTimeout(()=>m(!0),1e3);return()=>window.clearTimeout(p)},[]),d?null:g.jsx(Ql,{asChild:!0,children:g.jsx(Kl,{...s,children:c&&g.jsxs(g.Fragment,{children:[o.label," ",a]})})})},e3="ToastTitle",tR=y.forwardRef((t,r)=>{const{__scopeToast:a,...s}=t;return g.jsx(we.div,{...s,ref:r})});tR.displayName=e3;var t3="ToastDescription",nR=y.forwardRef((t,r)=>{const{__scopeToast:a,...s}=t;return g.jsx(we.div,{...s,ref:r})});nR.displayName=t3;var rR="ToastAction",aR=y.forwardRef((t,r)=>{const{altText:a,...s}=t;return a.trim()?g.jsx(sR,{altText:a,asChild:!0,children:g.jsx(Np,{...s,ref:r})}):(console.error(`Invalid prop \`altText\` supplied to \`${rR}\`. Expected non-empty \`string\`.`),null)});aR.displayName=rR;var iR="ToastClose",Np=y.forwardRef((t,r)=>{const{__scopeToast:a,...s}=t,o=W4(iR,a);return g.jsx(sR,{asChild:!0,children:g.jsx(we.button,{type:"button",...s,ref:r,onClick:ve(t.onClick,o.onClose)})})});Np.displayName=iR;var sR=y.forwardRef((t,r)=>{const{__scopeToast:a,altText:s,...o}=t;return g.jsx(we.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...o,ref:r})});function lR(t){const r=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&r.push(s.textContent),r3(s)){const o=s.ariaHidden||s.hidden||s.style.display==="none",c=s.dataset.radixToastAnnounceExclude==="";if(!o)if(c){const f=s.dataset.radixToastAnnounceAlt;f&&r.push(f)}else r.push(...lR(s))}}),r}function Cc(t,r,a,{discrete:s}){const o=a.originalEvent.currentTarget,c=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:a});r&&o.addEventListener(t,r,{once:!0}),s?Wx(o,c):o.dispatchEvent(c)}var D0=(t,r,a=0)=>{const s=Math.abs(t.x),o=Math.abs(t.y),c=s>o;return r==="left"||r==="right"?c&&s>a:!c&&o>a};function n3(t=()=>{}){const r=nt(t);ft(()=>{let a=0,s=0;return a=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(r)),()=>{window.cancelAnimationFrame(a),window.cancelAnimationFrame(s)}},[r])}function r3(t){return t.nodeType===t.ELEMENT_NODE}function a3(t){const r=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)r.push(a.currentNode);return r}function dh(t){const r=document.activeElement;return t.some(a=>a===r?!0:(a.focus(),document.activeElement!==r))}var i3=K1,oR=Z1,cR=eR,uR=tR,fR=nR,dR=aR,hR=Np;const s3=i3,mR=y.forwardRef(({className:t,...r},a)=>g.jsx(oR,{ref:a,className:le("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...r}));mR.displayName=oR.displayName;const l3=ma("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),pR=y.forwardRef(({className:t,variant:r,...a},s)=>g.jsx(cR,{ref:s,className:le(l3({variant:r}),t),...a}));pR.displayName=cR.displayName;const gR=y.forwardRef(({className:t,...r},a)=>g.jsx(dR,{ref:a,className:le("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...r}));gR.displayName=dR.displayName;const vR=y.forwardRef(({className:t,...r},a)=>g.jsx(hR,{ref:a,className:le("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...r,children:g.jsx(bs,{className:"h-4 w-4"})}));vR.displayName=hR.displayName;const yR=y.forwardRef(({className:t,...r},a)=>g.jsx(uR,{ref:a,className:le("text-sm font-semibold [&+div]:text-xs",t),...r}));yR.displayName=uR.displayName;const bR=y.forwardRef(({className:t,...r},a)=>g.jsx(fR,{ref:a,className:le("text-sm opacity-90",t),...r}));bR.displayName=fR.displayName;function o3(){const{toasts:t}=xn();return g.jsxs(s3,{children:[t.map(({id:r,title:a,description:s,action:o,...c})=>g.jsxs(pR,{...c,children:[g.jsxs("div",{className:"grid gap-1",children:[a&&g.jsx(yR,{children:a}),s&&g.jsx(bR,{children:s})]}),o,g.jsx(vR,{})]},r)),g.jsx(mR,{})]})}var Ac={exports:{}},hh,_0;function Au(){if(_0)return hh;_0=1;const t="2.0.0",r=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,o=r-6;return hh={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:a,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},hh}var mh,L0;function Nu(){if(L0)return mh;L0=1;var t={};return mh=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{},mh}var z0;function ao(){return z0||(z0=1,function(t,r){const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:s,MAX_LENGTH:o}=Au(),c=Nu();r=t.exports={};const f=r.re=[],d=r.safeRe=[],m=r.src=[],p=r.safeSrc=[],v=r.t={};let b=0;const x="[a-zA-Z0-9-]",E=[["\\s",1],["\\d",o],[x,s]],T=w=>{for(const[C,N]of E)w=w.split(`${C}*`).join(`${C}{0,${N}}`).split(`${C}+`).join(`${C}{1,${N}}`);return w},S=(w,C,N)=>{const O=T(C),_=b++;c(w,_,C),v[w]=_,m[_]=C,p[_]=O,f[_]=new RegExp(C,N?"g":void 0),d[_]=new RegExp(O,N?"g":void 0)};S("NUMERICIDENTIFIER","0|[1-9]\\d*"),S("NUMERICIDENTIFIERLOOSE","\\d+"),S("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${x}*`),S("MAINVERSION",`(${m[v.NUMERICIDENTIFIER]})\\.(${m[v.NUMERICIDENTIFIER]})\\.(${m[v.NUMERICIDENTIFIER]})`),S("MAINVERSIONLOOSE",`(${m[v.NUMERICIDENTIFIERLOOSE]})\\.(${m[v.NUMERICIDENTIFIERLOOSE]})\\.(${m[v.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASEIDENTIFIER",`(?:${m[v.NUMERICIDENTIFIER]}|${m[v.NONNUMERICIDENTIFIER]})`),S("PRERELEASEIDENTIFIERLOOSE",`(?:${m[v.NUMERICIDENTIFIERLOOSE]}|${m[v.NONNUMERICIDENTIFIER]})`),S("PRERELEASE",`(?:-(${m[v.PRERELEASEIDENTIFIER]}(?:\\.${m[v.PRERELEASEIDENTIFIER]})*))`),S("PRERELEASELOOSE",`(?:-?(${m[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${m[v.PRERELEASEIDENTIFIERLOOSE]})*))`),S("BUILDIDENTIFIER",`${x}+`),S("BUILD",`(?:\\+(${m[v.BUILDIDENTIFIER]}(?:\\.${m[v.BUILDIDENTIFIER]})*))`),S("FULLPLAIN",`v?${m[v.MAINVERSION]}${m[v.PRERELEASE]}?${m[v.BUILD]}?`),S("FULL",`^${m[v.FULLPLAIN]}$`),S("LOOSEPLAIN",`[v=\\s]*${m[v.MAINVERSIONLOOSE]}${m[v.PRERELEASELOOSE]}?${m[v.BUILD]}?`),S("LOOSE",`^${m[v.LOOSEPLAIN]}$`),S("GTLT","((?:<|>)?=?)"),S("XRANGEIDENTIFIERLOOSE",`${m[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),S("XRANGEIDENTIFIER",`${m[v.NUMERICIDENTIFIER]}|x|X|\\*`),S("XRANGEPLAIN",`[v=\\s]*(${m[v.XRANGEIDENTIFIER]})(?:\\.(${m[v.XRANGEIDENTIFIER]})(?:\\.(${m[v.XRANGEIDENTIFIER]})(?:${m[v.PRERELEASE]})?${m[v.BUILD]}?)?)?`),S("XRANGEPLAINLOOSE",`[v=\\s]*(${m[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[v.XRANGEIDENTIFIERLOOSE]})(?:${m[v.PRERELEASELOOSE]})?${m[v.BUILD]}?)?)?`),S("XRANGE",`^${m[v.GTLT]}\\s*${m[v.XRANGEPLAIN]}$`),S("XRANGELOOSE",`^${m[v.GTLT]}\\s*${m[v.XRANGEPLAINLOOSE]}$`),S("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),S("COERCE",`${m[v.COERCEPLAIN]}(?:$|[^\\d])`),S("COERCEFULL",m[v.COERCEPLAIN]+`(?:${m[v.PRERELEASE]})?(?:${m[v.BUILD]})?(?:$|[^\\d])`),S("COERCERTL",m[v.COERCE],!0),S("COERCERTLFULL",m[v.COERCEFULL],!0),S("LONETILDE","(?:~>?)"),S("TILDETRIM",`(\\s*)${m[v.LONETILDE]}\\s+`,!0),r.tildeTrimReplace="$1~",S("TILDE",`^${m[v.LONETILDE]}${m[v.XRANGEPLAIN]}$`),S("TILDELOOSE",`^${m[v.LONETILDE]}${m[v.XRANGEPLAINLOOSE]}$`),S("LONECARET","(?:\\^)"),S("CARETTRIM",`(\\s*)${m[v.LONECARET]}\\s+`,!0),r.caretTrimReplace="$1^",S("CARET",`^${m[v.LONECARET]}${m[v.XRANGEPLAIN]}$`),S("CARETLOOSE",`^${m[v.LONECARET]}${m[v.XRANGEPLAINLOOSE]}$`),S("COMPARATORLOOSE",`^${m[v.GTLT]}\\s*(${m[v.LOOSEPLAIN]})$|^$`),S("COMPARATOR",`^${m[v.GTLT]}\\s*(${m[v.FULLPLAIN]})$|^$`),S("COMPARATORTRIM",`(\\s*)${m[v.GTLT]}\\s*(${m[v.LOOSEPLAIN]}|${m[v.XRANGEPLAIN]})`,!0),r.comparatorTrimReplace="$1$2$3",S("HYPHENRANGE",`^\\s*(${m[v.XRANGEPLAIN]})\\s+-\\s+(${m[v.XRANGEPLAIN]})\\s*$`),S("HYPHENRANGELOOSE",`^\\s*(${m[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${m[v.XRANGEPLAINLOOSE]})\\s*$`),S("STAR","(<|>)?=?\\s*\\*"),S("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),S("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ac,Ac.exports)),Ac.exports}var ph,P0;function Op(){if(P0)return ph;P0=1;const t=Object.freeze({loose:!0}),r=Object.freeze({});return ph=s=>s?typeof s!="object"?t:s:r,ph}var gh,U0;function xR(){if(U0)return gh;U0=1;const t=/^[0-9]+$/,r=(s,o)=>{const c=t.test(s),f=t.test(o);return c&&f&&(s=+s,o=+o),s===o?0:c&&!f?-1:f&&!c?1:s<o?-1:1};return gh={compareIdentifiers:r,rcompareIdentifiers:(s,o)=>r(o,s)},gh}var vh,k0;function Nt(){if(k0)return vh;k0=1;const t=Nu(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:a}=Au(),{safeRe:s,safeSrc:o,t:c}=ao(),f=Op(),{compareIdentifiers:d}=xR();class m{constructor(v,b){if(b=f(b),v instanceof m){if(v.loose===!!b.loose&&v.includePrerelease===!!b.includePrerelease)return v;v=v.version}else if(typeof v!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof v}".`);if(v.length>r)throw new TypeError(`version is longer than ${r} characters`);t("SemVer",v,b),this.options=b,this.loose=!!b.loose,this.includePrerelease=!!b.includePrerelease;const x=v.trim().match(b.loose?s[c.LOOSE]:s[c.FULL]);if(!x)throw new TypeError(`Invalid Version: ${v}`);if(this.raw=v,this.major=+x[1],this.minor=+x[2],this.patch=+x[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");x[4]?this.prerelease=x[4].split(".").map(E=>{if(/^[0-9]+$/.test(E)){const T=+E;if(T>=0&&T<a)return T}return E}):this.prerelease=[],this.build=x[5]?x[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(v){if(t("SemVer.compare",this.version,this.options,v),!(v instanceof m)){if(typeof v=="string"&&v===this.version)return 0;v=new m(v,this.options)}return v.version===this.version?0:this.compareMain(v)||this.comparePre(v)}compareMain(v){return v instanceof m||(v=new m(v,this.options)),d(this.major,v.major)||d(this.minor,v.minor)||d(this.patch,v.patch)}comparePre(v){if(v instanceof m||(v=new m(v,this.options)),this.prerelease.length&&!v.prerelease.length)return-1;if(!this.prerelease.length&&v.prerelease.length)return 1;if(!this.prerelease.length&&!v.prerelease.length)return 0;let b=0;do{const x=this.prerelease[b],E=v.prerelease[b];if(t("prerelease compare",b,x,E),x===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(x===void 0)return-1;if(x===E)continue;return d(x,E)}while(++b)}compareBuild(v){v instanceof m||(v=new m(v,this.options));let b=0;do{const x=this.build[b],E=v.build[b];if(t("build compare",b,x,E),x===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(x===void 0)return-1;if(x===E)continue;return d(x,E)}while(++b)}inc(v,b,x){if(v.startsWith("pre")){if(!b&&x===!1)throw new Error("invalid increment argument: identifier is empty");if(b){const E=new RegExp(`^${this.options.loose?o[c.PRERELEASELOOSE]:o[c.PRERELEASE]}$`),T=`-${b}`.match(E);if(!T||T[1]!==b)throw new Error(`invalid identifier: ${b}`)}}switch(v){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",b,x);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",b,x);break;case"prepatch":this.prerelease.length=0,this.inc("patch",b,x),this.inc("pre",b,x);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",b,x),this.inc("pre",b,x);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const E=Number(x)?1:0;if(this.prerelease.length===0)this.prerelease=[E];else{let T=this.prerelease.length;for(;--T>=0;)typeof this.prerelease[T]=="number"&&(this.prerelease[T]++,T=-2);if(T===-1){if(b===this.prerelease.join(".")&&x===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(E)}}if(b){let T=[b,E];x===!1&&(T=[b]),d(this.prerelease[0],b)===0?isNaN(this.prerelease[1])&&(this.prerelease=T):this.prerelease=T}break}default:throw new Error(`invalid increment argument: ${v}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return vh=m,vh}var yh,H0;function As(){if(H0)return yh;H0=1;const t=Nt();return yh=(a,s,o=!1)=>{if(a instanceof t)return a;try{return new t(a,s)}catch(c){if(!o)return null;throw c}},yh}var bh,$0;function c3(){if($0)return bh;$0=1;const t=As();return bh=(a,s)=>{const o=t(a,s);return o?o.version:null},bh}var xh,q0;function u3(){if(q0)return xh;q0=1;const t=As();return xh=(a,s)=>{const o=t(a.trim().replace(/^[=v]+/,""),s);return o?o.version:null},xh}var Sh,B0;function f3(){if(B0)return Sh;B0=1;const t=Nt();return Sh=(a,s,o,c,f)=>{typeof o=="string"&&(f=c,c=o,o=void 0);try{return new t(a instanceof t?a.version:a,o).inc(s,c,f).version}catch{return null}},Sh}var wh,I0;function d3(){if(I0)return wh;I0=1;const t=As();return wh=(a,s)=>{const o=t(a,null,!0),c=t(s,null,!0),f=o.compare(c);if(f===0)return null;const d=f>0,m=d?o:c,p=d?c:o,v=!!m.prerelease.length;if(!!p.prerelease.length&&!v){if(!p.patch&&!p.minor)return"major";if(p.compareMain(m)===0)return p.minor&&!p.patch?"minor":"patch"}const x=v?"pre":"";return o.major!==c.major?x+"major":o.minor!==c.minor?x+"minor":o.patch!==c.patch?x+"patch":"prerelease"},wh}var Eh,V0;function h3(){if(V0)return Eh;V0=1;const t=Nt();return Eh=(a,s)=>new t(a,s).major,Eh}var Rh,Y0;function m3(){if(Y0)return Rh;Y0=1;const t=Nt();return Rh=(a,s)=>new t(a,s).minor,Rh}var Th,F0;function p3(){if(F0)return Th;F0=1;const t=Nt();return Th=(a,s)=>new t(a,s).patch,Th}var Ch,G0;function g3(){if(G0)return Ch;G0=1;const t=As();return Ch=(a,s)=>{const o=t(a,s);return o&&o.prerelease.length?o.prerelease:null},Ch}var Ah,Q0;function wn(){if(Q0)return Ah;Q0=1;const t=Nt();return Ah=(a,s,o)=>new t(a,o).compare(new t(s,o)),Ah}var Nh,X0;function v3(){if(X0)return Nh;X0=1;const t=wn();return Nh=(a,s,o)=>t(s,a,o),Nh}var Oh,K0;function y3(){if(K0)return Oh;K0=1;const t=wn();return Oh=(a,s)=>t(a,s,!0),Oh}var Mh,W0;function Mp(){if(W0)return Mh;W0=1;const t=Nt();return Mh=(a,s,o)=>{const c=new t(a,o),f=new t(s,o);return c.compare(f)||c.compareBuild(f)},Mh}var jh,Z0;function b3(){if(Z0)return jh;Z0=1;const t=Mp();return jh=(a,s)=>a.sort((o,c)=>t(o,c,s)),jh}var Dh,J0;function x3(){if(J0)return Dh;J0=1;const t=Mp();return Dh=(a,s)=>a.sort((o,c)=>t(c,o,s)),Dh}var _h,ex;function Ou(){if(ex)return _h;ex=1;const t=wn();return _h=(a,s,o)=>t(a,s,o)>0,_h}var Lh,tx;function jp(){if(tx)return Lh;tx=1;const t=wn();return Lh=(a,s,o)=>t(a,s,o)<0,Lh}var zh,nx;function SR(){if(nx)return zh;nx=1;const t=wn();return zh=(a,s,o)=>t(a,s,o)===0,zh}var Ph,rx;function wR(){if(rx)return Ph;rx=1;const t=wn();return Ph=(a,s,o)=>t(a,s,o)!==0,Ph}var Uh,ax;function Dp(){if(ax)return Uh;ax=1;const t=wn();return Uh=(a,s,o)=>t(a,s,o)>=0,Uh}var kh,ix;function _p(){if(ix)return kh;ix=1;const t=wn();return kh=(a,s,o)=>t(a,s,o)<=0,kh}var Hh,sx;function ER(){if(sx)return Hh;sx=1;const t=SR(),r=wR(),a=Ou(),s=Dp(),o=jp(),c=_p();return Hh=(d,m,p,v)=>{switch(m){case"===":return typeof d=="object"&&(d=d.version),typeof p=="object"&&(p=p.version),d===p;case"!==":return typeof d=="object"&&(d=d.version),typeof p=="object"&&(p=p.version),d!==p;case"":case"=":case"==":return t(d,p,v);case"!=":return r(d,p,v);case">":return a(d,p,v);case">=":return s(d,p,v);case"<":return o(d,p,v);case"<=":return c(d,p,v);default:throw new TypeError(`Invalid operator: ${m}`)}},Hh}var $h,lx;function S3(){if(lx)return $h;lx=1;const t=Nt(),r=As(),{safeRe:a,t:s}=ao();return $h=(c,f)=>{if(c instanceof t)return c;if(typeof c=="number"&&(c=String(c)),typeof c!="string")return null;f=f||{};let d=null;if(!f.rtl)d=c.match(f.includePrerelease?a[s.COERCEFULL]:a[s.COERCE]);else{const E=f.includePrerelease?a[s.COERCERTLFULL]:a[s.COERCERTL];let T;for(;(T=E.exec(c))&&(!d||d.index+d[0].length!==c.length);)(!d||T.index+T[0].length!==d.index+d[0].length)&&(d=T),E.lastIndex=T.index+T[1].length+T[2].length;E.lastIndex=-1}if(d===null)return null;const m=d[2],p=d[3]||"0",v=d[4]||"0",b=f.includePrerelease&&d[5]?`-${d[5]}`:"",x=f.includePrerelease&&d[6]?`+${d[6]}`:"";return r(`${m}.${p}.${v}${b}${x}`,f)},$h}var qh,ox;function w3(){if(ox)return qh;ox=1;class t{constructor(){this.max=1e3,this.map=new Map}get(a){const s=this.map.get(a);if(s!==void 0)return this.map.delete(a),this.map.set(a,s),s}delete(a){return this.map.delete(a)}set(a,s){if(!this.delete(a)&&s!==void 0){if(this.map.size>=this.max){const c=this.map.keys().next().value;this.delete(c)}this.map.set(a,s)}return this}}return qh=t,qh}var Bh,cx;function En(){if(cx)return Bh;cx=1;const t=/\s+/g;class r{constructor($,j){if(j=o(j),$ instanceof r)return $.loose===!!j.loose&&$.includePrerelease===!!j.includePrerelease?$:new r($.raw,j);if($ instanceof c)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=j,this.loose=!!j.loose,this.includePrerelease=!!j.includePrerelease,this.raw=$.trim().replace(t," "),this.set=this.raw.split("||").map(B=>this.parseRange(B.trim())).filter(B=>B.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const B=this.set[0];if(this.set=this.set.filter(z=>!S(z[0])),this.set.length===0)this.set=[B];else if(this.set.length>1){for(const z of this.set)if(z.length===1&&w(z[0])){this.set=[z];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){$>0&&(this.formatted+="||");const j=this.set[$];for(let B=0;B<j.length;B++)B>0&&(this.formatted+=" "),this.formatted+=j[B].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){const B=((this.options.includePrerelease&&E)|(this.options.loose&&T))+":"+$,z=s.get(B);if(z)return z;const Q=this.options.loose,M=Q?m[p.HYPHENRANGELOOSE]:m[p.HYPHENRANGE];$=$.replace(M,se(this.options.includePrerelease)),f("hyphen replace",$),$=$.replace(m[p.COMPARATORTRIM],v),f("comparator trim",$),$=$.replace(m[p.TILDETRIM],b),f("tilde trim",$),$=$.replace(m[p.CARETTRIM],x),f("caret trim",$);let F=$.split(" ").map(oe=>N(oe,this.options)).join(" ").split(/\s+/).map(oe=>te(oe,this.options));Q&&(F=F.filter(oe=>(f("loose invalid filter",oe,this.options),!!oe.match(m[p.COMPARATORLOOSE])))),f("range list",F);const ee=new Map,ae=F.map(oe=>new c(oe,this.options));for(const oe of ae){if(S(oe))return[oe];ee.set(oe.value,oe)}ee.size>1&&ee.has("")&&ee.delete("");const re=[...ee.values()];return s.set(B,re),re}intersects($,j){if(!($ instanceof r))throw new TypeError("a Range is required");return this.set.some(B=>C(B,j)&&$.set.some(z=>C(z,j)&&B.every(Q=>z.every(M=>Q.intersects(M,j)))))}test($){if(!$)return!1;if(typeof $=="string")try{$=new d($,this.options)}catch{return!1}for(let j=0;j<this.set.length;j++)if(de(this.set[j],$,this.options))return!0;return!1}}Bh=r;const a=w3(),s=new a,o=Op(),c=Mu(),f=Nu(),d=Nt(),{safeRe:m,t:p,comparatorTrimReplace:v,tildeTrimReplace:b,caretTrimReplace:x}=ao(),{FLAG_INCLUDE_PRERELEASE:E,FLAG_LOOSE:T}=Au(),S=q=>q.value==="<0.0.0-0",w=q=>q.value==="",C=(q,$)=>{let j=!0;const B=q.slice();let z=B.pop();for(;j&&B.length;)j=B.every(Q=>z.intersects(Q,$)),z=B.pop();return j},N=(q,$)=>(f("comp",q,$),q=k(q,$),f("caret",q),q=_(q,$),f("tildes",q),q=H(q,$),f("xrange",q),q=K(q,$),f("stars",q),q),O=q=>!q||q.toLowerCase()==="x"||q==="*",_=(q,$)=>q.trim().split(/\s+/).map(j=>L(j,$)).join(" "),L=(q,$)=>{const j=$.loose?m[p.TILDELOOSE]:m[p.TILDE];return q.replace(j,(B,z,Q,M,F)=>{f("tilde",q,B,z,Q,M,F);let ee;return O(z)?ee="":O(Q)?ee=`>=${z}.0.0 <${+z+1}.0.0-0`:O(M)?ee=`>=${z}.${Q}.0 <${z}.${+Q+1}.0-0`:F?(f("replaceTilde pr",F),ee=`>=${z}.${Q}.${M}-${F} <${z}.${+Q+1}.0-0`):ee=`>=${z}.${Q}.${M} <${z}.${+Q+1}.0-0`,f("tilde return",ee),ee})},k=(q,$)=>q.trim().split(/\s+/).map(j=>V(j,$)).join(" "),V=(q,$)=>{f("caret",q,$);const j=$.loose?m[p.CARETLOOSE]:m[p.CARET],B=$.includePrerelease?"-0":"";return q.replace(j,(z,Q,M,F,ee)=>{f("caret",q,z,Q,M,F,ee);let ae;return O(Q)?ae="":O(M)?ae=`>=${Q}.0.0${B} <${+Q+1}.0.0-0`:O(F)?Q==="0"?ae=`>=${Q}.${M}.0${B} <${Q}.${+M+1}.0-0`:ae=`>=${Q}.${M}.0${B} <${+Q+1}.0.0-0`:ee?(f("replaceCaret pr",ee),Q==="0"?M==="0"?ae=`>=${Q}.${M}.${F}-${ee} <${Q}.${M}.${+F+1}-0`:ae=`>=${Q}.${M}.${F}-${ee} <${Q}.${+M+1}.0-0`:ae=`>=${Q}.${M}.${F}-${ee} <${+Q+1}.0.0-0`):(f("no pr"),Q==="0"?M==="0"?ae=`>=${Q}.${M}.${F}${B} <${Q}.${M}.${+F+1}-0`:ae=`>=${Q}.${M}.${F}${B} <${Q}.${+M+1}.0-0`:ae=`>=${Q}.${M}.${F} <${+Q+1}.0.0-0`),f("caret return",ae),ae})},H=(q,$)=>(f("replaceXRanges",q,$),q.split(/\s+/).map(j=>U(j,$)).join(" ")),U=(q,$)=>{q=q.trim();const j=$.loose?m[p.XRANGELOOSE]:m[p.XRANGE];return q.replace(j,(B,z,Q,M,F,ee)=>{f("xRange",q,B,z,Q,M,F,ee);const ae=O(Q),re=ae||O(M),oe=re||O(F),pe=oe;return z==="="&&pe&&(z=""),ee=$.includePrerelease?"-0":"",ae?z===">"||z==="<"?B="<0.0.0-0":B="*":z&&pe?(re&&(M=0),F=0,z===">"?(z=">=",re?(Q=+Q+1,M=0,F=0):(M=+M+1,F=0)):z==="<="&&(z="<",re?Q=+Q+1:M=+M+1),z==="<"&&(ee="-0"),B=`${z+Q}.${M}.${F}${ee}`):re?B=`>=${Q}.0.0${ee} <${+Q+1}.0.0-0`:oe&&(B=`>=${Q}.${M}.0${ee} <${Q}.${+M+1}.0-0`),f("xRange return",B),B})},K=(q,$)=>(f("replaceStars",q,$),q.trim().replace(m[p.STAR],"")),te=(q,$)=>(f("replaceGTE0",q,$),q.trim().replace(m[$.includePrerelease?p.GTE0PRE:p.GTE0],"")),se=q=>($,j,B,z,Q,M,F,ee,ae,re,oe,pe)=>(O(B)?j="":O(z)?j=`>=${B}.0.0${q?"-0":""}`:O(Q)?j=`>=${B}.${z}.0${q?"-0":""}`:M?j=`>=${j}`:j=`>=${j}${q?"-0":""}`,O(ae)?ee="":O(re)?ee=`<${+ae+1}.0.0-0`:O(oe)?ee=`<${ae}.${+re+1}.0-0`:pe?ee=`<=${ae}.${re}.${oe}-${pe}`:q?ee=`<${ae}.${re}.${+oe+1}-0`:ee=`<=${ee}`,`${j} ${ee}`.trim()),de=(q,$,j)=>{for(let B=0;B<q.length;B++)if(!q[B].test($))return!1;if($.prerelease.length&&!j.includePrerelease){for(let B=0;B<q.length;B++)if(f(q[B].semver),q[B].semver!==c.ANY&&q[B].semver.prerelease.length>0){const z=q[B].semver;if(z.major===$.major&&z.minor===$.minor&&z.patch===$.patch)return!0}return!1}return!0};return Bh}var Ih,ux;function Mu(){if(ux)return Ih;ux=1;const t=Symbol("SemVer ANY");class r{static get ANY(){return t}constructor(v,b){if(b=a(b),v instanceof r){if(v.loose===!!b.loose)return v;v=v.value}v=v.trim().split(/\s+/).join(" "),f("comparator",v,b),this.options=b,this.loose=!!b.loose,this.parse(v),this.semver===t?this.value="":this.value=this.operator+this.semver.version,f("comp",this)}parse(v){const b=this.options.loose?s[o.COMPARATORLOOSE]:s[o.COMPARATOR],x=v.match(b);if(!x)throw new TypeError(`Invalid comparator: ${v}`);this.operator=x[1]!==void 0?x[1]:"",this.operator==="="&&(this.operator=""),x[2]?this.semver=new d(x[2],this.options.loose):this.semver=t}toString(){return this.value}test(v){if(f("Comparator.test",v,this.options.loose),this.semver===t||v===t)return!0;if(typeof v=="string")try{v=new d(v,this.options)}catch{return!1}return c(v,this.operator,this.semver,this.options)}intersects(v,b){if(!(v instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new m(v.value,b).test(this.value):v.operator===""?v.value===""?!0:new m(this.value,b).test(v.semver):(b=a(b),b.includePrerelease&&(this.value==="<0.0.0-0"||v.value==="<0.0.0-0")||!b.includePrerelease&&(this.value.startsWith("<0.0.0")||v.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&v.operator.startsWith(">")||this.operator.startsWith("<")&&v.operator.startsWith("<")||this.semver.version===v.semver.version&&this.operator.includes("=")&&v.operator.includes("=")||c(this.semver,"<",v.semver,b)&&this.operator.startsWith(">")&&v.operator.startsWith("<")||c(this.semver,">",v.semver,b)&&this.operator.startsWith("<")&&v.operator.startsWith(">")))}}Ih=r;const a=Op(),{safeRe:s,t:o}=ao(),c=ER(),f=Nu(),d=Nt(),m=En();return Ih}var Vh,fx;function ju(){if(fx)return Vh;fx=1;const t=En();return Vh=(a,s,o)=>{try{s=new t(s,o)}catch{return!1}return s.test(a)},Vh}var Yh,dx;function E3(){if(dx)return Yh;dx=1;const t=En();return Yh=(a,s)=>new t(a,s).set.map(o=>o.map(c=>c.value).join(" ").trim().split(" ")),Yh}var Fh,hx;function R3(){if(hx)return Fh;hx=1;const t=Nt(),r=En();return Fh=(s,o,c)=>{let f=null,d=null,m=null;try{m=new r(o,c)}catch{return null}return s.forEach(p=>{m.test(p)&&(!f||d.compare(p)===-1)&&(f=p,d=new t(f,c))}),f},Fh}var Gh,mx;function T3(){if(mx)return Gh;mx=1;const t=Nt(),r=En();return Gh=(s,o,c)=>{let f=null,d=null,m=null;try{m=new r(o,c)}catch{return null}return s.forEach(p=>{m.test(p)&&(!f||d.compare(p)===1)&&(f=p,d=new t(f,c))}),f},Gh}var Qh,px;function C3(){if(px)return Qh;px=1;const t=Nt(),r=En(),a=Ou();return Qh=(o,c)=>{o=new r(o,c);let f=new t("0.0.0");if(o.test(f)||(f=new t("0.0.0-0"),o.test(f)))return f;f=null;for(let d=0;d<o.set.length;++d){const m=o.set[d];let p=null;m.forEach(v=>{const b=new t(v.semver.version);switch(v.operator){case">":b.prerelease.length===0?b.patch++:b.prerelease.push(0),b.raw=b.format();case"":case">=":(!p||a(b,p))&&(p=b);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${v.operator}`)}}),p&&(!f||a(f,p))&&(f=p)}return f&&o.test(f)?f:null},Qh}var Xh,gx;function A3(){if(gx)return Xh;gx=1;const t=En();return Xh=(a,s)=>{try{return new t(a,s).range||"*"}catch{return null}},Xh}var Kh,vx;function Lp(){if(vx)return Kh;vx=1;const t=Nt(),r=Mu(),{ANY:a}=r,s=En(),o=ju(),c=Ou(),f=jp(),d=_p(),m=Dp();return Kh=(v,b,x,E)=>{v=new t(v,E),b=new s(b,E);let T,S,w,C,N;switch(x){case">":T=c,S=d,w=f,C=">",N=">=";break;case"<":T=f,S=m,w=c,C="<",N="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(v,b,E))return!1;for(let O=0;O<b.set.length;++O){const _=b.set[O];let L=null,k=null;if(_.forEach(V=>{V.semver===a&&(V=new r(">=0.0.0")),L=L||V,k=k||V,T(V.semver,L.semver,E)?L=V:w(V.semver,k.semver,E)&&(k=V)}),L.operator===C||L.operator===N||(!k.operator||k.operator===C)&&S(v,k.semver))return!1;if(k.operator===N&&w(v,k.semver))return!1}return!0},Kh}var Wh,yx;function N3(){if(yx)return Wh;yx=1;const t=Lp();return Wh=(a,s,o)=>t(a,s,">",o),Wh}var Zh,bx;function O3(){if(bx)return Zh;bx=1;const t=Lp();return Zh=(a,s,o)=>t(a,s,"<",o),Zh}var Jh,xx;function M3(){if(xx)return Jh;xx=1;const t=En();return Jh=(a,s,o)=>(a=new t(a,o),s=new t(s,o),a.intersects(s,o)),Jh}var em,Sx;function j3(){if(Sx)return em;Sx=1;const t=ju(),r=wn();return em=(a,s,o)=>{const c=[];let f=null,d=null;const m=a.sort((x,E)=>r(x,E,o));for(const x of m)t(x,s,o)?(d=x,f||(f=x)):(d&&c.push([f,d]),d=null,f=null);f&&c.push([f,null]);const p=[];for(const[x,E]of c)x===E?p.push(x):!E&&x===m[0]?p.push("*"):E?x===m[0]?p.push(`<=${E}`):p.push(`${x} - ${E}`):p.push(`>=${x}`);const v=p.join(" || "),b=typeof s.raw=="string"?s.raw:String(s);return v.length<b.length?v:s},em}var tm,wx;function D3(){if(wx)return tm;wx=1;const t=En(),r=Mu(),{ANY:a}=r,s=ju(),o=wn(),c=(b,x,E={})=>{if(b===x)return!0;b=new t(b,E),x=new t(x,E);let T=!1;e:for(const S of b.set){for(const w of x.set){const C=m(S,w,E);if(T=T||C!==null,C)continue e}if(T)return!1}return!0},f=[new r(">=0.0.0-0")],d=[new r(">=0.0.0")],m=(b,x,E)=>{if(b===x)return!0;if(b.length===1&&b[0].semver===a){if(x.length===1&&x[0].semver===a)return!0;E.includePrerelease?b=f:b=d}if(x.length===1&&x[0].semver===a){if(E.includePrerelease)return!0;x=d}const T=new Set;let S,w;for(const H of b)H.operator===">"||H.operator===">="?S=p(S,H,E):H.operator==="<"||H.operator==="<="?w=v(w,H,E):T.add(H.semver);if(T.size>1)return null;let C;if(S&&w){if(C=o(S.semver,w.semver,E),C>0)return null;if(C===0&&(S.operator!==">="||w.operator!=="<="))return null}for(const H of T){if(S&&!s(H,String(S),E)||w&&!s(H,String(w),E))return null;for(const U of x)if(!s(H,String(U),E))return!1;return!0}let N,O,_,L,k=w&&!E.includePrerelease&&w.semver.prerelease.length?w.semver:!1,V=S&&!E.includePrerelease&&S.semver.prerelease.length?S.semver:!1;k&&k.prerelease.length===1&&w.operator==="<"&&k.prerelease[0]===0&&(k=!1);for(const H of x){if(L=L||H.operator===">"||H.operator===">=",_=_||H.operator==="<"||H.operator==="<=",S){if(V&&H.semver.prerelease&&H.semver.prerelease.length&&H.semver.major===V.major&&H.semver.minor===V.minor&&H.semver.patch===V.patch&&(V=!1),H.operator===">"||H.operator===">="){if(N=p(S,H,E),N===H&&N!==S)return!1}else if(S.operator===">="&&!s(S.semver,String(H),E))return!1}if(w){if(k&&H.semver.prerelease&&H.semver.prerelease.length&&H.semver.major===k.major&&H.semver.minor===k.minor&&H.semver.patch===k.patch&&(k=!1),H.operator==="<"||H.operator==="<="){if(O=v(w,H,E),O===H&&O!==w)return!1}else if(w.operator==="<="&&!s(w.semver,String(H),E))return!1}if(!H.operator&&(w||S)&&C!==0)return!1}return!(S&&_&&!w&&C!==0||w&&L&&!S&&C!==0||V||k)},p=(b,x,E)=>{if(!b)return x;const T=o(b.semver,x.semver,E);return T>0?b:T<0||x.operator===">"&&b.operator===">="?x:b},v=(b,x,E)=>{if(!b)return x;const T=o(b.semver,x.semver,E);return T<0?b:T>0||x.operator==="<"&&b.operator==="<="?x:b};return tm=c,tm}var nm,Ex;function _3(){if(Ex)return nm;Ex=1;const t=ao(),r=Au(),a=Nt(),s=xR(),o=As(),c=c3(),f=u3(),d=f3(),m=d3(),p=h3(),v=m3(),b=p3(),x=g3(),E=wn(),T=v3(),S=y3(),w=Mp(),C=b3(),N=x3(),O=Ou(),_=jp(),L=SR(),k=wR(),V=Dp(),H=_p(),U=ER(),K=S3(),te=Mu(),se=En(),de=ju(),q=E3(),$=R3(),j=T3(),B=C3(),z=A3(),Q=Lp(),M=N3(),F=O3(),ee=M3(),ae=j3(),re=D3();return nm={parse:o,valid:c,clean:f,inc:d,diff:m,major:p,minor:v,patch:b,prerelease:x,compare:E,rcompare:T,compareLoose:S,compareBuild:w,sort:C,rsort:N,gt:O,lt:_,eq:L,neq:k,gte:V,lte:H,cmp:U,coerce:K,Comparator:te,Range:se,satisfies:de,toComparators:q,maxSatisfying:$,minSatisfying:j,minVersion:B,validRange:z,outside:Q,gtr:M,ltr:F,intersects:ee,simplifyRange:ae,subset:re,SemVer:a,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers},nm}var L3=_3();const z3=gs(L3);function P3(){const{toast:t}=xn();async function r(s){const o=`https://api.github.com/repos/${s}/releases/latest`;try{const c=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"fetch-latest-release"}});if(!c.ok)throw new Error(`Failed to fetch latest release: ${c.status} ${c.statusText}`);return(await c.json()).tag_name}catch{}}const a=async()=>{try{const s=await r("elizaos/eliza"),o=Ji==null?void 0:Ji.version;s&&o&&z3.gt(s.replace("v",""),o.replace("v",""))&&t({variant:"default",title:`New version ${s} is available.`,description:"Visit GitHub for more information.",action:g.jsx(Va,{to:"https://github.com/elizaos/eliza/releases",target:"_blank",children:g.jsx(gR,{altText:"Update",children:"Update"})})})}catch(s){console.error(`Unable to retrieve latest version from GitHub: ${s}`)}};return y.useEffect(()=>{a()},[a]),null}var zp="Avatar",[U3,bz]=qn(zp),[k3,RR]=U3(zp),TR=y.forwardRef((t,r)=>{const{__scopeAvatar:a,...s}=t,[o,c]=y.useState("idle");return g.jsx(k3,{scope:a,imageLoadingStatus:o,onImageLoadingStatusChange:c,children:g.jsx(we.span,{...s,ref:r})})});TR.displayName=zp;var CR="AvatarImage",AR=y.forwardRef((t,r)=>{const{__scopeAvatar:a,src:s,onLoadingStatusChange:o=()=>{},...c}=t,f=RR(CR,a),d=H3(s,c.referrerPolicy),m=nt(p=>{o(p),f.onImageLoadingStatusChange(p)});return ft(()=>{d!=="idle"&&m(d)},[d,m]),d==="loaded"?g.jsx(we.img,{...c,ref:r,src:s}):null});AR.displayName=CR;var NR="AvatarFallback",OR=y.forwardRef((t,r)=>{const{__scopeAvatar:a,delayMs:s,...o}=t,c=RR(NR,a),[f,d]=y.useState(s===void 0);return y.useEffect(()=>{if(s!==void 0){const m=window.setTimeout(()=>d(!0),s);return()=>window.clearTimeout(m)}},[s]),f&&c.imageLoadingStatus!=="loaded"?g.jsx(we.span,{...o,ref:r}):null});OR.displayName=NR;function H3(t,r){const[a,s]=y.useState("idle");return ft(()=>{if(!t){s("error");return}let o=!0;const c=new window.Image,f=d=>()=>{o&&s(d)};return s("loading"),c.onload=f("loaded"),c.onerror=f("error"),c.src=t,r&&(c.referrerPolicy=r),()=>{o=!1}},[t,r]),a}var MR=TR,jR=AR,DR=OR;const $c=y.forwardRef(({className:t,...r},a)=>g.jsx(MR,{ref:a,className:le("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-md",t),...r}));$c.displayName=MR.displayName;const qc=y.forwardRef(({className:t,...r},a)=>g.jsx(jR,{ref:a,className:le("aspect-square h-full w-full",t),...r}));qc.displayName=jR.displayName;const _R=y.forwardRef(({className:t,...r},a)=>g.jsx(DR,{ref:a,className:le("flex h-full w-full items-center justify-center rounded-md bg-muted",t),...r}));_R.displayName=DR.displayName;function $3(){return g.jsxs("svg",{role:"img","aria-label":"Loading animation",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[g.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:g.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),g.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:g.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),g.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:g.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const q3=ma("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),LR=y.forwardRef(({className:t,variant:r,layout:a,children:s,...o},c)=>g.jsx("div",{className:le(q3({variant:r,layout:a,className:t}),"relative group"),ref:c,...o,children:y.Children.map(s,f=>y.isValidElement(f)&&typeof f.type!="string"&&f.type!==y.Fragment?y.cloneElement(f,{variant:r,layout:a}):f)}));LR.displayName="ChatBubble";const B3=ma("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-lg rounded-bl-none",sent:"bg-primary text-primary-foreground rounded-lg rounded-br-none"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),zR=y.forwardRef(({className:t,variant:r,layout:a,isLoading:s=!1,children:o,...c},f)=>g.jsx("div",{className:le(B3({variant:r,layout:a,className:t}),"break-words max-w-full whitespace-pre-wrap"),ref:f,...c,children:s?g.jsx("div",{className:"flex items-center space-x-2",children:g.jsx($3,{})}):o}));zR.displayName="ChatBubbleMessage";const I3=({timestamp:t,className:r,...a})=>g.jsx("div",{className:le("text-xs text-right select-none",r),...a,children:t}),V3=y.forwardRef(({variant:t,className:r,children:a,...s},o)=>g.jsx("div",{ref:o,className:le("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",t==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",r),...s,children:a}));V3.displayName="ChatBubbleActionWrapper";const PR=y.forwardRef(({className:t,...r},a)=>g.jsx(xp,{autoComplete:"off",ref:a,name:"message",className:le("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",t),...r}));PR.displayName="ChatInput";const UR=y.forwardRef(({className:t,children:r,scrollRef:a,isAtBottom:s,scrollToBottom:o,disableAutoScroll:c,...f},d)=>g.jsxs("div",{className:"relative w-full h-full",children:[g.jsx("div",{className:`flex flex-col w-full h-full p-4 overflow-y-auto ${t}`,ref:a,onWheel:c,onTouchMove:c,...f,children:g.jsx("div",{className:"flex flex-col gap-6",children:r})}),!s&&g.jsx(Qe,{onClick:()=>{o()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 transform -translate-x-1/2 inline-flex rounded-full shadow-md",children:g.jsx($O,{className:"h-4 w-4"})})]}));UR.displayName="ChatMessageList";var Fi={},Gi={},Qi={},Rx;function Y3(){if(Rx)return Qi;Rx=1;var t=Qi&&Qi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Qi,"__esModule",{value:!0});var r=t(Fl()),a=function(s,o){var c=r.default.useRef(null),f=r.default.useRef(s);return r.default.useEffect(function(){f.current=s},[s]),r.default.useEffect(function(){var d=function(){return f.current()};if(typeof o=="number")return c.current=window.setInterval(d,o),function(){return window.clearInterval(c.current)}},[o]),c};return Qi.default=a,Qi}var $a={},Tx;function F3(){if(Tx)return $a;Tx=1,Object.defineProperty($a,"__esModule",{value:!0}),$a.getCurrentNodeOverflow=$a.getStringPosition=void 0;var t=function(a,s,o){return a.split(s,o).join(" ").length};$a.getStringPosition=t;var r=function(a,s){for(var o=0,c=0,f=0;f<a.length&&!(o+a[f]>s);f++)c++,o=o+a[f];return[c,s-o]};return $a.getCurrentNodeOverflow=r,$a}var Cx;function G3(){if(Cx)return Gi;Cx=1;var t=Gi&&Gi.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Gi,"__esModule",{value:!0});var r=t(Fl()),a=t(Y3()),s=F3(),o=r.default.memo(function(c){var f=c.children,d=c.delay,m=d===void 0?25:d,p=c.onEnd,v=p===void 0?function(){}:p,b=r.default.useState(0),x=b[0],E=b[1],T=r.default.useMemo(function(){var C=[],N=function(O){var _,L=(_=O==null?void 0:O.props)===null||_===void 0?void 0:_.children;return Array.isArray(O)&&O.forEach(function(k){typeof k=="object"?N(k):typeof k=="string"&&C.push(k.split(" ").length)}),L===void 0&&typeof O=="string"&&C.push(O.split(" ").length),typeof L=="object"&&N(L),typeof L=="string"&&C.push(L.split(" ").length),C};return N(f)},[f]),S=r.default.useMemo(function(){return T.reduce(function(C,N){return C+N},0)},[T]),w=r.default.useMemo(function(){var C=0,N=0,O=function(_){var L;if(C>x)return null;var k=(L=_==null?void 0:_.props)===null||L===void 0?void 0:L.children;if(Array.isArray(_)){var V=[];return _.forEach(function(se){if(typeof se=="object")V.push(O(se));else if(typeof se=="string"){C+=se.split(" ").length,N++;var de=(0,s.getCurrentNodeOverflow)(T,x),q=de[0],$=de[1];q<N&&V.push(se.slice(0,(0,s.getStringPosition)(se," ",$))),V.push(se)}}),V}if(k===void 0&&typeof _=="string"){C+=_.split(" ").length,N++;var H=(0,s.getCurrentNodeOverflow)(T,x),U=H[0],K=H[1];return U<N?_.slice(0,(0,s.getStringPosition)(_," ",K)):_}if(typeof k=="object")return r.default.createElement(_.type,_==null?void 0:_.props,O(k));if(typeof k=="string"){C+=k.split(" ").length,N++;var te=(0,s.getCurrentNodeOverflow)(T,x),U=te[0],K=te[1];return U<N?r.default.createElement(_.type,_==null?void 0:_.props,k.slice(0,(0,s.getStringPosition)(k," ",K))):_}};return O(f)},[f,x,T]);return(0,a.default)(function(){E(function(C){return C+1>=S&&v(),C+1})},S>x?m:null),r.default.useEffect(function(){console.log("hmmm"),E(0)},[f]),w});return o.displayName="AIWriter",Gi.default=o,Gi}var Ax;function Q3(){if(Ax)return Fi;Ax=1;var t=Fi&&Fi.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Fi,"__esModule",{value:!0});var r=t(G3());return Fi.default=r.default,Fi}var X3=Q3();const K3=gs(X3);let Dl,_l=[],Nc;const Nx=(t,r)=>String(t).padStart(r,"0"),W3=({className:t,timerClassName:r,agentId:a,onChange:s})=>{const{toast:o}=xn(),[c,f]=y.useState(!1),[d,m]=y.useState(!1),[p,v]=y.useState(0),[b,x]=y.useState({id:-1,name:"",file:null}),E=Math.floor(p%3600/60),T=p%60,[S,w]=y.useMemo(()=>Nx(E,2).split(""),[E]),[C,N]=y.useMemo(()=>Nx(T,2).split(""),[T]),O=y.useRef({stream:null,analyser:null,mediaRecorder:null,audioContext:null}),_=Zl({mutationKey:["whisper"],mutationFn:U=>Lt.whisper(a,U),onSuccess:U=>{var K;(K=U==null?void 0:U.data)!=null&&K.text&&s(U.data.text)},onError:U=>{o({variant:"destructive",title:"Unable to start recording",description:U.message}),console.log(U)}});function L(){var U;(U=navigator.mediaDevices)!=null&&U.getUserMedia&&navigator.mediaDevices.getUserMedia({audio:!0}).then(K=>{f(!0);const te=window.AudioContext,se=new te,de=se.createAnalyser();se.createMediaStreamSource(K).connect(de),O.current={stream:K,analyser:de,mediaRecorder:null,audioContext:se};const j={mimeType:MediaRecorder.isTypeSupported("audio/mpeg")?"audio/mpeg":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/wav"};O.current.mediaRecorder=new MediaRecorder(K,j),O.current.mediaRecorder.start(),_l=[],Dl=new MediaRecorder(K),Dl.start(),Dl.ondataavailable=B=>{_l.push(B.data)}}).catch(K=>{o({variant:"destructive",title:"Unable to start recording",description:K.message}),console.log(K)})}function k(){Dl.onstop=()=>{const U=new Blob(_l,{type:"audio/wav"});_.mutate(U),x({...b,file:window.URL.createObjectURL(U)}),_l=[]},Dl.stop(),f(!1),m(!0),v(0),clearTimeout(Nc)}function V(){const{mediaRecorder:U,stream:K,analyser:te,audioContext:se}=O.current;if(U&&(U.onstop=()=>{_l=[]},U.stop()),te&&te.disconnect(),K)for(const de of K.getTracks())de.stop();se&&se.close(),f(!1),m(!0),v(0),clearTimeout(Nc)}const H=()=>{k()};return y.useEffect(()=>(c&&(Nc=setTimeout(()=>{v(p+1)},1e3)),()=>clearTimeout(Nc)),[c,p]),_!=null&&_.isPending?g.jsx(Qe,{variant:"ghost",disabled:!0,size:"icon",children:g.jsx(US,{className:"size-4"})}):g.jsxs("div",{className:le("flex items-center justify-center gap-2 border-l border-l-transparent border-opacity-0 transition-all duration-300",{"border-opacity-100 border-l-border pl-2":c},t),children:[c?g.jsxs("div",{className:"flex gap-1 items-center",children:[g.jsx("div",{className:"bg-red-500 rounded-full h-2.5 w-2.5 animate-pulse"}),g.jsx(kR,{minuteLeft:S,minuteRight:w,secondLeft:C,secondRight:N,timerClassName:r})]}):null,g.jsxs("div",{className:"flex items-center",children:[c?g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx(Qe,{onClick:V,size:"icon",variant:"ghost",children:g.jsx(r2,{className:"size-4"})})}),g.jsx(Un,{className:"m-2",children:g.jsx("span",{children:" Reset recording"})})]}):null,g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:c?g.jsx(Qe,{onClick:H,variant:"ghost",size:"icon",children:g.jsx(kS,{className:"size-4"})}):g.jsxs(Qe,{variant:"ghost",size:"icon",onClick:()=>L(),children:[g.jsx(XO,{className:"size-4"}),g.jsx("span",{className:"sr-only",children:"Use Microphone"})]})}),g.jsx(Un,{side:"right",children:g.jsxs("span",{children:[c?"Send":"Start"," "]})})]})]})]})},kR=hr.memo(({minuteLeft:t,minuteRight:r,secondLeft:a,secondRight:s,timerClassName:o})=>g.jsx("div",{className:le("text-sm animate-in duration-1000 fade-in-0 select-none",o),children:g.jsxs("p",{children:[t,r,":",a,s]})}));kR.displayName="Timer";const Z3=({text:t})=>{const[r,a]=y.useState(!1),s=()=>{navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})};return g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx(Qe,{onClick:s,variant:"ghost",size:"icon",className:"flex items-center space-x-2 text-muted-foreground",children:r?g.jsx(Xm,{className:"size-4"}):g.jsx(VO,{className:"size-4"})})}),g.jsx(Un,{side:"bottom",children:g.jsx("p",{children:"Copy"})})]})};function J3({agentId:t,text:r}){const{toast:a}=xn(),[s,o]=y.useState(!1),[c,f]=y.useState(null),d=y.useRef(null),m=Zl({mutationKey:["tts",r],mutationFn:()=>Lt.tts(t,r),onSuccess:E=>{f(E),p()},onError:E=>{a({variant:"destructive",title:"Unable to read message aloud",description:E.message})}}),p=()=>{d.current&&d.current.play().catch(E=>{console.error("Error playing audio:",E)}),o(!0)},v=()=>{d.current&&(d.current.pause(),d.current.currentTime=0),o(!1)},b=()=>{if(!(m!=null&&m.isPending)){if(s){v();return}if(c){p();return}}},x="text-muted-foreground size-4";return g.jsxs("div",{children:[c?g.jsxs("audio",{crossOrigin:"anonymous",playsInline:!0,ref:d,onEnded:()=>{o(!1)},autoPlay:!0,children:[g.jsx("source",{src:URL.createObjectURL(c),type:"audio/mpeg"}),g.jsx("track",{kind:"captions",src:"",label:"English captions"}),"Your browser does not support the audio element."]}):null,g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx(Qe,{size:"icon",variant:"ghost",type:"button",onClick:()=>b(),disabled:m==null?void 0:m.isPending,children:m!=null&&m.isPending?g.jsx(US,{className:x}):s?g.jsx(IO,{className:x}):g.jsx(a2,{className:x})})}),g.jsx(Un,{side:"bottom",children:g.jsx("p",{children:s?"Stop":"Read aloud"})})]})]})}function ez(t={}){const{offset:r=20,smooth:a=!1}=t,s=y.useRef(null),o=y.useRef(0),c=y.useRef(!1),[f,d]=y.useState({isAtBottom:!0,autoScrollEnabled:!0}),m=y.useCallback(x=>{const{scrollTop:E,scrollHeight:T,clientHeight:S}=x;return Math.abs(T-E-S)<=r},[r]),p=y.useCallback(x=>{if(!s.current)return;const E=s.current.scrollHeight-s.current.clientHeight;x?s.current.scrollTop=E:s.current.scrollTo({top:E,behavior:a?"smooth":"auto"}),d({isAtBottom:!0,autoScrollEnabled:!0}),c.current=!1},[a]),v=y.useCallback(()=>{if(!s.current)return;const x=m(s.current);d(E=>({isAtBottom:x,autoScrollEnabled:x?!0:E.autoScrollEnabled}))},[m]);y.useEffect(()=>{const x=s.current;if(x)return x.addEventListener("scroll",v,{passive:!0}),()=>x.removeEventListener("scroll",v)},[v]),y.useEffect(()=>{const x=s.current;if(!x)return;const E=x.scrollHeight;E!==o.current&&(f.autoScrollEnabled&&requestAnimationFrame(()=>{p(o.current===0)}),o.current=E)},[f.autoScrollEnabled,p]),y.useEffect(()=>{const x=s.current;if(!x)return;const E=new ResizeObserver(()=>{f.autoScrollEnabled&&p(!0)});return E.observe(x),()=>E.disconnect()},[f.autoScrollEnabled,p]);const b=y.useCallback(()=>{(s.current?m(s.current):!1)||(c.current=!0,d(E=>({...E,autoScrollEnabled:!1})))},[m]);return{scrollRef:s,isAtBottom:f.isAtBottom,autoScrollEnabled:f.autoScrollEnabled,scrollToBottom:()=>p(!1),disableAutoScroll:b}}function Ox({message:t,agentId:r}){var a;return g.jsxs("div",{className:"flex flex-col",children:[g.jsxs(zR,{isLoading:t.isLoading,...t.name==="Anon"?{variant:"sent"}:{},children:[t.name==="Anon"?t.text:g.jsx(K3,{children:t.text}),g.jsx("div",{children:(a=t.attachments)==null?void 0:a.map(s=>g.jsxs("div",{className:"flex flex-col gap-1 mt-2",children:[g.jsx("img",{alt:"attachment",src:s.url,width:"100%",height:"100%",className:"w-64 rounded-md"}),g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsx("span",{}),g.jsx("span",{})]})]},`${s.url}-${s.title}`))})]}),g.jsxs("div",{className:"flex items-center gap-4 justify-between w-full mt-1",children:[t.text&&!t.isLoading?g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Z3,{text:t.text}),g.jsx(J3,{agentId:r,text:t.text})]}):null,g.jsxs("div",{className:le([t.isLoading?"mt-2":"","flex items-center justify-between gap-4 select-none"]),children:[t.source?g.jsx(Nm,{variant:"outline",children:t.source}):null,t.actions?g.jsx(Nm,{variant:"outline",children:t.actions.join(", ")}):null,t.createdAt?g.jsx(I3,{timestamp:cN(t.createdAt).format("LT")}):null]})]})]})}function tz({agentId:t}){var k,V;const{toast:r}=xn(),[a,s]=y.useState(null),[o,c]=y.useState(""),f=y.useRef(null),d=y.useRef(null),m=y.useRef(null),p=In(),v=Ya.getWorldId(),{messages:b}=k_(t),x=(V=(k=z_(t))==null?void 0:k.data)==null?void 0:V.data,E=H=>H!=="user"?"received":"sent",{scrollRef:T,isAtBottom:S,scrollToBottom:w,disableAutoScroll:C}=ez({smooth:!0});y.useEffect(()=>{w()},[p.getQueryData(["messages",t,v])]),y.useEffect(()=>{w()},[]);const N=H=>{if(H.key==="Enter"&&!H.shiftKey){if(H.preventDefault(),H.nativeEvent.isComposing)return;O(H)}},O=H=>{var te;if(H.preventDefault(),!o)return;const U=a?[{url:URL.createObjectURL(a),contentType:a.type,title:a.name}]:void 0,K=[{text:o,name:"Anon",createdAt:Date.now(),attachments:U,worldId:v},{text:o,name:"system",isLoading:!0,createdAt:Date.now(),worldId:v}];p.setQueryData(["messages",t,v],(se=[])=>[...se,...K]),_.mutate({message:o,selectedFile:a||null}),s(null),c(""),(te=m.current)==null||te.reset()};y.useEffect(()=>{f.current&&f.current.focus()},[]);const _=Zl({mutationKey:["send_message",t],mutationFn:({message:H,selectedFile:U})=>Lt.sendMessage(t,H,U),onSuccess:H=>{H?p.setQueryData(["messages",t,v],(U=[])=>[...U.filter(K=>!K.isLoading),{...H.data.message,createdAt:Date.now()}]):p.setQueryData(["messages",t,v],(U=[])=>[...U.filter(K=>!K.isLoading)])},onError:H=>{r({variant:"destructive",title:"Unable to send message",description:H.message})}}),L=H=>{var K;const U=(K=H.target.files)==null?void 0:K[0];U!=null&&U.type.startsWith("image/")&&s(U)};return g.jsxs("div",{className:"flex flex-col w-full h-[calc(100dvh)] p-4",children:[g.jsx("div",{className:"flex items-center justify-between mb-4 p-3 bg-card rounded-lg border",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx($c,{className:"size-10 border rounded-full",children:g.jsx(qc,{src:"/elizaos-icon.png"})}),g.jsxs("div",{className:"flex flex-col",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("h2",{className:"font-semibold text-lg",children:(x==null?void 0:x.name)||"Agent"}),x!=null&&x.enabled?g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx("div",{className:"size-2.5 rounded-full bg-green-500 ring-2 ring-green-500/20 animate-pulse"})}),g.jsx(Un,{side:"right",children:g.jsx("p",{children:"Agent is active"})})]}):g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsx("div",{className:"size-2.5 rounded-full bg-gray-300 ring-2 ring-gray-300/20"})}),g.jsx(Un,{side:"right",children:g.jsx("p",{children:"Agent is inactive"})})]})]}),(x==null?void 0:x.bio)&&g.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:Array.isArray(x.bio)?x.bio[0]:x.bio})]})]})}),g.jsx("div",{className:"flex-1 overflow-y-auto",children:g.jsx(UR,{scrollRef:T,isAtBottom:S,scrollToBottom:w,disableAutoScroll:C,children:b.map(H=>g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",padding:"1rem"},children:g.jsx(LR,{variant:E(H.name),className:"flex flex-row items-center gap-2",children:H.name!=="Anon"?g.jsxs(g.Fragment,{children:[g.jsx($c,{className:"size-8 p-1 border rounded-full select-none",children:g.jsx(qc,{src:"/elizaos-icon.png"})}),g.jsx(Ox,{message:H,agentId:t})]}):g.jsxs(g.Fragment,{children:[g.jsx(Ox,{message:H,agentId:t}),g.jsxs($c,{className:"size-8 p-1 border rounded-full select-none",children:[g.jsx(qc,{src:"/user-icon.png"}),g.jsx(_R,{children:"U"})]})]})})},H.name+H.createdAt))})}),g.jsx("div",{className:"px-4 pb-4",children:g.jsxs("form",{ref:m,onSubmit:O,className:"relative rounded-md border bg-card",children:[a?g.jsx("div",{className:"p-3 flex",children:g.jsxs("div",{className:"relative rounded-md border p-2",children:[g.jsx(Qe,{onClick:()=>s(null),className:"absolute -right-2 -top-2 size-[22px] ring-2 ring-background",variant:"outline",size:"icon",children:g.jsx(bs,{})}),g.jsx("img",{alt:"Selected file",src:URL.createObjectURL(a),height:"100%",width:"100%",className:"aspect-square object-contain w-16"})]})}):null,g.jsx(PR,{ref:f,onKeyDown:N,value:o,onChange:({target:H})=>c(H.value),placeholder:"Type your message here...",className:"min-h-12 resize-none rounded-md bg-card border-0 p-3 shadow-none focus-visible:ring-0"}),g.jsxs("div",{className:"flex items-center p-3 pt-0",children:[g.jsxs(br,{children:[g.jsx(xr,{asChild:!0,children:g.jsxs("div",{children:[g.jsxs(Qe,{variant:"ghost",size:"icon",onClick:()=>{d.current&&d.current.click()},children:[g.jsx(WO,{className:"size-4"}),g.jsx("span",{className:"sr-only",children:"Attach file"})]}),g.jsx("input",{type:"file",ref:d,onChange:L,accept:"image/*",className:"hidden"})]})}),g.jsx(Un,{side:"left",children:g.jsx("p",{children:"Attach file"})})]}),g.jsx(W3,{agentId:t,onChange:H=>c(H)}),g.jsxs(Qe,{disabled:!o||(_==null?void 0:_.isPending),type:"submit",size:"sm",className:"ml-auto gap-1.5 h-[30px]",children:[_!=null&&_.isPending?"...":"Send Message",g.jsx(kS,{className:"size-3.5"})]})]})]})})]})}function nz(){const{agentId:t}=eE();return t?g.jsx(tz,{agentId:t}):g.jsx("div",{children:"No data."})}function rz(){return g.jsx(qE,{})}function az({title:t,content:r,buttons:a}){return g.jsxs(gu,{className:"h-full",children:[g.jsx(fE,{className:"pb-2 pt-3",children:g.jsx(dE,{className:"text-base",children:t})}),g.jsx(gp,{className:"p-3",children:g.jsx("div",{className:"rounded-md bg-muted w-full mb-3",style:{aspectRatio:"1 / 1"},children:g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"text-4xl font-bold uppercase",children:r})})})}),g.jsx(hE,{className:"p-3 pb-4",children:g.jsx("div",{className:"flex items-center gap-2 w-full",children:a.map(({label:s,icon:o,action:c,className:f,variant:d,size:m,disabled:p},v)=>g.jsxs(Qe,{variant:d,className:f,onClick:c,size:m,disabled:p,children:[o,s&&g.jsx("span",{children:s})]},v))})})]})}function iz(){const t=to(),r=In(),{toast:a}=xn(),s=P_(),o=U_(),[c,f]=y.useState([]),[d,m]=y.useState([]);return{startAgent:async E=>{if(!E.id){a({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const T=E.id;if(!c.includes(T))try{f(S=>[...S,T]),await s.mutateAsync(T),r.invalidateQueries({queryKey:["active-agents"]}),t(`/chat/${T}`)}catch(S){console.error("Failed to start agent:",S),a({title:"Error Starting Agent",description:S instanceof Error?S.message:"Failed to start agent",variant:"destructive"})}finally{f(S=>S.filter(w=>w!==T))}},stopAgent:async E=>{if(!E.id){a({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const T=E.id;if(!d.includes(T))try{m(S=>[...S,T]),await o.mutateAsync(T),r.invalidateQueries({queryKey:["active-agents"]}),a({title:"Agent Stopped",description:`${E.name} has been stopped`})}catch(S){console.error("Failed to stop agent:",S),a({title:"Error Stopping Agent",description:S instanceof Error?S.message:"Failed to stop agent",variant:"destructive"})}finally{m(S=>S.filter(w=>w!==T))}},isAgentStarting:E=>E?c.includes(E):!1,isAgentStopping:E=>E?d.includes(E):!1,startingAgents:c,stoppingAgents:d}}function sz(){const{data:{data:t}={},isLoading:r,isError:a,error:s}=IE(),o=to(),{startAgent:c,stopAgent:f,isAgentStarting:d,isAgentStopping:m}=iz(),p=(t==null?void 0:t.agents)||[];return g.jsxs("div",{className:"flex flex-col gap-4 h-full p-4",children:[g.jsx("div",{className:"flex items-center justify-between",children:g.jsx(QE,{title:"Agents"})}),r&&g.jsx("div",{className:"text-center py-8",children:"Loading agents..."}),a&&g.jsxs("div",{className:"text-center py-8 text-destructive",children:["Error loading agents:"," ",s instanceof Error?s.message:"Unknown error"]}),p.length===0&&!r&&g.jsx("div",{className:"text-center py-8 flex flex-col items-center gap-4",children:g.jsx("p",{className:"text-muted-foreground",children:"No agents currently running. Start a character to begin."})}),!r&&!a&&g.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p==null?void 0:p.sort((v,b)=>Number(b==null?void 0:b.enabled)-Number(v==null?void 0:v.enabled)).map(v=>{const b=v.status==="active",x=d(v.id),E=m(v.id),T=x||E;let S="Start",w=g.jsx(ZO,{});return x?(S="Starting...",w=g.jsx(Xb,{className:"animate-spin"})):E?(S="Stopping...",w=g.jsx(Xb,{className:"animate-spin"})):b&&(S="Stop",w=g.jsx(n2,{fill:"#EF4444",size:16})),g.jsx(az,{title:v.name,content:uN(v.name),buttons:[{label:S,icon:w,action:()=>{T||(b?f(v):c(v))},className:`w-full grow ${b?"text-red-500":""} ${T?"opacity-80 cursor-not-allowed":""}`,variant:b?"secondary":"default",disabled:T},{icon:g.jsx(QO,{style:{height:14,width:14}}),className:"w-10 h-10 rounded-full",action:()=>o(`/chat/${v.id}`),variant:"outline",disabled:!b},{icon:g.jsx(PS,{style:{height:16,width:16}}),className:"w-10 h-10 rounded-full",action:()=>o(`/settings/${v.id}`),variant:"outline"}]},v.id)}),g.jsx(gu,{className:"flex flex-col items-center justify-center h-full cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>o("/create"),children:g.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[g.jsx(JO,{size:40,className:"text-muted-foreground"}),g.jsx("span",{className:"text-muted-foreground whitespace-nowrap",children:"Create New Agent"})]})})]})]})}function lz({agent:t,agentId:r}){const{toast:a}=xn(),s=to(),o=In(),[c,f]=y.useState(t),d=async p=>{try{if(!r)throw new Error("Agent ID is missing");const v={...p,plugins:c.plugins};await Lt.updateAgent(r,v),o.invalidateQueries({queryKey:["agent",r]}),o.invalidateQueries({queryKey:["agents"]}),s("/"),a({title:"Success",description:"Agent updated and restarted successfully"})}catch(v){throw a({title:"Error",description:v instanceof Error?v.message:"Failed to update agent",variant:"destructive"}),v}},m=async p=>{try{await Lt.deleteAgent(p.id),o.invalidateQueries({queryKey:["agents"]}),s("/")}catch(v){console.error("Error deleting agent:",v)}};return g.jsx(LE,{characterValue:c,setCharacterValue:f,title:"Character Settings",description:"Configure your AI character's behavior and capabilities",onSubmit:d,onReset:()=>f(t),onDelete:()=>m(t),isAgent:!0,customComponents:[{name:"Plugins",component:g.jsx(HE,{characterValue:c,setCharacterValue:f})},{name:"Secret",component:g.jsx($E,{characterValue:c,setCharacterValue:f})}]})}function oz(){var s;const{agentId:t}=eE(),r=Es({queryKey:["agent",t],queryFn:()=>Lt.getAgent(t??""),staleTime:kn.FREQUENT,refetchInterval:5e3,enabled:!!t});if(!t)return g.jsx("div",{children:"No data."});const a=(s=r==null?void 0:r.data)==null?void 0:s.data;return a?g.jsx(lz,{agent:a,agentId:t}):null}const HR=new pj({defaultOptions:{queries:{staleTime:kn.STANDARD,refetchInterval:!1,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0},mutations:{retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)}}}),$R=async()=>{try{await HR.prefetchQuery({queryKey:["agents"],queryFn:()=>Lt.getAgents(),staleTime:kn.FREQUENT})}catch(t){console.error("Error prefetching initial data:",t)}};$R();function cz(){return P3(),y.useEffect(()=>{$R()},[]),g.jsx(xj,{client:HR,children:g.jsx("div",{className:"dark antialiased",style:{colorScheme:"dark"},children:g.jsx(VD,{children:g.jsxs(xw,{delayDuration:0,children:[g.jsxs(ww,{children:[g.jsx(q_,{}),g.jsx(Rw,{children:g.jsx("div",{className:"flex flex-1 flex-col gap-4 size-full container",children:g.jsxs(SD,{children:[g.jsx(qa,{path:"/",element:g.jsx(sz,{})}),g.jsx(qa,{path:"chat/:agentId",element:g.jsx(nz,{})}),g.jsx(qa,{path:"settings/:agentId",element:g.jsx(oz,{})}),g.jsx(qa,{path:"agents/new",element:g.jsx(rz,{})}),g.jsx(qa,{path:"/create",element:g.jsx(qE,{})}),g.jsx(qa,{path:"/logs",element:g.jsx(q4,{})})]})})})]}),g.jsx(o3,{})]})})})})}const qR=document.getElementById("root");if(!qR)throw new Error("Root element not found");xA.createRoot(qR).render(g.jsx(y.StrictMode,{children:g.jsx(cz,{})}));