@tyanxie/paimon-darwin-arm64 2.0.0 → 2.1.0

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.
@@ -1,264 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./modalFeatures-BeDlpc4S.js","./framework-gzBbjyR4.js","./markdown-OowzRXxA.js","./index-DsjiosHk.js","./modelConfig-BWIG2U9q.js","./isObjectLike-DlmVz5ty.js","./mermaid.core-DVbCkJL3.js","./purify.es-CAi2OJFm.js","./mix-CrMk8dT1.js","./mermaidTheme-DoQvsUbV.js","./channel-DF8NlRb_.js"])))=>i.map(i=>d[i]);
2
- import{a as f,j as l,g as zc,b as Hc,R as ln,r as pt,_ as ot,c as Uc}from"./framework-gzBbjyR4.js";import{d as ls,M as Kc,b as Wc,c as qc,r as Gc,f as Yc,s as Jc,e as Xc,j as ra}from"./markdown-OowzRXxA.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();/**
3
- * react-router v7.15.1
4
- *
5
- * Copyright (c) Remix Software Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE.md file in the root directory of this source tree.
9
- *
10
- * @license MIT
11
- */var yi="popstate";function xi(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Zc(e={}){function t(s,r){var u;let i=(u=r.state)==null?void 0:u.masked,{pathname:o,search:a,hash:c}=i||s.location;return Os("",{pathname:o,search:a,hash:c},r.state&&r.state.usr||null,r.state&&r.state.key||"default",i?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,r){return typeof r=="string"?r:It(r)}return eu(t,n,null,e)}function Q(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ce(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Qc(){return Math.random().toString(36).substring(2,10)}function vi(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Os(e,t,n=null,s,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?mt(t):t,state:n,key:t&&t.key||s||Qc(),mask:r}}function It({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function mt(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function eu(e,t,n,s={}){let{window:r=document.defaultView,v5Compat:i=!1}=s,o=r.history,a="POP",c=null,u=d();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function d(){return(o.state||{idx:null}).idx}function h(){a="POP";let y=d(),v=y==null?null:y-u;u=y,c&&c({action:a,location:x.location,delta:v})}function g(y,v){a="PUSH";let k=xi(y)?y:Os(x.location,y,v);u=d()+1;let b=vi(k,u),S=x.createHref(k.mask||k);try{o.pushState(b,"",S)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;r.location.assign(S)}i&&c&&c({action:a,location:x.location,delta:1})}function m(y,v){a="REPLACE";let k=xi(y)?y:Os(x.location,y,v);u=d();let b=vi(k,u),S=x.createHref(k.mask||k);o.replaceState(b,"",S),i&&c&&c({action:a,location:x.location,delta:0})}function p(y){return tu(y)}let x={get action(){return a},get location(){return e(r,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return r.addEventListener(yi,h),c=y,()=>{r.removeEventListener(yi,h),c=null}},createHref(y){return t(r,y)},createURL:p,encodeLocation(y){let v=p(y);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:g,replace:m,go(y){return o.go(y)}};return x}function tu(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Q(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:It(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function ia(e,t,n="/"){return nu(e,t,n,!1)}function nu(e,t,n,s,r){let i=typeof t=="string"?mt(t):t,o=Ae(i.pathname||"/",n);if(o==null)return null;let a=su(e),c=null,u=mu(o);for(let d=0;c==null&&d<a.length;++d)c=hu(a[d],u,s);return c}function su(e){let t=oa(e);return ru(t),t}function oa(e,t=[],n=[],s="",r=!1){let i=(o,a,c=r,u)=>{let d={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(s)&&c)return;Q(d.relativePath.startsWith(s),`Absolute route path "${d.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(s.length)}let h=me([s,d.relativePath]),g=n.concat(d);o.children&&o.children.length>0&&(Q(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),oa(o.children,t,g,h,c)),!(o.path==null&&!o.index)&&t.push({path:h,score:du(h,o.index),routesMeta:g})};return e.forEach((o,a)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,a);else for(let u of aa(o.path))i(o,a,!0,u)}),t}function aa(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,r=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return r?[i,""]:[i];let o=aa(s.join("/")),a=[];return a.push(...o.map(c=>c===""?i:[i,c].join("/"))),r&&a.push(...o),a.map(c=>e.startsWith("/")&&c===""?"/":c)}function ru(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:fu(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var iu=/^:[\w-]+$/,ou=3,au=2,lu=1,cu=10,uu=-2,bi=e=>e==="*";function du(e,t){let n=e.split("/"),s=n.length;return n.some(bi)&&(s+=uu),t&&(s+=au),n.filter(r=>!bi(r)).reduce((r,i)=>r+(iu.test(i)?ou:i===""?lu:cu),s)}function fu(e,t){return e.length===t.length&&e.slice(0,-1).every((s,r)=>s===t[r])?e[e.length-1]-t[t.length-1]:0}function hu(e,t,n=!1){let{routesMeta:s}=e,r={},i="/",o=[];for(let a=0;a<s.length;++a){let c=s[a],u=a===s.length-1,d=i==="/"?t:t.slice(i.length)||"/",h=Rn({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),g=c.route;if(!h&&u&&n&&!s[s.length-1].route.index&&(h=Rn({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(r,h.params),o.push({params:r,pathname:me([i,h.pathname]),pathnameBase:vu(me([i,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(i=me([i,h.pathnameBase]))}return o}function Rn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=pu(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let i=r[0],o=i.replace(/(.)\/+$/,"$1"),a=r.slice(1);return{params:s.reduce((u,{paramName:d,isOptional:h},g)=>{if(d==="*"){let p=a[g]||"";o=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const m=a[g];return h&&!m?u[d]=void 0:u[d]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function pu(e,t=!1,n=!0){Ce(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,c,u,d)=>{if(s.push({paramName:a,isOptional:c!=null}),c){let h=d.charAt(u+o.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),s]}function mu(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ce(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ae(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}var gu=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function yu(e,t="/"){let{pathname:n,search:s="",hash:r=""}=typeof e=="string"?mt(e):e,i;return n?(n=ca(n),n.startsWith("/")?i=wi(n.substring(1),"/"):i=wi(n,t)):i=t,{pathname:i,search:bu(s),hash:wu(r)}}function wi(e,t){let n=Mn(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function cs(e,t,n,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function xu(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function la(e){let t=xu(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function br(e,t,n,s=!1){let r;typeof e=="string"?r=mt(e):(r={...e},Q(!r.pathname||!r.pathname.includes("?"),cs("?","pathname","search",r)),Q(!r.pathname||!r.pathname.includes("#"),cs("#","pathname","hash",r)),Q(!r.search||!r.search.includes("#"),cs("#","search","hash",r)));let i=e===""||r.pathname==="",o=i?"/":r.pathname,a;if(o==null)a=n;else{let h=t.length-1;if(!s&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),h-=1;r.pathname=g.join("/")}a=h>=0?t[h]:"/"}let c=yu(r,a),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}var ca=e=>e.replace(/\/\/+/g,"/"),me=e=>ca(e.join("/")),Mn=e=>e.replace(/\/+$/,""),vu=e=>Mn(e).replace(/^\/*/,"/"),bu=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wu=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Su=class{constructor(e,t,n,s=!1){this.status=e,this.statusText=t||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Cu(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ku(e){let t=e.map(n=>n.route.path).filter(Boolean);return me(t)||"/"}var ua=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function da(e,t){let n=e;if(typeof n!="string"||!gu.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,r=!1;if(ua)try{let i=new URL(window.location.href),o=n.startsWith("//")?new URL(i.protocol+n):new URL(n),a=Ae(o.pathname,t);o.origin===i.origin&&a!=null?n=a+o.search+o.hash:r=!0}catch{Ce(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fa=["POST","PUT","PATCH","DELETE"];new Set(fa);var ju=["GET",...fa];new Set(ju);var gt=f.createContext(null);gt.displayName="DataRouter";var Gn=f.createContext(null);Gn.displayName="DataRouterState";var ha=f.createContext(!1);function Eu(){return f.useContext(ha)}var pa=f.createContext({isTransitioning:!1});pa.displayName="ViewTransition";var Tu=f.createContext(new Map);Tu.displayName="Fetchers";var Nu=f.createContext(null);Nu.displayName="Await";var pe=f.createContext(null);pe.displayName="Navigation";var qt=f.createContext(null);qt.displayName="Location";var ye=f.createContext({outlet:null,matches:[],isDataRoute:!1});ye.displayName="Route";var wr=f.createContext(null);wr.displayName="RouteError";var ma="REACT_ROUTER_ERROR",Ru="REDIRECT",Mu="ROUTE_ERROR_RESPONSE";function Au(e){if(e.startsWith(`${ma}:${Ru}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Lu(e){if(e.startsWith(`${ma}:${Mu}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Su(t.status,t.statusText,t.data)}catch{}}function Iu(e,{relative:t}={}){Q(Gt(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(pe),{hash:r,pathname:i,search:o}=Jt(e,{relative:t}),a=i;return n!=="/"&&(a=i==="/"?n:me([n,i])),s.createHref({pathname:a,search:o,hash:r})}function Gt(){return f.useContext(qt)!=null}function xe(){return Q(Gt(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(qt).location}var ga="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ya(e){f.useContext(pe).static||f.useLayoutEffect(e)}function Yt(){let{isDataRoute:e}=f.useContext(ye);return e?Yu():Pu()}function Pu(){Q(Gt(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(gt),{basename:t,navigator:n}=f.useContext(pe),{matches:s}=f.useContext(ye),{pathname:r}=xe(),i=JSON.stringify(la(s)),o=f.useRef(!1);return ya(()=>{o.current=!0}),f.useCallback((c,u={})=>{if(Ce(o.current,ga),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=br(c,JSON.parse(i),r,u.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:me([t,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[t,n,i,r,e])}var $u=f.createContext(null);function Ou(e){let t=f.useContext(ye).outlet;return f.useMemo(()=>t&&f.createElement($u.Provider,{value:e},t),[t,e])}function _u(){let{matches:e}=f.useContext(ye),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Jt(e,{relative:t}={}){let{matches:n}=f.useContext(ye),{pathname:s}=xe(),r=JSON.stringify(la(n));return f.useMemo(()=>br(e,JSON.parse(r),s,t==="path"),[e,r,s,t])}function Fu(e,t){return xa(e,t)}function xa(e,t,n){var y;Q(Gt(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(pe),{matches:r}=f.useContext(ye),i=r[r.length-1],o=i?i.params:{},a=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let v=u&&u.path||"";ba(a,!u||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${v}">) 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.
12
-
13
- Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let d=xe(),h;if(t){let v=typeof t=="string"?mt(t):t;Q(c==="/"||((y=v.pathname)==null?void 0:y.startsWith(c)),`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 "${c}" but pathname "${v.pathname}" was given in the \`location\` prop.`),h=v}else h=d;let g=h.pathname||"/",m=g;if(c!=="/"){let v=c.replace(/^\//,"").split("/");m="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let p=n&&n.state.matches.length?n.state.matches.map(v=>Object.assign(v,{route:n.manifest[v.route.id]||v.route})):ia(e,{pathname:m});Ce(u||p!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Ce(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.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 x=Hu(p&&p.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:me([c,s.encodeLocation?s.encodeLocation(v.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:me([c,s.encodeLocation?s.encodeLocation(v.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:v.pathnameBase])})),r,n);return t&&x?f.createElement(qt.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},x):x}function Du(){let e=Gu(),t=Cu(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:i},"ErrorBoundary")," or"," ",f.createElement("code",{style:i},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:r},n):null,o)}var Vu=f.createElement(Du,null),va=class extends f.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Lu(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(ye.Provider,{value:this.props.routeContext},f.createElement(wr.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(Bu,{error:e},t):t}};va.contextType=ha;var us=new WeakMap;function Bu({children:e,error:t}){let{basename:n}=f.useContext(pe);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=Au(t.digest);if(s){let r=us.get(t);if(r)throw r;let i=da(s.location,n);if(ua&&!us.get(t))if(i.isExternal||s.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:s.replace}));throw us.set(t,o),o}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function zu({routeContext:e,match:t,children:n}){let s=f.useContext(gt);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(ye.Provider,{value:e},n)}function Hu(e,t=[],n){let s=n==null?void 0:n.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let r=e,i=s==null?void 0:s.errors;if(i!=null){let d=r.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);Q(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),r=r.slice(0,Math.min(r.length,d+1))}let o=!1,a=-1;if(n&&s){o=s.renderFallback;for(let d=0;d<r.length;d++){let h=r[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(a=d),h.route.id){let{loaderData:g,errors:m}=s,p=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!m||m[h.route.id]===void 0);if(h.route.lazy||p){n.isStatic&&(o=!0),a>=0?r=r.slice(0,a+1):r=[r[0]];break}}}}let c=n==null?void 0:n.onError,u=s&&c?(d,h)=>{var g,m;c(d,{location:s.location,params:((m=(g=s.matches)==null?void 0:g[0])==null?void 0:m.params)??{},pattern:ku(s.matches),errorInfo:h})}:void 0;return r.reduceRight((d,h,g)=>{let m,p=!1,x=null,y=null;s&&(m=i&&h.route.id?i[h.route.id]:void 0,x=h.route.errorElement||Vu,o&&(a<0&&g===0?(ba("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,y=null):a===g&&(p=!0,y=h.route.hydrateFallbackElement||null)));let v=t.concat(r.slice(0,g+1)),k=()=>{let b;return m?b=x:p?b=y:h.route.Component?b=f.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=d,f.createElement(zu,{match:h,routeContext:{outlet:d,matches:v,isDataRoute:s!=null},children:b})};return s&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?f.createElement(va,{location:s.location,revalidation:s.revalidation,component:x,error:m,children:k(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:u}):k()},null)}function Sr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Uu(e){let t=f.useContext(gt);return Q(t,Sr(e)),t}function Ku(e){let t=f.useContext(Gn);return Q(t,Sr(e)),t}function Wu(e){let t=f.useContext(ye);return Q(t,Sr(e)),t}function Cr(e){let t=Wu(e),n=t.matches[t.matches.length-1];return Q(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function qu(){return Cr("useRouteId")}function Gu(){var s;let e=f.useContext(wr),t=Ku("useRouteError"),n=Cr("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function Yu(){let{router:e}=Uu("useNavigate"),t=Cr("useNavigate"),n=f.useRef(!1);return ya(()=>{n.current=!0}),f.useCallback(async(r,i={})=>{Ce(n.current,ga),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Si={};function ba(e,t,n){!t&&!Si[e]&&(Si[e]=!0,Ce(!1,n))}f.memo(Ju);function Ju({routes:e,manifest:t,future:n,state:s,isStatic:r,onError:i}){return xa(e,void 0,{manifest:t,state:s,isStatic:r,onError:i})}function Xu(e){return Ou(e.context)}function jt(e){Q(!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 Zu({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:r,static:i=!1,useTransitions:o}){Q(!Gt(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=e.replace(/^\/*/,"/"),c=f.useMemo(()=>({basename:a,navigator:r,static:i,useTransitions:o,future:{}}),[a,r,i,o]);typeof n=="string"&&(n=mt(n));let{pathname:u="/",search:d="",hash:h="",state:g=null,key:m="default",mask:p}=n,x=f.useMemo(()=>{let y=Ae(u,a);return y==null?null:{location:{pathname:y,search:d,hash:h,state:g,key:m,mask:p},navigationType:s}},[a,u,d,h,g,m,s,p]);return Ce(x!=null,`<Router basename="${a}"> is not able to match the URL "${u}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:f.createElement(pe.Provider,{value:c},f.createElement(qt.Provider,{children:t,value:x}))}function Qu({children:e,location:t}){return Fu(_s(e),t)}function _s(e,t=[]){let n=[];return f.Children.forEach(e,(s,r)=>{if(!f.isValidElement(s))return;let i=[...t,r];if(s.type===f.Fragment){n.push.apply(n,_s(s.props.children,i));return}Q(s.type===jt,`[${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>`),Q(!s.props.index||!s.props.children,"An index route cannot have child routes.");let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,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&&(o.children=_s(s.props.children,i)),n.push(o)}),n}var mn="get",gn="application/x-www-form-urlencoded";function Yn(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ed(e){return Yn(e)&&e.tagName.toLowerCase()==="button"}function td(e){return Yn(e)&&e.tagName.toLowerCase()==="form"}function nd(e){return Yn(e)&&e.tagName.toLowerCase()==="input"}function sd(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function rd(e,t){return e.button===0&&(!t||t==="_self")&&!sd(e)}var cn=null;function id(){if(cn===null)try{new FormData(document.createElement("form"),0),cn=!1}catch{cn=!0}return cn}var od=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ds(e){return e!=null&&!od.has(e)?(Ce(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${gn}"`),null):e}function ad(e,t){let n,s,r,i,o;if(td(e)){let a=e.getAttribute("action");s=a?Ae(a,t):null,n=e.getAttribute("method")||mn,r=ds(e.getAttribute("enctype"))||gn,i=new FormData(e)}else if(ed(e)||nd(e)&&(e.type==="submit"||e.type==="image")){let a=e.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||a.getAttribute("action");if(s=c?Ae(c,t):null,n=e.getAttribute("formmethod")||a.getAttribute("method")||mn,r=ds(e.getAttribute("formenctype"))||ds(a.getAttribute("enctype"))||gn,i=new FormData(a,e),!id()){let{name:u,type:d,value:h}=e;if(d==="image"){let g=u?`${u}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}else u&&i.append(u,h)}}else{if(Yn(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=mn,s=null,r=gn,o=e}return i&&r==="text/plain"&&(o=i,i=void 0),{action:s,method:n.toLowerCase(),encType:r,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function kr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wa(e,t,n,s){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${s}`:r.pathname=`${r.pathname}.${s}`:r.pathname==="/"?r.pathname=`_root.${s}`:t&&Ae(r.pathname,t)==="/"?r.pathname=`${Mn(t)}/_root.${s}`:r.pathname=`${Mn(r.pathname)}.${s}`,r}async function ld(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function cd(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function ud(e,t,n){let s=await Promise.all(e.map(async r=>{let i=t.routes[r.route.id];if(i){let o=await ld(i,n);return o.links?o.links():[]}return[]}));return pd(s.flat(1).filter(cd).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function Ci(e,t,n,s,r,i){let o=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,a=(c,u)=>{var d;return n[u].pathname!==c.pathname||((d=n[u].route.path)==null?void 0:d.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>o(c,u)||a(c,u)):i==="data"?t.filter((c,u)=>{var h;let d=s.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,u)||a(c,u))return!0;if(c.route.shouldRevalidate){let g=c.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function dd(e,t,{includeHydrateFallback:n}={}){return fd(e.map(s=>{let r=t.routes[s.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function fd(e){return[...new Set(e)]}function hd(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function pd(e,t){let n=new Set;return new Set(t),e.reduce((s,r)=>{let i=JSON.stringify(hd(r));return n.has(i)||(n.add(i),s.push({key:i,link:r})),s},[])}function jr(){let e=f.useContext(gt);return kr(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function md(){let e=f.useContext(Gn);return kr(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Er=f.createContext(void 0);Er.displayName="FrameworkContext";function Tr(){let e=f.useContext(Er);return kr(e,"You must render this element inside a <HydratedRouter> element"),e}function gd(e,t){let n=f.useContext(Er),[s,r]=f.useState(!1),[i,o]=f.useState(!1),{onFocus:a,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:h}=t,g=f.useRef(null);f.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let x=v=>{v.forEach(k=>{o(k.isIntersecting)})},y=new IntersectionObserver(x,{threshold:.5});return g.current&&y.observe(g.current),()=>{y.disconnect()}}},[e]),f.useEffect(()=>{if(s){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[s]);let m=()=>{r(!0)},p=()=>{r(!1),o(!1)};return n?e!=="intent"?[i,g,{}]:[i,g,{onFocus:St(a,m),onBlur:St(c,p),onMouseEnter:St(u,m),onMouseLeave:St(d,p),onTouchStart:St(h,m)}]:[!1,g,{}]}function St(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function yd({page:e,...t}){let n=Eu(),{router:s}=jr(),r=f.useMemo(()=>ia(s.routes,e,s.basename),[s.routes,e,s.basename]);return r?n?f.createElement(vd,{page:e,matches:r,...t}):f.createElement(bd,{page:e,matches:r,...t}):null}function xd(e){let{manifest:t,routeModules:n}=Tr(),[s,r]=f.useState([]);return f.useEffect(()=>{let i=!1;return ud(e,t,n).then(o=>{i||r(o)}),()=>{i=!0}},[e,t,n]),s}function vd({page:e,matches:t,...n}){let s=xe(),{future:r}=Tr(),{basename:i}=jr(),o=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let a=wa(e,i,r.unstable_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?c=!0:u.push(d.route.id);return c&&u.length>0&&a.searchParams.set("_routes",u.join(",")),[a.pathname+a.search]},[i,r.unstable_trailingSlashAwareDataRequests,e,s,t]);return f.createElement(f.Fragment,null,o.map(a=>f.createElement("link",{key:a,rel:"prefetch",as:"fetch",href:a,...n})))}function bd({page:e,matches:t,...n}){let s=xe(),{future:r,manifest:i,routeModules:o}=Tr(),{basename:a}=jr(),{loaderData:c,matches:u}=md(),d=f.useMemo(()=>Ci(e,t,u,i,s,"data"),[e,t,u,i,s]),h=f.useMemo(()=>Ci(e,t,u,i,s,"assets"),[e,t,u,i,s]),g=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let x=new Set,y=!1;if(t.forEach(k=>{var S;let b=i.routes[k.route.id];!b||!b.hasLoader||(!d.some(w=>w.route.id===k.route.id)&&k.route.id in c&&((S=o[k.route.id])!=null&&S.shouldRevalidate)||b.hasClientLoader?y=!0:x.add(k.route.id))}),x.size===0)return[];let v=wa(e,a,r.unstable_trailingSlashAwareDataRequests,"data");return y&&x.size>0&&v.searchParams.set("_routes",t.filter(k=>x.has(k.route.id)).map(k=>k.route.id).join(",")),[v.pathname+v.search]},[a,r.unstable_trailingSlashAwareDataRequests,c,s,i,d,t,e,o]),m=f.useMemo(()=>dd(h,i),[h,i]),p=xd(h);return f.createElement(f.Fragment,null,g.map(x=>f.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),m.map(x=>f.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),p.map(({key:x,link:y})=>f.createElement("link",{key:x,nonce:n.nonce,...y,crossOrigin:y.crossOrigin??n.crossOrigin})))}function wd(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Sd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Sd&&(window.__reactRouterVersion="7.15.1")}catch{}function Cd({basename:e,children:t,useTransitions:n,window:s}){let r=f.useRef();r.current==null&&(r.current=Zc({window:s,v5Compat:!0}));let i=r.current,[o,a]=f.useState({action:i.action,location:i.location}),c=f.useCallback(u=>{n===!1?a(u):f.startTransition(()=>a(u))},[n]);return f.useLayoutEffect(()=>i.listen(c),[i,c]),f.createElement(Zu,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:i,useTransitions:n})}var Sa=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ca=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:r,reloadDocument:i,replace:o,mask:a,state:c,target:u,to:d,preventScrollReset:h,viewTransition:g,defaultShouldRevalidate:m,...p},x){let{basename:y,navigator:v,useTransitions:k}=f.useContext(pe),b=typeof d=="string"&&Sa.test(d),S=da(d,y);d=S.to;let w=Iu(d,{relative:r}),A=xe(),T=null;if(a){let P=br(a,[],A.mask?A.mask.pathname:"/",!0);y!=="/"&&(P.pathname=P.pathname==="/"?y:me([y,P.pathname])),T=v.createHref(P)}let[C,E,j]=gd(s,p),O=Td(d,{replace:o,mask:a,state:c,target:u,preventScrollReset:h,relative:r,viewTransition:g,defaultShouldRevalidate:m,useTransitions:k});function $(P){t&&t(P),P.defaultPrevented||O(P)}let R=!(S.isExternal||i),N=f.createElement("a",{...p,...j,href:(R?T:void 0)||S.absoluteURL||w,onClick:R?$:t,ref:wd(x,E),target:u,"data-discover":!b&&n==="render"?"true":void 0});return C&&!b?f.createElement(f.Fragment,null,N,f.createElement(yd,{page:w})):N});Ca.displayName="Link";var kd=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:r=!1,style:i,to:o,viewTransition:a,children:c,...u},d){let h=Jt(o,{relative:u.relative}),g=xe(),m=f.useContext(Gn),{navigator:p,basename:x}=f.useContext(pe),y=m!=null&&Ld(h)&&a===!0,v=p.encodeLocation?p.encodeLocation(h).pathname:h.pathname,k=g.pathname,b=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(k=k.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&x&&(b=Ae(b,x)||b);const S=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let w=k===v||!r&&k.startsWith(v)&&k.charAt(S)==="/",A=b!=null&&(b===v||!r&&b.startsWith(v)&&b.charAt(v.length)==="/"),T={isActive:w,isPending:A,isTransitioning:y},C=w?t:void 0,E;typeof s=="function"?E=s(T):E=[s,w?"active":null,A?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let j=typeof i=="function"?i(T):i;return f.createElement(Ca,{...u,"aria-current":C,className:E,ref:d,style:j,to:o,viewTransition:a},typeof c=="function"?c(T):c)});kd.displayName="NavLink";var jd=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:r,state:i,method:o=mn,action:a,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:g,...m},p)=>{let{useTransitions:x}=f.useContext(pe),y=Md(),v=Ad(a,{relative:u}),k=o.toLowerCase()==="get"?"get":"post",b=typeof a=="string"&&Sa.test(a),S=w=>{if(c&&c(w),w.defaultPrevented)return;w.preventDefault();let A=w.nativeEvent.submitter,T=(A==null?void 0:A.getAttribute("formmethod"))||o,C=()=>y(A||w.currentTarget,{fetcherKey:t,method:T,navigate:n,replace:r,state:i,relative:u,preventScrollReset:d,viewTransition:h,defaultShouldRevalidate:g});x&&n!==!1?f.startTransition(()=>C()):C()};return f.createElement("form",{ref:p,method:k,action:v,onSubmit:s?c:S,...m,"data-discover":!b&&e==="render"?"true":void 0})});jd.displayName="Form";function Ed(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ka(e){let t=f.useContext(gt);return Q(t,Ed(e)),t}function Td(e,{target:t,replace:n,mask:s,state:r,preventScrollReset:i,relative:o,viewTransition:a,defaultShouldRevalidate:c,useTransitions:u}={}){let d=Yt(),h=xe(),g=Jt(e,{relative:o});return f.useCallback(m=>{if(rd(m,t)){m.preventDefault();let p=n!==void 0?n:It(h)===It(g),x=()=>d(e,{replace:p,mask:s,state:r,preventScrollReset:i,relative:o,viewTransition:a,defaultShouldRevalidate:c});u?f.startTransition(()=>x()):x()}},[h,d,g,n,s,r,t,e,i,o,a,c,u])}var Nd=0,Rd=()=>`__${String(++Nd)}__`;function Md(){let{router:e}=ka("useSubmit"),{basename:t}=f.useContext(pe),n=qu(),s=e.fetch,r=e.navigate;return f.useCallback(async(i,o={})=>{let{action:a,method:c,encType:u,formData:d,body:h}=ad(i,t);if(o.navigate===!1){let g=o.fetcherKey||Rd();await s(g,n,o.action||a,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||c,formEncType:o.encType||u,flushSync:o.flushSync})}else await r(o.action||a,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||c,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[s,r,t,n])}function Ad(e,{relative:t}={}){let{basename:n}=f.useContext(pe),s=f.useContext(ye);Q(s,"useFormAction must be used inside a RouteContext");let[r]=s.matches.slice(-1),i={...Jt(e||".",{relative:t})},o=xe();if(e==null){i.search=o.search;let a=new URLSearchParams(i.search),c=a.getAll("index");if(c.some(d=>d==="")){a.delete("index"),c.filter(h=>h).forEach(h=>a.append("index",h));let d=a.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&r.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:me([n,i.pathname])),It(i)}function Ld(e,{relative:t}={}){let n=f.useContext(pa);Q(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=ka("useViewTransitionState"),r=Jt(e,{relative:t});if(!n.isTransitioning)return!1;let i=Ae(n.currentLocation.pathname,s)||n.currentLocation.pathname,o=Ae(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Rn(r.pathname,o)!=null||Rn(r.pathname,i)!=null}/**
14
- * @license lucide-react v1.16.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */const ja=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
19
- * @license lucide-react v1.16.0 - ISC
20
- *
21
- * This source code is licensed under the ISC license.
22
- * See the LICENSE file in the root directory of this source tree.
23
- */const Id=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
24
- * @license lucide-react v1.16.0 - ISC
25
- *
26
- * This source code is licensed under the ISC license.
27
- * See the LICENSE file in the root directory of this source tree.
28
- */const Pd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());/**
29
- * @license lucide-react v1.16.0 - ISC
30
- *
31
- * This source code is licensed under the ISC license.
32
- * See the LICENSE file in the root directory of this source tree.
33
- */const ki=e=>{const t=Pd(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
34
- * @license lucide-react v1.16.0 - ISC
35
- *
36
- * This source code is licensed under the ISC license.
37
- * See the LICENSE file in the root directory of this source tree.
38
- */var fs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
39
- * @license lucide-react v1.16.0 - ISC
40
- *
41
- * This source code is licensed under the ISC license.
42
- * See the LICENSE file in the root directory of this source tree.
43
- */const $d=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Od=f.createContext({}),_d=()=>f.useContext(Od),Fd=f.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},c)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:h=!1,color:g="currentColor",className:m=""}=_d()??{},p=s??h?Number(n??d)*24/Number(t??u):n??d;return f.createElement("svg",{ref:c,...fs,width:t??u??fs.width,height:t??u??fs.height,stroke:e??g,strokeWidth:p,className:ja("lucide",m,r),...!i&&!$d(a)&&{"aria-hidden":"true"},...a},[...o.map(([x,y])=>f.createElement(x,y)),...Array.isArray(i)?i:[i]])});/**
44
- * @license lucide-react v1.16.0 - ISC
45
- *
46
- * This source code is licensed under the ISC license.
47
- * See the LICENSE file in the root directory of this source tree.
48
- */const G=(e,t)=>{const n=f.forwardRef(({className:s,...r},i)=>f.createElement(Fd,{ref:i,iconNode:t,className:ja(`lucide-${Id(ki(e))}`,`lucide-${e}`,s),...r}));return n.displayName=ki(e),n};/**
49
- * @license lucide-react v1.16.0 - ISC
50
- *
51
- * This source code is licensed under the ISC license.
52
- * See the LICENSE file in the root directory of this source tree.
53
- */const Dd=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Vd=G("arrow-left",Dd);/**
54
- * @license lucide-react v1.16.0 - ISC
55
- *
56
- * This source code is licensed under the ISC license.
57
- * See the LICENSE file in the root directory of this source tree.
58
- */const Bd=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],zd=G("arrow-up",Bd);/**
59
- * @license lucide-react v1.16.0 - ISC
60
- *
61
- * This source code is licensed under the ISC license.
62
- * See the LICENSE file in the root directory of this source tree.
63
- */const Hd=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Jn=G("brain",Hd);/**
64
- * @license lucide-react v1.16.0 - ISC
65
- *
66
- * This source code is licensed under the ISC license.
67
- * See the LICENSE file in the root directory of this source tree.
68
- */const Ud=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],yt=G("check",Ud);/**
69
- * @license lucide-react v1.16.0 - ISC
70
- *
71
- * This source code is licensed under the ISC license.
72
- * See the LICENSE file in the root directory of this source tree.
73
- */const Kd=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ea=G("chevron-down",Kd);/**
74
- * @license lucide-react v1.16.0 - ISC
75
- *
76
- * This source code is licensed under the ISC license.
77
- * See the LICENSE file in the root directory of this source tree.
78
- */const Wd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],qd=G("chevron-left",Wd);/**
79
- * @license lucide-react v1.16.0 - ISC
80
- *
81
- * This source code is licensed under the ISC license.
82
- * See the LICENSE file in the root directory of this source tree.
83
- */const Gd=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],De=G("chevron-right",Gd);/**
84
- * @license lucide-react v1.16.0 - ISC
85
- *
86
- * This source code is licensed under the ISC license.
87
- * See the LICENSE file in the root directory of this source tree.
88
- */const Yd=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Jd=G("chevrons-down",Yd);/**
89
- * @license lucide-react v1.16.0 - ISC
90
- *
91
- * This source code is licensed under the ISC license.
92
- * See the LICENSE file in the root directory of this source tree.
93
- */const Xd=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],An=G("circle-alert",Xd);/**
94
- * @license lucide-react v1.16.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- */const Zd=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Qd=G("circle-check-big",Zd);/**
99
- * @license lucide-react v1.16.0 - ISC
100
- *
101
- * This source code is licensed under the ISC license.
102
- * See the LICENSE file in the root directory of this source tree.
103
- */const ef=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],tf=G("circle-check",ef);/**
104
- * @license lucide-react v1.16.0 - ISC
105
- *
106
- * This source code is licensed under the ISC license.
107
- * See the LICENSE file in the root directory of this source tree.
108
- */const nf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],sf=G("circle-question-mark",nf);/**
109
- * @license lucide-react v1.16.0 - ISC
110
- *
111
- * This source code is licensed under the ISC license.
112
- * See the LICENSE file in the root directory of this source tree.
113
- */const rf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],of=G("circle-stop",rf);/**
114
- * @license lucide-react v1.16.0 - ISC
115
- *
116
- * This source code is licensed under the ISC license.
117
- * See the LICENSE file in the root directory of this source tree.
118
- */const af=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],lf=G("circle-x",af);/**
119
- * @license lucide-react v1.16.0 - ISC
120
- *
121
- * This source code is licensed under the ISC license.
122
- * See the LICENSE file in the root directory of this source tree.
123
- */const cf=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Nr=G("copy",cf);/**
124
- * @license lucide-react v1.16.0 - ISC
125
- *
126
- * This source code is licensed under the ISC license.
127
- * See the LICENSE file in the root directory of this source tree.
128
- */const uf=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Fs=G("cpu",uf);/**
129
- * @license lucide-react v1.16.0 - ISC
130
- *
131
- * This source code is licensed under the ISC license.
132
- * See the LICENSE file in the root directory of this source tree.
133
- */const df=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ds=G("ellipsis",df);/**
134
- * @license lucide-react v1.16.0 - ISC
135
- *
136
- * This source code is licensed under the ISC license.
137
- * See the LICENSE file in the root directory of this source tree.
138
- */const ff=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],hf=G("expand",ff);/**
139
- * @license lucide-react v1.16.0 - ISC
140
- *
141
- * This source code is licensed under the ISC license.
142
- * See the LICENSE file in the root directory of this source tree.
143
- */const pf=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],mf=G("folder-plus",pf);/**
144
- * @license lucide-react v1.16.0 - ISC
145
- *
146
- * This source code is licensed under the ISC license.
147
- * See the LICENSE file in the root directory of this source tree.
148
- */const gf=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ta=G("folder",gf);/**
149
- * @license lucide-react v1.16.0 - ISC
150
- *
151
- * This source code is licensed under the ISC license.
152
- * See the LICENSE file in the root directory of this source tree.
153
- */const yf=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],xf=G("gauge",yf);/**
154
- * @license lucide-react v1.16.0 - ISC
155
- *
156
- * This source code is licensed under the ISC license.
157
- * See the LICENSE file in the root directory of this source tree.
158
- */const vf=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Na=G("git-branch",vf);/**
159
- * @license lucide-react v1.16.0 - ISC
160
- *
161
- * This source code is licensed under the ISC license.
162
- * See the LICENSE file in the root directory of this source tree.
163
- */const bf=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],wf=G("history",bf);/**
164
- * @license lucide-react v1.16.0 - ISC
165
- *
166
- * This source code is licensed under the ISC license.
167
- * See the LICENSE file in the root directory of this source tree.
168
- */const Sf=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],ji=G("image-plus",Sf);/**
169
- * @license lucide-react v1.16.0 - ISC
170
- *
171
- * This source code is licensed under the ISC license.
172
- * See the LICENSE file in the root directory of this source tree.
173
- */const Cf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ra=G("info",Cf);/**
174
- * @license lucide-react v1.16.0 - ISC
175
- *
176
- * This source code is licensed under the ISC license.
177
- * See the LICENSE file in the root directory of this source tree.
178
- */const kf=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ma=G("layers",kf);/**
179
- * @license lucide-react v1.16.0 - ISC
180
- *
181
- * This source code is licensed under the ISC license.
182
- * See the LICENSE file in the root directory of this source tree.
183
- */const jf=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Le=G("loader-circle",jf);/**
184
- * @license lucide-react v1.16.0 - ISC
185
- *
186
- * This source code is licensed under the ISC license.
187
- * See the LICENSE file in the root directory of this source tree.
188
- */const Ef=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Tf=G("log-out",Ef);/**
189
- * @license lucide-react v1.16.0 - ISC
190
- *
191
- * This source code is licensed under the ISC license.
192
- * See the LICENSE file in the root directory of this source tree.
193
- */const Nf=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Ei=G("minimize-2",Nf);/**
194
- * @license lucide-react v1.16.0 - ISC
195
- *
196
- * This source code is licensed under the ISC license.
197
- * See the LICENSE file in the root directory of this source tree.
198
- */const Rf=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Aa=G("plus",Rf);/**
199
- * @license lucide-react v1.16.0 - ISC
200
- *
201
- * This source code is licensed under the ISC license.
202
- * See the LICENSE file in the root directory of this source tree.
203
- */const Mf=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Af=G("server",Mf);/**
204
- * @license lucide-react v1.16.0 - ISC
205
- *
206
- * This source code is licensed under the ISC license.
207
- * See the LICENSE file in the root directory of this source tree.
208
- */const Lf=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],If=G("settings",Lf);/**
209
- * @license lucide-react v1.16.0 - ISC
210
- *
211
- * This source code is licensed under the ISC license.
212
- * See the LICENSE file in the root directory of this source tree.
213
- */const Pf=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],$f=G("sparkles",Pf);/**
214
- * @license lucide-react v1.16.0 - ISC
215
- *
216
- * This source code is licensed under the ISC license.
217
- * See the LICENSE file in the root directory of this source tree.
218
- */const Of=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],_f=G("square",Of);/**
219
- * @license lucide-react v1.16.0 - ISC
220
- *
221
- * This source code is licensed under the ISC license.
222
- * See the LICENSE file in the root directory of this source tree.
223
- */const Ff=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Df=G("timer",Ff);/**
224
- * @license lucide-react v1.16.0 - ISC
225
- *
226
- * This source code is licensed under the ISC license.
227
- * See the LICENSE file in the root directory of this source tree.
228
- */const Vf=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Bf=G("triangle-alert",Vf);/**
229
- * @license lucide-react v1.16.0 - ISC
230
- *
231
- * This source code is licensed under the ISC license.
232
- * See the LICENSE file in the root directory of this source tree.
233
- */const zf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Rr=G("x",zf);/**
234
- * @license lucide-react v1.16.0 - ISC
235
- *
236
- * This source code is licensed under the ISC license.
237
- * See the LICENSE file in the root directory of this source tree.
238
- */const Hf=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Uf=G("zoom-out",Hf);/**
239
- * @license lucide-react v1.16.0 - ISC
240
- *
241
- * This source code is licensed under the ISC license.
242
- * See the LICENSE file in the root directory of this source tree.
243
- */const Kf=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Wf=G("zoom-in",Kf);function we({children:e,detail:t,tone:n="neutral",compact:s=!1,className:r=""}){const i=n==="loading"?Le:n==="error"?An:Ra;return l.jsxs("div",{role:n==="error"?"alert":"status",className:`ui-status ${n==="error"?"select-text":"select-none"} ${s?"ui-status--compact":""} ${r}`,"data-tone":n,children:[l.jsx(i,{size:s?16:20,className:`shrink-0 ${n==="loading"?"animate-spin":""}`,"aria-hidden":"true"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{children:e}),t&&l.jsx("div",{className:"ui-status-detail",children:t})]})]})}const La=f.createContext({});function xt(e){const t=f.useRef(null);return t.current===null&&(t.current=e()),t.current}const qf=typeof window<"u",Pt=qf?f.useLayoutEffect:f.useEffect,Xt=f.createContext(null);function Gf(e,t){e.indexOf(t)===-1&&e.push(t)}function Yf(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const ze=(e,t,n)=>n>t?t:n<e?e:n;let Xn=()=>{};const ke={},Mr=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Jf=e=>typeof e=="object"&&e!==null,Ar=e=>/^0[^.\s]+$/u.test(e);function Ia(e){let t;return()=>(t===void 0&&(t=e()),t)}const Zt=e=>e,Zn=(...e)=>e.reduce((t,n)=>s=>n(t(s))),Ln=(e,t,n)=>{const s=t-e;return s?(n-e)/s:1};class Vs{constructor(){this.subscriptions=[]}add(t){return Gf(this.subscriptions,t),()=>this.remove(t)}remove(t){Yf(this.subscriptions,t)}notify(t,n,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](t,n,s);else for(let i=0;i<r;i++){const o=this.subscriptions[i];o&&o(t,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Se=e=>e*1e3,he=e=>e/1e3,Pa=(e,t)=>t?e*(1e3/t):0,hs=(e,t,n)=>e*(3*(1-e)*((1-e)*t+e*n)+e*e);function Qt(e,t,n,s){return e===t&&n===s?Zt:r=>{let i=0,o=1,a=r;for(let c=0;;c++){a>=i&&a<=o||(a=(i+o)/2);const u=hs(a,e,n)-r;if(u*u<1e-28||c===40)break;u>0?o=a:i=a,a-=u*1e-7/(hs(a+1e-7,e,n)-r-u)}return hs(a,t,s)}}const $a=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Oa=e=>t=>1-e(1-t),_a=Qt(.33,1.53,.69,.99),Lr=Oa(_a),Fa=$a(Lr),Da=e=>e>=1?1:(e*=2)<1?.5*Lr(e):.5*(2-Math.pow(2,-10*(e-1))),Ir=e=>1-Math.sin(Math.acos(e)),Xf=Oa(Ir),Va=$a(Ir),Zf=Qt(.42,0,1,1),Qf=Qt(0,0,.58,1),Pr=Qt(.42,0,.58,1),eh=e=>Array.isArray(e)&&typeof e[0]!="number",$r=e=>Array.isArray(e)&&typeof e[0]=="number",th={linear:Zt,easeIn:Zf,easeInOut:Pr,easeOut:Qf,circIn:Ir,circInOut:Va,circOut:Xf,backIn:Lr,backInOut:Fa,backOut:_a,anticipate:Da},nh=e=>typeof e=="string",Ti=e=>{if($r(e)){Xn(e.length===4);const[t,n,s,r]=e;return Qt(t,n,s,r)}else if(nh(e))return th[e];return e},Ve={delta:0,timestamp:0,isProcessing:!1};let yn;function sh(){yn=void 0}const ee={now:()=>(yn===void 0&&ee.set(Ve.isProcessing||ke.useManualTiming?Ve.timestamp:performance.now()),yn),set:e=>{yn=e,queueMicrotask(sh)}},at=e=>Math.round(e*1e5)/1e5,Ba=e=>t=>typeof t=="string"&&t.startsWith(e),za=Ba("--"),rh=Ba("var(--"),Or=e=>rh(e)?ih.test(e.split("/*")[0].trim()):!1,ih=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ps(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const vt={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},$t={...vt,transform:e=>ze(0,1,e)},un={...vt,default:1},_r=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function oh(e){return e==null}const ah=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fr=(e,t)=>n=>!!(typeof n=="string"&&ah.test(n)&&n.startsWith(e)||t&&!oh(n)&&Object.prototype.hasOwnProperty.call(n,t)),Ha=(e,t,n)=>s=>{if(typeof s!="string")return s;const[r,i,o,a]=s.match(_r);return{[e]:parseFloat(r),[t]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},lh=e=>ze(0,255,e),ms={...vt,transform:e=>Math.round(lh(e))},Ue={test:Fr("rgb","red"),parse:Ha("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:s=1})=>"rgba("+ms.transform(e)+", "+ms.transform(t)+", "+ms.transform(n)+", "+at($t.transform(s))+")"};function ch(e){let t="",n="",s="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),s=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),s=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,s+=s,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Bs={test:Fr("#"),parse:ch,transform:Ue.transform},en=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ne=en("deg"),lt=en("%"),H=en("px"),uh=en("vh"),dh=en("vw"),Ni={...lt,parse:e=>lt.parse(e)/100,transform:e=>lt.transform(e*100)},tt={test:Fr("hsl","hue"),parse:Ha("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:s=1})=>"hsla("+Math.round(e)+", "+lt.transform(at(t))+", "+lt.transform(at(n))+", "+at($t.transform(s))+")"},ne={test:e=>Ue.test(e)||Bs.test(e)||tt.test(e),parse:e=>Ue.test(e)?Ue.parse(e):tt.test(e)?tt.parse(e):Bs.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ue.transform(e):tt.transform(e),getAnimatableNone:e=>{const t=ne.parse(e);return t.alpha=0,ne.transform(t)}},fh=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Ua=new RegExp(_r.source),Ka=new RegExp(fh.source,"i");function hh(e){return isNaN(e)&&typeof e=="string"&&(Ua.test(e)||Ka.test(e))}const Wa="number",qa="color",ph="var",mh="var(",Ri="${}",gh=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function yh(e){const t=e.toString();return Ua.test(t)||Ka.test(t)}function Ot(e){const t=e.toString(),n=[],s={color:[],number:[],var:[]},r=[];let i=0;const a=t.replace(gh,c=>(ne.test(c)?(s.color.push(i),r.push(qa),n.push(ne.parse(c))):c.startsWith(mh)?(s.var.push(i),r.push(ph),n.push(c)):(s.number.push(i),r.push(Wa),n.push(parseFloat(c))),++i,Ri)).split(Ri);return{values:n,split:a,indexes:s,types:r}}function xh(e){return Ot(e).values}function Ga({split:e,types:t}){const n=e.length;return s=>{let r="";for(let i=0;i<n;i++)if(r+=e[i],s[i]!==void 0){const o=t[i];o===Wa?r+=at(s[i]):o===qa?r+=ne.transform(s[i]):r+=s[i]}return r}}function vh(e){return Ga(Ot(e))}const bh=e=>typeof e=="number"?0:ne.test(e)?ne.getAnimatableNone(e):e,wh=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:bh(e);function Sh(e){const t=Ot(e);return Ga(t)(t.values.map((s,r)=>wh(s,t.split[r])))}const ge={test:hh,parse:xh,createTransformer:vh,getAnimatableNone:Sh};function gs(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ch({hue:e,saturation:t,lightness:n,alpha:s}){e/=360,t/=100,n/=100;let r=0,i=0,o=0;if(!t)r=i=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,c=2*n-a;r=gs(c,a,e+1/3),i=gs(c,a,e),o=gs(c,a,e-1/3)}return{red:Math.round(r*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:s}}function In(e,t){return n=>n>0?t:e}const et=(e,t,n)=>e+(t-e)*n,ys=(e,t,n)=>{const s=e*e,r=n*(t*t-s)+s;return r<0?0:Math.sqrt(r)},kh=[Bs,Ue,tt],jh=e=>kh.find(t=>t.test(e));function Mi(e){const t=jh(e);if(!t)return!1;let n=t.parse(e);return t===tt&&(n=Ch(n)),n}const Ai=(e,t)=>{const n=Mi(e),s=Mi(t);if(!n||!s)return In(e,t);const r={...n};return i=>(r.red=ys(n.red,s.red,i),r.green=ys(n.green,s.green,i),r.blue=ys(n.blue,s.blue,i),r.alpha=et(n.alpha,s.alpha,i),Ue.transform(r))},zs=new Set(["none","hidden"]);function Eh(e,t){return zs.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Th(e,t){return n=>et(e,t,n)}function Dr(e){return typeof e=="number"?Th:typeof e=="string"?Or(e)?In:ne.test(e)?Ai:Mh:Array.isArray(e)?Ya:typeof e=="object"?ne.test(e)?Ai:Nh:In}function Ya(e,t){const n=[...e],s=n.length,r=e.map((i,o)=>Dr(i)(i,t[o]));return i=>{for(let o=0;o<s;o++)n[o]=r[o](i);return n}}function Nh(e,t){const n={...e,...t},s={};for(const r in n)e[r]!==void 0&&t[r]!==void 0&&(s[r]=Dr(e[r])(e[r],t[r]));return r=>{for(const i in s)n[i]=s[i](r);return n}}function Rh(e,t){const n=[],s={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const i=t.types[r],o=e.indexes[i][s[i]],a=e.values[o]??0;n[r]=a,s[i]++}return n}const Mh=(e,t)=>{const n=ge.createTransformer(t),s=Ot(e),r=Ot(t);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?zs.has(e)&&!r.values.length||zs.has(t)&&!s.values.length?Eh(e,t):Zn(Ya(Rh(s,r),r.values),n):In(e,t)},Li=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function Ah(e,t){const n=Li.exec(e);if(!n)return;const s=Li.exec(t);if(!s||n[2]!==s[2])return;const r=n[2],i=parseFloat(n[1]),o=parseFloat(s[1]);return a=>at(et(i,o,a))+r}function Vr(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return et(e,t,n);if(typeof e=="string"&&typeof t=="string"){const r=Ah(e,t);if(r)return r}return Dr(e)(e,t)}const dn=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Lh(e){let t=new Set,n=new Set,s=!1,r=!1;const i=new Set;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){i.has(u)&&(n.add(u),e()),u(o)}const c={schedule:(u,d=!1,h=!1)=>{const m=h&&s?t:n;return d&&i.add(u),m.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,s){r=!0;return}s=!0;const d=t;t=n,n=d,t.forEach(a),t.clear(),s=!1,r&&(r=!1,c.process(u))}};return c}const Ih=40;function Ja(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let s=!1,r=!0;const i=()=>s=!0,o=dn.reduce((b,S)=>(b[S]=Lh(i),b),{}),{setup:a,read:c,resolveKeyframes:u,preUpdate:d,update:h,preRender:g,render:m,postRender:p}=o,x=()=>{const b=ke.useManualTiming,S=b?n.timestamp:performance.now();s=!1,b||(n.delta=r?1e3/60:Math.max(Math.min(S-n.timestamp,Ih),1)),n.timestamp=S,n.isProcessing=!0,a.process(n),c.process(n),u.process(n),d.process(n),h.process(n),g.process(n),m.process(n),p.process(n),n.isProcessing=!1,s&&t&&(r=!1,e(x))},y=()=>{s=!0,r=!0,n.isProcessing||e(x)};return{schedule:dn.reduce((b,S)=>{const w=o[S];return b[S]=(A,T=!1,C=!1)=>(s||y(),w.schedule(A,T,C)),b},{}),cancel:b=>{for(let S=0;S<dn.length;S++)o[dn[S]].cancel(b)},state:n,steps:o}}const{schedule:fe,cancel:Hs,steps:av}=Ja(typeof requestAnimationFrame<"u"?requestAnimationFrame:Zt,!0,Ve),Xa=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>fe.update(t,n),stop:()=>Hs(t),now:()=>Ve.isProcessing?Ve.timestamp:ee.now()}},Za=(e,t,n=10)=>{let s="";const r=Math.max(Math.round(t/n),2);for(let i=0;i<r;i++)s+=Math.round(e(i/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},Br=2e4;function zr(e,t=50,n=Br,s){let r=0,i=e.next(r);for(;!i.done&&r<n;)r+=t,i=e.next(r);return r>=n?1/0:r}function Ph(e,t=100,n){const{keyframes:s,velocity:r}=e,i=s&&s[s.length-1]-s[0],o=n({...e,velocity:r&&i?r*t/i:r,keyframes:[0,t]}),a=Math.min(zr(o),Br);return{type:"keyframes",ease:c=>o.next(a*c).value/t,duration:he(a)}}const re={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},Qa=e=>e<0?1/Math.max(1+e,re.minDamping):Math.max(1-e,re.minDamping);function el(e,t){if(!(e>1))return 1;const n=Math.sqrt(e*e-1),s=e-n,r=e+n,i=2*n*Math.exp(-t)*(1+t);return tl(o=>r*Math.exp(-s*o)-s*Math.exp(-r*o)-i,o=>Math.exp(-r*o)-Math.exp(-s*o),t)/t}function Us(e,t){return e*Math.sqrt(1-t*t)}const $h=12;function tl(e,t,n){let s=n;for(let r=1;r<$h;r++)s=s-e(s)/t(s);return s}const xs=.001;function Oh({duration:e=re.duration,bounce:t=re.bounce}){let n,s;const r=Qa(t);e=ze(re.minDuration,re.maxDuration,he(e)),r<1?(n=u=>{const d=u*r,h=d*e,g=Us(u,r),m=Math.exp(-h);return xs-d/g*m},s=u=>{const h=u*r*e,g=r*r*u*u*e,m=Math.exp(-h),p=Us(u*u,r);return(-n(u)+xs>0?-1:1)*-g*m/p}):(n=u=>{const d=Math.exp(-u*e),h=u*e+1;return-xs+d*h},s=u=>{const d=Math.exp(-u*e),h=-u*(e*e);return d*h});const i=5/e,o=tl(n,s,i),a=o*el(r,o*e),c=a*a;return{stiffness:c,damping:r*2*Math.sqrt(c),duration:Se(e)}}const Ks=(e,t)=>(t?e>=0:e>0)&&e<1/0;function vs(e,t){if(Ks(e,t))return e}function _h(e){const t=vs(e.stiffness),n=vs(e.damping,!0),s=vs(e.mass),r={...e,stiffness:t??re.stiffness,damping:n??re.damping,mass:s??re.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??s)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(r.isTimeDefined){if(e.visualDuration){const i=Qa(e.bounce||0),o=2*Math.PI/(e.visualDuration*1.2)*el(i,2*Math.PI/1.2);r.stiffness=o*o,r.damping=2*i*Math.sqrt(r.stiffness)}else Object.assign(r,Oh(r)),r.isResolvedFromDuration=!0;(!Ks(r.stiffness)||!Ks(r.damping,!0))&&(r.stiffness=re.stiffness,r.damping=re.damping)}return r}function Pn(e=re.visualDuration,t=re.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,s=n.keyframes[0],r=n.keyframes[n.keyframes.length-1],i={done:!1,value:s},{stiffness:o,damping:a,mass:c,duration:u,isResolvedFromDuration:d,isTimeDefined:h}=_h({...n}),g=T=>h?0:-he(T),m=a/(2*Math.sqrt(o*c)),p=he(Math.sqrt(o/c)),x=m*p,y={target:r,delta:r-s,velocity:g(n.velocity||0)||0,restSpeed:0,restDelta:0},v=()=>{const T=Math.abs(y.delta)<5;y.restSpeed=n.restSpeed||(T?re.restSpeed.granular:re.restSpeed.default),y.restDelta=n.restDelta||(T?re.restDelta.granular:re.restDelta.default)};v();let k,b,S;if(m<1){const T=Us(p,m),C={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};S=()=>{C.A=(y.velocity+x*y.delta)/T,C.sinC=x*C.A+y.delta*T,C.cosC=x*y.delta-C.A*T};const E=j=>{j!==C.t&&(C.t=j,C.env=Math.exp(-x*j),C.sin=Math.sin(T*j),C.cos=Math.cos(T*j))};k=j=>(E(j),y.target-C.env*(C.A*C.sin+y.delta*C.cos)),b=j=>(E(j),C.env*(C.sinC*C.sin+C.cosC*C.cos))}else if(m===1){k=C=>y.target-Math.exp(-p*C)*(y.delta+(y.velocity+p*y.delta)*C);const T={C:0};S=()=>{T.C=y.velocity+p*y.delta},b=C=>Math.exp(-p*C)*(p*T.C*C-y.velocity)}else{const T=p*Math.sqrt(m*m-1),C=x-T,E=x+T,j=h?1/0:300/T,O=(R,N)=>Math.exp(N>j?-R*j-x*(N-j):-R*N),$={S:0,F:0};S=()=>{const R=(y.velocity+x*y.delta)/T;$.S=(y.delta+R)/2,$.F=(y.delta-R)/2},k=R=>y.target-$.S*O(C,R)-$.F*O(E,R),b=R=>C*$.S*O(C,R)+E*$.F*O(E,R)}S();const w=d&&u||null,A={calculatedDuration:w,retarget:(T,C)=>{y.target=T[T.length-1],y.delta=y.target-T[0],y.velocity=g(C),n.restSpeed&&n.restDelta||v(),A.calculatedDuration=w,i.done=!1,S()},velocity:T=>Se(b(T)),next:T=>{const C=k(T);if(d)i.done=T>=u;else{const E=Se(b(T));i.done=Math.abs(E)<=y.restSpeed&&Math.abs(y.target-C)<=y.restDelta}return i.value=i.done?y.target:C,i},toString:()=>{const T=Math.min(zr(A),Br),C=Za(E=>A.next(T*E).value,T,30);return T+"ms "+C},toTransition:()=>{}};return A}Pn.applyToOptions=e=>{const t=Ph(e,100,Pn);return e.ease=t.ease,e.duration=Se(t.duration),e.type="keyframes",e};function $n({keyframes:e,velocity:t=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:c,restDelta:u=.5,restSpeed:d}){const h=e[0],g={done:!1,value:h},m=T=>T<a||T>c,p=T=>a===void 0?c:c===void 0||Math.abs(a-T)<Math.abs(c-T)?a:c;let x=n*t;const y=h+x,v=o===void 0?y:o(y);v!==y&&(x=v-h);const k=T=>-x*Math.exp(-T/s),b=T=>{const C=k(T);g.done=Math.abs(C)<=u,g.value=g.done?v:v+C};let S,w;const A=T=>{m(g.value)&&(S=T,w=Pn({keyframes:[g.value,p(g.value)],velocity:-k(T)/s*1e3,damping:r,stiffness:i,restDelta:u,restSpeed:d}))};return A(0),{calculatedDuration:null,next:T=>{let C=!1;return!w&&S===void 0&&(C=!0,b(T),A(T)),S!==void 0&&T>=S?w.next(T-S):(!C&&b(T),g)}}}function Fh(e,t,n){const s=[],r=n||ke.mix||Vr,i=e.length-1;for(let o=0;o<i;o++){let a=r(e[o],e[o+1]);if(t){const c=Array.isArray(t)?t[o]||Zt:t;a=Zn(c,a)}s.push(a)}return s}function Dh(e,t,{clamp:n=!0,ease:s,mixer:r}={}){const i=e.length;if(Xn(i===t.length),i===1)return()=>t[0];if(i===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Fh(t,s,r),c=a.length,u=d=>{if(o&&d<e[0])return t[0];let h=0;if(c>1)for(;h<e.length-2&&!(d<e[h+1]);h++);const g=Ln(e[h],e[h+1],d);return a[h](g)};return n?d=>u(ze(e[0],e[i-1],d)):u}function Vh(e,t){const n=e[e.length-1];for(let s=1;s<=t;s++){const r=Ln(0,t,s);e.push(et(n,1,r))}}function nl(e){const t=[0];return Vh(t,e.length-1),t}function Bh(e,t){return e.map(n=>n*t)}function zh(e,t){return e.map(()=>t||Pr).splice(0,e.length-1)}function _e({duration:e=300,keyframes:t,times:n,ease:s="easeInOut"}){const r=eh(s)?s.map(Ti):Ti(s)||Pr,i={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(r)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){const[c,u]=t,d=c===u?void 0:(ke.mix||Vr)(c,u);return{calculatedDuration:e,next:h=>(i.value=d?d(r(e>0?ze(0,1,h/e):1)):u,i.done=h>=e,i)}}const o=Bh(n&&n.length===t.length?n:nl(t),e),a=Dh(o,t,{ease:Array.isArray(r)?r:zh(t,r)});return{calculatedDuration:e,next:c=>(i.value=a(c),i.done=c>=e,i)}}const Hh=5;function Uh(e,t,n){const s=Math.max(t-Hh,0);return Pa(n-e(s),t-s)}function Kh(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):Uh(s=>e.next(s).value,t,e.next(t).value)}const Wh=e=>e!==null;function _t(e,{repeat:t,repeatType:n="loop"},s,r=1){const i=e.filter(Wh),a=r<0||t&&n!=="loop"&&t%2===1?0:i.length-1;return!a||s===void 0?i[a]:s}const qh={decay:$n,inertia:$n,tween:_e,keyframes:_e,spring:Pn};function sl(e){typeof e.type=="string"&&(e.type=qh[e.type])}const Gh=40,rl=(e,t)=>t-e>Gh&&!ke.useManualTiming?t:e;function il(e,t){return{kind:e,animation:t,timestamp:ee.now(),frameTimestamp:Ve.timestamp,frameIsProcessing:Ve.isProcessing}}function ol(e,t,n){const s=globalThis.__MOTION_INSPECT__;if(s)try{s({...il("animation-start",e),options:n?{...t,...n}:t})}catch{}}function lv(e,t){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...il("layout-animation-start",e),node:t})}catch{}}class Hr{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(t=>{this._resolve=t})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){var t;this.isResolved=!0,(t=this._resolve)==null||t.call(this)}then(t,n){return this.finished.then(t,n)}}const Yh=e=>e/100,Ws=e=>Math.round(e*1e4)/1e4;class Ft extends Hr{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var s,r;const{motionValue:n}=this.options;n&&n.updatedAt!==ee.now()&&this.tick(ee.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause(),ol(this,this.options)}initAnimation(){const{options:t}=this;sl(t);const{type:n=_e,repeat:s=0,repeatDelay:r=0,repeatType:i,velocity:o=0}=t;let{keyframes:a}=t;const c=n||_e;c!==_e&&typeof a[0]!="number"&&(this.mixKeyframes=Zn(Yh,Vr(a[0],a[1])),a=[0,100]);const u=c(a===t.keyframes?t:{...t,keyframes:a});i==="mirror"&&(this.mirroredGenerator=c({...t,keyframes:[...a].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=zr(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:s,totalDuration:r,calculatedDuration:i}=this;if(this.startTime===null)return s.next(0);const{delay:o=0,keyframes:a,type:c,onUpdate:u,finalKeyframe:d}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=rl(this.startTime,t)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-r/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const h=this.currentTime-o*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?h<0:h>r;this.currentTime=Math.max(h,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);const m=this.generate(this.currentTime,g);let{done:p}=m;!g&&i!==null&&(p=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const x=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&p);return x&&c!==$n&&(m.value=_t(a,this.options,d,this.speed)),u&&u(m.value),x&&this.finish(),m}at(t){return this.holdTime??Ws((t-this.startTime)*this.playbackSpeed)}sampleAt(t,n){const{options:s,totalDuration:r}=this,i=this.at(t)-(s.delay||0);return i>=r&&s.type!==$n?_t(s.keyframes,s,n?void 0:s.finalKeyframe):this.generate(Math.max(i,0),i<0).value}generate(t,n){const{generator:s,totalDuration:r,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a}=this,{keyframes:c,repeat:u,repeatType:d,repeatDelay:h}=this.options;let g=t,m=s;if(u){const x=Math.min(t,r)/a;let y=Math.floor(x),v=x%1;!v&&x>=1&&(v=1),v===1&&y--,y=Math.min(y,u+1),!!(y%2)&&(d==="reverse"?(v=1-v,h&&(v-=h/a)):d==="mirror"&&(m=o)),g=ze(0,1,v)*a}let p;return n?(this.delayState.value=c[0],p=this.delayState):p=m.next(g),i&&!n&&(p.value=i(p.value)),p}then(t,n){return this.finished.then(t,n)}get duration(){return he(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+he(t)}get time(){return he(this.currentTime)}set time(t){t=Se(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){return Kh(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(ee.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=he(this.currentTime))}play(){var r,i;if(this.isStopped)return;const{driver:t=Xa,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(i=(r=this.options).onPlay)==null||i.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime/(this.playbackSpeed||1):this.startTime||(this.startTime=n??(this.pendingStartTime=s)),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ee.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}const Jh=new Set(["brightness","contrast","saturate","opacity"]);function Xh(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[s]=n.match(_r)||[];if(!s)return e;const r=n.replace(s,"");let i=Jh.has(t)?1:0;return s!==n&&(i*=100),t+"("+i+r+")"}const Zh=/\b([a-z-]*)\(.*?\)/gu,qs={...ge,getAnimatableNone:e=>{const t=e.match(Zh);return t?t.map(Xh).join(" "):e}},Gs={...ge,getAnimatableNone:e=>{const t=ge.parse(e);return ge.createTransformer(e)(t.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},Ii={...vt,transform:Math.round},Qh={rotate:Ne,pathRotation:Ne,rotateX:Ne,rotateY:Ne,rotateZ:Ne,scale:un,scaleX:un,scaleY:un,scaleZ:un,skew:Ne,skewX:Ne,skewY:Ne,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:$t,originX:Ni,originY:Ni,originZ:H},Dt={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,...Qh,zIndex:Ii,fillOpacity:$t,strokeOpacity:$t,numOctaves:Ii},ep={...Dt,color:ne,backgroundColor:ne,outlineColor:ne,fill:ne,stroke:ne,borderColor:ne,borderTopColor:ne,borderRightColor:ne,borderBottomColor:ne,borderLeftColor:ne,filter:qs,WebkitFilter:qs,mask:Gs,WebkitMask:Gs},al=e=>ep[e],tp=new Set([qs,Gs]);function Ur(e,t){let n=al(e);return tp.has(n)||(n=ge),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function np(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Ke=e=>e*180/Math.PI,Ys=e=>{const t=Ke(Math.atan2(e[1],e[0]));return Js(t)},sp={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ys,rotateZ:Ys,skewX:e=>Ke(Math.atan(e[1])),skewY:e=>Ke(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Js=e=>(e=e%360,e<0&&(e+=360),e),Pi=Ys,$i=e=>Math.hypot(e[0],e[1]),Oi=e=>Math.hypot(e[4],e[5]),rp={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:$i,scaleY:Oi,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>($i(e)+Oi(e))/2,rotateX:e=>Js(Ke(Math.atan2(e[6],e[5]))),rotateY:e=>Js(Ke(Math.atan2(-e[2],e[0]))),rotateZ:Pi,rotate:Pi,skewX:e=>Ke(Math.atan(e[4])),skewY:e=>Ke(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Vt(e){return e.includes("scale")?1:0}function Xs(e,t){if(!e||e==="none")return Vt(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(n)s=rp,r=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=sp,r=a}if(!r)return Vt(t);const i=s[t],o=r[1].split(",").map(op);return typeof i=="function"?i(o):o[i]}const ip=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Xs(n,t)};function op(e){return parseFloat(e.trim())}const Ie=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Fe=new Set([...Ie,"pathRotation"]),_i=e=>e===vt||e===H,ap=new Set(["x","y","z"]),lp=Ie.filter(e=>!ap.has(e));function cp(e){const t=[];return lp.forEach(n=>{const s=e.getValue(n);if(s!==void 0){const r=s.get(),i=n.startsWith("scale")?1:0;if(r===i)return;t.push([n,r]),s.set(i)}}),t}const up=new Set(["bottom","right"]);function Fi(e,t,n,s,r,i){const o=parseFloat(e);if(!isNaN(o))return o;const{min:a,max:c}=t()[n],u=c-a;return i==="border-box"?u:u-parseFloat(s)-parseFloat(r)}const We={width:({width:e,paddingLeft:t="0",paddingRight:n="0",boxSizing:s},r)=>Fi(e,r,"x",t,n,s),height:({height:e,paddingTop:t="0",paddingBottom:n="0",boxSizing:s},r)=>Fi(e,r,"y",t,n,s),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{const{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>Xs(e,"x"),y:({transform:e})=>Xs(e,"y")};We.translateX=We.x;We.translateY=We.y;const qe=new Set;let Zs=!1,Qs=!1,er=!1;function ll(){if(Qs){const e=[],t=new Set,n=new Set;qe.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),up.has(r.name)&&n.add(r.element))});const s=new Map;n.forEach(r=>{const i=cp(r);i.length&&(s.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=s.get(r);i&&i.forEach(([o,a])=>{var c;(c=r.getValue(o))==null||c.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Qs=!1,Zs=!1,qe.forEach(e=>e.complete(er)),qe.clear()}function cl(){qe.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Qs=!0)})}function dp(){er=!0,cl(),ll(),er=!1}function fp(e,t,n){if(typeof e=="string"){if(Mr(e)||Ar(e))return parseFloat(e);if(!ge.test(e)&&ge.test(n))return Ur(t,n)}return e??void 0}class Kr{constructor(t,n,s,r,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=s,this.motionValue=r,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(qe.add(this),Zs||(Zs=!0,fe.read(cl),fe.resolveKeyframes(ll))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:s,motionValue:r}=this;if(t[0]===null){const i=r==null?void 0:r.get(),o=t[t.length-1];if(i!==void 0)t[0]=i;else if(s&&n){const a=fp(s.readValue(n,o),n,o);a!==void 0&&(t[0]=a)}t[0]===void 0&&(t[0]=o),r&&i===void 0&&r.set(t[0])}np(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),qe.delete(this)}cancel(){this.state==="scheduled"&&(qe.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const hp=e=>e.startsWith("--");function ul(e,t,n){hp(t)?e.style.setProperty(t,n):e.style[t]=n}const pp={};function dl(e,t){const n=Ia(e);return()=>pp[t]??n()}const mp=dl(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Wr=dl(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),nt=([e,t,n,s])=>`cubic-bezier(${e}, ${t}, ${n}, ${s})`,tr={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nt([0,.65,.55,1]),circOut:nt([.55,0,1,.45]),backIn:nt([.31,.01,.66,-.59]),backOut:nt([.33,1.53,.69,.99])};function fl(e,t){if(e)return typeof e=="function"?Wr()?Za(e,t):"ease-out":$r(e)?nt(e):Array.isArray(e)?e.map(n=>fl(n,t)||tr.easeOut):tr[e]}function gp(e,t,n,{delay:s=0,duration:r=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:c}={},u=void 0){const d={[t]:n};c&&(d.offset=c);const h=fl(a,r);Array.isArray(h)&&(d.easing=h);const g={delay:s,duration:r,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(g.pseudoElement=u),e.animate(d,g)}function hl(e){return typeof e=="function"&&"applyToOptions"in e}function yp({type:e,...t}){return hl(e)&&Wr()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class pl extends Hr{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:s,keyframes:r,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:c}=t;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=t,Xn(typeof t.type!="string");const u=yp(t);this.animation=gp(n,s,r,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=_t(r,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(d),ul(n,s,d),this.animation.cancel()}c==null||c(),this.notifyFinished()},ol(this,t,u)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,s,r;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((r=(s=this.animation).commitStyles)==null||r.call(s))}get duration(){var n,s;const t=((s=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:s.call(n).duration)||0;return he(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+he(t)}get time(){return he(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Se(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,onAttach:n,observe:s}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&mp()?(this.animation.timeline=t,n==null||n(this.animation),Zt):s(this)}}const ml={anticipate:Da,backInOut:Fa,circInOut:Va};function xp(e){return e in ml}function vp(e){typeof e.ease=="string"&&xp(e.ease)&&(e.ease=ml[e.ease])}const On=10;class bp extends pl{constructor(t){vp(t),sl(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}elapsed(){return this.state==="running"?(ee.now()-this.startTime)*this.speed:this.time*1e3}sample(t){if(!this.sampler){const{motionValue:n,onUpdate:s,onComplete:r,onPlay:i,onStop:o,element:a,...c}=this.options;this.sampler=new Ft({...c,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,t)).value}liveValue(){const{state:t}=this;if(t==="running"||t==="paused")return this.sample(this.elapsed())}updateMotionValue(t){const{motionValue:n,element:s,name:r}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const{speed:i}=this,o=this.elapsed(),a=this.state==="running"&&i?ze(0,On,o):0,c=this.sample(o);s&&r&&ul(s,r,c),n.setWithVelocity(this.sample(o-a*Math.sign(i)),c,a/Math.abs(i||1))}}const Di=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(ge.test(e)||e==="0")&&!e.startsWith("url("));function wp(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Sp(e,t,n,s){const r=e[0];if(r===null)return!1;if(t==="display"||t==="visibility")return!0;const i=e[e.length-1],o=Di(r,t),a=Di(i,t);return!o||!a?!1:wp(e)||(n==="spring"||hl(n))&&s}function nr(e){e.duration=0,e.type="keyframes"}const sr=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Cp=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function kp(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&Cp.test(e[t]))return!0;return!1}const Vi=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),gl=Ia(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function jp(e){var h;const{motionValue:t,name:n,repeatDelay:s,repeatType:r,damping:i,type:o,keyframes:a}=e;if(!n||!(sr.has(n)||Vi.has(n)))return!1;const c=(h=t==null?void 0:t.owner)==null?void 0:h.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;const{onUpdate:u,transformTemplate:d}=t.owner.getProps();return gl()&&(sr.has(n)||Vi.has(n)&&kp(a))&&(n!=="transform"||!d)&&!u&&!s&&r!=="mirror"&&i!==0&&o!=="inertia"}const _n=(e,t)=>t&&typeof e=="number"?t.transform(e):e,yl={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ep=Ie.length;function xl(e,t,n){let s="",r=!0;for(let o=0;o<Ep;o++){const a=Ie[o],c=e[a];if(c===void 0)continue;let u=!0;if(typeof c=="number")u=c===(a.startsWith("scale")?1:0);else{const d=parseFloat(c);u=a.startsWith("scale")?d===1:d===0}if(!u||n){const d=_n(c,Dt[a]);if(!u){r=!1;const h=yl[a]||a;s+=`${h}(${d}) `}n&&(t[a]=d)}}const i=e.pathRotation;return i&&(r=!1,s+=`rotate(${_n(i,Dt.pathRotation)}) `),s=s.trim(),n?s=n(t,r?"":s):r&&(s="none"),s}const Bt=new WeakMap,Tp=200,fn=.001,Np=.1,Rp=.001,Mp=100,Ap=e=>/^(linear|ease(In|Out|InOut))$/.test(e),bs=(e,t)=>e-t,Bi=(e,t,n)=>{const s=[];for(let r=0;r<=n;r++)s.push(et(e,t,r/n));return s},xn=e=>e.motionValue.owner,vn=e=>Bt.get(e),st=(e,t)=>{var n;return e.latestValues?e.latestValues[t]:(n=e.getValue(t))==null?void 0:n.get()},Lp=({name:e,motionValue:t})=>{var n;return e&&Ie.includes(e)&&((n=t==null?void 0:t.owner)==null?void 0:n.current)instanceof HTMLElement&&gl()&&Wr()};function Ip(e){var r;const t=xn(e),{onUpdate:n,transformTemplate:s}=t.getProps();return!e.isHandoff&&!n&&!e.hasOnUpdate&&!s&&e.type!=="inertia"&&(st(t,"transform")||"none")==="none"&&!st(t,"pathRotation")&&!((r=t.projection)!=null&&r.isProjecting())}class Pp extends Ft{constructor(t){const n=xn(t).current,{driver:s=Xa}=t;let r;const i=Ip(t);t.driver=a=>{const c=s(a);return{js:c,now:c.now,start:(u=!0)=>{const d=vn(n);!d||d.isJS?c.start(u):d.schedule(!1,!u)},stop:()=>{c.stop();const u=vn(n);u&&!u.isFinishing&&u.release(r)}}},super(t),r=this,this.canAccelerate=i;const{stop:o}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),o()}}get group(){return vn(xn(this.options).current)}get js(){var t;return(t=this.driver)==null?void 0:t.js}get name(){return this.options.name}timing(){const{startTime:t,speed:n,totalDuration:s}=this,{delay:r=0,repeatType:i}=this.options;return this.holdTime!==null?[1/0,0]:s===1/0?[t+r/n,this.resolvedDuration*(i==="loop"?1:2)/n||1]:[t+(r+s)/n,0]}isAccelerated(){const{group:t,state:n}=this;return(t==null?void 0:t.tracks.has(this))&&!t.isJS&&this.canAccelerate&&(n==="running"||n==="paused")}liveValue(){return this.isAccelerated()?this.sampleAt(ee.now()):void 0}tween(){const{keyframes:t,type:n,ease:s,times:r,repeat:i,delay:o=0}=this.options,a=$r(s)?nt(s):Ap(s)&&tr[s];if(a&&!i&&!r&&t.length===2&&n===_e&&this.holdTime===null){const c=this.startTime+o/this.speed;return[c,c+this.resolvedDuration/this.speed,a]}}boundaries(t,n){const{startTime:s,speed:r,resolvedDuration:i,options:o}=this,{delay:a=0,repeat:c=0,repeatDelay:u=0,repeatType:d,times:h,keyframes:g,type:m}=o,p=(m||_e)===_e?h||nl(g):[0,1],x=s+a/r,y=[];if(this.holdTime!==null||!(i>0))return y;for(let v=Math.max(0,Math.floor((t-x)*r/i));v<=c;v++){const k=x+v*i/r;if(k>n)break;for(const b of p){const S=k+(v%2&&d&&d!=="loop"?1-b:b)*(i-u)/r;S>t&&S<n&&y.push(S)}}return y}numberAt(t){return parseFloat(this.sampleAt(t,!0))}sync(){const t=ee.now();this.options.motionValue.setWithVelocity(this.sampleAt(t-On,!0),this.sampleAt(t,!0),On)}play(){this.isStopped||((this.group||$p(xn(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&(this.sync(),this.group.schedule(!1))}complete(){super.complete();const{group:t}=this;t&&!t.isJS&&this.canAccelerate&&this.tick(ee.now())}get time(){return this.isAccelerated()?he(ze(0,this.totalDuration,this.at(ee.now())-(this.options.delay||0))):super.time}set time(t){super.time=t,this.isAccelerated()&&this.sync()}attachTimeline(t){var n;return this.canAccelerate=!1,(n=this.group)==null||n.demote(!0),super.attachTimeline(t)}}function $p(e){const t=e.current,n=new Set,s=new Map;let r={},i=[],o=new Map,a=[],c=!1,u=!1,d=!1,h=!1,g=-1/0;const m=R=>{for(const N of n)if(N.name===R)return!0},p=(R,N)=>{const P={};for(const I of R===void 0?Ie:i){const _=s.get(I),F=R===void 0?st(e,I):_?_.sampleAt(N>R&&!_.timing()[1]?N:R):r[I];F!==void 0&&(P[I]=F)}return P},x=(R,N)=>{let P="";const I=p(R,N);for(const _ in I)P+=(yl[_]||_)+"("+_n(I[_],Dt[_])+") ";return P||"none"},y=(R=p())=>{t.style.transform=xl(R,{})},v=(R=!0)=>{R&&y(),a.forEach(({animation:N})=>N.cancel()),a=[]},k=(R,N,P=1/0)=>{const I={animation:R,offset:N,end:P};R.startTime=ee.now()+N,P<1/0&&(R.onfinish=()=>{I.isDone=!0,a.some(_=>_.end===1/0)&&(R.cancel(),a=a.filter(_=>_!==I)),$.schedule(!1)}),R.oncancel=()=>a.includes(I)&&$.demote(),a.push(I)},b=(R,N,P)=>{const I=(F,U)=>Math.abs(R(U)-R(F)),_=I(N,P);for(;P-N>.01;){const F=(N+P)/2;I(N,F)>I(F,P)?P=F:N=F}return I(N,P)>_/2?[N,P]:[]},S=(R,N,P,I)=>{const _=Math.min(Tp,Math.max(2,Math.ceil((P-N)/On)));if(I.length*4>_)return;const F=Bi(N,P,_).concat(I).sort(bs),U=V=>Ln(N,P,V);let L,M;for(const V of R){const K=F.map(te=>V.numberAt(te)),[z]=K,X=K.map(te=>te-z),oe=X[X.length-1],J=X.some(te=>Math.abs(te)*fn>Math.abs(oe))?0:oe,de=X.map(te=>J?te/J:te);if(J){if(!L)L=de,M=te=>(V.numberAt(te)-z)/J;else if(de.some((te,os)=>!(Math.abs(te-L[os])<=fn)))return}else if(de.some(te=>!(Math.abs(te)<=fn)))return}if(!L||L.every((V,K)=>Math.abs(V-U(F[K]))<=fn))return"linear";const D=[],B=(V,K=M(V))=>D.push(Ws(K)+" "+Ws(U(V)*100)+"%");return L.forEach((V,K)=>{K&&Math.abs(V-L[K-1])>.2&&b(M,F[K-1],F[K]).forEach(z=>B(z)),B(F[K],V)}),"linear("+D+")"},w=(R,N,P,I)=>{const _=[N],F=(D,B)=>R.every(V=>!(Math.abs(V.numberAt((D+B)/2)-(V.numberAt(D)+V.numberAt(B))/2)>(V.name.startsWith("scale")?Rp:Np))),U=(D,B,V)=>{if(B-D<1||F(D,B))_.push(B);else if(V<4)U(D,(D+B)/2,V+1),U((D+B)/2,B,V+1);else{for(const K of R)_.push(...b(z=>K.numberAt(z),D,B));_.push(B)}},L=Bi(N,P,Math.ceil((P-N)/100));for(const D of I)L.push(D,Math.min(D+.01,P));let M=N;for(const D of L.sort(bs))D>M&&U(M,D,0),M=D;return _.sort(bs)},A=R=>{let N;for(const P of R){const I=P.tween();if(!I||N!=null&&N.some((_,F)=>F<2?Math.abs(I[F]-_)>1:I[F]!==_))return;N=I}return N},T=(R,N,P,I={fill:"both"},_,F)=>{const U=R.flatMap(V=>V.boundaries(N,P)),L=F||S(R,N,P,U),M=L?[N,P]:w(R,N,P,U),D=M.map(V=>x(V,_));let B={transform:D};return L||(B.offset=M.map(V=>Ln(N,P,V))),D.every(V=>V===D[0])&&(y(p(N,_)),B=null),t.animate(B,{...I,duration:P-N,easing:L||"linear"})},C=R=>{let N=R,P=0,I=0;const _=[],F=[],U=new Set;s.clear(),o=new Map;for(const M of n){s.set(M.name,M);const[D,B]=M.timing(),V=D===1/0;if(o.set(M,[M.at(R),M.speed,V]),V){M.sync();continue}if(M.speed<0)return;if(B){if(P){const K=(D-I)/B;if(Math.abs(B-P)>1||Math.abs(K-Math.round(K))*P>1)return}else P=B,I=D;F.push(M)}else U.add(D);_.push(M),N=Math.max(N,D)}r={},i=Ie.filter(M=>{if(s.has(M))return!0;const D=r[M]=st(e,M);return D!==void 0&&parseFloat(D)!==(M.startsWith("scale")?1:0)}),v(!1);const L=!P&&A(_);try{if(L&&L[1]>R){const[M,D,B]=L;k(T(_,M,D,void 0,void 0,B),M-R,D-M)}else N>R&&(k(T(_,R,N),0,N-R),U.forEach(M=>M<N-1&&k(t.animate(null,{duration:M-R}),0,M-R)));if(P){const M=I+Math.floor((N-I)/P)*P;k(T(F,M,M+P,{iterations:1/0,iterationStart:(N-M)/P,fill:"forwards"},N),N-R)}}catch{return}return a.length||v(),!0},E=R=>{let N,P=0;for(const I of n){const _=o.get(I);if(!_)return!1;const[F,U,L]=_,M=I.at(R),D=I.timing()[0]===1/0;if(L){if(D&&M===F)continue;return!1}const B=(M-F)/U,V=D?0:I.speed/U;if(N===void 0)N=B,P=V;else if(Math.abs(B-N)>1||V!==P)return!1}if(N===void 0)return!0;if(!a.length)return!1;for(const{offset:I,end:_,isDone:F}of a){const U=N-I;if(_<1/0&&(F?U<_-1:U<0||U>=_))return!1}for(const{animation:I,offset:_,isDone:F}of a){if(F)continue;const U=N-_;P?(I.playbackRate=P,I.startTime=R-U/P):(I.pause(),I.currentTime=U)}return!0},j=()=>n.size?!1:(d=!0,vn(t)===$&&Bt.delete(t),$.isJS||v(),!0),O=()=>{const R=ee.now();if($.isJS||($.isFinishing=!0,n.forEach(I=>{const[_,F]=I.timing();I.state==="running"&&I.speed>0&&!F&&_<=R+1&&(I.complete(),r[I.name]=st(e,I.name),o.has(I)||(c=!0))}),$.isFinishing=!1),u=!1,d||(n.forEach(({state:I},_)=>{(I==="idle"||I==="finished")&&n.delete(_)}),j()))return;for(const I of n)if(!I.canAccelerate)return $.demote(!0);$.isJS&&($.isJS=!1,c=!0,n.forEach(I=>{var _;return(_=I.js)==null?void 0:_.stop()}));const N=c,P=h;if(c=h=!1,N||!E(R)){if(P){if(R-g<Mp)return $.demote();g=R}if(!C(R))return $.demote()}},$={tracks:n,isJS:!1,isFinishing:!1,schedule(R,N){d||(c||(c=R),h||(h=!!N),u||(u=!0,Ve.isProcessing?fe.render(O,!1,!0):queueMicrotask(O)))},release(R){const{state:N}=R;(N==="idle"||N==="finished")&&n.delete(R),j()||$.schedule(!0)},check(){if(!$.isJS){for(const R in r)if(st(e,R)!==r[R]&&!m(R))return $.schedule(!0,!0)}},demote(R){$.isJS||d||(n.forEach(N=>{N.isAccelerated()&&N.sync(),R||(N.canAccelerate=!1)}),$.isJS=!0,o=new Map,v(),n.forEach(N=>{var P;return N.state==="running"&&((P=N.js)==null?void 0:P.start())}))}};return Bt.set(t,$),$}class Op extends Hr{constructor(t){var c;super(),this.stop=()=>{var u,d;this._animation&&(this._animation.stop(),(u=this.stopTimeline)==null||u.call(this)),(d=this.keyframeResolver)==null||d.cancel()},this.createdAt=ee.now();const{keyframes:n,name:s,motionValue:r,element:i}=t,o=t;o.autoplay??(o.autoplay=!0),o.delay??(o.delay=0),o.type??(o.type="keyframes"),o.repeat??(o.repeat=0),o.repeatDelay??(o.repeatDelay=0),o.repeatType??(o.repeatType="loop");const a=(i==null?void 0:i.KeyframeResolver)||Kr;this.keyframeResolver=new a(n,(u,d,h)=>this.onKeyframesResolved(u,d,o,!h),s,r,i),(c=this.keyframeResolver)==null||c.scheduleResolve()}onKeyframesResolved(t,n,s,r){var y,v;this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:c,isHandoff:u,onUpdate:d}=s;this.resolvedAt=ee.now();let h=!0;Sp(t,i,o,a)||(h=!1,(ke.instantAnimations||!c)&&(d==null||d(_t(t,s,n))),t[0]=t[t.length-1],nr(s),s.repeat=0);const{onComplete:g}=s;s.finalKeyframe=n,s.keyframes=t,s.onComplete=()=>{g==null||g(),this.notifyFinished()};const m=h&&!u&&jp(s),p=!m&&Lp(s);r&&(m||p||this.resolvedAt!==this.createdAt)&&(s.startTime??(s.startTime=rl(this.createdAt,this.resolvedAt)));let x;if(m){s.element=(v=(y=s.motionValue)==null?void 0:y.owner)==null?void 0:v.current;try{x=new bp(s)}catch{x=new Ft(s)}}else p?x=new Pp(s):x=new Ft(s);this.pendingTimeline&&(this.stopTimeline=x.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=x}get finished(){return this._animation?this._animation.finished:super.finished}then(t,n){return this.finished.finally(t).then(()=>{})}liveValue(){var t,n;return(n=(t=this._animation)==null?void 0:t.liveValue)==null?void 0:n.call(t)}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),dp()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function vl(e,t,n,s=0,r=1){const i=Array.from(e).sort((u,d)=>u.sortNodePosition(d)).indexOf(t),o=e.size,a=(o-1)*s;return typeof n=="function"?n(i,o):r===1?i*s:a-i*s}const zi=30,_p=e=>!isNaN(parseFloat(e));class Fp{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const r=ee.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=ee.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=_p(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){var s;return t==="change"?this.onChangeSubscribe(n):((s=this.events)[t]||(s[t]=new Vs)).add(n)}onChangeSubscribe(t){const{events:n}=this;return!n.change&&!this.changeSubscriber?this.changeSubscriber=t:(n.change||(n.change=new Vs,n.change.add(this.changeSubscriber),this.changeSubscriber=void 0),n.change.add(t)),()=>{var s;this.changeSubscriber===t?this.changeSubscriber=void 0:(s=n.change)==null||s.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){fe.read(()=>{var t;!this.changeSubscriber&&!((t=this.events.change)!=null&&t.getSize())&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){var s;const{current:t,changeSubscriber:n}=this;n?n(t):(s=this.events.change)==null||s.notify(t)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){var n,s;const t=(s=(n=this.animation)==null?void 0:n.liveValue)==null?void 0:s.call(n);return t===void 0?this.current:t}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=ee.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>zi)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,zi);return Pa(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{var i;this.hasAnimated=!0;let s=!1,r;r=t(()=>{var o;s=!0,(o=this.events.animationComplete)==null||o.notify(),this.animation===r&&this.clearAnimation(),n()}),s||(this.animation=r),(i=this.events.animationStart)==null||i.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function zt(e,t){return new Fp(e,t)}function qr(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...s}=e;return{...t,...s}}return e}function bl(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?qr(n,e):n}const Dp={type:"spring",stiffness:500,damping:25,restSpeed:10},Vp=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Bp={type:"keyframes",duration:.8},zp={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Hp=(e,{keyframes:t})=>t.length>2?Bp:Fe.has(e)?e.startsWith("scale")?Vp(t[1]):Dp:zp,Up=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function Kp(e){for(const t in e)if(!Up.has(t))return!0;return!1}const Wp=(e,t,n,s={},r,i)=>o=>{const a=bl(s,e)||{},c=a.delay||s.delay||0;let{elapsed:u=0}=s;u=u-Se(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-u,onUpdate:g=>{t.set(g),a.onUpdate&&a.onUpdate(g)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:i?void 0:r,hasOnUpdate:!!a.onUpdate};Kp(a)||Object.assign(d,Hp(e,d)),d.duration&&(d.duration=Se(d.duration)),d.repeatDelay&&(d.repeatDelay=Se(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(nr(d),d.delay===0&&(h=!0)),(ke.instantAnimations||ke.skipAnimations||r!=null&&r.shouldSkipAnimations||a.skipAnimations)&&(h=!0,nr(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,h&&!i&&t.get()!==void 0){const g=_t(d.keyframes,a);if(g!==void 0){fe.update(()=>{d.onUpdate(g),d.onComplete()});return}}return a.isSync?new Ft(d):new Op(d)},qp=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Gp(e){const t=qp.exec(e);if(!t)return[,];const[,n,s,r]=t;return[`--${n??s}`,r]}function wl(e,t,n=1){const[s,r]=Gp(e);if(!s)return;const i=window.getComputedStyle(t).getPropertyValue(s);if(i){const o=i.trim();return Mr(o)?parseFloat(o):o}return Or(r)?wl(r,t,n+1):r}function Yp(e){const t=[{},{}];return e==null||e.values.forEach((n,s)=>{t[0][s]=n.get(),t[1][s]=n.getVelocity()}),t}function Sl(e,t,n,s){const r=i=>typeof i=="function"?i(n!==void 0?n:e.custom,...Yp(s)):i;return t=r(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),r(t)}function Ge(e,t,n){return Sl(e.getProps(),t,n,e)}const Cl=(e,t)=>{var n;return t==="exit"?(n=e.presenceContext)==null?void 0:n.custom:void 0},kl=new Set(["width","height","top","left","right","bottom",...Ie]),Jp=e=>Array.isArray(e);function Xp(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,zt(n))}function Zp(e){return Jp(e)?e[e.length-1]||0:e}function Qp(e,t){const n=Ge(e,t);let{transitionEnd:s={},transition:r={},...i}=n||{};i={...i,...s};for(const o in i){const a=Zp(i[o]);Xp(e,o,a)}}const ae=e=>!!(e&&e.getVelocity);function em(e){return!!(ae(e)&&e.add)}function tm(e,t){const n=e.getValue("willChange");if(em(n))return n.add(t);if(!n&&ke.WillChange){const s=new ke.WillChange("auto");e.addValue("willChange",s),s.add(t)}}function Gr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const nm="framerAppearId",jl="data-"+Gr(nm);function sm(e){return e.props[jl]}const rm=typeof window<"u";function im({protectedKeys:e,needsAnimating:t},n){const s=n in e&&!t[n];return t[n]=!1,s}function El(e,t,{delay:n=0,transitionOverride:s,type:r}={}){var p,x;let{transition:i,transitionEnd:o,...a}=t;const c=e.getDefaultTransition();i=i?qr(i,c):c;const u=i==null?void 0:i.reduceMotion,d=i==null?void 0:i.skipAnimations;s&&(i=s);const h=[],g=r&&((p=e.animationState)==null?void 0:p.getState()[r]),m=i==null?void 0:i.path;m&&(m.animateValues?m.animateValues(y=>e.getValue(y,e.latestValues[y]??0),a,i,n,h):(x=m.animateVisualElement)==null||x.call(m,e,a,i,n,h));for(const y in a){const v=e.getValue(y,e.latestValues[y]??null),k=a[y];if(k===void 0||g&&im(g,y))continue;const b={delay:n,...bl(i||{},y)};d&&(b.skipAnimations=!0);const S=v.get();if(S!==void 0&&!v.isAnimating()&&!Array.isArray(k)&&k===S&&!b.velocity){fe.update(()=>v.set(k));continue}let w=!1;if(rm&&window.MotionHandoffAnimation){const C=sm(e);if(C){const E=window.MotionHandoffAnimation(C,y,fe);E!==null&&(b.startTime=E,w=!0)}}tm(e,y);const A=u??e.shouldReduceMotion;v.start(Wp(y,v,k,A&&kl.has(y)?{type:!1}:b,e,w));const T=v.animation;T&&h.push(T)}if(o){const y=()=>fe.update(()=>{o&&Qp(e,o)});h.length?Promise.all(h).then(y):y()}return h}function rr(e,t,n={}){const s=Ge(e,t,Cl(e,n.type)),r=n.transitionOverride||((s==null?void 0:s.transition)??(e.getDefaultTransition()||{})),i=()=>Promise.all(s?El(e,s,n):[]),o=(c=0)=>{const{variantChildren:u}=e,{delayChildren:d=0,staggerChildren:h,staggerDirection:g}=r,m=[];return u==null||u.forEach(p=>{p.notify("AnimationStart",t),m.push(rr(p,t,{...n,delay:c+(typeof d=="function"?0:d)+vl(u,p,d,h,g)}).then(()=>p.notify("AnimationComplete",t)))}),Promise.all(m)},{when:a}=r;return a?a==="beforeChildren"?i().then(()=>o()):o().then(i):Promise.all([i(),o(n.delay)])}function om(e,t,n={}){return e.notify("AnimationStart",t),(Array.isArray(t)?Promise.all(t.map(r=>rr(e,r,n))):typeof t=="string"?rr(e,t,n):Promise.all(El(e,Ge(e,t,n.custom),n))).then(()=>{e.notify("AnimationComplete",t)})}const am={test:e=>e==="auto",parse:e=>e},lm=e=>t=>t.test(e),cm=[vt,H,lt,Ne,dh,uh,am],Hi=e=>cm.find(lm(e));function um(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ar(e):!0}const dm=new Set(["auto","none","0"]);function fm(e,t,n){let s=0,r;for(;s<e.length&&!r;){const i=e[s];typeof i=="string"&&!dm.has(i)&&yh(i)&&(r=e[s]),s++}if(r&&n)for(const i of t)e[i]!==r&&(e[i]=Ur(n,r))}class hm extends Kr{constructor(t,n,s,r,i){super(t,n,s,r,i,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){const{unresolvedKeyframes:t,element:n,motionValue:s}=this,r=t[0]??(s==null?void 0:s.get());if(!(n!=null&&n.current)||r===void 0)return!1;for(let i=0;i<t.length;i++)if(ps(i?t[i]:r))return!1;return!0}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let d=0;d<t.length;d++){let h=t[d];if(typeof h=="string"&&(h=h.trim(),Or(h))){const g=wl(h,n.current);g!==void 0&&(t[d]=g),d===t.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!kl.has(s)||t.length!==2)return;const[r,i]=t;if(typeof r=="number"&&typeof i=="number")return;const o=Hi(r),a=Hi(i),c=ps(r),u=ps(i);if(c!==u&&We[s]){this.needsMeasurement=!0;return}if(o!==a)if(_i(o)&&_i(a))for(let d=0;d<t.length;d++){const h=t[d];typeof h=="string"&&(t[d]=parseFloat(h))}else We[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,s=[];for(let r=0;r<t.length;r++)(t[r]===null||um(t[r]))&&s.push(r);s.length&&fm(t,s,n)}measure(){const{element:t,name:n}=this;return We[n](window.getComputedStyle(t.current),()=>t.measureViewportBox())}measureInitialState(){var i;const{element:t,unresolvedKeyframes:n,name:s}=this;if(!t||!t.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),n[0]=this.measuredOrigin;const r=n[n.length-1];r!==void 0&&((i=this.motionValue)==null||i.jump(r,!1))}measureEndState(){var i,o;const{element:t,unresolvedKeyframes:n}=this;if(!t||!t.current)return;(i=this.motionValue)==null||i.jump(this.measuredOrigin,!1);const s=n.length-1,r=n[s];n[s]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),(o=this.removedTransforms)!=null&&o.length&&this.removedTransforms.forEach(([a,c])=>{t.getValue(a).set(c)}),this.resolveNoneKeyframes()}}function bn(e){return Jf(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function pm(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const r=(n==null?void 0:n[e])??s.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(s=>s!=null)}function Yr(e,t,n){const{style:s,vars:r,transformOrigin:i}=e;let o=!1,a=!1;for(const c in t){const u=t[c];if(Fe.has(c)){o=!0;continue}else if(za(c)){r[c]=u;continue}else{const d=_n(u,Dt[c]);c.startsWith("origin")?(a=!0,i[c]=d):s[c]=d}}if(t.transform||(o||n?s.transform=xl(t,e.transform,n):s.transform&&(s.transform="none")),a){const{originX:c="50%",originY:u="50%",originZ:d=0}=i;s.transformOrigin=`${c} ${u} ${d}`}}const mm={offset:"stroke-dashoffset",array:"stroke-dasharray"},gm={offset:"strokeDashoffset",array:"strokeDasharray"};function ym(e,t,n=1,s=0,r=!0){e.pathLength=1;const i=r?mm:gm;e[i.offset]=`${-s}`,e[i.array]=`${t} ${n}`}const Tl=["transform","opacity","clipPath","filter","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Nl(e,{attrX:t,attrY:n,attrScale:s,pathLength:r,pathSpacing:i=1,pathOffset:o=0,...a},c,u,d){if(Yr(e,a,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:g}=e;for(const m of Tl)h[m]!==void 0&&(g[m]=h[m],delete h[m]);(g.transform||h.transformOrigin)&&(g.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),g.transform&&(g.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),s!==void 0&&(h.scale=s),r!==void 0&&ym(h,r,i,o,!1)}function xm({top:e,left:t,right:n,bottom:s}){return{x:{min:t,max:n},y:{min:e,max:s}}}function cv({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function vm(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),s=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function ws(e){return e===void 0||e===1}function bm({scale:e,scaleX:t,scaleY:n}){return!ws(e)||!ws(t)||!ws(n)}function wm(e){return bm(e)||Sm(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.rotateZ||e.skewX||e.skewY}function Sm(e){return Ui(e.x)||Ui(e.y)}function Ui(e){return e&&e!=="0%"}function Ki(e,t,n){const s=e-n,r=t*s;return n+r}function Wi(e,t,n,s,r){return r!==void 0&&(e=Ki(e,r,s)),Ki(e,n,s)+t}function ir(e,t=0,n=1,s,r){e.min=Wi(e.min,t,n,s,r),e.max=Wi(e.max,t,n,s,r)}function Cm(e,{x:t,y:n}){ir(e.x,t.translate,t.scale,t.originPoint),ir(e.y,n.translate,n.scale,n.originPoint)}const qi=.999999999999,Gi=1.0000000000001;function uv(e,t,n,s=!1){var a;const r=n.length;if(!r)return;t.x=t.y=1;let i,o;for(let c=0;c<r;c++){i=n[c],o=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(s&&i.options.layoutScroll&&i.scroll&&i!==i.root&&(Fn(e.x,-i.scroll.offset.x),Fn(e.y,-i.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Cm(e,o)),s&&wm(i.latestValues)&&km(e,i.latestValues,(a=i.layout)==null?void 0:a.layoutBox))}t.x<Gi&&t.x>qi&&(t.x=1),t.y<Gi&&t.y>qi&&(t.y=1)}function Fn(e,t){e.min+=t,e.max+=t}function Yi(e,t,n,s,r=.5){const i=et(e.min,e.max,r);ir(e,t,n,i,s)}function Ji(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function km(e,t,n){const s=n??e;Yi(e.x,Ji(t.x,s.x),t.scaleX,t.scale,t.originX),Yi(e.y,Ji(t.y,s.y),t.scaleY,t.scale,t.originY)}function Rl(e,t){return xm(vm(e.getBoundingClientRect(),t))}function dv(e,t,n){const s=Rl(e,n),{scroll:r}=t;return r&&(Fn(s.x,r.offset.x),Fn(s.y,r.offset.y)),s}const{schedule:jm}=Ja(queueMicrotask,!1),Em={};function Tm(e){return ae(e)?e.get():e}const Xi=()=>({translate:0,scale:1,origin:0,originPoint:0}),fv=()=>({x:Xi(),y:Xi()}),Zi=()=>({min:0,max:0}),Ml=()=>({x:Zi(),y:Zi()});function Qi(e,t,n,s={passive:!0}){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}const Nm=new WeakMap;function Qn(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Ht(e){return typeof e=="string"||Array.isArray(e)}const Jr=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],eo=["initial",...Jr];function es(e){if(Qn(e.animate))return!0;for(let t=0;t<eo.length;t++)if(Ht(e[eo[t]]))return!0;return!1}function Al(e){return!!(es(e)||e.variants)}function Rm(e,t,n){for(const s in t){const r=t[s],i=n[s];if(ae(r))e.addValue(s,r);else if(ae(i))e.addValue(s,zt(r,{owner:e}));else if(i!==r)if(e.hasValue(s)){const o=e.getValue(s);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=e.getStaticValue(s);e.addValue(s,zt(o!==void 0?o:r,{owner:e}))}}for(const s in n)t[s]===void 0&&e.removeValue(s);return t}const Dn={current:null},Xr={current:!1},Mm=typeof window<"u";function Ll(){if(Xr.current=!0,!!Mm)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Dn.current=e.matches;e.addEventListener("change",t),t()}else Dn.current=!1}const to=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Vn={};function Il(e){Vn=e}function Am(){return Vn}class Lm{scrapeMotionValuesFromProps(t,n,s){return{}}constructor({parent:t,props:n,presenceContext:s,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:o,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Kr,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=ee.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,fe.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=d,this.parent=t,this.props=n,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=es(n),this.isVariantNode=Al(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:h,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const m in g){const p=g[m];u[m]!==void 0&&ae(p)&&p.set(u[m])}}mount(t){var n,s;if(this.hasBeenMounted)for(const r in this.initialValues)(n=this.values.get(r))==null||n.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];if(this.current=t,Nm.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.isVariantNode&&!this.isControllingVariants){let r=this;do r=r.props.inherit!==!1&&r.parent;while(r&&!r.isVariantNode);if(r){const{variantChildren:i}=r;i.add(this),this.removeFromVariantTree=()=>i.delete(this)}}this.values.forEach((r,i)=>this.bindToMotionValue(i,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Xr.current||Ll(),this.shouldReduceMotion=Dn.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(s=this.parent)==null||s.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Hs(this.notifyUpdate),Hs(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const s=this.features[n];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&sr.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:c,ease:u,duration:d}=n.accelerate,h=new pl({element:this.current,name:t,keyframes:a,times:c,ease:u,duration:Se(d)}),g=o(h);this.valueSubscriptions.set(t,()=>{g(),h.cancel()});return}const s=Fe.has(t);s&&this.onBindTransform&&this.onBindTransform();const r=n.on("change",o=>{var a;this.latestValues[t]=o,this.props.onUpdate&&fe.preRender(this.notifyUpdate),s&&(this.projection&&(this.projection.isTransformDirty=!0),(a=Bt.get(this.current))==null||a.check()),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{r(),i&&i()})}sortNodePosition(t){return!this.current||!t.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Vn){const n=Vn[t];if(!n)continue;const{isEnabled:s,Feature:r}=n;if(!this.features[t]&&r&&s(this.props)&&(this.features[t]=new r(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ml()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){var i;const{transformTemplate:s,onUpdate:r}=this.props;(t.transformTemplate||s)&&this.scheduleRender(),(t.transformTemplate&&!s||t.onUpdate&&!r)&&((i=Bt.get(this.current))==null||i.demote()),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let o=0;o<to.length;o++){const a=to[o];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const c="on"+a,u=t[c];u&&(this.propEventSubscriptions[a]=this.on(a,u))}this.prevMotionValues=Rm(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(t,n){const s=this.values.get(t);if(n!==s){s&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n);const r=n.get();r!==void 0&&(this.latestValues[t]=r)}}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){var r;if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return s===void 0&&n!==void 0&&(s=zt(n??((r=this.getDefaultValue)==null?void 0:r.call(this,t)),{owner:this}),this.addValue(t,s)),s}readValue(t,n){let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(Mr(s)||Ar(s))?s=parseFloat(s):typeof s!="number"&&!ge.test(s)&&ge.test(n)&&(s=Ur(t,n)),this.setBaseTarget(t,ae(s)?s.get():s)),ae(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}on(t,n){return this.events[t]||(this.events[t]=new Vs),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){jm.render(this.render)}}class Pl extends Lm{constructor(){super(...arguments),this.KeyframeResolver=hm}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const s=t.style;return s?s[n]:void 0}removeValueFromRenderState(t,{vars:n,style:s}){delete n[t],delete s[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ae(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function $l(e,{style:t,vars:n},s,r){const i=e.style;let o;for(o in t)i[o]=t[o];r==null||r.applyProjectionStyles(i,s);for(o in n)i.setProperty(o,n[o])}function Ol(e,{layout:t,layoutId:n}){return Fe.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Em[e]||e==="opacity")}function Zr(e,t,n){var o;const s=e.style,r=t==null?void 0:t.style,i={};if(!s)return i;for(const a in s)(ae(s[a])||r&&ae(r[a])||Ol(a,e)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function Im(e){return window.getComputedStyle(e)}class Pm extends Pl{constructor(){super(...arguments),this.type="html",this.renderInstance=$l}mount(t){Xn(!!t.style),super.mount(t)}readValueFromInstance(t,n){var s;if(Fe.has(n))return(s=this.projection)!=null&&s.isProjecting?Vt(n):ip(t,n);{const r=Im(t),i=(za(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Rl(t,n)}build(t,n,s){Yr(t,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,n,s){return Zr(t,n,s)}}const _l=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Qr(e){return{point:{x:e.pageX,y:e.pageY}}}const hv=e=>t=>_l(t)&&e(t,Qr(t)),$m=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Om(e){return $m.has(e.tagName)||e.isContentEditable===!0}const _m=new Set(["INPUT","SELECT","TEXTAREA"]);function pv(e){return _m.has(e.tagName)||e.isContentEditable===!0}const no={x:!1,y:!1};function Fl(){return no.x||no.y}function Dl(e,t){const n=pm(e),s=new AbortController,r={passive:!0,...t,signal:s.signal};return[n,r,()=>s.abort()]}function Fm(e){return!(e.pointerType==="touch"||Fl())}function Dm(e,t,n={}){const[s,r,i]=Dl(e,n);return s.forEach(o=>{let a=!1,c=!1,u;const d=()=>{o.removeEventListener("pointerleave",p)},h=y=>{u&&(u(y),u=void 0),d()},g=y=>{a=!1,window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),c&&(c=!1,h(y))},m=()=>{a=!0,window.addEventListener("pointerup",g,r),window.addEventListener("pointercancel",g,r)},p=y=>{if(y.pointerType!=="touch"){if(a){c=!0;return}h(y)}},x=y=>{if(!Fm(y))return;c=!1;const v=t(o,y);typeof v=="function"&&(u=v,o.addEventListener("pointerleave",p,r))};o.addEventListener("pointerenter",x,r),o.addEventListener("pointerdown",m,r)}),i}const Vl=(e,t)=>t?e===t?!0:Vl(e,t.parentElement):!1,wn=new WeakSet;function so(e){return t=>{t.key==="Enter"&&e(t)}}function Ss(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Vm=(e,t)=>{const n=e.currentTarget;if(!n)return;const s=so(()=>{if(wn.has(n))return;Ss(n,"down");const r=so(()=>{Ss(n,"up")}),i=()=>Ss(n,"cancel");n.addEventListener("keyup",r,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",s,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),t)};function ro(e){return _l(e)&&!Fl()}const io=new WeakSet;function Bm(e,t,n={}){const[s,r,i]=Dl(e,n),o=a=>{const c=a.currentTarget;if(!ro(a)||io.has(a))return;wn.add(c),n.stopPropagation&&io.add(a);const u=t(c,a),d={...r,capture:!0},h=(p,x)=>{window.removeEventListener("pointerup",g,d),window.removeEventListener("pointercancel",m,d),wn.has(c)&&wn.delete(c),ro(p)&&typeof u=="function"&&u(p,{success:x})},g=p=>{h(p,c===window||c===document||n.useGlobalTarget||Vl(c,p.target))},m=p=>{h(p,!1)};window.addEventListener("pointerup",g,d),window.addEventListener("pointercancel",m,d)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),bn(a)&&(a.addEventListener("focus",u=>Vm(u,r)),!Om(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}class bt{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Bl=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),zl=e=>typeof e=="string"&&e.toLowerCase()==="svg";function zm(e,t,n,s){$l(e,t,void 0,s);for(const r in t.attrs)e.setAttribute(Bl.has(r)?r:Gr(r),t.attrs[r])}function Hl(e,t,n){const s=Zr(e,t,n);for(const r in e)if(r!=="children"&&(ae(e[r])||ae(t[r]))){const i=Ie.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[i]=e[r]}return s}class Hm extends Pl{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ml}getBaseTargetFromProps(t,n){return Fe.has(n)?super.getBaseTargetFromProps(t,n)??Vt(n):t[n]}getDefaultValue(t){return Fe.has(t)?this.latestValues[t]??Vt(t):void 0}readValueFromInstance(t,n){if(Fe.has(n)){const s=al(n);return s&&s.default||0}if(Tl.includes(n)){const r=getComputedStyle(t)[n];if(typeof r=="string"&&r)return r.trim()}return n=Bl.has(n)?n:Gr(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,s){return Hl(t,n,s)}build(t,n,s){Nl(t,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(t,n,s,r){zm(t,n,s,r)}mount(t){this.isSVGTag=zl(t.tagName),super.mount(t)}}function Ul(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let s=0;s<n;s++)if(t[s]!==e[s])return!1;return!0}const Um=[...Jr].reverse();function Km(e){let t=a=>Promise.all(a.map(({animation:c,options:u})=>om(e,c,u))),n=oo(),s=!0,r=!1;function i(a){var k;const{props:c,parent:u,manuallyAnimateOnMount:d}=e,h=s||r,g=[],m=new Set;let p={},x=1/0,y=e;do y=y.props.inherit!==!1&&y.parent;while(y&&!y.isControllingVariants);if(Um.forEach((b,S)=>{var F,U;const w=n[b],A=c[b],T=y&&y.props[b],C=A!==void 0?A:Ht(T)||T===!1?T:void 0,E=Ht(C),j=b===a?w.isActive:null;j===!1&&(x=S);const O=E&&A===void 0&&!(h&&d);if(w.protectedKeys={...p},!w.isActive&&j===null||!C&&!w.prevProp||Qn(C)||typeof C=="boolean")return;if(b==="exit"&&w.isActive&&j!==!0){p={...p,...w.prevResolvedValues};return}const $=Wm(w.prevProp,C);let R=$||E&&(j&&!O||S>x),N=!1;const P=Array.isArray(C)?C:[C];let I={};if(j!==!1)for(const L of P){const{transition:M,transitionEnd:D,...B}=Ge(e,L,Cl(e,b))||{};I={...I,...B,...D}}const{prevResolvedValues:_}=w;for(const L in{..._,...I}){if(L in p)continue;const M=I[L],D=_[L],B=Array.isArray(M)&&Array.isArray(D)?!Ul(M,D)||$:M!==D;if(B&&M==null)m.add(L);else if(B||M!==void 0&&m.has(L)){R=!0,m.delete(L)&&(N=!0),w.needsAnimating[L]=!0;const V=e.getValue(L);V&&(V.liveStyle=!1)}else w.protectedKeys[L]=!0}if(w.prevProp=C,w.prevResolvedValues=I,w.isActive&&(p={...p,...I}),R&&(!(O&&$)||N))for(const L of P){const M={type:b};if(typeof L=="string"&&h&&d&&(u!=null&&u.enteringChildren)){const D=(U=(F=Ge(u,L))==null?void 0:F.transition)==null?void 0:U.delayChildren;M.delay=vl(u.enteringChildren,e,D)}g.push({animation:L,options:M})}}),m.size){const{initial:b}=c,S={},w=typeof b!="boolean"&&Ge(e,Array.isArray(b)?b[0]:b,(k=e.presenceContext)==null?void 0:k.custom);w&&w.transition&&(S.transition=w.transition),m.forEach(A=>{const T=e.getValue(A);T&&(T.liveStyle=!0);const C=w&&!Array.isArray(b)?w[A]:void 0,E=e.getBaseTargetFromProps(c,A);S[A]=(C!==void 0?C:E!==void 0&&!ae(E)?E:e.initialValues[A]===void 0?e.baseTarget[A]:void 0)??null}),g.push({animation:S})}const v=h&&e.blockInitialAnimation||s&&!d&&(c.initial===!1||c.initial===c.animate);return s=r=!1,!v&&g.length?t(g):Promise.resolve()}function o(a,c){var d;if(n[a].isActive===c)return Promise.resolve();(d=e.variantChildren)==null||d.forEach(h=>{var g;return(g=h.animationState)==null?void 0:g.setActive(a,c)}),n[a].isActive=c;const u=i(a);for(const h in n)n[h].protectedKeys={};return u}return{animateChanges:i,setActive:o,setAnimateFunction:a=>{t=a(e)},getState:()=>n,reset:()=>{n=oo(),r=!0}}}function Wm(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Ul(t,e):!1}function oo(){const e={};for(const t of Jr)e[t]={isActive:t==="animate",protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}const je=f.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function ao(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qm(...e){return t=>{let n=!1;const s=e.map(r=>{const i=ao(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():ao(e[r],null)}}}}function Gm(...e){return f.useCallback(qm(...e),e)}class Ym extends f.Component{getSnapshotBeforeUpdate(t){const n=this.props.getElement();if(bn(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,r=bn(s)&&s.offsetWidth||0,i=bn(s)&&s.offsetHeight||0,o=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=r-a.width-a.left,a.bottom=i-a.height-a.top,a.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function Jm({children:e,isPresent:t,anchorX:n,anchorY:s,root:r,pop:i,popNode:o}){var p;const a=f.useId(),c=f.useRef(null),u=f.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:d}=f.useContext(je),h=i!==!1?((p=e.props)==null?void 0:p.ref)??(e==null?void 0:e.ref):void 0,g=Gm(c,h),m=()=>{var x;return c.current||((x=o==null?void 0:o.current)==null?void 0:x.current)};return f.useInsertionEffect(()=>{const{width:x,height:y,top:v,left:k,right:b,bottom:S,direction:w}=u.current,A=m();if(t||i===!1||!A||!x||!y)return;const T=w==="rtl",C=n==="left"?T?`right: ${b}`:`left: ${k}`:T?`left: ${k}`:`right: ${b}`,E=s==="bottom"?`bottom: ${S}`:`top: ${v}`;A.dataset.motionPopId=a;const j=A.ownerDocument,O=j.createElement("style");d&&(O.nonce=d);const $=r??j.head;return $.appendChild(O),O.sheet&&O.sheet.insertRule(`
244
- [data-motion-pop-id="${a}"] {
245
- position: absolute !important;
246
- width: ${x}px !important;
247
- height: ${y}px !important;
248
- ${C}px !important;
249
- ${E}px !important;
250
- }
251
- `),()=>{A.removeAttribute("data-motion-pop-id"),$.contains(O)&&$.removeChild(O)}},[t]),l.jsx(Ym,{isPresent:t,getElement:m,sizeRef:u,pop:i,children:i===!1?e:f.cloneElement(e,{ref:g})})}const Xm=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:i,mode:o,anchorX:a,anchorY:c,root:u})=>{const d=xt(Zm),h=f.useId(),g=f.useRef(),m=f.useRef(n),p=f.useRef(s);Pt(()=>{m.current=n,p.current=s});let x=!0,y=f.useMemo(()=>(x=!1,{id:h,initial:t,isPresent:n,custom:r,onExitComplete:v=>{d.set(v,!0);for(const k of d.values())if(!k)return;s&&s()},register:(v,k)=>{var b,S;return d.set(v,!1),k&&((S=(b=k.parent)==null?void 0:b.presenceContext)==null?void 0:S.id)!==h&&(g.current=k),()=>{var w;d.delete(v),!m.current&&!d.size&&((w=p.current)==null||w.call(p))}}}),[n,d,s]);return i&&x&&(y={...y}),f.useMemo(()=>{d.forEach((v,k)=>d.set(k,!1))},[n]),f.useEffect(()=>{!n&&!d.size&&s&&s()},[n]),e=l.jsx(Jm,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:c,root:u,popNode:g,children:e}),l.jsx(Xt.Provider,{value:y,children:e})};function Zm(){return new Map}function Qm(e=!0){const t=f.useContext(Xt);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,i=f.useId();f.useEffect(()=>{if(e)return r(i)},[e]);const o=f.useCallback(()=>e&&s&&s(i),[i,s,e]);return!n&&s?[!1,o]:[!0]}function ts(){return eg(f.useContext(Xt))}function eg(e){return e===null?!0:e.isPresent}const Ct=e=>e.key||"";function lo(e){const t=[];return f.Children.forEach(e,n=>{f.isValidElement(n)&&t.push(n)}),t}const Ee=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",anchorY:c="top",root:u})=>{const[d,h]=Qm(o),g=f.useMemo(()=>lo(e),[e]),m=o&&!d?[]:g.map(Ct),p=f.useRef(!0),x=xt(()=>new Map),y=f.useRef(new Set),[v,k]=f.useState(g),[b,S]=f.useState(g);Pt(()=>{o&&!d&&!b.length&&(h==null||h())},[d,o,b.length,h]);const w=f.useRef();f.useEffect(()=>()=>{const C=w.current;w.current=void 0,C==null||C()},[b]),Pt(()=>{p.current=!1;for(let C=0;C<b.length;C++){const E=Ct(b[C]);m.includes(E)?(x.delete(E),y.current.delete(E)):x.get(E)!==!0&&x.set(E,!1)}},[b,m.length,m.join("-")]);const A=[];if(g!==v){let C=[...g],E=0;for(const j of b){const O=m.indexOf(Ct(j));O===-1?(C.splice(E++,0,j),A.push(j)):E=O+A.length+1}return A.every(j=>x.get(Ct(j)))?C=g:i==="wait"&&(C=A),S(lo(C)),k(g),null}const{forceRender:T}=f.useContext(La);return l.jsx(l.Fragment,{children:b.map(C=>{const E=Ct(C),j=o&&!d?!1:g===b||m.includes(E),O=()=>{if(y.current.has(E))return;if(x.has(E))y.current.add(E),x.set(E,!0);else return;let $=!0;x.forEach(R=>{R||($=!1)}),$&&(T==null||T(),k([]),o&&(h==null||h()),w.current=s)};return l.jsx(Xm,{isPresent:j,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:i,root:u,onExitComplete:j?void 0:O,anchorX:a,anchorY:c,children:C},E)})})},ei=f.createContext({strict:!1}),co={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let uo=!1;function tg(){if(uo)return;const e={};for(const t in co)e[t]={isEnabled:n=>co[t].some(s=>!!n[s])};Il(e),uo=!0}function Kl(){return tg(),Am()}function fo(e){const t=Kl();for(const n in e)t[n]={...t[n],...e[n]};Il(t)}function tn({children:e,features:t,strict:n=!1}){const[,s]=f.useState(!Cs(t)),r=f.useRef(void 0);if(!Cs(t)){const{renderer:i,...o}=t;r.current=i,fo(o)}return f.useEffect(()=>{Cs(t)&&t().then(({renderer:i,...o})=>{fo(o),r.current=i,s(!0)})},[]),l.jsx(ei.Provider,{value:{renderer:r.current,strict:n},children:e})}function Cs(e){return typeof e=="function"}function ng({children:e,...t}){const n=f.useContext(je);t={...n,...t},t.transition=qr(t.transition,n.transition),t.isStatic=xt(()=>t.isStatic);const s=f.useMemo(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations,t.isValidProp]);return l.jsx(je.Provider,{value:s,children:e})}const ns=f.createContext({});function sg(e,t){if(es(e)){const{initial:n,animate:s}=e;return{initial:n===!1||Ht(n)?n:void 0,animate:Ht(s)?s:void 0}}return e.inherit!==!1?t:{}}function rg(e){const{initial:t,animate:n}=sg(e,f.useContext(ns));return f.useMemo(()=>({initial:t,animate:n}),[ho(t),ho(n)])}function ho(e){return Array.isArray(e)?e.join(" "):e}const ti=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Wl(e,t,n){for(const s in t)!ae(t[s])&&!Ol(s,n)&&(e[s]=t[s])}function ig({transformTemplate:e},t){return f.useMemo(()=>{const n=ti();return Yr(n,t,e),Object.assign({},n.vars,n.style)},[t])}function og(e,t){const n=e.style||{},s={};return Wl(s,n,e),Object.assign(s,ig(e,t)),s}function ag(e,t){const n={},s=og(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const ql=()=>({...ti(),attrs:{}});function lg(e,t,n,s){const r=f.useMemo(()=>{const i=ql();return Nl(i,t,zl(s),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Wl(i,e.style,e),r.style={...i,...r.style}}return r}const cg=new Set(["animate","exit","variants","initial","style","values","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Bn(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||cg.has(e)}function ug(e,t){return e.startsWith("on")?!Bn(e):(t==null?void 0:t(e))??!Bn(e)}function dg(e,t,n,s){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||ae(e[i])||(ug(i,s)||n===!0&&Bn(i)||!t&&!Bn(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}const fg=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ni(e){return typeof e!="string"||e.includes("-")?!1:!!(fg.indexOf(e)>-1||/[A-Z]/u.test(e))}function hg(e,t,n,{latestValues:s},r,i=!1,o,a){const u=(o??ni(e)?lg:ag)(t,s,r,e),d=dg(t,typeof e=="string",i,a),h=e!==f.Fragment?{...d,...u,ref:n}:{},{children:g}=t,m=f.useMemo(()=>ae(g)?g.get():g,[g]);return f.createElement(e,{...h,children:m})}function pg({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:mg(n,s,r,e),renderState:t()}}function mg(e,t,n,s){const r={},i=s(e,{});for(const g in i)r[g]=Tm(i[g]);let{initial:o,animate:a}=e;const c=es(e),u=Al(e);t&&u&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?a:o;if(h&&typeof h!="boolean"&&!Qn(h)){const g=Array.isArray(h)?h:[h];for(let m=0;m<g.length;m++){const p=Sl(e,g[m]);if(p){const{transitionEnd:x,transition:y,...v}=p;for(const k in v){let b=v[k];if(Array.isArray(b)){const S=d?b.length-1:0;b=b[S]}b!==null&&(r[k]=b)}for(const k in x)r[k]=x[k]}}}return r}const Gl=e=>(t,n)=>{const s=f.useContext(ns),r=f.useContext(Xt),i=()=>pg(e,t,s,r);return n?i():xt(i)},gg=Gl({scrapeMotionValuesFromProps:Zr,createRenderState:ti}),yg=Gl({scrapeMotionValuesFromProps:Hl,createRenderState:ql}),xg=Symbol.for("motionComponentSymbol");function vg(e,t,n){const s=f.useRef(n);f.useInsertionEffect(()=>{s.current=n});const r=f.useRef(null);return f.useCallback(i=>{var a;i&&((a=e.onMount)==null||a.call(e,i)),t&&(i?t.mount(i):t.unmount());const o=s.current;if(typeof o=="function")if(i){const c=o(i);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):o(i);else o&&(o.current=i)},[t])}const bg=f.createContext({});function wg(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Sg(e,t,n,s,r,i){var b,S;const{visualElement:o}=f.useContext(ns),a=f.useContext(ei),c=f.useContext(Xt),u=f.useContext(je),d=u.reducedMotion,h=u.skipAnimations,g=f.useRef(null),m=f.useRef(!1);s=s||a.renderer,!g.current&&s&&(g.current=s(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:h,isSVG:i}),m.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const p=g.current,x=f.useContext(bg);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&Cg(g.current,n,r,x);const y=f.useRef(!1);f.useInsertionEffect(()=>{p&&y.current&&p.update(n,c)});const v=n[jl],k=f.useRef(!!v&&typeof window<"u"&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,v))&&((S=window.MotionHasOptimisedAnimation)==null?void 0:S.call(window,v)));return Pt(()=>{var w;!m.current||!p||((w=p.animationState)==null||w.animateChanges(),p.enteringChildren=void 0)},[]),Pt(()=>{m.current=!0,p&&(y.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),k.current&&p.animationState&&p.animationState.animateChanges())}),f.useEffect(()=>{p&&(!k.current&&p.animationState&&p.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)==null||w.call(window,v)}),k.current=!1),p.enteringChildren=void 0)}),p}function Cg(e,t,n,s){const{layoutId:r,layout:i,drag:o,dragConstraints:a,layoutScroll:c,layoutRoot:u,layoutAnchor:d,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Yl(e.parent)),e.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!o||a&&wg(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,crossfade:h,layoutScroll:c,layoutRoot:u,layoutAnchor:d})}function Yl(e){if(e)return e.options.allowProjection!==!1?e.projection:Yl(e.parent)}function kg(e,{forwardMotionProps:t=!1,type:n}={},s,r){const i=n?n==="svg":ni(e),o=i?yg:gg;function a(u,d){let h;const g={...f.useContext(je),...u,layoutId:jg(u)},{isStatic:m,isValidProp:p}=g,x=rg(u),y=o(u,m);if(!m&&typeof window<"u"){Eg();const v=Tg(g);h=v.MeasureLayout,x.visualElement=Sg(e,y,g,r,v.ProjectionNode,i)}return l.jsxs(ns.Provider,{value:x,children:[h&&x.visualElement?l.jsx(h,{visualElement:x.visualElement,...g}):null,hg(e,u,vg(y,x.visualElement,d),y,m,t,i,p)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const c=f.forwardRef(a);return c[xg]=e,c}function jg({layoutId:e}){const t=f.useContext(La).id;return t&&e!==void 0?t+"-"+e:e}function Eg(e,t){f.useContext(ei).strict}function Tg(e){const t=Kl(),{drag:n,layout:s}=t;if(!n&&!s)return{};const r={...n,...s};return{MeasureLayout:n!=null&&n.isEnabled(e)||s!=null&&s.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const Ng=(e,t)=>t.isSVG??ni(e)?new Hm(t):new Pm(t,{allowProjection:e!==f.Fragment});class Rg extends bt{constructor(t){super(t),t.animationState||(t.animationState=Km(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Qn(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let Mg=0;class Ag extends bt{constructor(){super(...arguments),this.id=Mg++}update(){var c;const{presenceContext:t,prevPresenceContext:n,animationState:s}=this.node;if(!t||!s)return;const{isPresent:r,onExitComplete:i}=t,o=n==null?void 0:n.isPresent;if(r===o)return;if(r&&o===!1){if(this.exit===!0){const{initial:u}=this.node.getProps();if(u&&!Array.isArray(u)){const{transition:d,transitionEnd:h,...g}=Ge(this.node,u)||{};for(const m in g)(c=this.node.getValue(m))==null||c.jump(g[m])}this.node.blockInitialAnimation=!1,s.reset(),s.animateChanges()}else s.setActive("exit",!1);this.exit=void 0;return}const a=this.exit=s.setActive("exit",!r);i&&!r&&a.then(()=>{this.exit===a&&(this.exit=!0,i(this.id))})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id,this.node))}unmount(){}}const Lg={animation:{Feature:Rg},exit:{Feature:Ag}};function po(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=s[r];i&&fe.postRender(()=>i(t,Qr(t)))}class Ig extends bt{mount(){const{current:t}=this.node;t&&(this.unmount=Dm(t,(n,s)=>(po(this.node,s,"Start"),r=>po(this.node,r,"End"))))}unmount(){}}class Pg extends bt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Zn(Qi(this.node.current,"focus",()=>this.onFocus()),Qi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function mo(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=s[r];i&&fe.postRender(()=>i(t,Qr(t)))}class $g extends bt{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=Bm(t,(r,i)=>(mo(this.node,i,"Start"),(o,{success:a})=>mo(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const or=new WeakMap,ks=new WeakMap,Og=e=>{const t=or.get(e.target);t&&t(e)},_g=e=>{e.forEach(Og)};function Fg({root:e,...t}){const n=e||document;ks.has(n)||ks.set(n,{});const s=ks.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(_g,{root:e,...t})),s[r]}function Dg(e,t,n){const s=Fg(t);return or.set(e,n),s.observe(e),()=>{or.delete(e),s.unobserve(e)}}const Vg={some:0,all:1};class Bg extends bt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var c;(c=this.stopObserver)==null||c.call(this);const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:Vg[r]},a=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:g}=this.node.getProps(),m=d?h:g;m&&m(u)};this.stopObserver=Dg(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(zg(t,n))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function zg({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Hg={inView:{Feature:Bg},tap:{Feature:$g},focus:{Feature:Pg},hover:{Feature:Ig}},ss={renderer:Ng,...Lg,...Hg};function Ug(e){const t=xt(()=>zt(e)),{isStatic:n}=f.useContext(je);if(n){const[,s]=f.useState(e);f.useEffect(()=>t.on("change",s),[])}return t}function nn(){!Xr.current&&Ll();const[e]=f.useState(Dn.current);return e}class Kg{constructor(){this.componentControls=new Set}subscribe(t){return this.componentControls.add(t),()=>this.componentControls.delete(t)}start(t,n){this.componentControls.forEach(s=>{s.start(t.nativeEvent||t,n)})}cancel(){this.componentControls.forEach(t=>{t.cancel()})}stop(){this.componentControls.forEach(t=>{t.stop()})}}const Wg=()=>new Kg;function qg(){return xt(Wg)}function Gg(){f.useEffect(()=>{const e=window.visualViewport;if(!e)return;const t=document.documentElement;function n(){if(!e)return;window.innerHeight-e.height>1?(t.style.setProperty("--app-viewport-height",`${e.height}px`),t.style.setProperty("--app-viewport-top",`${e.offsetTop}px`),window.scrollY>0&&window.scrollTo(0,0)):(t.style.removeProperty("--app-viewport-height"),t.style.removeProperty("--app-viewport-top"))}return n(),e.addEventListener("resize",n),e.addEventListener("scroll",n),()=>{e.removeEventListener("resize",n),e.removeEventListener("scroll",n),t.style.removeProperty("--app-viewport-height"),t.style.removeProperty("--app-viewport-top")}},[])}function Y({variant:e="ghost",size:t="regular",loading:n=!1,disabled:s,type:r="button",className:i="",children:o,...a}){return l.jsxs("button",{...a,type:r,disabled:s||n,"aria-busy":n||a["aria-busy"]||void 0,className:`ui-button ui-button--${e} ui-button--${t} ${i}`,children:[n&&l.jsx(Le,{size:16,className:"animate-spin shrink-0","aria-hidden":"true"}),o]})}function si({invalid:e,className:t="",...n}){return l.jsx("input",{...n,"aria-invalid":e||n["aria-invalid"]||void 0,className:`ui-field ${t}`})}function Yg({invalid:e,className:t="",...n}){return l.jsx("textarea",{...n,"aria-invalid":e||n["aria-invalid"]||void 0,className:`ui-field ui-field--multiline ${t}`})}function Jg({invalid:e,className:t="",...n}){return l.jsx("select",{...n,"aria-invalid":e||n["aria-invalid"]||void 0,className:`ui-field ${t}`})}function ar({label:e,htmlFor:t,children:n}){return l.jsxs("div",{className:"ui-form-field",children:[l.jsx("label",{htmlFor:t,className:"ui-field-label",children:e}),n]})}const W=e=>typeof e=="string",kt=()=>{let e,t;const n=new Promise((s,r)=>{e=s,t=r});return n.resolve=e,n.reject=t,n},go=e=>e==null?"":String(e),Xg=(e,t,n)=>{e.forEach(s=>{t[s]&&(n[s]=t[s])})},Zg=/###/g,yo=e=>e&&e.includes("###")?e.replace(Zg,"."):e,xo=e=>!e||W(e),Nt=(e,t,n)=>{const s=W(t)?t.split("."):t;let r=0;for(;r<s.length-1;){if(xo(e))return{};const i=yo(s[r]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++r}return xo(e)?{}:{obj:e,k:yo(s[r])}},vo=(e,t,n)=>{const{obj:s,k:r}=Nt(e,t,Object);if(s!==void 0||t.length===1){s[r]=n;return}let i=t[t.length-1],o=t.slice(0,t.length-1),a=Nt(e,o,Object);for(;a.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),a=Nt(e,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},Qg=(e,t,n,s)=>{const{obj:r,k:i}=Nt(e,t,Object);r[i]=r[i]||[],r[i].push(n)},zn=(e,t)=>{const{obj:n,k:s}=Nt(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},e0=(e,t,n)=>{const s=zn(e,n);return s!==void 0?s:zn(t,n)},Jl=(e,t,n)=>{for(const s in t)s!=="__proto__"&&s!=="constructor"&&(s in e?W(e[s])||e[s]instanceof String||W(t[s])||t[s]instanceof String?n&&(e[s]=t[s]):Jl(e[s],t[s],n):e[s]=t[s]);return e},Te=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"},n0=e=>W(e)?e.replace(/[&<>"'\/]/g,t=>t0[t]):e;class s0{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const s=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,s),this.regExpQueue.push(t),s}}const r0=[" ",",","?","!",";"],i0=new s0(20),o0=(e,t,n)=>{t=t||"",n=n||"";const s=r0.filter(o=>!t.includes(o)&&!n.includes(o));if(s.length===0)return!0;const r=i0.getRegExp(`(${s.map(o=>o==="?"?"\\?":o).join("|")})`);let i=!r.test(e);if(!i){const o=e.indexOf(n);o>0&&!r.test(e.substring(0,o))&&(i=!0)}return i},lr=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const s=t.split(n);let r=e;for(let i=0;i<s.length;){if(!r||typeof r!="object")return;let o,a="";for(let c=i;c<s.length;++c)if(c!==i&&(a+=n),a+=s[c],o=r[a],o!==void 0){if(["string","number","boolean"].includes(typeof o)&&c<s.length-1)continue;i+=c-i+1;break}r=o}return r},Ut=e=>e==null?void 0:e.replace(/_/g,"-"),a0={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,s;(s=(n=console==null?void 0:console[e])==null?void 0:n.apply)==null||s.call(n,console,t)}};class Hn{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||a0,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,s,r){return r&&!this.debug?null:(t=t.map(i=>W(i)?i.replace(/[\r\n\x00-\x1F\x7F]/g," "):i),W(t[0])&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Hn(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Hn(this.logger,t)}}var ve=new Hn;class rs{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const r=this.observers[s].get(n)||0;this.observers[s].set(n,r+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}once(t,n){const s=(...r)=>{n(...r),this.off(t,s)};return this.on(t,s),this}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([r,i])=>{for(let o=0;o<i;o++)r(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,i])=>{for(let o=0;o<i;o++)r(t,...n)})}}class bo extends rs{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.includes(t)||this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,s,r={}){var u,d;const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.includes(".")?a=t.split("."):(a=[t,n],s&&(Array.isArray(s)?a.push(...s):W(s)&&i?a.push(...s.split(i)):a.push(s)));const c=zn(this.data,a);return!c&&!n&&!s&&t.includes(".")&&(t=a[0],n=a[1],s=a.slice(2).join(".")),c||!o||!W(s)?c:lr((d=(u=this.data)==null?void 0:u[t])==null?void 0:d[n],s,i)}addResource(t,n,s,r,i={silent:!1}){const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let a=[t,n];s&&(a=a.concat(o?s.split(o):s)),t.includes(".")&&(a=t.split("."),r=n,n=a[1]),this.addNamespaces(n),vo(this.data,a,r),i.silent||this.emit("added",t,n,s,r)}addResources(t,n,s,r={silent:!1}){for(const i in s)(W(s[i])||Array.isArray(s[i]))&&this.addResource(t,n,i,s[i],{silent:!0});r.silent||this.emit("added",t,n,s)}addResourceBundle(t,n,s,r,i,o={silent:!1,skipCopy:!1}){let a=[t,n];t.includes(".")&&(a=t.split("."),r=s,s=n,n=a[1]),this.addNamespaces(n);let c=zn(this.data,a)||{};o.skipCopy||(s=JSON.parse(JSON.stringify(s))),r?Jl(c,s,i):c={...c,...s},vo(this.data,a,c),o.silent||this.emit("added",t,n,s)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var Xl={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,s,r){return e.forEach(i=>{var o;t=((o=this.processors[i])==null?void 0:o.process(t,n,s,r))??t}),t}};const Zl=Symbol("i18next/PATH_KEY");function l0(){const e=[],t=Object.create(null);let n;return t.get=(s,r)=>{var i;return(i=n==null?void 0:n.revoke)==null||i.call(n),r===Zl?e:(e.push(r),n=Proxy.revocable(s,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Ye(e,t){const{[Zl]:n}=e(l0()),s=(t==null?void 0:t.keySeparator)??".",r=(t==null?void 0:t.nsSeparator)??":",i=(t==null?void 0:t.enableSelector)==="strict";if(n.length>1&&r){const o=t==null?void 0:t.ns,a=i?Array.isArray(o)?o:o?[o]:null:Array.isArray(o)?o:null;if(a&&(i?a:a.length>1?a.slice(1):[]).includes(n[0]))return`${n[0]}${r}${n.slice(1).join(s)}`}return n.join(s)}const js=e=>!W(e)&&typeof e!="boolean"&&typeof e!="number";class Un extends rs{constructor(t,n={}){super(),Xg(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ve.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const s={...n};if(t==null)return!1;const r=this.resolve(t,s);if((r==null?void 0:r.res)===void 0)return!1;const i=js(r.res);return!(s.returnObjects===!1&&i)}extractFromKey(t,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const o=s&&t.includes(s),a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!o0(t,s,r);if(o&&!a){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:W(i)?[i]:i};const u=t.split(s);(s!==r||s===r&&this.options.ns.includes(u[0]))&&(i=u.shift()),t=u.join(r)}return{key:t,namespaces:W(i)?[i]:i}}translate(t,n,s){let r=typeof n=="object"?{...n}:n;if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),t==null)return"";typeof t=="function"&&(t=Ye(t,{...this.options,...r})),Array.isArray(t)||(t=[String(t)]),t=t.map(R=>typeof R=="function"?Ye(R,{...this.options,...r}):String(R));const i=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:a,namespaces:c}=this.extractFromKey(t[t.length-1],r),u=c[c.length-1];let d=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const h=r.lng||this.language,g=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((h==null?void 0:h.toLowerCase())==="cimode")return g?i?{res:`${u}${d}${a}`,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(r)}:`${u}${d}${a}`:i?{res:a,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(r)}:a;const m=this.resolve(t,r);let p=m==null?void 0:m.res;const x=(m==null?void 0:m.usedKey)||a,y=(m==null?void 0:m.exactUsedKey)||a,v=["[object Number]","[object Function]","[object RegExp]"],k=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,S=r.count!==void 0&&!W(r.count),w=Un.hasDefaultValue(r),A=S?this.pluralResolver.getSuffix(h,r.count,r):"",T=r.ordinal&&S?this.pluralResolver.getSuffix(h,r.count,{ordinal:!1}):"",C=S&&!r.ordinal&&r.count===0,E=C&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${A}`]||r[`defaultValue${T}`]||r.defaultValue;let j=p;b&&!p&&w&&(j=E);const O=js(j),$=Object.prototype.toString.apply(j);if(b&&j&&O&&!v.includes($)&&!(W(k)&&Array.isArray(j))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,j,{...r,ns:c}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(m.res=R,m.usedParams=this.getUsedParamsDetails(r),m):R}if(o){const R=Array.isArray(j),N=R?[]:{},P=R?y:x;for(const I in j)if(Object.prototype.hasOwnProperty.call(j,I)){const _=`${P}${o}${I}`;w&&!p?N[I]=this.translate(_,{...r,defaultValue:js(E)?E[I]:void 0,joinArrays:!1,ns:c}):N[I]=this.translate(_,{...r,joinArrays:!1,ns:c}),N[I]===_&&(N[I]=j[I])}p=N}}else if(b&&W(k)&&Array.isArray(p))p=p.join(k),p&&(p=this.extendTranslation(p,t,r,s));else{let R=!1,N=!1;!this.isValidLookup(p)&&w&&(R=!0,p=E),this.isValidLookup(p)||(N=!0,p=a);const I=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:p,_=w&&E!==p&&this.options.updateMissing;if(N||R||_){if(this.logger.log(_?"updateKey":"missingKey",h,u,S&&!_?`${a}${this.pluralResolver.getSuffix(h,r.count,r)}`:a,_?E:p),o){const M=this.resolve(a,{...r,keySeparator:!1});M&&M.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let F=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let M=0;M<U.length;M++)F.push(U[M]);else this.options.saveMissingTo==="all"?F=this.languageUtils.toResolveHierarchy(r.lng||this.language):F.push(r.lng||this.language);const L=(M,D,B)=>{var K;const V=w&&B!==p?B:I;this.options.missingKeyHandler?this.options.missingKeyHandler(M,u,D,V,_,r):(K=this.backendConnector)!=null&&K.saveMissing&&this.backendConnector.saveMissing(M,u,D,V,_,r),this.emit("missingKey",M,u,D,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&S?F.forEach(M=>{const D=this.pluralResolver.getSuffixes(M,r);C&&r[`defaultValue${this.options.pluralSeparator}zero`]&&!D.includes(`${this.options.pluralSeparator}zero`)&&D.push(`${this.options.pluralSeparator}zero`),D.forEach(B=>{L([M],a+B,r[`defaultValue${B}`]||E)})}):L(F,a,E))}p=this.extendTranslation(p,t,r,m,s),N&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${u}${d}${a}`),(N||R)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${d}${a}`:a,R?p:void 0,r))}return i?(m.res=p,m.usedParams=this.getUsedParamsDetails(r),m):p}extendTranslation(t,n,s,r,i){var c,u;if((c=this.i18nFormat)!=null&&c.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const d=W(t)&&(((u=s==null?void 0:s.interpolation)==null?void 0:u.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(d){const m=t.match(this.interpolator.nestingRegexp);h=m&&m.length}let g=s.replace&&!W(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),t=this.interpolator.interpolate(t,g,s.lng||this.language||r.usedLng,s),d){const m=t.match(this.interpolator.nestingRegexp),p=m&&m.length;h<p&&(s.nest=!1)}!s.lng&&r&&r.res&&(s.lng=this.language||r.usedLng),s.nest!==!1&&(t=this.interpolator.nest(t,(...m)=>(i==null?void 0:i[0])===m[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${n[0]}`),null):this.translate(...m,n),s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,a=W(o)?[o]:o;return t!=null&&(a!=null&&a.length)&&s.applyPostProcessor!==!1&&(t=Xl.handle(a,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),t}resolve(t,n={}){let s,r,i,o,a;return W(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(c=>typeof c=="function"?Ye(c,{...this.options,...n}):c)),t.forEach(c=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(c,n),d=u.key;r=d;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const g=n.count!==void 0&&!W(n.count),m=g&&!n.ordinal&&n.count===0,p=n.context!==void 0&&(W(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(y=>{var v,k;this.isValidLookup(s)||(a=y,!this.checkedLoadedFor[`${x[0]}-${y}`]&&((v=this.utils)!=null&&v.hasLoadedNamespace)&&!((k=this.utils)!=null&&k.hasLoadedNamespace(a))&&(this.checkedLoadedFor[`${x[0]}-${y}`]=!0,this.logger.warn(`key "${r}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(b=>{var A;if(this.isValidLookup(s))return;o=b;const S=[d];if((A=this.i18nFormat)!=null&&A.addLookupKeys)this.i18nFormat.addLookupKeys(S,d,b,y,n);else{let T;g&&(T=this.pluralResolver.getSuffix(b,n.count,n));const C=`${this.options.pluralSeparator}zero`,E=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(g&&(n.ordinal&&T.startsWith(E)&&S.push(d+T.replace(E,this.options.pluralSeparator)),S.push(d+T),m&&S.push(d+C)),p){const j=`${d}${this.options.contextSeparator||"_"}${n.context}`;S.push(j),g&&(n.ordinal&&T.startsWith(E)&&S.push(j+T.replace(E,this.options.pluralSeparator)),S.push(j+T),m&&S.push(j+C))}}let w;for(;w=S.pop();)this.isValidLookup(s)||(i=w,s=this.getResource(b,y,w,n))}))})}),{res:s,usedKey:r,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,s,r={}){var i;return(i=this.i18nFormat)!=null&&i.getResource?this.i18nFormat.getResource(t,n,s,r):this.resourceStore.getResource(t,n,s,r)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=t.replace&&!W(t.replace);let r=s?t.replace:t;if(s&&typeof t.count<"u"&&(r.count=t.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!s){r={...r};for(const i of n)delete r[i]}return r}static hasDefaultValue(t){const n="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&s.startsWith(n)&&t[s]!==void 0)return!0;return!1}}class wo{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ve.create("languageUtils")}getScriptPartFromCode(t){if(t=Ut(t),!t||!t.includes("-"))return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Ut(t),!t||!t.includes("-"))return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(W(t)&&t.includes("-")){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(s=>{if(n)return;const r=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&t.forEach(s=>{if(n)return;const r=this.getScriptPartFromCode(s);if(this.isSupportedCode(r))return n=r;const i=this.getLanguagePartFromCode(s);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>o===i?!0:!o.includes("-")&&!i.includes("-")?!1:!!(o.includes("-")&&!i.includes("-")&&o.slice(0,o.indexOf("-"))===i||o.startsWith(i)&&i.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),W(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let s=t[n];return s||(s=t[this.getScriptPartFromCode(n)]),s||(s=t[this.formatLanguageCode(n)]),s||(s=t[this.getLanguagePartFromCode(n)]),s||(s=t.default),s||[]}toResolveHierarchy(t,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),r=[],i=o=>{o&&(this.isSupportedCode(o)?r.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return W(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):W(t)&&i(this.formatLanguageCode(t)),s.forEach(o=>{r.includes(o)||i(this.formatLanguageCode(o))}),r}}const So={zero:0,one:1,two:2,few:3,many:4,other:5},Co={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class c0{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=ve.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const s=Ut(t==="dev"?"en":t),r=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:s,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(s,{type:r})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Co;if(!t.match(/-|_/))return Co;const c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,n)}return this.pluralRulesCache[i]=o,o}needsPlural(t,n={}){let s=this.getRule(t,n);return s||(s=this.getRule("dev",n)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,n,s={}){return this.getSuffixes(t,s).map(r=>`${n}${r}`)}getSuffixes(t,n={}){let s=this.getRule(t,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((r,i)=>So[r]-So[i]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(t,n,s={}){const r=this.getRule(t,s);return r?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,s))}}const ko=(e,t,n,s=".",r=!0)=>{let i=e0(e,t,n);return!i&&r&&W(n)&&(i=lr(e,n,s),i===void 0&&(i=lr(t,n,s))),i},Es=e=>e.replace(/\$/g,"$$$$");class jo{constructor(t={}){var n;this.logger=ve.create("interpolator"),this.options=t,this.format=((n=t==null?void 0:t.interpolation)==null?void 0:n.format)||(s=>s),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:r,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:g,nestingPrefixEscaped:m,nestingSuffix:p,nestingSuffixEscaped:x,nestingOptionsSeparator:y,maxReplaces:v,alwaysFormat:k}=t.interpolation;this.escape=n!==void 0?n:n0,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=i?Te(i):o||"{{",this.suffix=a?Te(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":h?Te(h):"-",this.unescapeSuffix=this.unescapePrefix?"":d?Te(d):"",this.nestingPrefix=g?Te(g):m||Te("$t("),this.nestingSuffix=p?Te(p):x||Te(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=v||1e3,this.alwaysFormat=k!==void 0?k:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,s)=>(n==null?void 0:n.source)===s?(n.lastIndex=0,n):new RegExp(s,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,s,r){var m;let i,o,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=p=>{if(!p.includes(this.formatSeparator)){const k=ko(n,c,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(k,void 0,s,{...r,...n,interpolationkey:p}):k}const x=p.split(this.formatSeparator),y=x.shift().trim(),v=x.join(this.formatSeparator).trim();return this.format(ko(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure),v,s,{...r,...n,interpolationkey:y})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const d=(r==null?void 0:r.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((m=r==null?void 0:r.interpolation)==null?void 0:m.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>Es(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?Es(this.escape(p)):Es(p)}].forEach(p=>{for(a=0;i=p.regex.exec(t);){const x=i[1].trim();if(o=u(x),o===void 0)if(typeof d=="function"){const v=d(t,i,r);o=W(v)?v:""}else if(r&&Object.prototype.hasOwnProperty.call(r,x))o="";else if(h){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${t}`),o="";else!W(o)&&!this.useRawValueToEscape&&(o=go(o));const y=p.safeValue(o);if(t=t.replace(i[0],y),h?(p.regex.lastIndex+=o.length,p.regex.lastIndex-=i[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n,s={}){let r,i,o;const a=(c,u)=>{const d=this.nestingOptionsSeparator;if(!c.includes(d))return c;const h=c.split(new RegExp(`${Te(d)}[ ]*{`));let g=`{${h[1]}`;c=h[0],g=this.interpolate(g,o);const m=g.match(/'/g),p=g.match(/"/g);(((m==null?void 0:m.length)??0)%2===0&&!p||((p==null?void 0:p.length)??0)%2!==0)&&(g=g.replace(/'/g,'"'));try{o=JSON.parse(g),u&&(o={...u,...o})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,x),`${c}${d}${g}`}return o.defaultValue&&o.defaultValue.includes(this.prefix)&&delete o.defaultValue,c};for(;r=this.nestingRegexp.exec(t);){let c=[];o={...s},o=o.replace&&!W(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const u=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(u!==-1&&(c=r[1].slice(u).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),r[1]=r[1].slice(0,u)),i=n(a.call(this,r[1].trim(),o),o),i&&r[0]===t&&!W(i))return i;W(i)||(i=go(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${t}`),i=""),c.length&&(i=c.reduce((d,h)=>this.format(d,h,s.lng,{...s,interpolationkey:r[1].trim()}),i.trim())),t=t.replace(r[0],i),this.regexp.lastIndex=0}return t}}const u0=e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const s=e.split("(");t=s[0].toLowerCase().trim();const r=s[1].slice(0,-1);t==="currency"&&!r.includes(":")?n.currency||(n.currency=r.trim()):t==="relativetime"&&!r.includes(":")?n.range||(n.range=r.trim()):r.split(";").forEach(o=>{if(o){const[a,...c]=o.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),d=a.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Eo=e=>{const t={};return(n,s,r)=>{let i=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(i={...i,[r.interpolationkey]:void 0});const o=s+JSON.stringify(i);let a=t[o];return a||(a=e(Ut(s),r),t[o]=a),a(n)}},d0=e=>(t,n,s)=>e(Ut(n),s)(t);class f0{constructor(t={}){this.logger=ve.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?Eo:d0;this.formats={number:s((r,i)=>{const o=new Intl.NumberFormat(r,{...i});return a=>o.format(a)}),currency:s((r,i)=>{const o=new Intl.NumberFormat(r,{...i,style:"currency"});return a=>o.format(a)}),datetime:s((r,i)=>{const o=new Intl.DateTimeFormat(r,{...i});return a=>o.format(a)}),relativetime:s((r,i)=>{const o=new Intl.RelativeTimeFormat(r,{...i});return a=>o.format(a,i.range||"day")}),list:s((r,i)=>{const o=new Intl.ListFormat(r,{...i});return a=>o.format(a)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Eo(n)}format(t,n,s,r={}){if(!n||t==null)return t;const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&!i[0].includes(")")&&i.find(a=>a.includes(")"))){const a=i.findIndex(c=>c.includes(")"));i[0]=[i[0],...i.splice(1,a)].join(this.formatSeparator)}return i.reduce((a,c)=>{var h;const{formatName:u,formatOptions:d}=u0(c);if(this.formats[u]){let g=a;try{const m=((h=r==null?void 0:r.formatParams)==null?void 0:h[r.interpolationkey])||{},p=m.locale||m.lng||r.locale||r.lng||s;g=this.formats[u](a,p,{...d,...r,...m})}catch(m){this.logger.warn(m)}return g}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const h0=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class p0 extends rs{constructor(t,n,s,r={}){var i,o;super(),this.backend=t,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=r,this.logger=ve.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],(o=(i=this.backend)==null?void 0:i.init)==null||o.call(i,s,r.backend,r)}queueLoad(t,n,s,r){const i={},o={},a={},c={};return t.forEach(u=>{let d=!0;n.forEach(h=>{const g=`${u}|${h}`;!s.reload&&this.store.hasResourceBundle(u,h)?this.state[g]=2:this.state[g]<0||(this.state[g]===1?o[g]===void 0&&(o[g]=!0):(this.state[g]=1,d=!1,o[g]===void 0&&(o[g]=!0),i[g]===void 0&&(i[g]=!0),c[h]===void 0&&(c[h]=!0)))}),d||(a[u]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(t,n,s){const r=t.split("|"),i=r[0],o=r[1];n&&this.emit("failedLoading",i,o,n),!n&&s&&this.store.addResourceBundle(i,o,s,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&s&&(this.state[t]=0);const a={};this.queue.forEach(c=>{Qg(c.loaded,[i],o),h0(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});const d=c.loaded[u];d.length&&d.forEach(h=>{a[u][h]===void 0&&(a[u][h]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(t,n,s,r=0,i=this.retryTimeout,o){if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:s,tried:r,wait:i,callback:o});return}this.readingCalls++;const a=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&d&&r<this.maxRetries){setTimeout(()=>{this.read(t,n,s,r+1,i*2,o)},i);return}o(u,d)},c=this.backend[s].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}return}return c(t,n,a)}prepareLoading(t,n,s={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();W(t)&&(t=this.languageUtils.toResolveHierarchy(t)),W(n)&&(n=[n]);const i=this.queueLoad(t,n,s,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,s){this.prepareLoading(t,n,{},s)}reload(t,n,s){this.prepareLoading(t,n,{reload:!0},s)}loadOne(t,n=""){const s=t.split("|"),r=s[0],i=s[1];this.read(r,i,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${i} for language ${r} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${i} for language ${r}`,a),this.loaded(t,o,a)})}saveMissing(t,n,s,r,i,o={},a=()=>{}){var c,u,d,h,g;if((u=(c=this.services)==null?void 0:c.utils)!=null&&u.hasLoadedNamespace&&!((h=(d=this.services)==null?void 0:d.utils)!=null&&h.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${s}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if((g=this.backend)!=null&&g.create){const m={...o,isUpdate:i},p=this.backend.create.bind(this.backend);if(p.length<6)try{let x;p.length===5?x=p(t,n,s,r,m):x=p(t,n,s,r),x&&typeof x.then=="function"?x.then(y=>a(null,y)).catch(a):a(null,x)}catch(x){a(x)}else p(t,n,s,r,a,m)}!t||!t[0]||this.store.addResource(t[0],n,s,r)}}}const Ts=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),W(e[1])&&(t.defaultValue=e[1]),W(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(s=>{t[s]=n[s]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),To=e=>(W(e.ns)&&(e.ns=[e.ns]),W(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),W(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),hn=()=>{},m0=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Rt extends rs{constructor(t={},n){if(super(),this.options=To(t),this.services={},this.logger=ve,this.modules={external:[]},m0(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(W(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const s=Ts();this.options={...s,...this.options,...To(t)},this.options.interpolation={...s.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const r=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?ve.init(r(this.modules.logger),this.options):ve.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=f0;const d=new wo(this.options);this.store=new bo(this.options.resources,this.options);const h=this.services;h.logger=ve,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new c0(d,{prepend:this.options.pluralSeparator}),u&&(h.formatter=r(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new jo(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new p0(r(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(g,...m)=>{this.emit(g,...m)}),this.modules.languageDetector&&(h.languageDetector=r(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=r(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Un(this.services,this.options),this.translator.on("*",(g,...m)=>{this.emit(g,...m)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,n||(n=hn),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...d)=>this.store[u](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...d)=>(this.store[u](...d),this)});const a=kt(),c=()=>{const u=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(h),n(d,h)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),a}loadResources(t,n=hn){var i,o;let s=n;const r=W(t)?t:this.language;if(typeof t=="function"&&(s=t),!this.options.resources||this.options.partialBundledLanguages){if((r==null?void 0:r.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const a=[],c=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(h=>{h!=="cimode"&&(a.includes(h)||a.push(h))})};r?c(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(d=>c(d)),(o=(i=this.options.preload)==null?void 0:i.forEach)==null||o.call(i,u=>c(u)),this.services.backendConnector.load(a,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(u)})}else s(null)}reloadResources(t,n,s){const r=kt();return typeof t=="function"&&(s=t,t=void 0),typeof n=="function"&&(s=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),s||(s=hn),this.services.backendConnector.reload(t,n,i=>{r.resolve(),s(i)}),r}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Xl.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let n=0;n<this.languages.length;n++){const s=this.languages[n];if(!["cimode","dev"].includes(s)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&!this.languages.includes(t)&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const s=kt();this.emit("languageChanging",t);const r=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},i=(a,c)=>{c?this.isLanguageChangingTo===t&&(r(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,s.resolve((...u)=>this.t(...u)),n&&n(a,(...u)=>this.t(...u))},o=a=>{var d,h;!t&&!a&&this.services.languageDetector&&(a=[]);const c=W(a)?a:a&&a[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(W(a)?[a]:a);u&&(this.language||r(u),this.translator.language||this.translator.changeLanguage(u),(h=(d=this.services.languageDetector)==null?void 0:d.cacheUserLanguage)==null||h.call(d,u)),this.loadResources(u,g=>{i(g,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(t),s}getFixedT(t,n,s,r){const i=r==null?void 0:r.scopeNs,o=(a,c,...u)=>{let d;typeof c!="object"?d=this.options.overloadTranslationOptionHandler([a,c].concat(u)):d={...c},d.lng=d.lng||o.lng,d.lngs=d.lngs||o.lngs;const h=d.ns!==void 0&&d.ns!==null;d.ns=d.ns||o.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||s||o.keyPrefix);const g={...this.options,...d};Array.isArray(i)&&!h&&(g.ns=i),typeof d.keyPrefix=="function"&&(d.keyPrefix=Ye(d.keyPrefix,g));const m=this.options.keySeparator||".";let p;return d.keyPrefix&&Array.isArray(a)?p=a.map(x=>(typeof x=="function"&&(x=Ye(x,g)),`${d.keyPrefix}${m}${x}`)):(typeof a=="function"&&(a=Ye(a,g)),p=d.keyPrefix?`${d.keyPrefix}${m}${a}`:a),this.t(p,d)};return W(t)?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=s,o}t(...t){var n;return(n=this.translator)==null?void 0:n.translate(...t)}exists(...t){var n;return(n=this.translator)==null?void 0:n.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const o=(a,c)=>{const u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(s,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(s,t)&&(!r||o(i,t)))}loadNamespaces(t,n){const s=kt();return this.options.ns?(W(t)&&(t=[t]),t.forEach(r=>{this.options.ns.includes(r)||this.options.ns.push(r)}),this.loadResources(r=>{s.resolve(),n&&n(r)}),s):(n&&n(),Promise.resolve())}loadLanguages(t,n){const s=kt();W(t)&&(t=[t]);const r=this.options.preload||[],i=t.filter(o=>!r.includes(o)&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=r.concat(i),this.loadResources(o=>{s.resolve(),n&&n(o)}),s):(n&&n(),Promise.resolve())}dir(t){var r,i;if(t||(t=this.resolvedLanguage||(((r=this.languages)==null?void 0:r.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=((i=this.services)==null?void 0:i.languageUtils)||new wo(Ts());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(s.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const s=new Rt(t,n);return s.createInstance=Rt.createInstance,s}cloneInstance(t={},n=hn){const s=t.forkResourceStore;s&&delete t.forkResourceStore;const r={...this.options,...t,isClone:!0},i=new Rt(r);if((t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},s){const a=Object.keys(this.store.data).reduce((c,u)=>(c[u]={...this.store.data[u]},c[u]=Object.keys(c[u]).reduce((d,h)=>(d[h]={...c[u][h]},d),c[u]),c),{});i.store=new bo(a,r),i.services.resourceStore=i.store}if(t.interpolation){const c={...Ts().interpolation,...this.options.interpolation,...t.interpolation},u={...r,interpolation:c};i.services.interpolator=new jo(u)}return i.translator=new Un(i.services,r),i.translator.on("*",(a,...c)=>{i.emit(a,...c)}),i.init(r,n),i.translator.options=r,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ie=Rt.createInstance();ie.createInstance;ie.dir;ie.init;ie.loadResources;ie.reloadResources;ie.use;ie.changeLanguage;ie.getFixedT;ie.t;ie.exists;ie.setDefaultNamespace;ie.hasLoadedNamespace;ie.loadNamespaces;ie.loadLanguages;var Ns,No;function g0(){return No||(No=1,Ns={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),Ns}var y0=g0();const x0=zc(y0);var v0=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Ro(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(x0[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var s=e.indexOf("-->");return{type:"comment",comment:s!==-1?e.slice(4,s):""}}for(var r=new RegExp(v0),i=null;(i=r.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),a=[o,""];o.indexOf("=")>-1&&(a=o.split("=")),t.attrs[a[0]]=a[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var b0=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,w0=/^\s*$/,S0=Object.create(null);function Ql(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var s=[];for(var r in n)s.push(r+'="'+n[r]+'"');return s.length?" "+s.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(Ql,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var C0={parse:function(e,t){t||(t={}),t.components||(t.components=S0);var n,s=[],r=[],i=-1,o=!1;if(e.indexOf("<")!==0){var a=e.indexOf("<");s.push({type:"text",content:a===-1?e:e.substring(0,a)})}return e.replace(b0,function(c,u){if(o){if(c!=="</"+n.name+">")return;o=!1}var d,h=c.charAt(1)!=="/",g=c.startsWith("<!--"),m=u+c.length,p=e.charAt(m);if(g){var x=Ro(c);return i<0?(s.push(x),s):((d=r[i]).children.push(x),s)}if(h&&(i++,(n=Ro(c)).type==="tag"&&t.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!p||p==="<"||n.children.push({type:"text",content:e.slice(m,e.indexOf("<",m))}),i===0&&s.push(n),(d=r[i-1])&&d.children.push(n),r[i]=n),(!h||n.voidElement)&&(i>-1&&(n.voidElement||n.name===c.slice(2,-1))&&(i--,n=i===-1?s:r[i]),!o&&p!=="<"&&p)){d=i===-1?s:r[i].children;var y=e.indexOf("<",m),v=e.slice(m,y===-1?void 0:y);w0.test(v)&&(v=" "),(y>-1&&i+d.length>=0||v!==" ")&&d.push({type:"text",content:v})}}),s},stringify:function(e){return e.reduce(function(t,n){return t+Ql("",n)},"")}};const Sn=(e,t,n,s)=>{var i,o,a,c;const r=[n,{code:t,...s||{}}];if((o=(i=e==null?void 0:e.services)==null?void 0:i.logger)!=null&&o.forward)return e.services.logger.forward(r,"warn","react-i18next::",!0);ce(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),(c=(a=e==null?void 0:e.services)==null?void 0:a.logger)!=null&&c.warn?e.services.logger.warn(...r):console!=null&&console.warn&&console.warn(...r)},Mo={},Kt=(e,t,n,s)=>{ce(n)&&Mo[n]||(ce(n)&&(Mo[n]=new Date),Sn(e,t,n,s))},ec=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},cr=(e,t,n)=>{e.loadNamespaces(t,ec(e,n))},Ao=(e,t,n,s)=>{if(ce(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return cr(e,n,s);n.forEach(r=>{e.options.ns.indexOf(r)<0&&e.options.ns.push(r)}),e.loadLanguages(t,ec(e,s))},k0=(e,t,n={})=>!t.languages||!t.languages.length?(Kt(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,r)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!r(s.isLanguageChangingTo,e))return!1}}),ce=e=>typeof e=="string",Me=e=>typeof e=="object"&&e!==null,j0=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,E0={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},T0=e=>E0[e],tc=e=>e.replace(j0,T0);let ur={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:tc,transDefaultProps:void 0};const N0=(e={})=>{ur={...ur,...e}},ri=()=>ur;let nc;const R0=e=>{nc=e},ii=()=>nc,Cn=(e,t)=>{var s;if(!e)return!1;const n=((s=e.props)==null?void 0:s.children)??e.children;return t?n.length>0:!!n},Et=e=>{var n,s;if(!e)return[];const t=((n=e.props)==null?void 0:n.children)??e.children;return(s=e.props)!=null&&s.i18nIsDynamicList?Oe(t):t},M0=e=>Array.isArray(e)&&e.every(f.isValidElement),Oe=e=>Array.isArray(e)?e:[e],A0=(e,t)=>{const n={...t};return n.props={...t.props,...e.props},n},L0=e=>{const t={};if(!e)return t;const n=s=>{Oe(s).forEach(i=>{ce(i)||(Cn(i)?n(Et(i)):Me(i)&&!f.isValidElement(i)&&Object.assign(t,i))})};return n(e),t},dr=(e,t,n,s)=>{if(!e)return"";let r="";const i=Oe(e),o=t!=null&&t.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((a,c)=>{if(ce(a)){r+=`${a}`;return}if(f.isValidElement(a)){const{props:u,type:d}=a,h=Object.keys(u).length,g=o.indexOf(d)>-1,m=u.children;if(!m&&g&&!h){r+=`<${d}/>`;return}if(!m&&(!g||h)||u.i18nIsDynamicList){r+=`<${c}></${c}>`;return}if(g&&h<=1){const x=ce(m)?m:dr(m,t,n,s);r+=`<${d}>${x}</${d}>`;return}const p=dr(m,t,n,s);r+=`<${c}>${p}</${c}>`;return}if(a===null){Sn(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:s});return}if(Me(a)){const{format:u,...d}=a,h=Object.keys(d);if(h.length===1){const g=u?`${h[0]}, ${u}`:h[0];r+=`{{${g}}}`;return}Sn(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:s,child:a});return}Sn(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:s,child:a})}),r},I0=(e,t=[],n={})=>{if(!e)return e;const s=Object.keys(n),r=[...t,...s];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let a=!1;const c=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(c){const u=c[1];(/^\d+$/.test(u)||r.includes(u))&&(a=!0,i+=c[0],o+=c[0].length)}if(!a){const u=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(u){const d=u[1];(/^\d+$/.test(d)||r.includes(d))&&(a=!0,i+=u[0],o+=u[0].length)}}a||(i+="&lt;",o+=1)}else i+=e[o],o+=1;return i},P0=(e,t,n,s,r,i,o)=>{if(n==="")return[];const a=r.transKeepBasicHtmlNodesFor||[],c=n&&new RegExp(a.map(k=>`<${k}`).join("|")).test(n);if(!e&&!t&&!c&&!o)return[n];const u=t??{},d=k=>{Oe(k).forEach(S=>{ce(S)||(Cn(S)?d(Et(S)):Me(S)&&!f.isValidElement(S)&&Object.assign(u,S))})};d(e);const h=I0(n,a,u),g=C0.parse(`<0>${h}</0>`),m={...u,...i},p=(k,b,S)=>{var T;const w=Et(k),A=y(w,b.children,S);return M0(w)&&A.length===0||(T=k.props)!=null&&T.i18nIsDynamicList?w:A},x=(k,b,S,w,A)=>{k.dummy?(k.children=b,S.push(f.cloneElement(k,{key:w},A?void 0:b))):S.push(...f.Children.map([k],T=>{var E;if(T.type===f.Fragment||((E=T.props)==null?void 0:E.i18nIsDynamicList)!==void 0){const j={key:w};return T&&T.props&&Object.keys(T.props).forEach(O=>{O==="children"||O==="i18nIsDynamicList"||(j[O]=T.props[O])}),f.createElement(T.type,j,A?null:b)}const C={key:w};return T&&T.props&&Object.keys(T.props).forEach(j=>{j==="ref"||j==="children"||(C[j]=T.props[j])}),f.cloneElement(T,C,A?null:b)}))},y=(k,b,S)=>{const w=Oe(k),A=Oe(b),T={};return A.reduce((C,E,j)=>{var $,R;const O=((R=($=E.children)==null?void 0:$[0])==null?void 0:R.content)&&s.services.interpolator.interpolate(E.children[0].content,m,s.language);if(E.type==="tag"){let N=w[parseInt(E.name,10)];!N&&t&&(N=t[E.name]),S.length===1&&!N&&(N=S[0][E.name]),N||(N={});const P={...E.attrs};o&&Object.keys(P).forEach(M=>{const D=P[M];ce(D)&&(P[M]=tc(D))});const I=Object.keys(P).length!==0?A0({props:P},N):N,_=f.isValidElement(I),F=_&&Cn(E,!0)&&!E.voidElement,U=c&&Me(I)&&I.dummy&&!_,L=Me(t)&&Object.hasOwnProperty.call(t,E.name);if(ce(I)){const M=s.services.interpolator.interpolate(I,m,s.language);C.push(M)}else if(Cn(I)||F){const M=p(I,E,S);x(I,M,C,j)}else if(U){const M=y(w,E.children,S);x(I,M,C,j)}else if(Number.isNaN(parseFloat(E.name)))if(L){const M=p(I,E,S);x(I,M,C,j,E.voidElement)}else if(r.transSupportBasicHtmlNodes&&a.indexOf(E.name)>-1)if(E.voidElement)C.push(f.createElement(E.name,{key:`${E.name}-${j}`}));else{const M=T[E.name]||0;T[E.name]=M+1;let D,B=0;for(let z=0;z<w.length;z+=1){const X=w[z];if(f.isValidElement(X)&&X.type===E.name){if(B===M){D=X;break}B+=1}}const V=D?Oe(Et(D)):w,K=y(V,E.children,S);C.push(f.createElement(E.name,{key:`${E.name}-${j}`},K))}else if(E.voidElement)C.push(`<${E.name} />`);else{const M=y(w,E.children,S);C.push(`<${E.name}>${M}</${E.name}>`)}else if(Me(I)&&!_){const M=E.children[0]?O:null;M&&C.push(M)}else x(I,O,C,j,E.children.length!==1||!O)}else if(E.type==="text"){const N=r.transWrapTextNodes,P=typeof r.unescape=="function"?r.unescape:ri().unescape,I=o?P(s.services.interpolator.interpolate(E.content,m,s.language)):s.services.interpolator.interpolate(E.content,m,s.language);N?C.push(f.createElement(N,{key:`${E.name}-${j}`},I)):C.push(I)}return C},[])},v=y([{dummy:!0,children:e||[]}],g,Oe(e||[]));return Et(v[0])},sc=(e,t,n)=>{const s=e.key||t,r=f.cloneElement(e,{key:s});if(!r.props||!r.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return r;function i(){return f.createElement(f.Fragment,null,r)}return f.createElement(i,{key:s})},$0=(e,t)=>e.map((n,s)=>sc(n,s,t)),O0=(e,t)=>{const n={};return Object.keys(e).forEach(s=>{Object.assign(n,{[s]:sc(e[s],s,t)})}),n},_0=(e,t,n,s)=>e?Array.isArray(e)?$0(e,t):Me(e)?O0(e,t):(Kt(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:s}),null):null,F0=e=>!Me(e)||Array.isArray(e)?!1:Object.keys(e).reduce((t,n)=>t&&Number.isNaN(Number.parseFloat(n)),!0);function D0({children:e,count:t,parent:n,i18nKey:s,context:r,tOptions:i={},values:o,defaults:a,components:c,ns:u,i18n:d,t:h,shouldUnescape:g,...m}){var L,M,D,B,V,K;const p=d||ii();if(!p)return Kt(p,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:s}),e;const x=h||p.t.bind(p)||(z=>z),y={...ri(),...(L=p.options)==null?void 0:L.react};let v=u||x.ns||((M=p.options)==null?void 0:M.defaultNS);v=ce(v)?[v]:v||["translation"];const{transDefaultProps:k}=y,b=k!=null&&k.tOptions?{...k.tOptions,...i}:i,S=g??(k==null?void 0:k.shouldUnescape),w=k!=null&&k.values?{...k.values,...o}:o,A=k!=null&&k.components?{...k.components,...c}:c,T=dr(e,y,p,s),C=a||(b==null?void 0:b.defaultValue)||T||y.transEmptyNodeValue||(typeof s=="function"?Ye(s):s),{hashTransKey:E}=y,j=s||(E?E(T||C):T||C);(B=(D=p.options)==null?void 0:D.interpolation)!=null&&B.defaultVariables?o=w&&Object.keys(w).length>0?{...w,...p.options.interpolation.defaultVariables}:{...p.options.interpolation.defaultVariables}:o=w;const O=L0(e);O&&typeof O.count=="number"&&t===void 0&&(t=O.count);const $=o||t!==void 0&&!((K=(V=p.options)==null?void 0:V.interpolation)!=null&&K.alwaysFormat)||!e?b.interpolation:{interpolation:{...b.interpolation,prefix:"#$?",suffix:"?$#"}},R={...b,context:r||b.context,count:t,...o,...$,defaultValue:C,ns:v};let N=j?x(j,R):C;N===j&&C&&(N=C);const P=_0(A,N,p,s);let I=P||e,_=null;F0(P)&&(_=P,I=e);const F=P0(I,_,N,p,y,R,S),U=n??y.defaultTransParent;return U?f.createElement(U,m,F):F}const V0={type:"3rdParty",init(e){N0(e.options.react),R0(e)}},rc=f.createContext();class B0{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function z0({children:e,count:t,parent:n,i18nKey:s,context:r,tOptions:i={},values:o,defaults:a,components:c,ns:u,i18n:d,t:h,shouldUnescape:g,...m}){var k;const{i18n:p,defaultNS:x}=f.useContext(rc)||{},y=d||p||ii(),v=h||(y==null?void 0:y.t.bind(y));return D0({children:e,count:t,parent:n,i18nKey:s,context:r,tOptions:i,values:o,defaults:a,components:c,ns:u||(v==null?void 0:v.ns)||x||((k=y==null?void 0:y.options)==null?void 0:k.defaultNS),i18n:y,t:h,shouldUnescape:g,...m})}var Rs={exports:{}},Ms={};/**
252
- * @license React
253
- * use-sync-external-store-shim.production.js
254
- *
255
- * Copyright (c) Meta Platforms, Inc. and affiliates.
256
- *
257
- * This source code is licensed under the MIT license found in the
258
- * LICENSE file in the root directory of this source tree.
259
- */var Lo;function H0(){if(Lo)return Ms;Lo=1;var e=Hc();function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(h,g){var m=g(),p=s({inst:{value:m,getSnapshot:g}}),x=p[0].inst,y=p[1];return i(function(){x.value=m,x.getSnapshot=g,c(x)&&y({inst:x})},[h,m,g]),r(function(){return c(x)&&y({inst:x}),h(function(){c(x)&&y({inst:x})})},[h]),o(m),m}function c(h){var g=h.getSnapshot;h=h.value;try{var m=g();return!n(h,m)}catch{return!0}}function u(h,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Ms.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Ms}var Io;function U0(){return Io||(Io=1,Rs.exports=H0()),Rs.exports}var K0=U0();const W0=(e,t)=>{if(ce(t))return t;if(Me(t)&&ce(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){const n=e[e.length-1];return typeof n=="function"?"":n}return e},q0={t:W0,ready:!1},G0=()=>()=>{},q=(e,t={})=>{var E,j,O;const{i18n:n}=t,{i18n:s,defaultNS:r}=f.useContext(rc)||{},i=n||s||ii();i&&!i.reportNamespaces&&(i.reportNamespaces=new B0),i||Kt(i,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=f.useMemo(()=>{var $;return{...ri(),...($=i==null?void 0:i.options)==null?void 0:$.react,...t}},[i,t]),{useSuspense:a,keyPrefix:c}=o,u=r||((E=i==null?void 0:i.options)==null?void 0:E.defaultNS),d=ce(u)?[u]:u||["translation"],h=f.useMemo(()=>d,d);(O=(j=i==null?void 0:i.reportNamespaces)==null?void 0:j.addUsedNamespaces)==null||O.call(j,h);const g=f.useRef(0),m=f.useCallback($=>{if(!i)return G0;const{bindI18n:R,bindI18nStore:N}=o,P=()=>{g.current+=1,$()};return R&&i.on(R,P),N&&i.store.on(N,P),()=>{R&&R.split(" ").forEach(I=>i.off(I,P)),N&&N.split(" ").forEach(I=>i.store.off(I,P))}},[i,o]),p=f.useRef(),x=f.useCallback(()=>{if(!i)return q0;const $=!!(i.isInitialized||i.initializedStoreOnce)&&h.every(F=>k0(F,i,o)),R=t.lng||i.language,N=g.current,P=p.current;if(P&&P.ready===$&&P.lng===R&&P.keyPrefix===c&&P.revision===N)return P;const _={t:i.getFixedT(R,o.nsMode==="fallback"?h:h[0],c,{scopeNs:h}),ready:$,lng:R,keyPrefix:c,revision:N};return p.current=_,_},[i,h,c,o,t.lng]),[y,v]=f.useState(0),{t:k,ready:b}=K0.useSyncExternalStore(m,x,x);f.useEffect(()=>{if(i&&!b&&!a){const $=()=>v(R=>R+1);t.lng?Ao(i,t.lng,h,$):cr(i,h,$)}},[i,t.lng,h,b,a,y]);const S=i||{},w=f.useRef(null),A=f.useRef(),T=$=>{const R=Object.getOwnPropertyDescriptors($);R.__original&&delete R.__original;const N=Object.create(Object.getPrototypeOf($),R);if(!Object.prototype.hasOwnProperty.call(N,"__original"))try{Object.defineProperty(N,"__original",{value:$,writable:!1,enumerable:!1,configurable:!1})}catch{}return N},C=f.useMemo(()=>{const $=S,R=$==null?void 0:$.language;let N=$;$&&(w.current&&w.current.__original===$?A.current!==R?(N=T($),w.current=N,A.current=R):N=w.current:(N=T($),w.current=N,A.current=R));const P=!b&&!a?(..._)=>(Kt(i,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),k(..._)):k,I=[P,N,b];return I.t=P,I.i18n=N,I.ready=b,I},[k,S,b,S.resolvedLanguage,S.language,S.languages]);if(i&&a&&!b)throw new Promise($=>{const R=()=>$();t.lng?Ao(i,t.lng,h,R):cr(i,h,R)});return C},Po=e=>{let t;const n=new Set,s=(u,d)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const g=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,g))}},r=()=>t,a={setState:s,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(s,r,a);return a},Y0=(e=>e?Po(e):Po),J0=e=>e;function X0(e,t=J0){const n=ln.useSyncExternalStore(e.subscribe,ln.useCallback(()=>t(e.getState()),[e,t]),ln.useCallback(()=>t(e.getInitialState()),[e,t]));return ln.useDebugValue(n),n}const $o=e=>{const t=Y0(e),n=s=>X0(t,s);return Object.assign(n,t),n},sn=(e=>e?$o(e):$o),ct={appearance:"paimon:appearance",background:"paimon:background",notification:"paimon:notification"};function fr(){const e=localStorage.getItem(ct.appearance);return e==="light"||e==="dark"||e==="system"?e:"system"}function ic(){const e=localStorage.getItem(ct.background);return e==="mist"||e==="aurora"||e==="ember"?e:"mist"}function Z0(){return localStorage.getItem(ct.notification)==="true"}function oc(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Kn(e,t){const n=oc(e);return document.documentElement.setAttribute("data-theme",n),document.documentElement.setAttribute("data-bg",t),n}const ue=sn(e=>({appearance:fr(),background:ic(),resolvedTheme:oc(fr()),notification:Z0(),setAppearance:t=>{localStorage.setItem(ct.appearance,t);const n=Kn(t,ue.getState().background);e({appearance:t,resolvedTheme:n})},setBackground:t=>{localStorage.setItem(ct.background,t),Kn(ue.getState().appearance,t),e({background:t})},setNotification:t=>{localStorage.setItem(ct.notification,String(t)),e({notification:t})}})),Q0=window.matchMedia("(prefers-color-scheme: dark)");Q0.addEventListener("change",()=>{const{appearance:e,background:t}=ue.getState();if(e==="system"){const n=Kn(e,t);ue.setState({resolvedTheme:n})}});function e1(){const e=ue(n=>n.appearance),t=ue(n=>n.setAppearance);return[e,t]}function ac(){const e=ue(n=>n.background),t=ue(n=>n.setBackground);return[e,t]}function lc(){return ue(e=>e.resolvedTheme)}function t1(){const e=ue(n=>n.notification),t=ue(n=>n.setNotification);return[e,t]}Kn(fr(),ic());const Oo=window.__BASE_PATH__||"/",cc=Oo==="/"?"":Oo;function Ze(e){return`${cc}${e}`}const n1=Ze("/logos/mist/light/paimon-logo.png");function uc(e,t){return!e||!t?n1:Ze(`/logos/${e}/${t}/paimon-logo.png`)}function oi(){const[e]=ac(),t=lc();return uc(e,t)}function s1(){const{background:e,resolvedTheme:t}=ue.getState();return uc(e,t)}const ai="paimon:accessToken";function hr(){return localStorage.getItem(ai)}function dc(e){localStorage.setItem(ai,e)}function fc(){localStorage.removeItem(ai)}function r1({onLogin:e,error:t}){const{t:n}=q(),s=f.useId(),r=f.useId(),[i,o]=f.useState(""),[a,c]=f.useState(!1),[u,d]=f.useState(!1),h=oi(),g=f.useCallback(async m=>{m.preventDefault();const p=i.trim();if(!(!p||a)){c(!0),d(!1);try{if((await fetch(Ze("/api/instances"),{headers:{Authorization:`Bearer ${p}`}})).status===401){d(!0),c(!1);return}}catch{}c(!1),dc(p),e(p)}},[i,a,e]);return l.jsx("div",{className:"fixed-viewport flex items-center justify-center p-4 overflow-y-auto",children:l.jsxs("form",{onSubmit:g,className:"glass-panel w-full max-w-[380px] p-8 flex flex-col items-center gap-6",children:[l.jsx("img",{src:h,alt:"Paimon",className:"w-16 h-16 select-none",draggable:!1}),l.jsxs("div",{className:"text-center",children:[l.jsx("h1",{className:"text-[17px] font-semibold text-[var(--label-primary)]",children:"Paimon"}),l.jsx("p",{className:"mt-1 text-[13px] text-[var(--label-secondary)]",children:n("login.subtitle")})]}),l.jsxs(ar,{label:n("login.placeholder"),htmlFor:s,children:[l.jsx(si,{id:s,"aria-describedby":t||u?r:void 0,invalid:t||u,type:"password",value:i,onChange:m=>o(m.target.value),placeholder:n("login.placeholder"),autoFocus:!0,disabled:a,autoComplete:"off"}),(t||u)&&l.jsx("div",{id:r,children:l.jsx(we,{compact:!0,tone:"error",children:n("login.invalidToken")})})]}),l.jsx(Y,{variant:"primary",loading:a,type:"submit",disabled:!i.trim()||a,className:"w-full",children:n(a?"login.verifying":"login.connect")}),l.jsx("p",{className:"text-[11px] text-[var(--label-tertiary)] text-center leading-relaxed",children:l.jsx(z0,{i18nKey:"login.tokenHint",components:{1:l.jsx("code",{className:"px-1 py-0.5 rounded-inline bg-[var(--fill-secondary)] text-[var(--label-secondary)]"})}})})]})})}function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function i1(){const[e,t]=f.useState(hr()),[n,s]=f.useState(!1),[r,i]=f.useState(()=>hr()===null);f.useEffect(()=>{if(!r)return;let c=!1;return(async()=>{try{const d=await fetch(Ze("/api/token"),{signal:AbortSignal.timeout(3e3)});if(c||!d.ok)return;const h=await d.json();if(c||!se(h)||typeof h.token!="string")return;const g=h.token;dc(g),t(g)}catch{}finally{c||i(!1)}})(),()=>{c=!0}},[r]);const o=f.useCallback(c=>{s(!1),t(c)},[]),a=f.useCallback(()=>{fc(),t(null),s(!0)},[]);return{authToken:e,authError:n,probing:r,handleLogin:o,handleAuthError:a}}const _o={BROWSER_HEARTBEAT_INTERVAL:3e4,BROWSER_PONG_TIMEOUT:1e4};let Re=null;const pr=new Set;let ut=!1,kn=null,Je=null,jn=null,Mt=null,rt=null,At,As=!1;const o1=3e3,a1=3e3;function l1(e){for(const t of pr)try{t(e)}catch(n){console.error("[useWebSocket] listener error:",n)}}function c1(e){kn=setInterval(()=>{e.readyState===WebSocket.OPEN&&(e.send(JSON.stringify({type:"ping"})),Je=setTimeout(()=>{e.close()},_o.BROWSER_PONG_TIMEOUT))},_o.BROWSER_HEARTBEAT_INTERVAL)}function hc(){kn&&(clearInterval(kn),kn=null),Je&&(clearTimeout(Je),Je=null)}function Ls(){ut||(jn=setTimeout(pc,a1))}function mr(){Mt&&(clearTimeout(Mt),Mt=null)}function pc(){if(ut||!rt)return;const n=`${`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${Ze("/ws/browser")}`}?token=${encodeURIComponent(rt)}`;As=!1;const s=new WebSocket(n);Re=s,le.setState({connectionState:"connecting"}),Mt=setTimeout(()=>{Mt=null,s.readyState===WebSocket.CONNECTING&&s.close()},o1),s.onopen=()=>{mr(),As=!0,le.setState({connectionState:"connected"}),s.send(JSON.stringify({type:"list"})),c1(s)},s.onmessage=r=>{try{const i=JSON.parse(r.data);if(i.type==="pong"){Je&&(clearTimeout(Je),Je=null);return}l1(i)}catch{}},s.onclose=()=>{if(mr(),le.setState({connectionState:"disconnected"}),Re=null,hc(),!ut&&!As){const r={};rt&&(r.Authorization=`Bearer ${rt}`),fetch(Ze("/api/instances"),{headers:r}).then(i=>{i.status===401?At==null||At():Ls()}).catch(()=>{Ls()});return}ut||Ls()},s.onerror=()=>{s.close()}}const le=sn((e,t)=>({connectionState:"idle",send:n=>{(Re==null?void 0:Re.readyState)===WebSocket.OPEN&&Re.send(JSON.stringify(n))},subscribe:n=>(pr.add(n),()=>{pr.delete(n)}),connect:(n,s)=>{t().disconnect(),ut=!1,rt=n,At=s,pc()},disconnect:()=>{ut=!0,rt=null,At=void 0,hc(),mr(),jn&&(clearTimeout(jn),jn=null),Re&&(Re.close(),Re=null),e({connectionState:"idle"})}}));function u1(e,t){let n;try{n=e()}catch{return}return{getItem:r=>{var i;const o=c=>c===null?null:JSON.parse(c,void 0),a=(i=n.getItem(r))!=null?i:null;return a instanceof Promise?a.then(o):o(a)},setItem:(r,i)=>n.setItem(r,JSON.stringify(i,void 0)),removeItem:r=>n.removeItem(r)}}const gr=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return gr(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return gr(s)(n)}}}},d1=(e,t)=>(n,s,r)=>{let i={storage:u1(()=>window.localStorage),partialize:y=>y,version:0,merge:(y,v)=>({...v,...y}),...t},o=!1,a=0;const c=new Set,u=new Set;let d=i.storage;if(!d)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...y)},s,r);const h=()=>{const y=i.partialize({...s()});return d.setItem(i.name,{state:y,version:i.version})},g=r.setState;r.setState=(y,v)=>(g(y,v),h());const m=e((...y)=>(n(...y),h()),s,r);r.getInitialState=()=>m;let p;const x=()=>{var y,v;if(!d)return;const k=++a;o=!1,c.forEach(S=>{var w;return S((w=s())!=null?w:m)});const b=((v=i.onRehydrateStorage)==null?void 0:v.call(i,(y=s())!=null?y:m))||void 0;return gr(d.getItem.bind(d))(i.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==i.version){if(i.migrate){const w=i.migrate(S.state,S.version);return w instanceof Promise?w.then(A=>[!0,A]):[!0,w]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var w;if(k!==a)return;const[A,T]=S;if(p=i.merge(T,(w=s())!=null?w:m),n(p,!0),A)return h()}).then(()=>{k===a&&(b==null||b(s(),void 0),p=s(),o=!0,u.forEach(S=>S(p)))}).catch(S=>{k===a&&(b==null||b(void 0,S))})};return r.persist={setOptions:y=>{i={...i,...y},y.storage&&(d=y.storage)},clearStorage:()=>{d==null||d.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:y=>(c.add(y),()=>{c.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},i.skipHydration||x(),p||m},mc=d1,Tt=sn()(mc(e=>({instances:[],instanceListReady:!1,handleMessage:t=>{switch(t.type){case"instance_list":e({instances:t.payload.instances,instanceListReady:!0});break;case"instance_update":{const{instance:n,action:s}=t.payload;s==="connected"?e(r=>({instances:r.instances.some(o=>o.id===n.id)?r.instances.map(o=>o.id===n.id?n:o):[...r.instances,n]})):s==="disconnected"?e(r=>({instances:r.instances.filter(i=>i.id!==n.id)})):s==="updated"&&e(r=>({instances:r.instances.map(i=>i.id===n.id?n:i)}));break}}}}),{name:"paimon:instances",partialize:e=>({instances:e.instances})}));function f1(e){return t=>e?t.instances.find(n=>n.id===e):void 0}const gc="Notification"in window;function h1(e){return e.action==="updated"&&e.settledOutcome==="completed"}function p1(){const e=le(r=>r.subscribe),t=Yt(),n=f.useRef(t);f.useEffect(()=>{n.current=t},[t]);const s=f.useRef(ue.getState().notification);f.useEffect(()=>ue.subscribe(r=>{s.current=r.notification}),[]),f.useEffect(()=>e(r=>{if(r.type==="instance_update"&&s.current&&h1(r.payload)){const{instance:i}=r.payload;m1(i.id,i.cwd,n)}}),[e])}function m1(e,t,n){if(document.hasFocus()||!gc||Notification.permission!=="granted")return;const s=t.split("/").pop()||t,r=new Notification("Paimon",{body:ie.t("notification.taskComplete",{name:s}),icon:s1()});r.onclick=()=>{var i;window.focus(),(i=n.current)==null||i.call(n,`/instance/${e}`),r.close()}}function g1(){const{t:e}=q(),t=oi();return l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsxs("div",{className:"text-center select-none",children:[l.jsx("img",{src:t,alt:"Paimon",className:"w-16 h-16 mx-auto mb-4 opacity-80"}),l.jsx("div",{className:"text-[14px] text-[var(--label-tertiary)] tracking-wide",children:e("eventStream.tagline")})]})})}function y1(){return l.jsx("div",{className:"relative flex-1 min-w-0 overflow-hidden flex flex-col",children:l.jsx(Xu,{})})}const dt=e=>e!==void 0&&e!=="idle";function yc(e){return e==="streaming"?"sidebar.statusStreaming":e==="compacting"?"sidebar.statusCompacting":e==="idle"?"sidebar.statusIdle":"sidebar.statusPending"}function xc(e){return e==="streaming"?"bg-[var(--color-accent)] animate-pulse motion-reduce:animate-none":e==="compacting"?"bg-[var(--toast-icon-warning)] animate-pulse motion-reduce:animate-none":e==="idle"?"bg-[var(--toast-icon-success)]":"bg-[var(--label-secondary)]"}const Fo=sn()(mc(e=>({collapsedEdges:{},toggleEdge:t=>e(n=>({collapsedEdges:{...n.collapsedEdges,[t]:!n.collapsedEdges[t]}}))}),{name:"paimon:sidebar",partialize:e=>({collapsedEdges:e.collapsedEdges})}));function vc(e,t){return kg(e,t)}const x1=vc("dialog"),ft=vc("div");function bc(e){return l.jsx(tn,{features:ss,strict:!0,children:l.jsx(v1,{...e})})}function v1({className:e="",children:t,...n}){const s=ts(),r=f.useContext(je).reducedMotion,i=nn()||r==="always";return l.jsx(ft,{...n,className:`glass-popover ui-floating ${e}`,inert:!s,"aria-hidden":!s||void 0,initial:{opacity:i?1:0,y:i?0:4,scale:i?1:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:i?0:4,scale:i?1:.98},transition:{duration:i?0:.12},children:t})}function wc(e){function t(){const r=window.visualViewport;return{top:(r==null?void 0:r.offsetTop)??0,left:(r==null?void 0:r.offsetLeft)??0,width:(r==null?void 0:r.width)??window.innerWidth,height:(r==null?void 0:r.height)??window.innerHeight}}const[n,s]=f.useState(t);return f.useLayoutEffect(()=>{if(!e)return;function r(){const o=t();s(a=>a.top===o.top&&a.left===o.left&&a.width===o.width&&a.height===o.height?a:o)}r();const i=window.visualViewport;return window.addEventListener("resize",r),i==null||i.addEventListener("resize",r),i==null||i.addEventListener("scroll",r),()=>{window.removeEventListener("resize",r),i==null||i.removeEventListener("resize",r),i==null||i.removeEventListener("scroll",r)}},[e]),n}function wt({trigger:e,label:t,width:n=200,maxHeight:s=1/0,children:r,disabled:i=!1,placement:o="top",align:a="right",onOpenChange:c}){const[u,d]=f.useState(!1),h=f.useRef(c);h.current=c,f.useLayoutEffect(()=>{var w;(w=h.current)==null||w.call(h,u)},[u]);const[g,m]=f.useState(null),p=wc(u),x=f.useRef(null),y=f.useRef(null),v=f.useId(),k=f.useCallback(()=>{var w,A;d(!1),(A=(w=x.current)==null?void 0:w.querySelector("button"))==null||A.focus()},[]);f.useLayoutEffect(()=>{var N;if(!u)return;const w=(N=x.current)==null?void 0:N.getBoundingClientRect();if(!w)return;const A=Math.min(n,Math.max(0,p.width-24)),T=Math.max(p.top+12,Math.min(w.top,p.top+p.height-12)),C=Math.max(T,Math.min(w.bottom,p.top+p.height-12)),E=Math.max(0,T-p.top-20),j=Math.max(0,p.top+p.height-C-20),O=o==="bottom"?j>=160||j>=E:E<160&&j>E,$=Math.max(p.left+12,Math.min(a==="left"?w.left:w.right-A,p.left+p.width-A-12)),R=Math.max(E,j)<160;m({left:$,...R?{top:p.top+12}:O?{top:Math.max(p.top+12,C+8)}:{bottom:Math.max(12,window.innerHeight-T+8)},maxHeight:Math.min(s,R?Math.max(0,p.height-24):O?j:E)})},[u,p,n,s,o,a]),f.useEffect(()=>{i&&d(!1)},[i]),f.useEffect(()=>{if(!u)return;const w=y.current;w&&!w.contains(document.activeElement)&&(w.querySelector("input, button:not([disabled])")??w).focus();const A=T=>{T.key==="Escape"&&(T.preventDefault(),k())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[u,!!g,k]),f.useEffect(()=>{if(!u)return;function w(A){const T=A.composedPath(),C=x.current,E=y.current;!(C&&T.includes(C))&&!(E&&T.includes(E))&&d(!1)}return document.addEventListener("mousedown",w,!0),document.addEventListener("click",w,!0),()=>{document.removeEventListener("mousedown",w,!0),document.removeEventListener("click",w,!0)}},[u]),f.useEffect(()=>{if(!u)return;const w=()=>d(!1);return window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w)}},[u]);const b=()=>{if(!i){if(u){d(!1);return}d(!0)}},S=g?pt.createPortal(l.jsx(Ee,{children:u&&g&&l.jsx(bc,{ref:y,id:v,role:t?"dialog":void 0,"aria-label":t,tabIndex:-1,className:"z-50",style:{position:"fixed",...g,width:`${Math.min(n,Math.max(0,p.width-24))}px`,maxWidth:"calc(100vw - 24px)"},children:r(k)},"popover")}),document.body):null;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"relative min-w-0",ref:x,onClick:b,children:e({open:u,id:v})}),S]})}function be({selected:e=!1,danger:t=!1,className:n="",type:s="button",...r}){return l.jsx("button",{...r,type:s,"data-selected":e||void 0,"data-danger":t||void 0,className:`ui-menu-item ${n}`})}function b1(e,t,n=12){const{innerWidth:s,innerHeight:r}=window;let i=e.x,o=e.y;return i+t.width+n>s&&(i=s-t.width-n),o+t.height+n>r&&(o=r-t.height-n),i=Math.max(n,i),o=Math.max(n,o),{left:i,top:o}}function w1({position:e,onClose:t,children:n}){const s=f.useRef(null),r=ts(),i=wc(r),[o,a]=f.useState(e),c=f.useRef(t);c.current=t;const u=f.useCallback(()=>c.current(),[]);return f.useEffect(()=>{if(!r)return;function d(m){s.current&&!s.current.contains(m.target)&&u()}function h(m){s.current&&!s.current.contains(m.target)&&u()}function g(m){m.key==="Escape"&&u()}return document.addEventListener("mousedown",d),document.addEventListener("contextmenu",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("contextmenu",h),document.removeEventListener("keydown",g)}},[u,r]),f.useEffect(()=>{var h,g;const d=document.activeElement;return(g=(h=s.current)==null?void 0:h.querySelector("button:not(:disabled)"))==null||g.focus({preventScroll:!0}),()=>{var m;d instanceof HTMLElement&&d.isConnected&&(document.activeElement===document.body||(m=s.current)!=null&&m.contains(document.activeElement))&&d.focus({preventScroll:!0})}},[]),f.useLayoutEffect(()=>{if(s.current){const d=s.current.getBoundingClientRect(),h=b1(e,{width:d.width,height:d.height});a({x:Math.max(i.left+12,Math.min(h.left,i.left+i.width-d.width-12)),y:Math.max(i.top+12,Math.min(h.top,i.top+i.height-d.height-12))})}},[e,i]),pt.createPortal(l.jsx(bc,{role:"menu",ref:s,className:"z-50 p-1.5 min-w-[160px] scrollbar-auto",style:{position:"fixed",left:o.x,top:o.y,maxWidth:i.width-24,maxHeight:i.height-24},children:n}),document.body)}function S1({icon:e,label:t,danger:n=!1,disabled:s=!1,onClick:r}){return l.jsxs(be,{role:"menuitem",danger:n,onClick:i=>{i.stopPropagation(),s||r()},disabled:s,children:[e&&l.jsx("span",{className:"flex-shrink-0 w-4 h-4 flex items-center justify-center",children:e}),l.jsx("span",{children:t})]})}const C1=500;function Do({instances:e,selectedId:t,onSelect:n,onShutdown:s,onNewInstance:r}){const{t:i}=q(),o=Yt(),{pathname:a}=xe(),c=oi(),u=f.useId(),d=Fo(C=>C.collapsedEdges),h=Fo(C=>C.toggleEdge),g=le(C=>C.connectionState),[m,p]=f.useState(null),x=f.useRef(null),y=f.useRef(!1),[v,k]=f.useState(null),b=f.useRef(null),S=f.useCallback(()=>{x.current&&clearTimeout(x.current),x.current=null},[]);f.useEffect(()=>()=>{S(),b.current&&clearTimeout(b.current)},[S]);const w=f.useCallback((C,E)=>{S(),y.current=!1;const j=C.touches[0];if(!j)return;const O={x:j.clientX,y:j.clientY};x.current=setTimeout(()=>{var $;x.current=null,y.current=!0,($=navigator.vibrate)==null||$.call(navigator,10),p({position:O,instanceId:E})},C1)},[S]),A=f.useCallback(C=>{navigator.clipboard.writeText(C).then(()=>{k(C),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>k(null),1500)},()=>{})},[]),T=f.useMemo(()=>{const C=new Map;for(const E of e){const j=C.get(E.edgeId);j?j.push(E):C.set(E.edgeId,[E])}return[...C.entries()].sort((E,j)=>E[0].localeCompare(j[0]))},[e]);return l.jsxs("aside",{className:"sidebar-layout select-none glass-panel flex min-h-0 w-full flex-1 flex-col overflow-hidden md:w-[240px] md:flex-none lg:w-[260px]",children:[l.jsxs("header",{className:"sidebar-header flex min-h-[60px] shrink-0 items-center gap-2 px-3 py-2",children:[l.jsxs("button",{type:"button",onClick:()=>o("/"),title:i("navigation.home"),"aria-label":i("navigation.home"),"aria-current":a==="/"?"page":void 0,className:"sidebar-brand flex min-w-0 flex-1 items-center gap-2 rounded-control text-left",children:[l.jsx("img",{src:c,alt:"",className:"h-[34px] w-[34px] shrink-0 object-contain"}),l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block truncate text-[14px] font-semibold leading-[20px] text-[var(--label-primary)]",children:i("navigation.brand")}),l.jsx("span",{className:"block text-[10px] leading-[14px] text-[var(--label-secondary)]",children:i(g==="connected"?"sidebar.hubConnected":g==="connecting"?"sidebar.hubConnecting":"sidebar.hubDisconnected")})]})]}),l.jsxs("nav",{className:"sidebar-navigation flex shrink-0 items-center gap-1","aria-label":i("navigation.main"),children:[l.jsx(Y,{size:"icon",type:"button",onClick:r,title:i("sidebar.newInstance"),"aria-label":i("sidebar.newInstance"),className:"navigation-create",children:l.jsx(Aa,{size:18,"aria-hidden":"true"})}),l.jsx("button",{type:"button",onClick:()=>o("/settings"),title:i("sidebar.settings"),"aria-label":i("sidebar.settings"),"aria-current":a==="/settings"?"page":void 0,className:"navigation-item",children:l.jsx(If,{size:18,"aria-hidden":"true"})})]})]}),l.jsx("section",{className:"instance-list flex min-h-0 min-w-0 flex-1 flex-col","aria-label":i("navigation.instances"),children:l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3 pt-2 scrollbar-auto",children:e.length===0?l.jsxs("div",{className:"px-4 py-12 text-center text-[13px] leading-[20px] text-[var(--label-secondary)]",children:[l.jsx(Af,{size:24,className:"mx-auto mb-3 opacity-60","aria-hidden":"true"}),i("sidebar.noInstances")]}):T.map(([C,E])=>l.jsxs("section",{className:"mb-3","data-edge-id":C,"aria-label":C,children:[l.jsxs("div",{className:"sidebar-edge-header flex items-center gap-1",children:[l.jsxs("button",{type:"button","aria-expanded":!d[C],"aria-controls":`${u}-edge-${encodeURIComponent(C)}`,"aria-label":i("sidebar.toggleMachine",{edgeId:C}),title:C,onClick:()=>h(C),className:"sidebar-edge-toggle flex min-w-0 flex-1 items-center gap-1.5 rounded-control px-2 py-1.5 text-left text-[11px] leading-[16px] text-[var(--label-secondary)]",children:[l.jsx(De,{size:12,className:`shrink-0 ${d[C]?"":"rotate-90"}`,"aria-hidden":"true"}),l.jsx("span",{className:"truncate",children:C}),l.jsxs("span",{className:"shrink-0 tabular-nums",children:["(",E.length,")"]})]}),l.jsx(wt,{label:i("sidebar.machineActions",{edgeId:C}),placement:"bottom",trigger:({open:j,id:O})=>l.jsx(Y,{size:"icon",type:"button",className:"sidebar-edge-actions","aria-label":i("sidebar.machineActions",{edgeId:C}),title:i("sidebar.machineActions",{edgeId:C}),"aria-haspopup":"dialog","aria-expanded":j,"aria-controls":j?O:void 0,children:v===C?l.jsx(yt,{size:14,"aria-hidden":"true"}):l.jsx(Ds,{size:14,"aria-hidden":"true"})}),children:j=>l.jsx("div",{className:"p-2",children:l.jsxs(be,{onClick:()=>{A(C),j()},children:[l.jsx(Nr,{size:14,"aria-hidden":"true"}),i("sidebar.copyMachineId")]})})})]}),l.jsx("ul",{id:`${u}-edge-${encodeURIComponent(C)}`,hidden:!!d[C],className:"space-y-1",children:E.map(j=>{var N;const O=j.cwd.split("/").filter(Boolean).pop()||j.cwd,$=yc(j.status),R=(N=j.contextUsage)==null?void 0:N.percent;return l.jsxs("li",{"data-instance-id":j.id,className:"instance-row relative","data-selected":t===j.id||void 0,children:[l.jsxs("button",{type:"button","data-instance-select":!0,title:j.cwd,"aria-current":t===j.id?"page":void 0,onClick:()=>{if(y.current){y.current=!1;return}n(j.id)},onTouchStart:P=>w(P,j.id),onTouchEnd:S,onTouchMove:S,onTouchCancel:S,className:"instance-item w-full rounded-control text-left",children:[l.jsx("span",{className:`instance-status h-2 w-2 rounded-full ${xc(j.status)}`,title:i($),"aria-hidden":"true"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-[14px] font-medium leading-[20px] text-[var(--label-primary)]",children:O}),l.jsx("span",{className:"sr-only",children:i($)}),l.jsx("div",{className:"mt-0.5 truncate text-[11px] leading-[14px] text-[var(--label-secondary)]",children:j.model.name||`${j.model.provider}/${j.model.id}`}),R!=null&&R>0&&l.jsx("div",{className:"instance-progress-track mt-1.5 h-[3px] overflow-hidden rounded-full bg-[var(--fill-quaternary)]",role:"progressbar","aria-label":i("composer.contextUsage"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.max(0,R)),children:l.jsx("div",{className:"h-full rounded-full transition-[width] duration-300 motion-reduce:transition-none",style:{width:`${Math.max(2,Math.min(100,R))}%`,backgroundColor:R>=90?"var(--toast-icon-error)":R>=60?"var(--toast-icon-warning)":"var(--toast-icon-success)"}})})]})]}),l.jsx(Y,{size:"icon",type:"button","aria-label":i("navigation.instanceActions",{name:O}),title:i("navigation.instanceActions",{name:O}),className:"instance-actions absolute right-1 top-1/2 -translate-y-1/2 flex items-center justify-center text-[var(--label-secondary)]",onClick:P=>{const I=P.currentTarget.getBoundingClientRect();p({position:{x:I.left,y:I.bottom},instanceId:j.id})},children:l.jsx(Ds,{size:16,"aria-hidden":"true"})})]},j.id)})})]},C))})}),l.jsx(Ee,{children:m&&l.jsx(w1,{position:m.position,onClose:()=>p(null),children:l.jsx(S1,{icon:l.jsx(Tf,{size:14}),label:i("sidebar.shutdown"),danger:!0,onClick:()=>{s(m.instanceId),p(null)}})},m.instanceId)})]})}let Vo=0,Bo="";function Sc(e,t){f.useLayoutEffect(()=>{var r;const n=e.current;if(!n)return;const s=document.activeElement;return Vo++===0&&(Bo=document.body.style.overflow,document.body.style.overflow="hidden"),n.showModal(),(r=t.current)==null||r.focus({preventScroll:!0}),()=>{n.close(),--Vo===0&&(document.body.style.overflow=Bo),s instanceof HTMLElement&&s.isConnected&&s.focus({preventScroll:!0})}},[e,t])}function Cc(e){if(e.defaultPrevented||e.key!=="Tab"||!e.currentTarget.contains(e.target))return;const t=Array.from(e.currentTarget.querySelectorAll('button, a[href], input, select, textarea, summary, [tabindex], [contenteditable="true"]')).filter(i=>{const o=getComputedStyle(i);return i.tabIndex>=0&&!i.matches(":disabled")&&!i.closest("[hidden], [inert]")&&o.display!=="none"&&o.visibility!=="hidden"}),n=t[0],s=t.at(-1);if(!n||!s)return;const r=document.activeElement;r instanceof HTMLElement&&!t.includes(r)?(e.preventDefault(),(e.shiftKey?s:n).focus({preventScroll:!0})):e.shiftKey&&r===n?(e.preventDefault(),s.focus({preventScroll:!0})):!e.shiftKey&&document.activeElement===s&&(e.preventDefault(),n.focus({preventScroll:!0}))}function li(e){return l.jsx(tn,{features:ss,strict:!0,children:l.jsx(k1,{...e})})}function k1({src:e,alt:t,zoomable:n=!1,placeholder:s,onClose:r}){const{t:i}=q(),[o,a]=f.useState(!1),[c,u]=f.useState(null),d=f.useRef(null),h=f.useRef(null),g=f.useRef(null),m=ts(),p=f.useContext(je).reducedMotion,x=nn()||p==="always";Sc(d,h);function y(){m&&r()}function v(){a(b=>!b),g.current&&(g.current.scrollTop=0,g.current.scrollLeft=0)}const k=l.jsx("div",{onClick:b=>b.stopPropagation(),className:"max-w-full max-h-full overflow-auto rounded-content bg-[var(--btn-solid)] text-[var(--label-primary)] shadow-2xl",children:s});return pt.createPortal(l.jsxs(x1,{ref:d,role:"dialog","aria-modal":"true","aria-label":t??i("imagePreview.title"),inert:!m,"data-presence":m?"present":"exiting",className:"native-dialog-viewport image-lightbox fixed-viewport z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-[30px]",initial:{opacity:x?1:0},animate:{opacity:1},exit:{opacity:0,transition:{duration:x?0:.15}},transition:{duration:x?0:.2},onClick:y,onKeyDown:Cc,onCancel:b=>{b.preventDefault(),b.stopPropagation(),y()},children:[l.jsx("span",{ref:h,tabIndex:-1,className:"sr-only outline-none",children:t??i("imagePreview.title")}),n&&l.jsxs(Y,{size:"compact",type:"button",onClick:b=>{b.stopPropagation(),v()},className:"glass-panel absolute top-[max(1rem,env(safe-area-inset-top))] left-1/2 -translate-x-1/2 z-10 flex items-center gap-2 px-3 text-[13px] text-[var(--label-primary)] select-none hover:text-[var(--color-accent)] transition-colors focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:[o?l.jsx(Uf,{size:16}):l.jsx(Wf,{size:16}),i(o?"imagePreview.fitWindow":"imagePreview.actualSize")]}),l.jsx(Y,{size:"icon",type:"button",onClick:b=>{b.stopPropagation(),y()},className:`absolute top-[max(1rem,env(safe-area-inset-top))] right-[max(1rem,env(safe-area-inset-right))] z-10 flex items-center justify-center select-none transition-colors focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] ${n?"glass-panel text-[var(--label-primary)] hover:text-[var(--color-accent)]":"bg-[var(--badge-bg)] hover:bg-[var(--badge-bg-hover)] text-[var(--badge-text)]"}`,"aria-label":i("imagePreview.close"),children:l.jsx(Rr,{size:18})}),n?l.jsxs("div",{className:"absolute left-[max(1rem,env(safe-area-inset-left))] right-[max(1rem,env(safe-area-inset-right))] top-[max(4.5rem,calc(env(safe-area-inset-top)+3.5rem))] bottom-[max(1rem,env(safe-area-inset-bottom))]",children:[l.jsx("div",{ref:g,tabIndex:0,role:"region","aria-label":i("imagePreview.title"),className:"h-full w-full overflow-auto focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:l.jsx("div",{className:`flex items-center justify-center ${o?"min-h-full min-w-full w-max":"h-full w-full"}`,children:e?l.jsx("img",{src:e,alt:t??i("imagePreview.title"),width:o?c==null?void 0:c.width:void 0,height:o?c==null?void 0:c.height:void 0,onLoad:b=>{const S=b.currentTarget;S.naturalWidth>0&&S.naturalHeight>0&&u({width:S.naturalWidth,height:S.naturalHeight})},onClick:b=>b.stopPropagation(),className:`block shrink-0 rounded-content bg-[var(--btn-solid)] shadow-2xl select-none ${o?"max-w-none max-h-none":"max-w-full max-h-full object-contain"}`,draggable:!1}):l.jsx("div",{"aria-hidden":"true",className:"shrink-0",style:o&&c?c:void 0})})}),!e&&l.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:l.jsx("div",{className:"max-w-full max-h-full pointer-events-auto",children:k})})]}):e?l.jsx("img",{src:e,alt:t??i("imagePreview.title"),onClick:b=>b.stopPropagation(),className:"max-w-[90vw] max-h-[90vh] object-contain rounded-content shadow-2xl select-none",draggable:!1}):k]}),document.body)}function kc({title:e,subtitle:t,backTo:n="/",actions:s,children:r}){const i=Yt(),{t:o}=q();return l.jsxs("div",{className:"md:hidden flex items-center gap-2",children:[l.jsx(Y,{size:"icon",type:"button",onClick:()=>i(n),"aria-label":o("navigation.backToInstances"),className:"flex shrink-0 select-none items-center justify-center text-[var(--label-secondary)] active:bg-[var(--fill-tertiary)] transition-opacity focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:l.jsx(qd,{size:20})}),r??l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[14px] font-medium text-[var(--label-primary)] truncate select-text",children:e}),t&&l.jsx("div",{className:"text-[11px] text-[var(--label-tertiary)] truncate select-text",children:t})]}),s]})]})}const ci=Object.freeze({text:"",images:[]}),Wn=sn(e=>({drafts:new Map,setDraft:(t,n)=>{e(s=>{const r=s.drafts.get(t)??ci,i=typeof n=="function"?n(r):n,o=new Map(s.drafts);return i.text||i.images.length>0?o.set(t,i):o.delete(t),{drafts:o}})}})),j1=()=>ot(()=>import("./modalFeatures-BeDlpc4S.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(e=>e.default);function zo(e,t){const n=e.offset.y;return n>Math.abs(e.offset.x)&&(n>=Math.min(140,Math.max(80,t*.2))||n>=40&&e.velocity.y>=600)}function Pe(e){return l.jsx(tn,{features:j1,strict:!0,children:l.jsx(E1,{...e})})}function E1({title:e,trailing:t,onClose:n,children:s,mobileSheet:r=!0,size:i="detail",footer:o}){const{t:a}=q(),c=f.useId(),u=f.useRef(null),d=f.useRef(null),h=f.useRef(null),g=f.useRef(null),m=ts(),p=f.useContext(je).reducedMotion,x=nn()||p==="always",y=qg(),v=Ug(0),[k,b]=f.useState(()=>window.matchMedia("(max-width: 767px)").matches),S=r&&k;Sc(u,d),f.useEffect(()=>{const C=window.matchMedia("(max-width: 767px)"),E=()=>{y.cancel(),v.set(0),b(C.matches)};return C.addEventListener("change",E),()=>C.removeEventListener("change",E)},[y,v]);function w(){m&&n()}const A={duration:x?0:.2,ease:"easeOut"},T={duration:x?0:.15,ease:"easeIn"};return pt.createPortal(l.jsxs("dialog",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":c,"data-presence":m?"present":"exiting",className:"native-dialog-viewport modal-viewport fixed-viewport",onCancel:C=>{C.preventDefault(),C.stopPropagation(),w()},onKeyDown:Cc,children:[l.jsx(ft,{className:"modal-overlay pointer-events-none absolute inset-0 bg-black/40 backdrop-blur-sm","aria-hidden":"true",initial:{opacity:x?1:0},animate:{opacity:1},exit:{opacity:0,transition:T},transition:A}),l.jsx("div",{className:"modal-positioner absolute inset-0 flex items-center justify-center","data-sheet":S,onPointerDown:C=>{g.current=C.target===C.currentTarget},onClick:C=>{C.target===C.currentTarget&&g.current!==!1&&w(),g.current=null},children:l.jsx(ft,{ref:h,"data-size":i,className:"modal-panel flex min-h-0 flex-col overflow-hidden","data-sheet":S,style:{y:v},initial:x?!1:{opacity:S?1:0,scale:S?1:.96,y:S?"100%":0},animate:{opacity:1,scale:1,y:0},exit:{opacity:S?1:0,scale:x||S?1:.96,y:!x&&S?"100%":0,transition:T},transition:A,drag:S&&m&&!x?"y":!1,dragControls:y,dragListener:!1,dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:1},dragSnapToOrigin:!0,dragMomentum:!1,onDragEnd:(C,E)=>{var j;C.type!=="pointercancel"&&zo(E,((j=h.current)==null?void 0:j.clientHeight)??0)&&w()},children:l.jsxs("div",{className:"modal-interior flex min-h-0 flex-1 flex-col",inert:!m,children:[S&&l.jsx(ft,{className:"modal-grabber flex h-6 shrink-0 items-center justify-center select-none","aria-hidden":"true",onPanEnd:(C,E)=>{var j;x&&C.type!=="pointercancel"&&zo(E,((j=h.current)==null?void 0:j.clientHeight)??0)&&w()},onPointerDown:C=>{!x&&C.isPrimary&&C.button===0&&y.start(C,{distanceThreshold:10})},children:l.jsx("span",{className:"h-1 w-9 rounded-full bg-[var(--label-tertiary)]"})}),l.jsxs("header",{className:"modal-header flex shrink-0 items-center justify-between gap-3 border-b border-[var(--separator)] px-4 py-1.5",children:[l.jsx("div",{id:c,ref:d,tabIndex:-1,className:"outline-none flex min-w-0 flex-wrap items-center gap-2 text-[15px] font-semibold text-[var(--label-primary)] select-text",children:e}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2 select-text",children:[t,l.jsx(Y,{size:"icon",type:"button",onClick:w,"aria-label":a("common.close"),className:"modal-close select-none flex items-center justify-center text-[var(--label-secondary)] transition-colors hover:bg-[var(--fill-secondary)] focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] motion-reduce:transition-none",children:l.jsx(Rr,{size:18,"aria-hidden":"true"})})]})]}),l.jsx("div",{className:"modal-content min-h-0 flex-1 overflow-auto scrollbar-auto",tabIndex:0,role:"region","aria-label":a("modal.content"),children:s}),o&&l.jsx("footer",{className:"ui-dialog-actions",children:o})]})})})]}),document.body)}function T1({onClose:e,onConfirm:t}){const{t:n}=q(),s=f.useId(),r=f.useId(),[i,o]=f.useState(""),a=f.useCallback(()=>{t(i.trim()||void 0)},[i,t]);return l.jsx(Pe,{mobileSheet:!1,size:"form",footer:l.jsxs(l.Fragment,{children:[l.jsx(Y,{onClick:e,className:"active:bg-[var(--fill-tertiary)]",children:n("common.cancel")}),l.jsx(Y,{variant:"primary",onClick:a,children:n("compact.start")})]}),title:n("compact.title"),onClose:e,children:l.jsxs("div",{className:"ui-form-content",children:[l.jsx("p",{id:r,className:"ui-form-note",children:n("compact.description")}),l.jsx(Yg,{id:s,"aria-label":n("compact.placeholder"),"aria-describedby":r,value:i,onChange:c=>o(c.target.value),placeholder:n("compact.placeholder"),rows:3})]})})}function N1({items:e}){const{t}=q(),n=f.useRef(null),s=f.useRef(new Map),r=f.useRef(null),[i,o]=f.useState([]),[a,c]=f.useState(!1),[u,d]=f.useState(null),h=f.useRef(null),g=e.find(m=>m.id===u);return f.useLayoutEffect(()=>{var y;if(a)return;const m=n.current;if(!m)return;const p=()=>{var T,C,E;const v=m.getBoundingClientRect().width;if(!v)return;const k=parseFloat(getComputedStyle(m).columnGap)||0,b=e.map(j=>{const O=s.current.get(j.id),$=j.flexible?O==null?void 0:O.querySelector("[data-toolbar-label]"):null,R=(O==null?void 0:O.getBoundingClientRect().width)??0,N=$?R+$.scrollWidth-$.getBoundingClientRect().width:R,P=$?N-$.scrollWidth+Math.min(j.minimumLabelWidth??0,$.scrollWidth):N;return{id:j.id,priority:j.priority,width:P,natural:N,control:O,flexible:j.flexible}});let S=b.reduce((j,O)=>j+O.width,0)+Math.max(0,b.length-1)*k;const w=[];if(S>v){S+=(((T=r.current)==null?void 0:T.getBoundingClientRect().width)??0)+k;for(const j of[...b].sort((O,$)=>O.priority-$.priority)){if(S<=v)break;w.push(j.id),S-=j.width+k}}let A=Math.max(0,v-S);for(const j of b){if(!j.flexible||w.includes(j.id))continue;const O=Math.min(A,Math.max(0,j.natural-j.width)),$=`${j.width+O}px`;((C=j.control)==null?void 0:C.style.getPropertyValue("--toolbar-item-width"))!==$&&((E=j.control)==null||E.style.setProperty("--toolbar-item-width",$)),A-=O}o(j=>j.length===w.length&&j.every((O,$)=>O===w[$])?j:w)};p();const x=typeof ResizeObserver>"u"?null:new ResizeObserver(p);x==null||x.observe(m);for(const v of m.children)x==null||x.observe(v);for(const v of m.querySelectorAll("[data-toolbar-label-content]"))x==null||x.observe(v);return(y=document.fonts)==null||y.addEventListener("loadingdone",p),()=>{var v;x==null||x.disconnect(),(v=document.fonts)==null||v.removeEventListener("loadingdone",p)}},[e,a]),f.useLayoutEffect(()=>{var x;const m=n.current;if(!m)return;[...m.querySelectorAll(".adaptive-toolbar-hidden")].some(y=>y.contains(document.activeElement))&&((x=m.querySelector(".adaptive-toolbar-item:not(.adaptive-toolbar-hidden) button:not(:disabled), .adaptive-toolbar-more:not(.adaptive-toolbar-hidden) button"))==null||x.focus())},[i]),f.useLayoutEffect(()=>{var m,p;a&&((p=(m=h.current)==null?void 0:m.querySelector("button:not(:disabled)"))==null||p.focus())},[u,a]),l.jsxs("div",{ref:n,className:"composer-controls adaptive-toolbar",children:[e.map(m=>l.jsx("div",{ref:p=>{p?s.current.set(m.id,p):s.current.delete(m.id)},"data-toolbar-item":m.id,className:`adaptive-toolbar-item${m.flexible?" adaptive-toolbar-flexible":""}${i.includes(m.id)?" adaptive-toolbar-hidden":""}`,inert:i.includes(m.id)||void 0,"aria-hidden":i.includes(m.id)||void 0,children:m.control},m.id)),l.jsx("div",{ref:r,className:`adaptive-toolbar-more${i.length?"":" adaptive-toolbar-hidden"}`,inert:!i.length||void 0,"aria-hidden":!i.length||void 0,children:l.jsx(wt,{label:t("composer.more"),width:280,align:"left",onOpenChange:m=>{c(m),d(null)},trigger:({open:m,id:p})=>l.jsx(Y,{size:"compact",className:"composer-control","aria-label":t("composer.more"),title:t("composer.more"),"aria-haspopup":"dialog","aria-expanded":m,"aria-controls":m?p:void 0,children:l.jsx(Ds,{size:18,"aria-hidden":"true"})}),children:m=>l.jsx("div",{ref:h,className:g!=null&&g.page?"ui-menu-layout":"ui-menu-scroll scrollbar-auto",style:{maxHeight:"inherit"},children:g!=null&&g.page?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"adaptive-toolbar-page-header",children:[l.jsx(Y,{size:"compact","aria-label":t("composer.backToOptions"),onClick:()=>d(null),children:l.jsx(Vd,{size:16,"aria-hidden":"true"})}),l.jsx("span",{children:g.pageLabel})]}),g.page(m)]}):e.filter(p=>i.includes(p.id)).map(p=>l.jsx("div",{children:p.menu(m,d)},p.id))})})})]})}const R1="Claude",mv=.8,gv=.1,M1="#D97757",yv=M1,xv="#fff",vv=.75,A1=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:R1}),l.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]})),L1="DeepSeek",bv=.65,wv=.2,I1="#4D6BFE",Sv=I1,Cv="#fff",kv=.75,P1=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:L1}),l.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z",fill:"#4D6BFE"})]})),$1=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function O1(e){return Array.from(e.match($1)??[])}function jc(e){return O1(e).map(t=>t.toLowerCase()).join("-")}const _1=e=>{const t=f.useId(),n=`lobe-icons-${jc(e)}-${t}`;return f.useMemo(()=>({fill:`url(#${n})`,id:n}),[e])},F1=(e,t)=>{const n=f.useId();return f.useMemo(()=>Array.from({length:t},(s,r)=>{const i=`lobe-icons-${jc(e)}-${r}-${n}`;return{fill:`url(#${i})`,id:i}}),[e,t,n])},Ho="Gemini",jv=.8,Ev=.2,D1="#fff",Tv=D1,Nv="#fff",Rv=.8,V1=f.memo(({size:e="1em",style:t,...n})=>{const[s,r,i]=F1(Ho,3);return l.jsxs("svg",{height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:Ho}),l.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),l.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:s.fill}),l.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:r.fill}),l.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:i.fill}),l.jsxs("defs",{children:[l.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:s.id,x1:"7",x2:"11",y1:"15.5",y2:"12",children:[l.jsx("stop",{stopColor:"#08B962"}),l.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),l.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:r.id,x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[l.jsx("stop",{stopColor:"#F94543"}),l.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),l.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[l.jsx("stop",{stopColor:"#FABC12"}),l.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]})}),B1="Grok",Mv=.75,Av=.2,z1="#000",Lv=z1,Iv="#fff",Pv=.75,H1=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:B1}),l.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})]})),U1="Hunyuan",$v=.75,Ov=.2,K1="#0053e0",_v=K1,Fv="#fff",Dv=.75,W1=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:U1}),l.jsx("circle",{cx:"12",cy:"12",fill:"#0055E9",r:"12"}),l.jsx("path",{d:"M12 0c.518 0 1.028.033 1.528.096A6.188 6.188 0 0112.12 12.28l-.12.001c-2.99 0-5.242 2.179-5.554 5.11-.223 2.086.353 4.412 2.242 6.146C3.672 22.1 0 17.479 0 12 0 5.373 5.373 0 12 0z",fill:"#A8DFF5"}),l.jsx("path",{d:"M5.286 5a2.438 2.438 0 01.682 3.38c-3.962 5.966-3.215 10.743 2.648 15.136C3.636 22.056 0 17.452 0 12c0-1.787.39-3.482 1.09-5.006.253-.435.525-.872.817-1.311A2.438 2.438 0 015.286 5z",fill:"#0055E9"}),l.jsx("path",{d:"M12.98.04c.272.021.543.053.81.093.583.106 1.117.254 1.538.44 6.638 2.927 8.07 10.052 1.748 15.642a4.125 4.125 0 01-5.822-.358c-1.51-1.706-1.3-4.184.357-5.822.858-.848 3.108-1.223 4.045-2.441 1.257-1.634 2.122-6.009-2.523-7.506L12.98.039z",fill:"#00BCFF"}),l.jsx("path",{d:"M13.528.096A6.187 6.187 0 0112 12.281a5.75 5.75 0 00-1.71.255c.147-.905.595-1.784 1.321-2.501.858-.848 3.108-1.223 4.045-2.441 1.27-1.651 2.14-6.104-2.676-7.554.184.014.367.033.548.056z",fill:"#ECECEE"})]})),Uo="Minimax",Vv=.45,Bv=.15,zv="#F23F5D",q1="linear-gradient(to right, #E2167E, #FE603C)",Hv=q1,Uv="#fff",Kv=.75,G1=f.memo(({size:e="1em",style:t,...n})=>{const{id:s,fill:r}=_1(Uo);return l.jsxs("svg",{height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:Uo}),l.jsx("defs",{children:l.jsxs("linearGradient",{id:s,x1:"0%",x2:"100.182%",y1:"50.057%",y2:"50.057%",children:[l.jsx("stop",{offset:"0%",stopColor:"#E2167E"}),l.jsx("stop",{offset:"100%",stopColor:"#FE603C"})]})}),l.jsx("path",{d:"M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z",fill:r,fillRule:"nonzero"})]})}),Y1="MoonshotAI",Wv=.75,qv=.4,J1="#16191E",Gv=J1,Yv="#fff",Jv=.75,X1=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:Y1}),l.jsx("path",{d:"M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"})]})),Z1="OpenAI",Xv=.75,Zv=.1,Q1="#000",Qv="#19C37D",eb="#AB68FF",tb="#F86AA4",nb="#F9C322",sb="#0099FF",rb="#0000FE",ib=Q1,ob="#fff",ab=.75,He=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:Z1}),l.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})]})),ey="Qwen",lb=.7,cb=.2,ty="#082dff",ub=ty,db="#fff",fb=.6,ny=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:ey}),l.jsx("path",{d:"M19.713 2.825h-5.907c0-.251-.066-.503-.196-.728L12.819.728A1.46 1.46 0 0 0 11.559 0h-1.58c-.52 0-1 .275-1.26.728l-2.42 4.19a1.45 1.45 0 0 0 0 1.453l.791 1.37c.26.448.74.727 1.26.727h11.36c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-.79-1.37a1.46 1.46 0 0 0-1.26-.728zM.195 9.905l2.951 5.115a1.46 1.46 0 0 0-.531.531l-.791 1.37a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h4.84c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451L5.086 7.083a1.46 1.46 0 0 0-1.26-.728h-1.58c-.52 0-1 .276-1.26.728l-.79 1.37a1.45 1.45 0 0 0 0 1.452m15.888 13.367 2.951-5.115c.217.125.469.196.728.196h1.582c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-2.42-4.191a1.46 1.46 0 0 0-1.259-.728h-1.582c-.52 0-1 .276-1.259.728l-5.678 9.838a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h1.582c.52 0 1-.275 1.26-.728z",fill:"#082dff"})]})),sy="Z.ai",hb=.9,pb=.3,ry="#000",mb=ry,gb="#fff",yb=.6,iy=f.memo(({size:e="1em",style:t,...n})=>l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",height:e,style:{flex:"none",lineHeight:1,...t},viewBox:"0 0 24 24",width:e,xmlns:"http://www.w3.org/2000/svg",...n,children:[l.jsx("title",{children:sy}),l.jsx("path",{d:"M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"})]})),oy=[{Icon:He,keywords:["gpt-3"],props:{type:"gpt3"}},{Icon:He,keywords:["gpt-4"],props:{type:"gpt4"}},{Icon:He,keywords:["gpt-5"],props:{type:"gpt5"}},{keywords:["sora"]},{Icon:He,keywords:["gpt-oss"],props:{type:"oss"}},{Icon:He,keywords:["o1-","^o1","/o1","o3-","^o3","/o3","o4-","^o4","/o4"],props:{type:"o1"}},{keywords:["dalle","dall-e"]},{Icon:He,keywords:["text-embedding-","tts-","whisper-","codex","davinci","babbage","omni-moderation","text-moderation","text-adb","text-ada","computer-use"],props:{type:"platform"}},{Icon:He,keywords:["^gpt-","/gpt-","openai"]},{keywords:["^glm-(.*)v","/glm-(.*)v","-glm-(.*)v"]},{Icon:iy,keywords:["^glm-5","/glm-5","/glm5","-glm-4","^glm-4","/glm-4","/glm4","-glm-5"]},{Icon:A1,keywords:["claude"]},{keywords:["gemini-3.1-flash-image-preview","gemini-3-pro-image-preview","gemini-\\d+(?:\\.\\d+)?-(?:flash(?:-lite)?|pro)-image(?:-preview)?(?::|$)","nanobanana","nano-banana"]},{Icon:V1,keywords:["gemini"]},{Icon:X1,keywords:["kimi","moonshot"]},{Icon:ny,keywords:["qwen","qwq","qvq","wanx","wan\\d/","wan\\d\\.\\d-","tongyi","gte-rerank"]},{Icon:G1,keywords:["minimax","abab","^image-"]},{Icon:W1,keywords:["hunyuan","hy3","hy4"]},{Icon:H1,keywords:["^grok-","/grok-"]},{Icon:P1,keywords:["deepseek"]}],ay=oy.map(e=>({...e,patterns:e.keywords.map(t=>new RegExp(t,"i"))})),ly=f.lazy(async()=>{try{const[{default:e},{modelMappings:t}]=await Promise.all([ot(()=>import("./index-DsjiosHk.js"),__vite__mapDeps([3,4,1,2,5]),import.meta.url),ot(()=>import("./modelConfig-BWIG2U9q.js").then(s=>s.m),__vite__mapDeps([4,1,2]),import.meta.url)]),n=t.flatMap(({keywords:s})=>s.map(r=>new RegExp(r,"i")));return{default:({model:s,size:r})=>n.some(i=>i.test(s.toLowerCase()))?l.jsx(e,{model:s,type:"color",size:r}):l.jsx(Fs,{size:r})}}catch{return{default:({size:e})=>l.jsx(Fs,{size:e})}}});function Ec({model:e,size:t=14}){const n=e.toLowerCase(),s=ay.find(({patterns:i})=>i.some(o=>o.test(n))),r=s==null?void 0:s.Icon;return l.jsx("span",{"aria-hidden":"true",className:"model-brand-icon",style:{width:t,height:t},children:r?l.jsx(r,{size:t,...s.props}):l.jsx(f.Suspense,{fallback:null,children:l.jsx(ly,{model:e,size:t})})})}function Tc({currentModel:e,availableModels:t,onSelect:n,onDone:s}){const r=new Map;for(const i of t??[]){const o=r.get(i.provider)??[];o.push(i),r.set(i.provider,o)}return l.jsx("div",{className:"ui-menu-scroll scrollbar-auto",style:{maxHeight:"inherit"},children:Array.from(r.entries()).map(([i,o],a)=>l.jsxs("div",{children:[a>0&&l.jsx("div",{className:"mx-1 my-1 h-px bg-[var(--separator)]"}),l.jsx("div",{className:"ui-menu-section",children:i}),o.map(c=>{const u=c.provider===e.provider&&c.id===e.id;return l.jsxs(be,{selected:u,"aria-pressed":u,onClick:()=>{u||n==null||n(c.provider,c.id),s()},children:[l.jsx(Ec,{model:c.id,size:18}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] text-[var(--label-primary)] truncate select-text",children:c.name||c.id}),l.jsx("div",{className:"text-[12px] text-[var(--label-secondary)] truncate select-text",children:c.id})]}),u&&l.jsx(yt,{size:14,className:"text-[var(--color-accent)] flex-shrink-0"})]},`${c.provider}/${c.id}`)})]},i))})}function cy({currentModel:e,availableModels:t,className:n="",onSelect:s}){const{t:r}=q(),o=t&&t.length>0&&s;return l.jsx(wt,{label:r("composer.model"),disabled:!o,width:280,align:"left",trigger:({open:a,id:c})=>l.jsxs(Y,{size:"compact",type:"button",disabled:!o,"aria-label":`${r("composer.model")}: ${e.name||e.id}`,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?a:void 0,"aria-controls":a?c:void 0,title:e.name||e.id,className:`inline-flex max-w-full items-center gap-1.5 px-2 text-[12px] font-normal disabled:opacity-100 transition-colors focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] ${o?"hover:bg-[var(--fill-secondary)] hover:text-[var(--label-primary)] cursor-pointer":"cursor-default"} text-[var(--label-secondary)] ${n}`,children:[l.jsx(Ec,{model:e.id}),l.jsx("span",{"data-toolbar-label":!0,className:"composer-model-name truncate select-text",children:l.jsx("span",{"data-toolbar-label-content":!0,children:e.name||e.id})}),o&&l.jsx(Ea,{size:12,"aria-hidden":"true",className:`selector-chevron shrink-0 transition-transform motion-reduce:transition-none ${a?"rotate-180":""}`})]}),children:a=>l.jsx(Tc,{currentModel:e,availableModels:t,onSelect:s,onDone:a})})}const uy=["off","minimal","low","medium","high"];function Nc({currentLevel:e,availableLevels:t,onSelect:n,onDone:s}){const r=t.length>0?t:uy;return l.jsx("div",{className:"ui-menu-scroll scrollbar-auto",style:{maxHeight:"inherit"},children:r.map(i=>{const o=i===e;return l.jsxs(be,{selected:o,type:"button","aria-pressed":o,onClick:()=>{o||n==null||n(i),s()},children:[l.jsx("span",{className:"flex-1 text-[13px] text-[var(--label-primary)]",children:i}),o&&l.jsx(yt,{size:14,className:"text-[var(--color-accent)] flex-shrink-0","aria-hidden":"true"})]},i)})})}function dy({currentLevel:e,availableLevels:t,onSelect:n,showLabel:s=!1,pending:r=!1,className:i=""}){const{t:o}=q(),a=e??o(r?"composer.pendingThinking":"composer.unsupportedThinking"),c=!!n&&e!=null;return l.jsx(wt,{disabled:!c,label:o("composer.thinkingLevel"),width:160,align:"left",trigger:({open:u,id:d})=>l.jsxs(Y,{size:"compact",type:"button",disabled:!c,"aria-label":`${o("composer.thinkingLevel")}: ${a}`,"aria-haspopup":c?"dialog":void 0,"aria-expanded":c?u:void 0,"aria-controls":u?d:void 0,className:`inline-flex items-center gap-1.5 px-2 text-[12px] font-normal disabled:opacity-100 transition-colors focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] ${c?"hover:bg-[var(--fill-secondary)] cursor-pointer":"cursor-default"} text-[var(--label-secondary)] ${i}`,children:[s&&l.jsxs(l.Fragment,{children:[l.jsx(Jn,{size:14,"aria-hidden":"true"}),l.jsx("span",{children:o("composer.thinkingLabel")})]}),l.jsx("span",{className:"select-text",children:a}),c&&l.jsx(Ea,{size:12,"aria-hidden":"true",className:`selector-chevron transition-transform motion-reduce:transition-none ${u?"rotate-180":""}`})]}),children:u=>e!=null?l.jsx(Nc,{currentLevel:e,availableLevels:t,onSelect:n,onDone:u}):null})}function fy({instance:e,showCompactButton:t,compactDisabled:n,onSetModel:s,onSetThinkingLevel:r,onAttachImages:i,onOpenCompact:o}){var y;const{t:a}=q(),c=e==null?void 0:e.contextUsage,u=e==null?void 0:e.model,d=e==null?void 0:e.availableModels,h=e==null?void 0:e.thinkingLevel,g=(y=d==null?void 0:d.find(v=>v.provider===(u==null?void 0:u.provider)&&v.id===(u==null?void 0:u.id)))==null?void 0:y.availableThinkingLevels,m=t&&!!c&&!n&&c.tokens!=null,p=n?a("composer.compactBusy"):!t||(c==null?void 0:c.tokens)==null?a("composer.compactUnavailable"):a("eventStream.compactContext"),x=f.useMemo(()=>[{id:"images",priority:2,control:l.jsxs(Y,{size:"compact",onClick:()=>i(),className:"composer-control shrink-0",title:a("eventStream.attachImage"),"aria-label":a("eventStream.attachImage"),children:[l.jsx(ji,{size:14,"aria-hidden":"true"}),l.jsx("span",{children:a("composer.images")})]}),menu:v=>l.jsxs(be,{onClick:()=>{v(),i()},children:[l.jsx(ji,{size:16,"aria-hidden":"true"}),l.jsx("span",{children:a("eventStream.attachImage")})]})},{id:"model",priority:3,flexible:!0,minimumLabelWidth:80,pageLabel:a("composer.model"),control:u?l.jsx(cy,{currentModel:u,availableModels:d,onSelect:s,className:"composer-control"}):l.jsx(Y,{size:"compact",disabled:!0,className:"composer-control",children:a("composer.modelWaiting")}),menu:(v,k)=>l.jsxs(be,{disabled:!u||!(d!=null&&d.length),onClick:()=>k("model"),children:[l.jsx(Fs,{size:16,"aria-hidden":"true"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block",children:a("composer.model")}),l.jsx("span",{className:"block truncate text-[11px] text-[var(--label-secondary)]",children:(u==null?void 0:u.name)||(u==null?void 0:u.id)||a("composer.modelWaiting")})]}),l.jsx(De,{size:14,"aria-hidden":"true"})]}),page:v=>u&&l.jsx(Tc,{currentModel:u,availableModels:d,onSelect:s,onDone:v})},{id:"thinking",priority:1,pageLabel:a("composer.thinkingLevel"),control:l.jsx(dy,{currentLevel:h,pending:!e,availableLevels:g??[],onSelect:r,showLabel:!0,className:"composer-control"}),menu:(v,k)=>l.jsxs(be,{disabled:h==null,onClick:()=>k("thinking"),children:[l.jsx(Jn,{size:16,"aria-hidden":"true"}),l.jsx("span",{className:"flex-1",children:a("composer.thinkingLabel")}),l.jsx("span",{className:"text-[11px] text-[var(--label-secondary)]",children:h??a(e?"composer.unsupportedThinking":"composer.pendingThinking")}),l.jsx(De,{size:14,"aria-hidden":"true"})]}),page:v=>h!=null&&l.jsx(Nc,{currentLevel:h,availableLevels:g??[],onSelect:r,onDone:v})},{id:"compact",priority:0,control:l.jsxs(Y,{size:"compact",disabled:!m,"aria-label":a("eventStream.compactContext"),title:p,onClick:()=>o(),className:"composer-control shrink-0",children:[l.jsx(Ei,{size:14,"aria-hidden":"true"}),l.jsx("span",{children:a("composer.compact")})]}),menu:v=>l.jsxs(be,{disabled:!m,title:p,onClick:()=>{v(),o()},children:[l.jsx(Ei,{size:16,"aria-hidden":"true"}),l.jsx("span",{children:a("eventStream.compactContext")})]})}],[a,u,d,h,e,g,s,r,m,p,i,o]);return l.jsx(N1,{items:x})}function hy({contextUsage:e}){const{t}=q(),{tokens:n,contextWindow:s,percent:r}=e,i=n!=null&&r!=null,o=i?r>90?"var(--toast-icon-error)":r>60?"var(--toast-icon-warning)":"var(--toast-icon-success)":"var(--label-secondary)",a=u=>u<1e3?String(u):u<1e4?`${(u/1e3).toFixed(1)}k`:u<1e6?`${Math.round(u/1e3)}k`:`${Number((u/1e6).toFixed(1))}M`,c=i?`${a(n)} / ${a(s)} (${Math.round(r)}%)`:t("composer.pendingUsage");return l.jsx(wt,{label:t("composer.contextUsage"),width:260,trigger:({open:u,id:d})=>l.jsxs(Y,{size:"compact",type:"button",title:c,"aria-label":`${t("composer.contextUsage")}: ${c}`,"aria-haspopup":"dialog","aria-expanded":u,"aria-controls":u?d:void 0,className:"composer-control composer-context shrink-0 tabular-nums focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",style:{color:o},children:[l.jsx(xf,{size:14,"aria-hidden":"true"}),i&&l.jsxs("span",{className:"composer-context-detail select-text",children:[a(n)," / ",a(s)]}),l.jsx("span",{className:"select-text",children:i?`${Math.round(r)}%`:"—"})]}),children:()=>l.jsx(py,{contextUsage:e})})}function py({contextUsage:e}){const{t,i18n:n}=q(),{tokens:s,contextWindow:r,percent:i}=e,o=new Intl.NumberFormat(n.resolvedLanguage??"zh-CN"),a=s!=null&&i!=null;return l.jsxs("div",{className:"p-3 text-[12px] text-[var(--label-secondary)]",children:[l.jsx("h2",{className:"mb-3 text-[13px] font-semibold text-[var(--label-primary)]",children:t("composer.contextUsage")}),l.jsxs("dl",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx("dt",{children:t("composer.usedTokens")}),l.jsx("dd",{className:"select-text tabular-nums text-[var(--label-primary)]",children:a?o.format(s):t("composer.pendingUsage")})]}),l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx("dt",{children:t("composer.contextWindow")}),l.jsx("dd",{className:"select-text tabular-nums text-[var(--label-primary)]",children:o.format(r)})]})]}),a?l.jsx("div",{className:"mt-3 h-1 overflow-hidden rounded-full bg-[var(--fill-secondary)]",role:"progressbar","aria-label":t("composer.contextUsage"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(100,Math.max(0,i)),children:l.jsx("div",{className:"h-full rounded-full bg-[var(--color-accent)]",style:{width:`${Math.min(100,Math.max(0,i))}%`}})}):l.jsx("p",{className:"mt-3 leading-[18px]",children:t("composer.pendingUsageDescription")})]})}function my(e,t,n){const[s,r]=f.useState({minimum:36,maximum:320,defaultHeight:60}),[i,o]=f.useState(null),[a,c]=f.useState(60),[u,d]=f.useState(!1),h=f.useRef(a),g=f.useRef(s),m=f.useRef(i),p=f.useRef(null);h.current=a,g.current=s,m.current=i;const x=f.useCallback(b=>{const S=g.current;b.style.height="auto";const w=m.current??Math.max(S.defaultHeight,b.scrollHeight),A=Math.min(S.maximum,Math.max(S.minimum,w));b.style.height=`${A}px`,b.style.overflowY=b.scrollHeight>A?"auto":"hidden",h.current=A,c(A)},[]);f.useLayoutEffect(()=>{var w;const b=()=>{var _;const A=((_=window.visualViewport)==null?void 0:_.height)??window.innerHeight,T=t.current,C=e.current,E=Math.max(0,((T==null?void 0:T.getBoundingClientRect().height)??0)-((C==null?void 0:C.getBoundingClientRect().height)??0)),j=Math.max(36,Math.floor(Math.min(320,A*.45,A-E-80))),O=C?getComputedStyle(C):null,$=Number.parseFloat((O==null?void 0:O.lineHeight)??"")||24,R=Number.parseFloat((O==null?void 0:O.paddingTop)??"")||6,N=Number.parseFloat((O==null?void 0:O.paddingBottom)??"")||6,P=Number.parseFloat((O==null?void 0:O.getPropertyValue("--composer-default-lines"))??"")||2,I=Math.ceil($*P+R+N);r(F=>F.maximum===j&&F.defaultHeight===I?F:{minimum:36,maximum:j,defaultHeight:I})};b(),window.addEventListener("resize",b),(w=window.visualViewport)==null||w.addEventListener("resize",b);const S=typeof ResizeObserver>"u"?null:new ResizeObserver(b);return t.current&&(S==null||S.observe(t.current)),()=>{var A,T;(A=p.current)==null||A.call(p),S==null||S.disconnect(),window.removeEventListener("resize",b),(T=window.visualViewport)==null||T.removeEventListener("resize",b)}},[t,e]),f.useLayoutEffect(()=>{e.current&&x(e.current)},[n,s,i,x,e]);const y=f.useCallback(()=>{var b;(b=p.current)==null||b.call(p),d(!1),m.current=null,o(null),e.current&&x(e.current)},[x,e]),v=f.useCallback(b=>{var P,I;if(!b.isPrimary||b.button!==0)return;b.preventDefault(),(P=p.current)==null||P.call(p);const S=b.pointerId,w=b.clientY,A=h.current,T=m.current,C=b.currentTarget;(I=C.setPointerCapture)==null||I.call(C,S),d(!0);const E=_=>{if(_.pointerId!==S)return;_.preventDefault();const F=g.current,U=Math.min(F.maximum,Math.max(F.minimum,A+w-_.clientY));m.current=U,o(U)},j=_=>{var F;(F=p.current)==null||F.call(p),d(!1),_&&(m.current=T,o(T))},O=_=>{_.pointerId===S&&j(!1)},$=_=>{_.pointerId===S&&j(!0)},R=_=>{_.key==="Escape"&&(_.preventDefault(),j(!0))},N=()=>j(!0);window.addEventListener("pointermove",E,{passive:!1}),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",$),window.addEventListener("keydown",R),window.addEventListener("blur",N),C.addEventListener("lostpointercapture",N),p.current=()=>{var _;p.current=null,window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",$),window.removeEventListener("keydown",R),window.removeEventListener("blur",N),C.removeEventListener("lostpointercapture",N),(_=C.hasPointerCapture)!=null&&_.call(C,S)&&C.releasePointerCapture(S)}},[]),k=f.useCallback(b=>{if(b.key==="Home"){b.preventDefault(),y();return}if(!["ArrowUp","ArrowDown","End"].includes(b.key))return;b.preventDefault();const S=g.current,w=b.key==="End"?S.maximum:h.current+(b.key==="ArrowUp"?24:-24),A=Math.min(S.maximum,Math.max(S.minimum,w));m.current=A,o(A)},[y]);return{height:a,limits:s,dragging:u,resizeTextarea:x,onPointerDown:v,onKeyDown:k,resetHeight:y}}let gy=0,En=[];function ht(e,t="info"){const n={id:++gy,message:e,level:t,phase:"entering"};En.forEach(s=>s(n))}const yy=16,xy=150,vy={info:3e3,success:3e3,warning:4e3,error:5e3},by={info:Ra,success:Qd,warning:Bf,error:An},wy={info:"var(--toast-icon-info)",success:"var(--toast-icon-success)",warning:"var(--toast-icon-warning)",error:"var(--toast-icon-error)"};function Sy(){const[e,t]=f.useState([]),n=f.useRef(new Set),s=f.useRef(null),r=f.useContext(je).reducedMotion,i=nn()||r==="always";return f.useEffect(()=>{function o(c,u){const d=setTimeout(()=>{n.current.delete(d),c()},u);n.current.add(d)}const a=c=>{t(u=>[...u,c]),o(()=>t(u=>u.map(d=>d.id===c.id?{...d,phase:"visible"}:d)),yy),o(()=>{t(u=>u.map(d=>d.id===c.id?{...d,phase:"exiting"}:d)),o(()=>t(u=>u.filter(d=>d.id!==c.id)),xy)},vy[c.level])};return En.push(a),()=>{En=En.filter(c=>c!==a),n.current.forEach(clearTimeout),n.current.clear()}},[]),f.useLayoutEffect(()=>{const o=s.current;if(o){if(typeof o.showPopover!="function"){o.removeAttribute("popover");return}return o.hidePopover(),o.showPopover(),()=>o.hidePopover()}},[e.length]),e.length?pt.createPortal(l.jsx(tn,{features:ss,strict:!0,children:l.jsx("div",{ref:s,popover:"manual",className:"toast-container",children:e.map(o=>{const a=by[o.level],c=o.phase==="visible"||i&&o.phase==="entering";return l.jsxs(ft,{role:o.level==="error"?"alert":"status","aria-atomic":"true",className:"ui-toast",initial:!1,animate:{opacity:c?1:0,y:i||c?0:-6},transition:{duration:i?0:.15},children:[l.jsx(a,{size:18,className:"mt-0.5 shrink-0",style:{color:wy[o.level]},"aria-hidden":"true"}),l.jsx("span",{className:"min-w-0 whitespace-pre-wrap",children:o.message})]},o.id)})})}),document.body):null}const Cy=["image/png","image/jpeg","image/gif","image/webp"],ky=2048,jy=2048,Ko=.85,Is=5*1024*1024;function Rc(){return`img_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}async function Ey(e){if(!Cy.includes(e.type))throw new Error(`Unsupported image type: ${e.type}`);const t=await createImageBitmap(e),{width:n,height:s}=Ny(t.width,t.height,ky,jy),r=document.createElement("canvas");r.width=n,r.height=s,r.getContext("2d").drawImage(t,0,0,n,s),t.close();let o=e.type,a=Ko;e.type!=="image/png"&&e.type!=="image/gif"&&(o="image/jpeg");let c=r.toDataURL(o,a);if(o==="image/jpeg"||o==="image/webp")for(;Ps(c)>Is&&a>.3;)a-=.1,c=r.toDataURL(o,a);if(o==="image/png"&&Ps(c)>Is)for(o="image/jpeg",a=Ko,c=r.toDataURL(o,a);Ps(c)>Is&&a>.3;)a-=.1,c=r.toDataURL(o,a);const u=c.split(",")[1];return{id:Rc(),data:u,mimeType:o,previewUrl:c}}function Ty(e){const t=[];for(let n=0;n<e.items.length;n++){const s=e.items[n];if(s.type.startsWith("image/")){const r=s.getAsFile();r&&t.push(r)}}return t}function Ny(e,t,n,s){if(e<=n&&t<=s)return{width:e,height:t};const r=Math.min(n/e,s/t);return{width:Math.round(e*r),height:Math.round(t*r)}}function Ps(e){const t=e.split(",")[1];return t?Math.ceil(t.length*3/4):0}function Ry(e){const{t}=q(),n=f.useCallback(o=>{Promise.all(o.map(Ey)).then(a=>e(c=>({...c,images:[...c.images,...a]}))).catch(a=>{ht(t("eventStream.imageProcessFailed"),"error"),console.error("Image process failed:",a)})},[e,t]),s=f.useCallback(o=>{const a=Ty(o.clipboardData);a.length!==0&&(o.preventDefault(),n(a))},[n]),r=f.useCallback(o=>{const a=Array.from(o.target.files??[]);a.length!==0&&(n(a),o.target.value="")},[n]),i=f.useCallback(o=>{e(a=>({...a,images:a.images.filter(c=>c.id!==o)}))},[e]);return{handlePaste:s,handleFileSelect:r,handleRemoveImage:i}}function My({ref:e,instance:t,draft:n,onDraftChange:s,onSendMessage:r,onAbort:i,onSetModel:o,onSetThinkingLevel:a,onCompact:c,buttonMode:u,showCompactButton:d,compactDisabled:h,onImageLightbox:g,startBottomFollow:m}){const{t:p}=q(),x=f.useRef(null),y=f.useRef(null),v=f.useId(),k=f.useId(),b=my(x,y,n.text);f.useImperativeHandle(e,()=>({focus(){const F=x.current;if(!F)return;F.focus();const U=F.value.length;F.selectionStart=F.selectionEnd=U,F.scrollTop=F.scrollHeight}}));const S=f.useRef(null),w=f.useRef(n);w.current=n;const[A,T]=f.useState(!1),C=t==null?void 0:t.status,E=t==null?void 0:t.contextUsage,j=b.resizeTextarea,O=f.useCallback(F=>{s(U=>({...U,text:F.target.value})),j(F.target)},[s,j]),$=!dt(C)&&(!!n.text.trim()||n.images.length>0),R=f.useCallback(()=>{const F=w.current;if(dt(C)||!F.text.trim()&&F.images.length===0)return;const U=F.images.length?F.images.map(L=>({data:L.data,mimeType:L.mimeType})):void 0;r(F.text.trim(),U),m()},[C,r,m]),N=f.useCallback(F=>{F.nativeEvent.isComposing||F.keyCode===229||F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),R())},[R]),{handlePaste:P,handleFileSelect:I,handleRemoveImage:_}=Ry(s);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:y,className:"composer-surface",children:[l.jsx("div",{role:"separator",tabIndex:0,"aria-orientation":"horizontal","aria-label":p("composer.resizeHeight"),"aria-describedby":k,"aria-controls":v,"aria-valuemin":b.limits.minimum,"aria-valuemax":b.limits.maximum,"aria-valuenow":b.height,"aria-valuetext":p("composer.heightPixels",{height:b.height}),className:"composer-resize-handle","data-dragging":b.dragging||void 0,onPointerDown:b.onPointerDown,onKeyDown:b.onKeyDown,onDoubleClick:b.resetHeight,title:p("composer.resizeHeightHelp"),children:l.jsx("span",{"aria-hidden":"true"})}),l.jsx("span",{id:k,className:"sr-only",children:p("composer.resizeHeightHelp")}),n.images.length>0&&l.jsx("div",{className:"composer-images flex gap-2 overflow-x-auto px-4 pt-4 scrollbar-auto",children:n.images.map((F,U)=>l.jsxs("div",{className:"relative shrink-0",children:[l.jsx("button",{type:"button","aria-label":p("composer.previewImage",{count:U+1}),onClick:()=>g(F.previewUrl),className:"block overflow-hidden rounded-content border border-[var(--separator)] focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:l.jsx("img",{src:F.previewUrl,alt:p("conversation.attachedImage",{count:U+1}),className:"h-14 w-14 object-cover",draggable:!1})}),l.jsx(Y,{size:"badge",type:"button",onClick:()=>_(F.id),className:"absolute -right-1.5 -top-1.5 bg-[var(--badge-bg)] text-[var(--badge-text)] hover:bg-[var(--badge-bg-hover)]","aria-label":p("composer.removeImage",{count:U+1}),children:l.jsx(Rr,{size:12,"aria-hidden":"true"})})]},F.id))}),l.jsx("textarea",{id:v,ref:x,rows:2,"aria-label":p("eventStream.sendPlaceholder"),placeholder:p("eventStream.sendPlaceholder"),value:n.text,onChange:O,onKeyDown:N,onPaste:P,className:"composer-editor block w-full resize-none overflow-hidden bg-transparent text-[16px] leading-[24px] text-[var(--label-primary)] outline-none placeholder:text-[var(--label-tertiary)] md:text-[14px] md:leading-[22px]"}),l.jsxs("div",{className:"composer-toolbar flex min-w-0 items-center gap-2 px-3 pb-3 pt-2",role:"group","aria-label":p("composer.options"),children:[l.jsx("input",{ref:S,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,onChange:I,className:"hidden"}),l.jsx(fy,{instance:t,showCompactButton:d,compactDisabled:h,onSetModel:o,onSetThinkingLevel:a,onAttachImages:()=>{var F;return(F=S.current)==null?void 0:F.click()},onOpenCompact:()=>T(!0)}),l.jsxs("div",{className:"composer-actions flex shrink-0 items-center gap-2",children:[l.jsxs("span",{role:"status",className:"composer-agent-status inline-flex items-center gap-1.5 whitespace-nowrap text-[11px] text-[var(--label-secondary)]",children:[l.jsx("span",{"aria-hidden":"true",className:`h-2 w-2 shrink-0 rounded-full ${xc(C)}`}),p(yc(C))]}),E&&l.jsx(hy,{contextUsage:E}),u==="stop"?l.jsx(Y,{size:"icon",type:"button",onClick:i,className:"select-none shrink-0 rounded-full bg-[var(--toast-icon-error)] text-white transition-[opacity,transform] hover:opacity-90 active:scale-95 focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] motion-reduce:transition-none motion-reduce:transform-none",title:p("eventStream.stop"),"aria-label":p("eventStream.stop"),children:l.jsx(_f,{size:12,fill:"currentColor","aria-hidden":"true"})}):l.jsx(Y,{size:"icon",type:"button",onClick:R,disabled:!$,className:`select-none shrink-0 rounded-full transition-[opacity,transform] focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] motion-reduce:transition-none motion-reduce:transform-none ${$?"bg-[var(--color-accent)] text-white hover:opacity-90 active:scale-95":"bg-[var(--fill-secondary)] text-[var(--label-tertiary)] opacity-50 cursor-default"}`,title:p("eventStream.send"),"aria-label":p("eventStream.send"),children:l.jsx(zd,{size:16,strokeWidth:2.5,"aria-hidden":"true"})})]})]})]}),l.jsx(Ee,{children:A&&l.jsx(T1,{onClose:()=>T(!1),onConfirm:F=>{c(F),T(!1)}},"compact")})]})}function Mc({id:e,expanded:t,children:n}){const s=nn();return l.jsx(ft,{id:e,initial:!1,animate:t?"expanded":"collapsed",variants:{expanded:{height:"auto",opacity:1,visibility:"visible"},collapsed:{height:0,opacity:0,transitionEnd:{visibility:"hidden"}}},transition:{duration:s?0:t?.2:.15,ease:"easeInOut"},"aria-hidden":!t,inert:!t,className:"min-w-0 overflow-hidden",children:n})}function Ay({message:e,onReEdit:t}){var h,g;const{t:n}=q(),[s,r]=f.useState(!1);let i=e,o="",a="",c="";const u=e.indexOf("{");if(u>0){i=e.slice(0,u).trim();try{const m=JSON.parse(e.slice(u));o=((h=m==null?void 0:m.error)==null?void 0:h.message)??e.slice(u),a=((g=m==null?void 0:m.error)==null?void 0:g.type)??"";const p=o.match(/request id:\s*([\w]+)/i);p&&(c=p[1])}catch{o=e.slice(u)}}const d=o.length>200;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"rounded-content border border-[rgba(255,66,69,0.3)] bg-[rgba(255,66,69,0.06)] px-3.5 py-2.5",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx(An,{size:14,"aria-hidden":"true",className:"mt-0.5 shrink-0 text-[#ff4245]"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("p",{className:"text-[12px] font-medium text-[#ff4245]",children:i}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t&&l.jsx(Y,{size:"compact",type:"button",onClick:t,className:"select-none text-[12px] text-[var(--color-accent)] hover:opacity-70",children:n("reEdit.button")}),d&&l.jsx(Y,{size:"compact",type:"button","aria-label":n("error.title"),onClick:()=>r(!0),className:"inline-flex h-8 w-8 items-center justify-center text-[var(--label-secondary)]",children:l.jsx(De,{size:14})})]})]}),o&&!d&&l.jsx("p",{className:"mt-1.5 break-all whitespace-pre-wrap text-[11px] text-[var(--label-secondary)]",children:o})]})]})}),l.jsx(Ee,{children:s&&l.jsx(Pe,{title:n("error.title"),onClose:()=>r(!1),children:l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-6 scrollbar-auto",children:[l.jsxs("div",{className:"mb-5 flex flex-col items-center text-center",children:[l.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-content bg-[rgba(255,66,69,0.1)]",children:l.jsx(An,{size:20,className:"text-[#ff4245]"})}),l.jsx("p",{className:"text-[15px] font-semibold text-[#ff4245]",children:i})]}),l.jsxs("div",{className:"space-y-3 rounded-content bg-[var(--fill-card)] p-4",children:[l.jsx($s,{label:n("error.message"),value:o}),a&&l.jsx($s,{label:n("error.type"),value:a}),c&&l.jsx($s,{label:n("error.requestId"),value:c,mono:!0})]})]})},"error")})]})}function $s({label:e,value:t,mono:n}){return l.jsxs("div",{children:[l.jsx("p",{className:"mb-0.5 text-[11px] text-[var(--label-tertiary)]",children:e}),l.jsx("p",{className:`break-all whitespace-pre-wrap text-[14px] leading-[22px] text-[var(--label-primary)] ${n?"font-mono text-[13px] leading-[20px]":""}`,children:t})]})}function Ac({label:e,children:t}){return l.jsxs("div",{className:"content-toolbar",children:[l.jsx("span",{className:"content-toolbar-label",children:e}),l.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t})]})}function Qe({error:e=!1,className:t="",...n}){return l.jsx("pre",{...n,className:`tool-result text-[13px] leading-[20px] whitespace-pre-wrap break-words overflow-x-auto ${e?"tool-result-error":""} ${t}`})}let Wo=Promise.resolve(),Ly=0;function Iy(e,t,n){const s=Wo.then(async()=>{var u;n.throwIfAborted();const[{default:r},{default:i},{createMermaidConfig:o}]=await Promise.all([ot(()=>import("./mermaid.core-DVbCkJL3.js").then(d=>d.bi),__vite__mapDeps([6,1,7,8,5]),import.meta.url),ot(()=>import("./purify.es-CAi2OJFm.js"),[],import.meta.url),ot(()=>import("./mermaidTheme-DoQvsUbV.js"),__vite__mapDeps([9,8,10]),import.meta.url)]);n.throwIfAborted();const a=o(t);r.initialize(a);const c=document.createElement("div");c.style.cssText="position:fixed;left:-100000px;top:0;width:960px;visibility:hidden;pointer-events:none",document.body.append(c);try{const{svg:d}=await r.render(`mermaid-${++Ly}`,e,c);n.throwIfAborted();const h=new DOMParser().parseFromString(d,"image/svg+xml").documentElement;if(!(h instanceof SVGSVGElement))throw new Error("Invalid Mermaid SVG document");const g=(u=h.viewBox)==null?void 0:u.baseVal;return g&&g.width>0&&g.height>0&&(h.setAttribute("width",String(g.width)),h.setAttribute("height",String(g.height))),h.style.backgroundColor="transparent",i.sanitize(new XMLSerializer().serializeToString(h),{USE_PROFILES:{svg:!0,svgFilters:!0}})}finally{c.remove()}});return Wo=s.then(()=>{},()=>{}),s}function Py({source:e,streaming:t}){const{t:n}=q(),s=lc(),[r,i]=f.useState({status:"loading",source:e,theme:s}),[o,a]=f.useState(!1),[c,u]=f.useState(!1),d=f.useRef(void 0);f.useEffect(()=>{const v=new AbortController,k=setTimeout(async()=>{try{const b=await Iy(e,s,v.signal);v.signal.aborted||i({status:"ready",source:e,theme:s,svg:b})}catch{v.signal.aborted||i({status:"error",source:e,theme:s})}},t?300:0);return()=>{clearTimeout(k),v.abort()}},[e,s,t]),f.useEffect(()=>()=>clearTimeout(d.current),[]);async function h(){try{await navigator.clipboard.writeText(e),a(!0),clearTimeout(d.current),d.current=setTimeout(()=>a(!1),2e3)}catch{a(!1)}}const g=r.source===e&&r.theme===s,m=g&&r.status==="ready",p=g&&r.status==="error"&&!t,x=m?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r.svg)}`:"",y=l.jsxs("div",{className:"text-[var(--label-primary)]",children:[l.jsxs("p",{className:"flex min-h-24 items-center justify-center gap-2 px-3 py-3 text-[12px] text-[var(--label-secondary)]",role:"status",children:[!p&&l.jsx(Le,{size:14,className:"animate-spin motion-reduce:animate-none","aria-hidden":"true"}),n(p?"entries.mermaidError":"entries.mermaidLoading")]}),p&&l.jsx("pre",{className:"px-3 py-2.5 overflow-x-auto text-[13px] leading-[20px]",children:l.jsx("code",{children:e})})]});return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"content-block max-w-full",children:[l.jsxs(Ac,{label:n("entries.mermaidDiagram"),children:[l.jsxs(Y,{size:"compact",type:"button",onClick:h,children:[o?l.jsx(yt,{size:12,"aria-hidden":"true"}):l.jsx(Nr,{size:12,"aria-hidden":"true"}),l.jsx("span",{"aria-live":"polite",children:n(o?"entries.copied":"entries.copy")})]}),m&&l.jsxs(Y,{size:"compact",type:"button",onClick:()=>u(!0),"aria-haspopup":"dialog",children:[l.jsx(hf,{size:12,"aria-hidden":"true"}),n("entries.mermaidExpand")]})]}),m?l.jsx("div",{className:"px-3 py-2.5 overflow-x-auto",children:l.jsx("img",{src:x,alt:n("entries.mermaidDiagram"),className:"block mx-auto max-w-full h-auto"})}):y]}),l.jsx(Ee,{children:c&&l.jsx(li,{src:x,alt:n("entries.mermaidDiagram"),zoomable:!0,placeholder:y,onClose:()=>u(!1)},"preview")})]})}const Lc=f.createContext(!1);function $y(){return e=>{var t;((t=e.children[0])==null?void 0:t.type)==="yaml"&&(e.children[0]={type:"code",lang:"__frontmatter__",value:e.children[0].value})}}function Oy({yamlText:e}){let t=[];try{const n=ra.load(e);se(n)&&(t=Object.entries(n).map(([s,r])=>{const i=typeof r=="string"?r:JSON.stringify(r,null,2);return[s,i]}))}catch{t=[["raw",e]]}return t.length===0?null:l.jsx("div",{className:"content-block",children:l.jsx("table",{className:"w-full text-[13px]",children:l.jsx("tbody",{children:t.map(([n,s])=>l.jsxs("tr",{className:"border-b last:border-b-0 border-[var(--separator)]",children:[l.jsx("td",{className:"px-3 py-1.5 bg-[var(--fill-quaternary)] text-[var(--label-secondary)] font-medium whitespace-nowrap align-top w-[1%]",children:n}),l.jsx("td",{className:"px-3 py-1.5 text-[var(--label-primary)] whitespace-pre-wrap break-all",children:s})]},n))})})})}function Wt(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Wt).join(""):f.isValidElement(e)?Wt(e.props.children):""}function qo({language:e,children:t}){const{t:n}=q(),[s,r]=f.useState(!1),i=Wt(t).replace(/\n$/,""),o=f.useCallback(()=>{navigator.clipboard.writeText(i),r(!0),setTimeout(()=>r(!1),2e3)},[i]);return l.jsxs("div",{className:"content-block group/code relative",children:[l.jsx(Ac,{label:e||n("entries.code"),children:l.jsxs(Y,{size:"compact",onClick:o,"aria-label":n(s?"entries.copied":"entries.copy"),children:[s?l.jsx(yt,{size:12}):l.jsx(Nr,{size:12}),n(s?"entries.copied":"entries.copy")]})}),l.jsx("pre",{className:"px-3 py-2.5 overflow-x-auto text-[13px] leading-[20px]",children:l.jsx("code",{children:t})})]})}const _y={code({className:e,children:t,...n}){const s=f.useContext(Lc),r=/language-(\w+)/.exec(e||"");if((r==null?void 0:r[1])==="mermaid")return l.jsx(Py,{source:Wt(t).replace(/\n$/,""),streaming:s});if((r==null?void 0:r[1])==="__frontmatter__"){const i=Wt(t).replace(/\n$/,"");return l.jsx(Oy,{yamlText:i})}return r?l.jsx(qo,{language:r[1],children:t}):String(t).includes(`
260
- `)?l.jsx(qo,{language:"",children:t}):l.jsx("code",{className:"px-1.5 py-0.5 rounded-inline bg-[var(--fill-secondary)] text-[13px] font-mono break-words",...n,children:t})},pre({children:e}){return l.jsx(l.Fragment,{children:e})},p({children:e}){return l.jsx("p",{className:"text-[14px] leading-[22px] text-[var(--label-primary)] mb-2 last:mb-0",children:e})},h1({children:e}){return l.jsx("h1",{className:"text-[20px] leading-[26px] font-semibold text-[var(--label-primary)] mt-4 mb-2",children:e})},h2({children:e}){return l.jsx("h2",{className:"text-[17px] leading-[23px] font-semibold text-[var(--label-primary)] mt-3 mb-1.5",children:e})},h3({children:e}){return l.jsx("h3",{className:"text-[15px] leading-[21px] font-semibold text-[var(--label-primary)] mt-2 mb-1",children:e})},ul({children:e}){return l.jsx("ul",{className:"text-[14px] leading-[22px] text-[var(--label-primary)] pl-5 mb-2 list-disc space-y-0.5",children:e})},ol({children:e}){return l.jsx("ol",{className:"text-[14px] leading-[22px] text-[var(--label-primary)] pl-5 mb-2 list-decimal space-y-0.5",children:e})},li({children:e}){return l.jsx("li",{className:"text-[14px] leading-[22px]",children:e})},blockquote({children:e}){return l.jsx("blockquote",{className:"pl-3 border-l-2 border-[var(--color-accent)] text-[14px] leading-[22px] text-[var(--label-secondary)] my-2",children:e})},table({children:e}){return l.jsx("div",{className:"content-block overflow-x-auto",children:l.jsx("table",{className:"w-full text-[13px]",children:e})})},thead({children:e}){return l.jsx("thead",{className:"bg-[var(--fill-tertiary)] text-[var(--label-secondary)]",children:e})},th({children:e}){return l.jsx("th",{className:"px-3 py-1.5 text-left font-medium border-b border-[var(--separator)]",children:e})},td({children:e}){return l.jsx("td",{className:"px-3 py-1.5 border-b border-[var(--separator)]",children:e})},hr(){return l.jsx("hr",{className:"my-3 border-[var(--separator)]"})},a({href:e,children:t}){return l.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-[var(--color-accent)] hover:underline",children:t})},strong({children:e}){return l.jsx("strong",{className:"font-semibold text-[var(--label-primary)]",children:e})},em({children:e}){return l.jsx("em",{className:"italic text-[var(--label-primary)]",children:e})}};function Fy(e){if(!/^---\s*\n/.test(e))return e;const t=e.match(/\n---\s*(?:\n|$)/);if(!t||t.index===void 0)return e;const n=e.slice(4,t.index);let s=!1;try{const r=ra.load(n);s=typeof r=="object"&&r!==null&&!Array.isArray(r)&&Object.keys(r).length>0}catch{}return s?e:"***"+e.slice(3)}var sa;const Dy={...ls,attributes:{...ls.attributes,code:[...((sa=ls.attributes)==null?void 0:sa.code)||[],["className",/^language-.+/]]}};function Be({content:e,streaming:t=!1}){const n=f.useMemo(()=>Fy(e),[e]);return e.trim()?l.jsx(Lc.Provider,{value:t,children:l.jsx("div",{className:"markdown-body min-w-0 max-w-full break-words",children:l.jsx(Kc,{remarkPlugins:[Yc,Jc,Xc,$y],rehypePlugins:[Wc,[qc,Dy],[Gc,{plainText:["mermaid"]}]],components:_y,children:n})})}):null}function ui({timestamps:e,showRange:t=!1,showDuration:n=!1}){const{t:s,i18n:r}=q(),i=e.filter(p=>!!p).map(p=>({value:p,date:new Date(p)})).filter(({date:p})=>Number.isFinite(p.getTime())),o=i[0],a=i.at(-1),c=o&&a&&o.value!==a.value?[o,a]:o?[o]:[];if(!c.length)return null;const u={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"},d=o&&a?a.date.getTime()-o.date.getTime():0,h=(p,x=0)=>new Intl.NumberFormat(r.resolvedLanguage,{maximumFractionDigits:x}).format(p),g=(p,x,y=0)=>s(`conversation.duration${p}`,{count:x,value:h(x,y)});let m=null;if(t&&n&&c.length>1&&d>0){if(d<1e3)m=g("Milliseconds",d);else if(d<6e4)m=g("Seconds",Math.min(59.9,Math.round(d/100)/10),1);else{const p=Math.floor(d/1e3);m=(p<3600?[["Minutes",Math.floor(p/60)],["Seconds",p%60]]:p<86400?[["Hours",Math.floor(p/3600)],["Minutes",Math.floor(p/60)%60]]:[["Days",Math.floor(p/86400)],["Hours",Math.floor(p/3600)%24]]).filter(([,y])=>y>0).map(([y,v])=>g(y,v)).join(" ")}m=s("conversation.approximateDuration",{duration:m})}return l.jsxs("span",{className:"conversation-time inline-flex min-w-0 max-w-full flex-wrap items-center gap-x-3 gap-y-1 text-left text-[11px] tabular-nums text-[var(--label-secondary)] select-text",children:[(t?c:c.slice(0,1)).map(({value:p,date:x},y)=>l.jsxs("span",{className:"inline-flex flex-wrap items-baseline gap-x-1",children:[t&&l.jsx("span",{children:s(y===0?"conversation.replyStart":"conversation.replyEnd")}),l.jsx("time",{dateTime:p,children:x.toLocaleString(r.resolvedLanguage,u)})]},p)),m&&l.jsx("span",{className:"conversation-duration",children:m})]})}function Vy({type:e,summary:t,timestamp:n}){const{t:s}=q(),[r,i]=f.useState(!1),o=s(e==="compaction"?"entries.contextCompacted":"entries.branchSummary"),a=e==="compaction"?Ma:Na;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"conversation-system flex flex-wrap items-start gap-2 border-y border-[var(--separator)] px-3 py-2",children:[l.jsxs("button",{type:"button",disabled:!t,onClick:()=>i(!0),className:"flex min-w-0 flex-1 items-start gap-2 py-1 text-left focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:[l.jsx(a,{size:14,"aria-hidden":"true",className:"mt-0.5 shrink-0 text-[var(--label-secondary)]"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block text-[12px] font-medium text-[var(--label-secondary)]",children:o}),t&&l.jsx("span",{className:"mt-1 block truncate text-[12px] text-[var(--label-secondary)]",children:t})]}),t&&l.jsx(De,{size:14,"aria-hidden":"true",className:"mt-0.5 shrink-0 text-[var(--label-secondary)]"})]}),l.jsx(ui,{timestamps:[n]})]}),l.jsx(Ee,{children:r&&l.jsx(Pe,{title:o,onClose:()=>i(!1),children:l.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4 scrollbar-auto",children:l.jsx(Be,{content:t})})},"summary")})]})}function By({content:e,streaming:t,onBeforeToggle:n}){const{t:s}=q(),[r,i]=f.useState(!1),[o,a]=f.useState(!1),c=f.useId();return l.jsxs("div",{className:"rounded-content bg-[var(--fill-quaternary)]",children:[l.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":c,onClick:u=>{n==null||n(u.currentTarget),a(!0),i(!r)},className:"conversation-thinking-toggle flex w-full items-center gap-2 rounded-content px-3 text-left text-[12px] text-[var(--label-secondary)] hover:bg-[var(--fill-quaternary)] focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:[l.jsx(De,{size:14,"aria-hidden":"true",className:`shrink-0 transition-transform motion-reduce:transition-none ${r?"rotate-90":""}`}),l.jsx(Jn,{size:14,"aria-hidden":"true"}),l.jsx("span",{className:"flex-1",children:s(t?"entries.thinkingStreaming":"entries.thinking")})]}),l.jsx(Mc,{id:c,expanded:r,children:o&&l.jsx("div",{className:"px-3 pb-3 text-[var(--label-secondary)]",children:l.jsx(Be,{content:e,streaming:t})})})]})}const zy={pending:"conversation.toolPending",running:"entries.running",completed:"conversation.toolCompleted",error:"conversation.toolFailed",aborted:"entries.aborted",unknown:"conversation.toolUnknown"},Hy={pending:"conversation.toolsPending",running:"conversation.toolsRunning",completed:"conversation.toolsCompleted",error:"conversation.toolsFailed",aborted:"conversation.toolsAborted",unknown:"conversation.toolsUnknown"},Uy={pending:Le,running:Le,completed:tf,error:lf,aborted:of,unknown:sf},Ky={pending:"var(--label-secondary)",running:"var(--label-secondary)",completed:"var(--toast-icon-success)",error:"var(--toast-icon-error)",aborted:"var(--label-secondary)",unknown:"var(--label-secondary)"};function di(e,t){const{t:n}=q();return t===void 0?n(zy[e]):n(Hy[e],{count:t})}function fi({status:e,count:t}){const n=di(e,t),s=Uy[e],r=e==="pending"||e==="running";return l.jsxs("span",{role:"img","aria-label":n,title:n,"data-tool-status":e,className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap tabular-nums",children:[l.jsx(s,{size:14,"aria-hidden":"true",style:{color:Ky[e]},className:r?"animate-spin motion-reduce:animate-none":void 0}),t!==void 0&&l.jsx("span",{"aria-hidden":"true",children:t})]})}function rn({status:e}){const{t}=q(),n=di(e);return l.jsxs("div",{className:"space-y-1 text-[12px] text-[var(--label-secondary)]",children:[l.jsx("p",{children:n}),e==="unknown"&&l.jsx("p",{children:t("conversation.toolUnavailableDescription")})]})}function on({name:e,status:t}){return l.jsxs(l.Fragment,{children:[l.jsx(fi,{status:t}),e]})}function Wy(e,t){switch(e){case"read":{const n=typeof t.path=="string"?t.path:"",s=typeof t.offset=="number"?t.offset:void 0,r=typeof t.limit=="number"?t.limit:void 0;if(s!=null||r!=null){const i=s??"",o=r!=null?(s??1)+r-1:"";return`${n} [${i}:${o}]`}return n}case"bash":return t.command?String(t.command).slice(0,80):"";case"edit":case"write":return typeof t.path=="string"?t.path:"";default:return""}}function qn(e,t){let n=0;const s=/`+/g;let r;for(;(r=s.exec(e))!==null;)r[0].length>n&&(n=r[0].length);const i="`".repeat(Math.max(3,n+1));return`${i}${t}
261
- ${e}
262
- ${i}`}const qy={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",css:"css",scss:"scss",less:"less",html:"xml",htm:"xml",xml:"xml",svg:"xml",md:"markdown",mdx:"markdown",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",hpp:"cpp",cs:"csharp",php:"php",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",makefile:"makefile",lua:"lua",vim:"vim",diff:"diff",patch:"diff"};function Ic(e){var r;const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"dockerfile";if(n==="makefile"||n==="gnumakefile")return"makefile";const s=(r=t.split(".").pop())==null?void 0:r.toLowerCase();if(s)return qy[s]}function Gy({name:e,args:t,result:n,durationDisplay:s,status:r,onClose:i}){const{t:o}=q(),a=typeof t.command=="string"?t.command:"",c=typeof t.timeout=="number"?t.timeout:void 0,u=qn(a,"bash"),d=n&&!n.isError?qn(n.content.trim(),"plaintext"):null;return l.jsx(Pe,{title:l.jsx(on,{name:e,status:r}),onClose:i,trailing:s,children:l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-auto",children:[l.jsxs("div",{className:"px-5 pt-3 pb-3 bg-[var(--fill-quaternary)]",children:[c!=null&&l.jsxs("p",{className:"mb-2 text-[11px] text-[var(--label-tertiary)]",children:[o("entries.timeout"),": ",l.jsx("span",{className:"whitespace-nowrap",children:`${c} s`})]}),l.jsx(Be,{content:u})]}),l.jsxs("div",{className:"px-5 pt-3 pb-5",children:[l.jsx("h4",{className:"text-[11px] font-semibold text-[var(--label-tertiary)] uppercase tracking-wide mb-2",children:o("entries.output")}),n!==null?n.isError?l.jsx(Qe,{error:!0,children:n.content}):l.jsx(Be,{content:d}):l.jsx(rn,{status:r})]})]})})}function Yy({name:e,args:t,result:n,durationDisplay:s,status:r,onClose:i}){const{t:o}=q();return l.jsx(Pe,{title:l.jsx(on,{name:e,status:r}),onClose:i,trailing:s,children:l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pt-3 pb-5 space-y-3 scrollbar-auto",children:[l.jsxs("section",{children:[l.jsx("h4",{className:"text-[11px] font-semibold text-[var(--label-tertiary)] uppercase tracking-wide mb-1.5",children:o("entries.params")}),l.jsx(Qe,{children:JSON.stringify(t,null,2)})]}),n!==null&&l.jsxs("section",{children:[l.jsx("h4",{className:"text-[11px] font-semibold text-[var(--label-tertiary)] uppercase tracking-wide mb-1.5",children:o("entries.result")}),l.jsx(Qe,{error:n.isError,children:n.content})]}),n===null&&l.jsx("section",{children:l.jsx(rn,{status:r})})]})})}function Jy({diff:e}){const t=e.split(`
263
- `);return l.jsx("pre",{className:"text-[13px] leading-[20px] font-mono overflow-x-auto",children:l.jsx("div",{style:{minWidth:"fit-content"},children:t.map((n,s)=>{const r=n[0];return r==="+"?l.jsx("div",{className:"px-3 rounded-inline",style:{backgroundColor:"var(--diff-add-bg)",color:"var(--diff-add-text)"},children:n},s):r==="-"?l.jsx("div",{className:"px-3 rounded-inline",style:{backgroundColor:"var(--diff-del-bg)",color:"var(--diff-del-text)"},children:n},s):l.jsx("div",{className:"px-3",style:{color:"var(--diff-context-text)"},children:n},s)})})})}function Xy({name:e,args:t,result:n,durationDisplay:s,status:r,onClose:i}){var c;const o=typeof t.path=="string"?t.path:"",a=typeof((c=n==null?void 0:n.details)==null?void 0:c.diff)=="string"?n.details.diff:void 0;return l.jsxs(Pe,{trailing:s,title:l.jsx(on,{name:e,status:r}),onClose:i,children:[l.jsx("div",{className:"px-5 py-2 border-b border-[var(--separator)] bg-[var(--fill-quaternary)]",children:l.jsx("p",{className:"text-[13px] text-[var(--label-secondary)] break-all leading-[20px] font-mono",children:o})}),l.jsx("div",{className:"flex-1 overflow-y-auto pt-3 pb-5 scrollbar-auto",children:n!==null?n.isError?l.jsx(Qe,{error:!0,className:"mx-5",children:n.content}):a?l.jsx(Jy,{diff:a}):l.jsx(Qe,{className:"mx-5",children:n.content}):l.jsx("div",{className:"px-5",children:l.jsx(rn,{status:r})})})]})}function Zy({name:e,args:t,result:n,durationDisplay:s,status:r,onClose:i}){const o=typeof t.path=="string"?t.path:"",a=typeof t.offset=="number"?t.offset:void 0,c=typeof t.limit=="number"?t.limit:void 0,u=Ic(o);let d=o;if(a!=null||c!=null){const m=a??"",p=c!=null?(a??1)+c-1:"";d+=` [${m}:${p}]`}const h=u==="markdown",g=n&&!n.isError&&!h?qn(n.content,u??""):null;return l.jsxs(Pe,{title:l.jsx(on,{name:e,status:r}),onClose:i,trailing:s,children:[l.jsx("div",{className:"px-5 py-2 border-b border-[var(--separator)] bg-[var(--fill-quaternary)]",children:l.jsx("p",{className:"text-[13px] text-[var(--label-secondary)] break-all leading-[20px] font-mono",children:d})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-5 pt-3 pb-5 scrollbar-auto",children:n!==null?n.isError?l.jsx(Qe,{error:!0,children:n.content}):h?l.jsx(Be,{content:n.content}):l.jsx(Be,{content:g}):l.jsx(rn,{status:r})})]})}function Qy({name:e,args:t,result:n,durationDisplay:s,status:r,onClose:i}){const{t:o}=q(),a=typeof t.path=="string"?t.path:"",c=typeof t.content=="string"?t.content:"",u=Ic(a),d=u==="markdown",h=d?null:qn(c,u??"");return l.jsxs(Pe,{trailing:s,title:l.jsx(on,{name:e,status:r}),onClose:i,children:[l.jsx("div",{className:"px-5 py-2 border-b border-[var(--separator)] bg-[var(--fill-quaternary)]",children:l.jsx("p",{className:"text-[13px] text-[var(--label-secondary)] break-all leading-[20px] font-mono",children:a})}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pt-3 pb-5 space-y-3 scrollbar-auto",children:[l.jsx("section",{children:l.jsx(Be,{content:d?c:h})}),n!==null&&l.jsxs("section",{children:[l.jsx("h4",{className:"text-[11px] font-semibold text-[var(--label-tertiary)] uppercase tracking-wide mb-1.5",children:o("entries.result")}),l.jsx(Qe,{error:n.isError,children:n.content})]}),n===null&&l.jsx(rn,{status:r})]})]})}function ex(e){const t=e.name==="read"?Zy:e.name==="bash"?Gy:e.name==="write"?Qy:e.name==="edit"?Xy:Yy;return l.jsx(t,{...e})}function tx({name:e,args:t,toolCallId:n,presentation:s,compact:r=!1}){const{t:i}=q(),[o,a]=f.useState(!1),c=Wy(e,t),{status:u,result:d,startedAt:h}=s,g=u==="completed"||u==="error",m=di(u),p=nx(u==="running"?h:void 0),x=l.jsx(sx,{elapsed:g?d==null?void 0:d.durationMs:p,isFinal:g});return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-label":`${i("conversation.toolDetails",{name:e})}: ${m}`,title:m,"data-tool-state":u,onClick:()=>a(!0),className:r?"conversation-tool-row flex w-full items-center gap-2 rounded-control px-3 py-1 text-left group select-none hover:bg-[var(--fill-quaternary)] focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]":"w-full max-w-[640px] flex items-center gap-2.5 px-3 py-2 rounded-content bg-[var(--fill-card)] border border-[var(--separator)] hover:bg-[var(--fill-tertiary)] transition-colors text-left group select-none",children:[l.jsx(fi,{status:u}),l.jsx("span",{className:"text-[13px] font-medium text-[var(--label-primary)]",children:e}),c&&l.jsx("span",{className:"text-[12px] text-[var(--label-tertiary)] truncate flex-1 min-w-0",children:c}),l.jsxs("span",{className:"ml-auto flex items-center gap-2.5 flex-shrink-0",children:[x,l.jsx(De,{size:14,"aria-hidden":"true",className:"text-[var(--label-tertiary)] group-hover:text-[var(--label-secondary)] transition-colors"})]})]}),l.jsx(Ee,{children:o&&l.jsx(ex,{name:e,args:t,result:d,durationDisplay:x,status:u,onClose:()=>a(!1)},n??e)})]})}function nx(e){const[t,n]=f.useState(0);return f.useEffect(()=>{if(e===void 0)return;const s=()=>n(Math.max(0,performance.now()-e));s();const r=setInterval(s,1e3);return()=>clearInterval(r)},[e]),e===void 0?void 0:t}function sx({elapsed:e,isFinal:t}){const{t:n}=q();return e===void 0||!Number.isFinite(e)||e<=0?null:l.jsxs("span",{title:n(t?"entries.executionDuration":"entries.waitingDuration"),className:"flex items-center gap-1 text-[11px] text-[var(--label-tertiary)] flex-shrink-0",children:[l.jsx(Df,{size:12}),e<1e3?`${Math.max(1,Math.round(e))} ms`:`${(e/1e3).toFixed(1)} s`]})}function rx({content:e,timestamp:t}){const{t:n}=q(),[s,r]=f.useState(null);let i="",o=[];return typeof e=="string"?i=e:Array.isArray(e)?(i=e.filter(a=>a.type==="text").map(a=>a.text).join(""),o=e.filter(a=>a.type==="image")):i=JSON.stringify(e),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex flex-col items-end gap-1 px-1 py-1 md:px-2","aria-label":n("conversation.you"),children:[l.jsxs("div",{className:"max-w-[90%] rounded-surface bg-[var(--color-accent)] text-white md:max-w-[80%]",children:[o.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 pb-0",children:o.map((a,c)=>{const u=`data:${a.mimeType};base64,${a.data}`,d=n("conversation.attachedImage",{count:c+1});return l.jsx("button",{type:"button","aria-label":d,onClick:()=>r(u),className:"block overflow-hidden rounded-inline transition-opacity hover:opacity-90 motion-reduce:transition-none",children:l.jsx("img",{src:u,alt:d,className:"max-h-[150px] max-w-[200px] object-cover",draggable:!1})},c)})}),i&&l.jsx("p",{className:"break-words whitespace-pre-wrap px-3 py-2 text-[14px] leading-[22px]",children:i}),!i&&o.length>0&&l.jsx("div",{className:"h-2"})]}),l.jsx(ui,{timestamps:[t]})]}),l.jsx(Ee,{children:s&&l.jsx(li,{src:s,onClose:()=>r(null)},"image")})]})}function ix({items:e,conversationKey:t,status:n,isStreaming:s,onReEdit:r,onBeforeToggle:i}){var g;const{t:o}=q(),a=n!=="compacting"&&(n==="streaming"||s),c=e.at(-1),u=a&&(c==null?void 0:c.type)!=="reply"?{type:"reply",key:`reply:${(c==null?void 0:c.key)??"pending"}`,userEntryKey:(c==null?void 0:c.type)==="user"?c.key:void 0,entries:[],parts:[]}:null,d=u?[...e,u]:e,h=(g=d.slice().reverse().find(m=>m.type==="reply"))==null?void 0:g.key;return l.jsx(tn,{features:ss,strict:!0,children:l.jsx(ng,{reducedMotion:"user",children:l.jsxs("div",{className:"conversation-list space-y-3",children:[d.map(m=>{var p;return m.type==="user"?l.jsx("div",{"data-entry-key":m.key,children:l.jsx(rx,{content:(p=m.entry.message)==null?void 0:p.content,timestamp:m.entry.timestamp})},m.key):m.type==="system"?l.jsx("div",{"data-entry-key":m.key,children:l.jsx(Vy,{type:m.entry.type,summary:m.entry.summary??"",timestamp:m.entry.timestamp})},m.key):l.jsx(ox,{reply:m,active:a&&m.key===h,settled:n==="idle"&&!s,onReEdit:m.key===h?r:void 0,onBeforeToggle:i},m.key)}),n==="compacting"&&l.jsxs("div",{className:"conversation-system flex items-center gap-2 border-y border-[var(--separator)] px-3 py-3 text-[12px] text-[var(--label-secondary)]","data-system-state":"compacting",children:[l.jsx(Ma,{size:14,"aria-hidden":"true"}),l.jsxs("span",{role:"status",className:"inline-flex items-center gap-2",children:[l.jsx(Le,{size:14,"aria-hidden":"true",className:"animate-spin motion-reduce:animate-none"}),o("conversation.compactingContext")]})]})]},t)})})}function ox({reply:e,active:t,settled:n,onReEdit:s,onBeforeToggle:r}){var u;const{t:i}=q(),o=(u=e.entries.slice().reverse().find(d=>{var h;return((h=d.message)==null?void 0:h.role)==="assistant"}))==null?void 0:u.message,a=(o==null?void 0:o.stopReason)==="aborted",c=(o==null?void 0:o.stopReason)==="error";return l.jsxs("div",{className:"conversation-reply-group space-y-1",children:[l.jsxs("article",{className:"conversation-reply rounded-surface border border-[var(--separator)] bg-[var(--fill-quaternary)] shadow-[0_2px_12px_rgba(0,0,0,0.035)]","data-reply-key":e.key,children:[l.jsxs("div",{"data-entry-key":e.key,className:"flex min-h-10 flex-wrap items-center gap-x-2 gap-y-1 px-3 py-1.5 md:px-4",children:[l.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-control bg-[var(--fill-card)] text-[var(--label-secondary)]",children:l.jsx($f,{size:15,"aria-hidden":"true"})}),l.jsx("span",{className:"text-[14px] font-semibold text-[var(--label-primary)]",children:i("conversation.agentName")}),!t&&(c||a)&&l.jsx("span",{className:"text-[11px] text-[var(--label-secondary)]",children:i(c?"conversation.replyFailed":"entries.aborted")}),l.jsx("div",{className:"ml-auto flex items-center gap-2",children:s&&l.jsx(Y,{size:"compact",type:"button",onClick:s,className:"shrink-0 px-2 py-1.5 text-[12px] text-[var(--color-accent)] focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:i("reEdit.button")})})]}),e.parts.length>0&&l.jsx("div",{className:"space-y-2 px-4 pb-3 md:px-5 md:pb-4",children:e.parts.map(d=>l.jsx("div",{"data-entry-key":d.key,className:"conversation-part min-w-0",children:d.type==="execution"?l.jsx(ax,{execution:d,onBeforeToggle:r}):d.type==="text"?l.jsx(Be,{content:d.content,streaming:d.source.streaming}):l.jsx(Ay,{message:d.content})},d.key))})]}),l.jsx("div",{className:"conversation-reply-time px-1 md:px-2",children:l.jsx(ui,{timestamps:e.entries.map(d=>d.timestamp),showRange:!0,showDuration:n})})]})}function ax({execution:e,onBeforeToggle:t}){const{t:n}=q(),[s,r]=f.useState(!1),[i,o]=f.useState(!1),a=f.useId(),c=e.items.filter(h=>h.type==="thinking"),u=c.some(h=>h.source.streaming),d=f.useMemo(()=>[...new Set(e.items.flatMap(h=>h.type==="tool"?[h.name]:[]))],[e.items]);return l.jsxs("section",{className:"conversation-execution rounded-surface border border-[var(--separator)] bg-[var(--fill-quaternary)]","data-execution-key":e.key,children:[l.jsxs("button",{type:"button","aria-expanded":s,"aria-controls":a,"aria-describedby":`${a}-summary`,"aria-label":n(s?"conversation.collapseExecution":"conversation.expandExecution"),onClick:h=>{t==null||t(h.currentTarget),o(!0),r(!s)},className:"conversation-execution-toggle flex w-full items-center gap-2 rounded-surface px-3 py-1 text-left focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:[l.jsx(De,{size:14,"aria-hidden":"true",className:`shrink-0 text-[var(--label-secondary)] transition-transform motion-reduce:transition-none ${s?"rotate-90":""}`}),l.jsxs("span",{id:`${a}-summary`,className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 text-[12px] text-[var(--label-secondary)]",children:[l.jsxs("span",{className:"conversation-execution-counts inline-flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1",children:[l.jsx(cx,{counts:e.counts}),c.length>0&&l.jsx(ux,{count:c.length,streaming:u})]}),d.length>0&&l.jsx(lx,{names:d})]})]}),l.jsx(Mc,{id:a,expanded:s,children:i&&l.jsx("div",{className:"space-y-1 border-t border-[var(--separator)] p-2",children:e.items.map(h=>h.type==="thinking"?l.jsx(By,{content:h.content,streaming:h.source.streaming,onBeforeToggle:t},h.key):l.jsx(tx,{name:h.name,args:h.args,toolCallId:h.toolCallId,presentation:h.presentation,compact:!0},h.key))})})]})}function lx({names:e}){const{t}=q(),n=f.useRef(null),s=f.useRef(null),[r,i]=f.useState(e.length);f.useLayoutEffect(()=>{var m;const c=n.current,u=s.current;if(!c||!u)return;let d=!0;const h=()=>{if(!d)return;const p=c.getBoundingClientRect().width;if(p<=0)return;const x=Array.from(u.querySelectorAll("[data-measure-name]")).map(S=>S.getBoundingClientRect().width),y=Array.from(u.querySelectorAll("[data-measure-overflow]")).map(S=>S.getBoundingClientRect().width),v=parseFloat(getComputedStyle(c).columnGap)||0;let k=0,b=0;for(const[S,w]of x.entries()){k+=w+(S>0?v:0);const A=e.length-S-1;k+(A>0?v+(y[A-1]??0):0)<=p&&(b=S+1)}i(b)};h();const g=new ResizeObserver(h);return g.observe(c),g.observe(u),(m=document.fonts)==null||m.ready.then(h),()=>{d=!1,g.disconnect()}},[e]);const o=Math.min(r,e.length),a=e.length-o;return l.jsxs("span",{ref:n,className:"conversation-tool-names relative flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:[e.slice(0,o).map(c=>l.jsx("span",{"data-tool-name":c,className:"conversation-tool-name",children:c},c)),a>0&&l.jsxs("span",{className:"conversation-tool-overflow shrink-0 text-[11px] tabular-nums","aria-label":t("conversation.moreToolTypes",{count:a}),children:["+",a]}),l.jsxs("span",{ref:s,"aria-hidden":"true",className:"conversation-tool-measure pointer-events-none invisible absolute left-0 top-0 flex w-max items-center gap-1",children:[e.map(c=>l.jsx("span",{"data-measure-name":!0,className:"conversation-tool-name",children:c},c)),e.map((c,u)=>l.jsxs("span",{"data-measure-overflow":!0,className:"shrink-0 text-[11px] tabular-nums",children:["+",u+1]},u))]})]})}function cx({counts:e}){const t=["pending","running","completed","error","aborted","unknown"];return l.jsx(l.Fragment,{children:t.map(n=>e[n]>0?l.jsx(fi,{status:n,count:e[n]},n):null)})}function ux({count:e,streaming:t}){const{t:n}=q(),s=n(t?"conversation.thinkingStreamingCount":"conversation.thinkingCount",{count:e}),r=t?Le:Jn;return l.jsxs("span",{role:"img","aria-label":s,title:s,"data-thinking-status":t?"streaming":"completed",className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap tabular-nums text-[var(--label-secondary)]",children:[l.jsx(r,{size:14,"aria-hidden":"true",className:t?"animate-spin motion-reduce:animate-none":void 0}),l.jsx("span",{"aria-hidden":"true",children:e})]})}function dx(e,t){if(t&&(e===t||e.startsWith(t.endsWith("/")?t:t+"/"))){const n=e.slice(t.length);return!n||n==="/"?"~":"~"+(n.startsWith("/")?n:"/"+n)}return e}function yr(e,t){if(e.length<=t)return e;const n=Math.floor((t-1)/2),s=t-1-n;return e.slice(0,s)+"…"+e.slice(-n)}function fx(e){const t=e.split("/").filter(Boolean);return t.length<=2?e.length:t.slice(-2).join("/").length}function Go(e,t){if(e.length<=t)return e;const n=fx(e);if(n+2<=t){const s=t-1-n;return e.slice(0,s)+"…"+e.slice(-n)}return yr(e,t)}const hx=6.2,px=20,mx=8;function Yo({icon:e,text:t,copyText:n,title:s}){const[r,i]=f.useState(!1),o=f.useRef(null);f.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const a=f.useCallback(()=>{navigator.clipboard.writeText(n).then(()=>{i(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>i(!1),1500)},()=>{})},[n]);return l.jsxs(Y,{size:"inline",type:"button",onClick:a,title:s??n,className:"inline-flex min-h-[18px] min-w-0 items-center gap-1 px-1 -mx-1 transition-colors hover:bg-[var(--fill-tertiary)] active:bg-[var(--fill-secondary)] cursor-pointer select-none focus-visible:outline-2 focus-visible:outline-[var(--color-accent)]",children:[l.jsx("span",{className:"shrink-0 opacity-70",children:r?l.jsx(yt,{size:11,className:"text-[var(--toast-icon-success)]"}):e}),l.jsx("span",{className:"truncate",children:t})]})}function Jo({title:e,cwd:t,homedir:n,gitBranch:s,actions:r}){const i=t?dx(t,n):null,o=f.useRef(null),[a,c]=f.useState(i),[u,d]=f.useState(s),h=f.useCallback(()=>{const g=o.current;if(!g)return;const m=g.getBoundingClientRect().width;if(m<=0)return;const p=(i?1:0)+(s?1:0),x=p*px+(p-1)*mx,y=Math.floor((m-x)/hx);if(i&&s){const v=Math.max(10,Math.floor(y*.6)),k=Math.max(8,y-v);c(Go(i,v)),d(yr(s,k))}else i?c(Go(i,Math.max(10,y))):s&&d(yr(s,Math.max(8,y)))},[i,s]);return f.useEffect(()=>{const g=o.current;if(!g)return;const m=new ResizeObserver(()=>h());return m.observe(g),h(),()=>m.disconnect()},[h]),f.useEffect(()=>{c(i),d(s),h()},[i,s,h]),l.jsxs("div",{className:"flex min-h-[44px] min-w-0 w-full flex-1 items-center justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"truncate text-[14px] leading-[20px] font-medium text-[var(--label-primary)] select-text",children:e}),(i||s)&&l.jsxs("div",{ref:o,className:"mt-0.5 flex min-w-0 items-center gap-2 text-[11px] leading-[14px] text-[var(--label-secondary)]",children:[a&&l.jsx(Yo,{icon:l.jsx(Ta,{size:11}),text:a,copyText:t,title:t},t),u&&l.jsx(Yo,{icon:l.jsx(Na,{size:11}),text:u,copyText:s},s)]})]}),r&&l.jsx("div",{className:"flex shrink-0 items-center justify-center",children:r})]})}function gx(e,t){const n=new Date(e),r=Date.now()-n.getTime(),i=Math.floor(r/6e4);if(i<1)return t("session.timeJustNow");if(i<60)return`${i}m`;const o=Math.floor(i/60);if(o<24)return`${o}h`;const a=Math.floor(o/24);if(a<7)return`${a}d`;const c=Math.floor(a/7);return c<4?`${c}w`:n.toLocaleDateString()}function yx({sessions:e,loading:t,hasMore:n,total:s,disabled:r,onOpen:i,onNewSession:o,onSwitchSession:a,onLoadMore:c,onFilterChange:u}){const{t:d}=q(),[h,g]=f.useState(""),m=f.useRef(null),p=f.useRef(null);f.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const x=f.useCallback(v=>{g(v),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{u(v)},300)},[u]),y=f.useCallback(v=>{if(!n||t)return;const k=v.currentTarget;k.scrollHeight-k.scrollTop-k.clientHeight<40&&c(e.length,h)},[n,t,e.length,h,c]);return l.jsx(wt,{label:d("session.title"),trigger:({open:v,id:k})=>l.jsx(Y,{size:"icon",type:"button",disabled:r,"aria-label":d("session.title"),"aria-haspopup":"dialog","aria-expanded":v,"aria-controls":v?k:void 0,className:`flex items-center justify-center transition-colors focus-visible:outline-2 focus-visible:outline-[var(--color-accent)] ${v?"bg-[var(--fill-secondary)]":"hover:bg-[var(--fill-tertiary)]"} ${r?"opacity-40 pointer-events-none":""}`,title:d("session.title"),onClick:()=>{v||(g(""),i())},children:l.jsx(wf,{size:18,className:"text-[var(--label-secondary)]","aria-hidden":"true"})}),width:320,maxHeight:420,disabled:r,placement:"bottom",children:v=>l.jsxs("div",{className:"ui-menu-layout",children:[l.jsxs("div",{className:"ui-menu-heading",children:[l.jsxs("span",{className:"text-[13px] font-medium text-[var(--label-primary)] select-none",children:[d("session.title"),s>0&&l.jsxs("span",{className:"ml-1.5 text-[11px] font-normal text-[var(--label-tertiary)]",children:["(",s,")"]})]}),l.jsxs(Y,{size:"compact",variant:"ghost",className:"active:bg-[var(--fill-tertiary)]",onClick:()=>{o(),v()},disabled:r,children:[l.jsx(Aa,{size:12}),l.jsx("span",{children:d("session.new")})]})]}),l.jsx("div",{className:"px-3 pb-2",children:l.jsx(si,{"aria-label":d("session.filter"),type:"text",placeholder:d("session.filter"),value:h,onChange:k=>x(k.target.value),autoFocus:!0})}),l.jsx("div",{className:"h-px bg-[var(--separator)] mx-2"}),l.jsx("div",{ref:p,className:"ui-menu-scroll flex-1 scrollbar-auto",onScroll:y,children:t&&e.length===0?l.jsx(we,{tone:"loading",children:d("common.loading")}):e.length===0?l.jsx(we,{children:d(h?"session.noMatch":"session.noPrevious")}):l.jsxs(l.Fragment,{children:[e.map(k=>l.jsxs(be,{selected:k.isCurrent,"aria-current":k.isCurrent||void 0,onClick:()=>{k.isCurrent||(a(k.path),v())},disabled:k.isCurrent,className:"flex-col items-stretch gap-0.5",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:`text-[14px] leading-[20px] truncate ${k.isCurrent?"font-medium text-[var(--color-accent)]":"text-[var(--label-primary)]"}`,children:k.name||k.firstMessage||d("session.empty")}),l.jsx("span",{className:"text-[12px] text-[var(--label-secondary)] whitespace-nowrap shrink-0",children:gx(k.modified,d)})]}),k.name&&k.firstMessage&&l.jsx("div",{className:"mt-0.5 text-[12px] leading-[18px] text-[var(--label-secondary)] truncate",children:k.firstMessage}),l.jsx("div",{className:"mt-0.5 text-[11px] text-[var(--label-secondary)]",children:d("session.messageCount",{count:k.messageCount})})]},k.id)),t&&e.length>0&&l.jsx("div",{className:"flex items-center justify-center py-2",children:l.jsx(Le,{size:14,className:"animate-spin text-[var(--label-tertiary)]"})})]})})]})})}function Tn(e){return se(e)&&typeof e.role=="string"&&"content"in e}function xx(e){if(!se(e)||typeof e.type!="string")return!1;for(const t of["id","__renderKey","timestamp","summary"])if(e[t]!==void 0&&typeof e[t]!="string")return!1;return(e.parentId===void 0||e.parentId===null||typeof e.parentId=="string")&&(e.message===void 0||Tn(e.message))}function vx(e){if(!se(e)||typeof e.toolCallId!="string"||!e.toolCallId||e.parentToolCallId!==void 0&&typeof e.parentToolCallId!="string")return!1;switch(e.type){case"tool_execution_start":case"tool_execution_update":return!0;case"tool_execution_end":return typeof e.isError=="boolean"&&(e.durationMs===void 0||typeof e.durationMs=="number");default:return!1}}function it(e){const t=e.id??e.__renderKey;if(!t)throw new Error(`SessionEntry missing stable render key: type=${e.type}`);return t}function bx(e,t,n,s,r=wx){return f.useMemo(()=>Cx(e,t,n,s,r),[e,t,n,s,r])}const wx=new Set;function Xo(e,t=!1,n){const s=se(e)?e:null,r=s==null?void 0:s.content;return{content:Array.isArray(r)?r.flatMap(i=>se(i)&&i.type==="text"&&typeof i.text=="string"?[i.text]:[]).join(`
264
- `):String(r??""),details:se(s==null?void 0:s.details)?s.details:void 0,isError:t,durationMs:n}}function Zo(e){return e.status==="completed"||e.status==="error"?{status:e.status,result:Xo(e.result,e.status==="error",e.durationMs)}:e.status==="running"?{status:e.status,result:e.execution.partialResult!=null?Xo(e.execution.partialResult):null,startedAt:e.execution.startedAt}:{status:e.status,result:null}}function Sx(e,t,n,s,r,i){var c,u;const o=n.get(e);if(o!=null&&o.message){const d=o.message;return{status:d.isError===!0?"error":"completed",result:d,resultEntry:o,durationMs:typeof d.durationMs=="number"?d.durationMs:void 0}}const a=s.get(e);return(a==null?void 0:a.status)==="completed"?{status:a.isError?"error":"completed",result:a.result,durationMs:a.durationMs}:((c=t.message)==null?void 0:c.stopReason)==="aborted"||((u=t.message)==null?void 0:u.stopReason)==="error"?{status:"aborted"}:(a==null?void 0:a.status)==="running"&&r!=="idle"?{status:"running",execution:a}:i&&r!=="idle"?{status:"pending"}:{status:"unknown"}}function Cx(e,t,n,s,r){var p;const i=new Map;for(const x of e){const y=x.message;x.type==="message"&&(y==null?void 0:y.role)==="toolResult"&&typeof y.toolCallId=="string"&&!i.has(y.toolCallId)&&i.set(y.toolCallId,x)}const o=[],a=new Map;let c,u,d,h;function g(x){return u||(u={type:"reply",key:`reply:${h??c??it(x)}`,userEntryKey:c,entries:[],parts:[]},o.push(u)),u}function m(x){return d||(d={type:"execution",key:`execution:${x.key}`,items:[],counts:{pending:0,running:0,completed:0,error:0,aborted:0,unknown:0}},g(x.entry).parts.push(d)),d}for(const x of e){if(x.type==="compaction"||x.type==="branch_summary"){const S={type:"system",key:it(x),entry:x};o.push(S),h=S.key,u=void 0,d=void 0;continue}if(x.type!=="message"||!x.message)continue;const y=x.message;if(y.role==="user"){c=it(x),o.push({type:"user",key:c,entry:x}),u=void 0,h=void 0,d=void 0;continue}if(y.role==="toolResult"){typeof y.toolCallId=="string"&&((p=a.get(y.toolCallId))==null||p.entries.push(x));continue}if(y.role!=="assistant")continue;const v=g(x);v.entries.push(x);const k=it(x),b=Array.isArray(y.content)?y.content:typeof y.content=="string"?[{type:"text",text:y.content}]:[];for(const[S,w]of b.entries()){if(!se(w))continue;const A={key:`${k}:block:${S}`,entry:x,blockIndex:S,streaming:x===n&&S===b.length-1};if(w.type==="text"&&typeof w.text=="string"){if(!w.text.trim())continue;v.parts.push({type:"text",key:A.key,source:A,content:w.text}),d=void 0}else if(w.type==="thinking"&&typeof w.thinking=="string"){const T=m(A);if(!w.thinking.trim())continue;T.items.push({type:"thinking",key:A.key,source:A,content:w.thinking})}else if(w.type==="toolCall"&&typeof w.id=="string"&&typeof w.name=="string"){if(a.has(w.id))continue;a.set(w.id,v);const T=m(A),C=Sx(w.id,x,i,t,n?"streaming":s,x===n||r.has(w.id));T.items.push({type:"tool",key:`tool:${w.id}`,source:A,toolCallId:w.id,name:w.name,args:se(w.arguments)?w.arguments:{},state:C,presentation:Zo(C)}),T.counts[C.status]+=1}}if((y.stopReason==="error"||y.stopReason==="aborted")&&typeof y.errorMessage=="string"&&y.errorMessage&&(v.parts.push({type:"error",key:`${k}:error`,source:{key:k,entry:x,streaming:x===n},content:y.errorMessage,stopReason:y.stopReason}),d=void 0),y.stopReason==="aborted"||y.stopReason==="error"){for(const S of v.parts)if(S.type==="execution")for(const w of S.items)w.type!=="tool"||!["pending","running","unknown"].includes(w.state.status)||(S.counts[w.state.status]-=1,w.state={status:"aborted"},w.presentation=Zo(w.state),S.counts.aborted+=1)}}for(const x of o)x.type==="reply"&&(x.parts=x.parts.filter(y=>y.type!=="execution"||y.items.length>0));return o}let kx=0;function xr(e,t){return`${e}:${t}:${kx++}`}function Qo(e,t,n){return t.id||t.__renderKey?t:{...t,__renderKey:xr(e,n)}}const jx=()=>{};function Ex(e,t,n=jx){const{t:s}=q(),r=le(L=>L.send),i=le(L=>L.subscribe),o=le(L=>L.connectionState==="connected"),[a,c]=f.useState([]),[u,d]=f.useState(new Map),[h,g]=f.useState(new Set),[m,p]=f.useState(null),x=f.useRef(null),y=f.useRef(null),[v,k]=f.useState("idle"),[b,S]=f.useState(null),[w,A]=f.useState(!1),T=f.useRef(a);T.current=a;const C=f.useRef(v);C.current=v;const E=f.useRef(w);E.current=w;const j=f.useCallback(()=>{c([]),d(new Map),g(new Set),x.current=null,y.current=null,p(null),k("refreshing"),S(null),A(!1),n()},[n]);f.useEffect(()=>i(L=>{switch(L.type){case"forwarded_event":{if(L.payload.instanceId!==e)return;P(e,L.payload.event,L.payload.data,L.payload.timestamp);break}case"history":{if(L.payload.instanceId!==e)return;const M=L.payload.messages;if(!Array.isArray(M)||!M.every(xx)){console.error("[Paimon] Invalid conversation history"),k("error"),S(null);break}const D=L.payload.hasMore??!1;I(e,M,D);break}case"error":{console.error("[Paimon]",L.payload.message),k("error"),S(L.payload.message);break}case"instance_error":{if(L.payload.instanceId!==e)return;const M=L.payload.action?`error.action.${L.payload.action}`:null,D=M?s(M,{message:L.payload.message,defaultValue:L.payload.message}):L.payload.message;ht(D,"error");break}}}),[e,i]),f.useEffect(()=>{if(o)return j(),r({type:"subscribe",payload:{instanceId:e}}),r({type:"get_history",payload:{instanceId:e}}),()=>{r({type:"unsubscribe",payload:{instanceId:e}})}},[e,o,r,j]);const O=f.useRef(t==null?void 0:t.sessionId),$=f.useRef(e);f.useEffect(()=>{const L=t==null?void 0:t.sessionId;if(e!==$.current){$.current=e,L!==void 0&&(O.current=L);return}O.current!==void 0&&L!==void 0&&L!==O.current&&(j(),r({type:"get_history",payload:{instanceId:e}})),L!==void 0&&(O.current=L)},[t==null?void 0:t.sessionId,e,r,j]);const R=f.useRef(t==null?void 0:t.status);f.useEffect(()=>{const L=t==null?void 0:t.status;R.current==="compacting"&&L!=="compacting"&&(j(),r({type:"get_history",payload:{instanceId:e}})),R.current=L},[t==null?void 0:t.status,e,r,j]);function N(L){if((L==null?void 0:L.role)!=="assistant")return;const M=Array.isArray(L.content)?L.content:[];g(new Set(M.flatMap(D=>se(D)&&D.type==="toolCall"&&typeof D.id=="string"?[D.id]:[])))}function P(L,M,D,B){if(!se(D))return;const V=D,K=new Date(B).toISOString();switch(M){case"tool_execution_start":case"tool_execution_update":case"tool_execution_end":{const z={...V,type:M};if(!vx(z)||z.parentToolCallId)break;const X=z.type==="tool_execution_start"?performance.now():void 0;d(oe=>{const J=oe.get(z.toolCallId);if((J==null?void 0:J.status)==="completed"&&z.type!=="tool_execution_end")return oe;const de=new Map(oe);return de.set(z.toolCallId,z.type==="tool_execution_end"?{status:"completed",startedAt:J==null?void 0:J.startedAt,result:z.result,isError:z.isError,durationMs:z.durationMs}:{status:"running",startedAt:z.type==="tool_execution_start"?X:J==null?void 0:J.startedAt,partialResult:z.type==="tool_execution_update"?z.partialResult:(J==null?void 0:J.status)==="running"?J.partialResult:void 0}),de});break}case"message_start":{const z=V.message;if(!Tn(z)||z.role!=="assistant")break;N(z);const X=Qo(L,{type:"message",timestamp:K,message:z},"streaming");x.current=X.__renderKey??X.id??null,y.current=K,p(X);break}case"message_update":{const z=V.message;if(!Tn(z))break;N(z);const X=x.current??xr(L,"streaming");x.current=X;const oe=y.current??K;y.current=oe,p(J=>J?{...J,message:z}:{type:"message",timestamp:oe,message:z,__renderKey:X});break}case"message_end":{const z=V.message;if(Tn(z)){N(z);const X=x.current??xr(L,"live"),oe={type:"message",timestamp:y.current??K,message:z,__renderKey:X};if(c(J=>[...J,oe]),z.role==="toolResult"&&typeof z.toolCallId=="string"){const J=z.toolCallId;d(de=>{if(!de.has(J))return de;const te=new Map(de);return te.delete(J),te})}}x.current=null,y.current=null,p(null);break}}}function I(L,M,D){const B=M.map(V=>Qo(L,V,"history"));C.current==="loadingMore"?c(V=>[...B,...V]):c(B),d(V=>{var z;const K=new Map(V);for(const X of M)((z=X.message)==null?void 0:z.role)==="toolResult"&&typeof X.message.toolCallId=="string"&&K.delete(X.message.toolCallId);return K}),A(D),k("idle"),S(null)}const _=f.useCallback(()=>{if(!E.current||C.current!=="idle")return;const L=T.current.length;k("loadingMore"),r({type:"get_history",payload:{instanceId:e,offset:L}})},[e,r]),F=f.useMemo(()=>m?[...a,m]:a,[a,m]),U=bx(F,u,m,t==null?void 0:t.status,h);return{entries:F,displayItems:U,toolExecutions:u,streamingEntry:m,isStreaming:m!==null,loadState:v,errorMessage:b,hasMore:w,loadMore:_}}const Tx=.5;function Nx({topChromeHeight:e,bottomChromeHeight:t,bottomSafeGap:n=0}){const s=Math.max(0,t-n),r=Math.max(40,s+12);return{paddingTop:Math.max(24,e+16),paddingBottom:r,scrollButtonBottom:n+r}}function Rx({previousScrollTop:e,previousScrollHeight:t,nextScrollHeight:n}){return e+n-t}function Mx(e){return e==="streaming"||e==="compacting"?"stop":"send"}function Lt(e){return Math.max(0,e)}function Ax({isAtBottom:e,isLoadingMore:t,distanceToBottom:n,overlap:s,force:r=!1,scrollToBottom:i}){return!e||t||!r&&n<=Tx&&s<=0?!1:(i(),!0)}function Lx({rawScrollTop:e,hasMore:t,canLoadMore:n,isLoadingMore:s,isSuppressed:r}){return e>=0&&Lt(e)<100&&t&&n&&!s&&!r}function Ix(e){const t=f.useRef(null),n=f.useRef(null),s=f.useRef(null),[r,i]=f.useState(64),[o,a]=f.useState(96),[c,u]=f.useState(12);return f.useLayoutEffect(()=>{const d=(p,x)=>{if(!p)return()=>{};const y=()=>{x(Math.ceil(p.getBoundingClientRect().height))};if(y(),typeof ResizeObserver>"u")return()=>{};const v=new ResizeObserver(y);return v.observe(p),()=>v.disconnect()},h=d(t.current,i),g=d(n.current,a),m=d(s.current,u);return()=>{h(),g(),m()}},[e]),{topChromeRef:t,bottomChromeRef:n,bottomSafeGapRef:s,topChromeHeight:r,bottomChromeHeight:o,bottomSafeGap:c,scrollSpacing:Nx({topChromeHeight:r,bottomChromeHeight:o,bottomSafeGap:c})}}function Px(e,t,n,s){const{t:r}=q(),i=Wn(u=>u.setDraft),{canReEdit:o,userContent:a}=f.useMemo(()=>{var d,h;if(n!=="idle"||t.length===0)return{canReEdit:!1,userContent:null};const u=t[t.length-1];if(u.type!=="message"||((d=u.message)==null?void 0:d.role)!=="assistant"||u.message.stopReason!=="aborted")return{canReEdit:!1,userContent:null};for(let g=t.length-2;g>=0;g--){const m=t[g];if(m.type==="message"&&((h=m.message)==null?void 0:h.role)==="user")return{canReEdit:!0,userContent:m.message.content}}return{canReEdit:!1,userContent:null}},[t,n]),c=f.useCallback(()=>{if(!o||a==null)return;const u=Wn.getState().drafts.get(e)??ci;if(u.text.trim()||u.images.length>0){ht(r("reEdit.draftNotEmpty"),"warning");return}const d=$x(a);pt.flushSync(()=>{i(e,d)}),s==null||s()},[o,a,e,i,r,s]);return o?c:void 0}function $x(e){let t="";const n=[];if(typeof e=="string")t=e;else if(Array.isArray(e)){const s=[];for(const r of e)if(se(r)){if(r.type==="text"&&typeof r.text=="string")s.push(r.text);else if(r.type==="image"&&typeof r.data=="string"&&typeof r.mimeType=="string"){const i=Rc();n.push({id:i,data:r.data,mimeType:r.mimeType,previewUrl:`data:${r.mimeType};base64,${r.data}`})}}t=s.join("")}return{text:t,images:n}}const ea=350,an="data-entry-key",Ox=.5,_x=3,Fx=2e3;function is(e){return e.getAttribute(an)??void 0}function hi(e,t){const n=t.closest(`[${an}]`);return!n||!e.contains(n)?null:n}function Pc(e,t){const n=e.querySelectorAll(`[${an}]`);for(const s of n)if(is(s)===t)return s;return null}function Xe(e,t){return t.getBoundingClientRect().top-e.top}function Dx(e){const t=e.getBoundingClientRect(),n=t.top+8,s=e.querySelectorAll(`[${an}]`);for(const r of s){const i=r.getBoundingClientRect();if(i.bottom>n&&i.top<t.bottom)return r}return null}function Vx(e){const t={fallbackScrollTop:Lt(e.scrollTop),fallbackScrollHeight:e.scrollHeight},n=e.getBoundingClientRect(),s=Dx(e);if(!s)return t;const r=is(s);if(!r)return t;const i=s.getBoundingClientRect(),o=Math.min(Math.max(n.top+12,i.top+8),Math.min(i.bottom-1,n.bottom-1)),a=[{x:n.left+n.width/2,y:o},{x:n.left+24,y:o},{x:n.right-24,y:o}];for(const c of a){const u=document.elementsFromPoint(c.x,c.y);for(const d of u){if(d===e||!e.contains(d))continue;const h=hi(e,d);if(!h||h!==s)continue;const g=d.getBoundingClientRect();if(!(g.bottom<=n.top||g.top>=n.bottom))return{...t,entryKey:r,element:d,elementTop:Xe(n,d),entryTop:Xe(n,s)}}}return{...t,entryKey:r,entryTop:Xe(n,s)}}function ta(e,t){Math.abs(t)<=Ox||(e.scrollTop+=t)}function na(e,t,{allowDiffFallback:n}){const s=e.getBoundingClientRect();if(t.element&&t.elementTop!=null&&t.element.isConnected&&e.contains(t.element)){const r=hi(e,t.element),i=r?is(r):void 0;if(!t.entryKey||i===t.entryKey){const o=Xe(s,t.element)-t.elementTop;return ta(e,o),{mode:"deep"}}}if(t.entryKey&&t.entryTop!=null){const r=Pc(e,t.entryKey);if(r){const i=Xe(s,r)-t.entryTop;return ta(e,i),{mode:"entry"}}}if(n){const r=Rx({previousScrollTop:t.fallbackScrollTop,previousScrollHeight:t.fallbackScrollHeight,nextScrollHeight:e.scrollHeight});return e.scrollTop=r,{mode:"diff"}}return{mode:"none"}}function Bx({scrollRef:e,contentRef:t,bottomChromeRef:n,entries:s,entriesRef:r,instanceId:i,hasMore:o,shouldScrollToBottom:a,onScrollToBottomHandled:c,onLoadMore:u,bottomChromeHeight:d,bottomSafeGap:h}){const g=f.useRef(!0),[m,p]=f.useState(!1),x=f.useRef(!1),y=f.useRef(!1),v=f.useRef(null),k=f.useRef(null),b=f.useRef(!1),S=f.useRef(null),w=f.useRef(s.length),A=f.useRef(void 0),T=f.useRef(0),C=f.useRef(null),E=f.useCallback(L=>{v.current!=null&&cancelAnimationFrame(v.current),y.current=!0,x.current=!0,L(),v.current=requestAnimationFrame(()=>{y.current=!1,x.current=!1,v.current=null})},[]),j=f.useCallback(()=>{var M;const L=C.current;L&&(L.rafId!=null&&cancelAnimationFrame(L.rafId),(M=L.observer)==null||M.disconnect(),C.current=null)},[]),O=f.useCallback(({force:L=!1}={})=>{const M=e.current,D=t.current,B=n.current;if(!M||!D||!B)return!1;const V=D.querySelectorAll(`[${an}]`),K=V[V.length-1],z=K==null?void 0:K.getBoundingClientRect(),X=B.getBoundingClientRect(),oe=M.scrollHeight-Lt(M.scrollTop)-M.clientHeight,J=z?z.bottom-X.top:0;return Ax({isAtBottom:g.current,isLoadingMore:b.current,distanceToBottom:oe,overlap:J,force:L,scrollToBottom:()=>{j(),E(()=>{M.scrollTop=M.scrollHeight}),p(!1)}})},[e,t,n,E,j]),$=f.useCallback(()=>{var L;(L=k.current)==null||L.call(k),k.current=null},[]),R=f.useCallback(()=>{$();const L=performance.now();let M=null,D=!1;const B=(V=performance.now())=>{M=null,!(D||V-L>=Fx)&&(!g.current||b.current||(O(),M=requestAnimationFrame(B)))};B(),k.current=()=>{D=!0,M!=null&&(cancelAnimationFrame(M),M=null)}},[O,$]);f.useLayoutEffect(()=>{b.current||O()},[d,h,O]),f.useLayoutEffect(()=>{const L=t.current;if(!L||typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>{O()});return M.observe(L),()=>M.disconnect()},[i,t,O]);const N=f.useCallback(()=>{const L=e.current,M=C.current;if(!L||!M)return;let D={mode:"none"};E(()=>{D=na(L,M.snapshot,{allowDiffFallback:!1})}),D.mode==="none"&&j()},[e,E,j]),P=f.useCallback(()=>{const L=C.current;!L||L.rafId!=null||(L.rafId=requestAnimationFrame(()=>{const M=C.current;!M||M!==L||(M.rafId=null,N())}))},[N]),I=f.useCallback(L=>{const M=e.current,D=t.current;if(!M||!D||!L.entryKey)return;j();const B={snapshot:L,observer:null,rafId:null,warmupFrame:0};if(C.current=B,typeof ResizeObserver<"u"){const K=new ResizeObserver(()=>{P()});K.observe(D);const z=Pc(M,L.entryKey);z&&z!==D&&K.observe(z),B.observer=K}const V=()=>{const K=C.current;!K||K!==B||K.warmupFrame>=_x||(K.rafId=requestAnimationFrame(()=>{const z=C.current;!z||z!==B||(z.rafId=null,z.warmupFrame+=1,N(),V())}))};V()},[e,t,N,P,j]);f.useLayoutEffect(()=>(b.current=!1,S.current=null,A.current=void 0,T.current=0,w.current=r.current.length,g.current=!0,p(!1),()=>{$(),j(),v.current!=null&&(cancelAnimationFrame(v.current),v.current=null),y.current=!1,x.current=!1,b.current=!1,S.current=null,A.current=void 0,T.current=0}),[i,r,j,$]),f.useLayoutEffect(()=>{e.current&&(b.current||O())},[s,i,e,O]),f.useLayoutEffect(()=>{if(!a)return;if(!e.current){c();return}g.current=!0,O({force:!0}),p(!1),c()},[a,s,e,O,c]),f.useLayoutEffect(()=>{const L=e.current;if(b.current&&L&&s.length>w.current){const M=s[0]?it(s[0]):void 0;if(!A.current||M!==A.current){const B=S.current;let V={mode:"none"};B&&E(()=>{V=na(L,B,{allowDiffFallback:!0})}),T.current=performance.now()+ea,B&&B.entryKey&&V.mode!=="none"&&I(B),b.current=!1,S.current=null,A.current=void 0}else S.current&&(S.current={...S.current,fallbackScrollHeight:L.scrollHeight})}b.current&&!o&&(b.current=!1,S.current=null,A.current=void 0),w.current=s.length},[s,o,i,e,E,I]);const _=f.useCallback(L=>{const M=e.current;if(!M||b.current||(T.current=performance.now()+ea,g.current))return;const D=hi(M,L),B=D?is(D):void 0;if(!D||!B)return;const V=M.getBoundingClientRect();I({entryKey:B,element:L,elementTop:Xe(V,L),entryTop:Xe(V,D),fallbackScrollTop:Lt(M.scrollTop),fallbackScrollHeight:M.scrollHeight})},[e,I]),F=f.useCallback(()=>{const L=e.current;if(!L)return;const M=L.scrollTop,D=Lt(M),B=performance.now()<T.current;if(M<0||x.current||y.current)return;C.current&&j();const V=L.scrollHeight-D-L.clientHeight<60;if(g.current=V,V||$(),p(!V),Lx({rawScrollTop:M,hasMore:o,canLoadMore:!!u,isLoadingMore:b.current,isSuppressed:B})&&u){$(),j(),b.current=!0;const z=r.current,X=Vx(L);S.current=X,A.current=z[0]?it(z[0]):void 0,u()}},[e,r,o,u,j,$]),U=f.useCallback(()=>{e.current&&(j(),E(()=>{e.current.scrollTop=e.current.scrollHeight}),g.current=!0,p(!1))},[e,E,j]);return{handleScroll:F,scrollToBottom:U,showScrollBtn:m,startBottomFollow:R,prepareForContentResize:_}}function zx(e){const t=le(p=>p.send),n=le(p=>p.subscribe),[s,r]=f.useState([]),[i,o]=f.useState(!1),[a,c]=f.useState(!1),[u,d]=f.useState(0),h=f.useRef(0),g=f.useCallback(()=>{r([]),o(!1),c(!1),d(0)},[]);f.useEffect(()=>n(p=>{if(p.type!=="session_list"||p.payload.instanceId!==e)return;const{sessions:x,hasMore:y,total:v}=p.payload;r(k=>h.current>0?[...k,...x]:x),c(y??!1),d(v??x.length),o(!1)}),[e,n]);const m=f.useCallback(p=>{const x=(p==null?void 0:p.offset)??0;h.current=x,x===0&&r([]),o(!0),t({type:"list_sessions",payload:{instanceId:e,offset:x,limit:p==null?void 0:p.limit,filter:p==null?void 0:p.filter}})},[e,t]);return{sessionList:s,sessionListLoading:i,sessionHasMore:a,sessionTotal:u,requestSessionList:m,resetSessionList:g}}function Hx(){const{t:e}=q(),{id:t=""}=_u(),n=le(Z=>Z.send),s=Tt(f1(t)),r=Wn(Z=>Z.drafts.get(t)??ci),i=Wn(Z=>Z.setDraft),{sessionList:o,sessionListLoading:a,sessionHasMore:c,sessionTotal:u,requestSessionList:d,resetSessionList:h}=zx(t),{entries:g,displayItems:m,isStreaming:p,loadState:x,errorMessage:y,hasMore:v,loadMore:k}=Ex(t,s,h),b=f.useCallback(Z=>{i(t,Z)},[t,i]),S=f.useCallback((Z,$e)=>{n({type:"prompt",payload:{instanceId:t,message:Z,images:$e!=null&&$e.length?$e:void 0}}),i(t,{text:"",images:[]})},[t,n,i]),w=f.useCallback(()=>{n({type:"abort",payload:{instanceId:t}})},[t,n]),A=f.useCallback((Z,$e)=>{n({type:"set_model",payload:{instanceId:t,provider:Z,id:$e}})},[t,n]),T=f.useCallback(Z=>{n({type:"set_thinking_level",payload:{instanceId:t,level:Z}})},[t,n]),C=f.useCallback(()=>{d({offset:0})},[d]),E=f.useCallback((Z,$e)=>{d({offset:Z,filter:$e})},[d]),j=f.useCallback(Z=>{d({offset:0,filter:Z||void 0})},[d]),O=f.useCallback(()=>{n({type:"new_session",payload:{instanceId:t}})},[t,n]),$=f.useCallback(Z=>{n({type:"switch_session",payload:{instanceId:t,path:Z}})},[t,n]),R=f.useCallback(Z=>{n({type:"compact",payload:{instanceId:t,customInstructions:Z}})},[t,n]),N=f.useRef(null),P=Px(t,g,s==null?void 0:s.status,()=>{var Z;(Z=N.current)==null||Z.focus()}),I=f.useRef(null),_=f.useRef(null),[F,U]=f.useState(null),L=f.useRef(g);L.current=g;const M=x==="refreshing",D=Mx(s==null?void 0:s.status),B=g.length>0&&g[g.length-1].type==="compaction",V=dt(s==null?void 0:s.status),[K,z]=f.useState(!1),X=f.useCallback(()=>{z(!1)},[]),oe=f.useRef(x);f.useLayoutEffect(()=>{oe.current==="refreshing"&&x==="idle"&&z(!0),oe.current=x},[x]);const{topChromeRef:J,bottomChromeRef:de,bottomSafeGapRef:te,topChromeHeight:os,bottomChromeHeight:pi,bottomSafeGap:mi,scrollSpacing:as}=Ix(t),{handleScroll:Oc,scrollToBottom:_c,showScrollBtn:Fc,startBottomFollow:Dc,prepareForContentResize:Vc}=Bx({scrollRef:I,contentRef:_,bottomChromeRef:de,entries:g,entriesRef:L,instanceId:t,hasMore:v,shouldScrollToBottom:K,onScrollToBottomHandled:X,onLoadMore:k,bottomChromeHeight:pi,bottomSafeGap:mi}),Bc={overflowAnchor:"none","--conversation-top-edge":`${os}px`,"--conversation-bottom-edge":`${Math.max(0,pi-mi)}px`},gi={title:(s==null?void 0:s.cwd.split("/").pop())||(s==null?void 0:s.cwd)||"",cwd:s==null?void 0:s.cwd,homedir:s==null?void 0:s.homedir,gitBranch:s==null?void 0:s.gitBranch,actions:l.jsx(yx,{sessions:o,loading:a,hasMore:c,total:u,disabled:dt(s==null?void 0:s.status),onOpen:C,onNewSession:O,onSwitchSession:$,onLoadMore:E,onFilterChange:j})};return l.jsxs("div",{className:"relative flex-1 min-w-0 overflow-hidden",children:[l.jsxs("main",{className:"absolute inset-0 flex min-h-0 flex-col overflow-hidden",children:[l.jsx("div",{ref:J,className:"pointer-events-none absolute left-0 right-0 top-0 z-20 px-3 pt-3 md:px-4 md:pt-0",children:l.jsxs("div",{className:"conversation-topbar header-material pointer-events-auto w-full px-3 py-2 md:px-4",role:"region","aria-label":e("conversation.instanceInfo"),children:[l.jsx("div",{className:"hidden md:flex",children:l.jsx(Jo,{...gi})}),l.jsx(kc,{children:l.jsx(Jo,{...gi})})]})}),l.jsx("div",{ref:I,onScroll:Oc,style:Bc,"aria-busy":M,className:"conversation-scroll absolute bottom-[var(--bottom-safe-gap)] left-0 right-0 top-0 overflow-y-auto scrollbar-auto px-3 md:bottom-0 md:px-4",children:l.jsxs("div",{ref:_,style:{paddingTop:as.paddingTop,paddingBottom:as.paddingBottom},className:"mx-auto max-w-[920px] space-y-2",children:[x==="loadingMore"&&l.jsx(we,{compact:!0,tone:"loading",className:"justify-center",children:e("conversation.loadingEarlier")}),M?l.jsx(Ux,{}):x==="error"?l.jsx(we,{tone:"error",detail:y,className:"mx-auto mt-8 max-w-[520px] border border-[var(--separator)] bg-[var(--fill-card)]",children:e("conversation.loadFailed")}):m.length===0&&!v&&!dt(s==null?void 0:s.status)&&!p?l.jsx(we,{className:"pt-8",children:e("conversation.noMessages")}):l.jsx(ix,{items:m,conversationKey:`${t}:${(s==null?void 0:s.sessionId)??""}`,status:s==null?void 0:s.status,isStreaming:p,onReEdit:P,onBeforeToggle:Vc})]})}),Fc&&l.jsx("div",{style:{bottom:as.scrollButtonBottom},className:"absolute left-1/2 z-30 -translate-x-1/2",children:l.jsx(Y,{size:"icon",onClick:_c,"aria-label":e("eventStream.scrollToBottom"),className:"conversation-scroll-bottom",title:e("eventStream.scrollToBottom"),children:l.jsx(Jd,{size:16,"aria-hidden":"true"})})}),l.jsx("div",{ref:de,className:"pointer-events-none absolute bottom-0 left-0 right-0 z-20 px-3 pb-0 md:px-4",children:l.jsxs("div",{className:"pointer-events-auto mx-auto w-full max-w-[920px]",children:[l.jsx(My,{ref:N,instance:s,draft:r,onDraftChange:b,onSendMessage:S,onAbort:w,onSetModel:A,onSetThinkingLevel:T,onCompact:R,buttonMode:D,showCompactButton:!B,compactDisabled:V,onImageLightbox:U,startBottomFollow:Dc},`${t}:${(s==null?void 0:s.sessionId)??""}`),l.jsx("div",{ref:te,className:"h-[var(--bottom-safe-gap)] md:h-0","aria-hidden":"true"})]})})]}),l.jsx(Ee,{children:F&&l.jsx(li,{src:F,onClose:()=>U(null)},"image")})]})}function Ux(){const{t:e}=q();return l.jsx("div",{className:"space-y-3 pt-3 select-none","aria-label":e("conversation.loadingConversation"),children:[0,1,2,3].map(t=>l.jsxs("div",{className:"space-y-4 rounded-surface border border-[var(--separator)] bg-[var(--fill-quaternary)] px-4 py-4 animate-pulse",children:[l.jsx("div",{className:"h-4 w-28 rounded-inline bg-[var(--fill-tertiary)]"}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsx("div",{className:"h-3 w-[82%] rounded-inline bg-[var(--fill-secondary)]"}),l.jsx("div",{className:"h-3 w-[64%] rounded-inline bg-[var(--fill-tertiary)]"})]})]},t))})}function Nn({options:e,value:t,onChange:n,label:s}){return l.jsx("div",{className:"ui-segmented select-none",role:"group","aria-label":s,children:e.map(r=>l.jsx(Y,{size:"compact","aria-pressed":t===r.value,className:"ui-segment",onClick:()=>n(r.value),children:r.label},r.value))})}const Kx={common:{cancel:"取消",close:"关闭",confirm:"确认",loading:"加载中…"},modal:{content:"详情内容"},imagePreview:{title:"图片预览",close:"关闭预览",actualSize:"原始尺寸",fitWindow:"适应窗口"},login:{subtitle:"输入 Access Token 以连接",placeholder:"Access Token",invalidToken:"Token 无效,请检查后重试。",connect:"连接",verifying:"验证中…",tokenHint:"Token 可在 <1>~/.paimon/hub.json</1> 中找到"},sidebar:{newInstance:"新建实例",hubConnected:"Hub 已连接",hubConnecting:"Hub 正在连接",hubDisconnected:"Hub 连接中断",toggleMachine:"展开或折叠机器 {{edgeId}}",machineActions:"{{edgeId}} 的机器操作",copyMachineId:"复制名称",noInstances:"暂无 pi 实例连接",settings:"设置",shutdown:"退出实例",shutdownBusy:"实例正在执行中,请等待完成后再退出",statusStreaming:"执行中",statusCompacting:"压缩中",statusIdle:"空闲",statusPending:"状态等待更新"},navigation:{brand:"Paimon",main:"主导航",home:"首页",instances:"实例",backToInstances:"返回实例列表",instanceActions:"{{name}} 的实例操作"},composer:{options:"输入选项",more:"更多输入选项",backToOptions:"返回输入选项",images:"图片",modelWaiting:"模型等待更新",thinkingLabel:"思考",pendingThinking:"等待更新",unsupportedThinking:"不支持",compact:"压缩",compactBusy:"任务运行期间暂不可压缩",compactUnavailable:"上下文用量更新后可压缩",resizeHeight:"调整输入区高度",resizeHeightHelp:"拖动调整高度;双击或 Home 恢复自动高度;上下方向键调整,End 展开到最大高度",heightPixels:"{{height}} 像素",model:"选择模型",thinkingLevel:"思考等级",contextUsage:"上下文用量",usedTokens:"已用 tokens",contextWindow:"上下文窗口",pendingUsage:"等待更新",pendingUsageDescription:"上下文用量将在下一次响应后更新",previewImage:"预览附加图片 {{count}}",removeImage:"移除附加图片 {{count}}"},eventStream:{tagline:"守望 · 交互 · 掌控",sendPlaceholder:"发送消息…",scrollToBottom:"滚到底部",stop:"停止",send:"发送",attachImage:"添加图片",imageProcessFailed:"图片处理失败,请检查图片格式",compactContext:"压缩上下文",instanceNotFound:"实例不存在"},conversation:{agentName:"Pi",you:"你发送的消息",approximateDuration:"约耗时 {{duration}}",durationMilliseconds:"{{value}} 毫秒",durationSeconds:"{{value}} 秒",durationMinutes:"{{value}} 分",durationHours:"{{value}} 小时",durationDays:"{{value}} 天",compactingContext:"正在整理上下文",attachedImage:"附加图片 {{count}}",expandExecution:"展开工具与思考过程",collapseExecution:"收起工具与思考过程",toolDetails:"查看 {{name}} 工具详情",moreToolTypes_one:"另外 {{count}} 种工具",moreToolTypes_other:"另外 {{count}} 种工具",thinkingCount_one:"{{count}} 段思考过程",thinkingCount_other:"{{count}} 段思考过程",thinkingStreamingCount_one:"{{count}} 段思考过程,思考中",thinkingStreamingCount_other:"{{count}} 段思考过程,思考中",toolsPending_one:"{{count}} 个工具准备中",toolsPending_other:"{{count}} 个工具准备中",toolsRunning_one:"{{count}} 个工具执行中",toolsRunning_other:"{{count}} 个工具执行中",toolsCompleted_one:"{{count}} 个工具执行完成",toolsCompleted_other:"{{count}} 个工具执行完成",toolsFailed_one:"{{count}} 个工具执行失败",toolsFailed_other:"{{count}} 个工具执行失败",toolsAborted_one:"{{count}} 个工具已终止",toolsAborted_other:"{{count}} 个工具已终止",toolsUnknown_one:"{{count}} 个工具结果不可用",toolsUnknown_other:"{{count}} 个工具结果不可用",toolPending:"准备中",toolCompleted:"执行完成",toolFailed:"执行失败",toolUnknown:"结果不可用",toolUnavailableDescription:"未收到工具结果或执行记录。",replyFailed:"回复失败",replyStart:"开始",replyEnd:"最后更新",loadingEarlier:"正在加载更早的消息…",loadingConversation:"正在加载对话",loadFailed:"对话加载失败",noMessages:"暂无消息",instanceInfo:"实例信息"},compact:{title:"压缩上下文",description:"压缩将总结旧的对话内容以释放上下文空间。可选填自定义提示词来指定压缩时关注的方向。",placeholder:"例如:重点保留关于数据库设计的讨论…",start:"开始压缩"},settings:{title:"设置",appearance:"外观",theme:"主题",themeLight:"浅色",themeDark:"深色",themeSystem:"系统",background:"背景",bgMist:"雾",bgAurora:"极光",bgEmber:"余烬",language:"语言",langZhCN:"简体中文",langEn:"English"},notification:{title:"通知",label:"任务完成通知",on:"开启",off:"关闭",denied:"通知权限已被浏览器拒绝,请在浏览器设置中允许",taskComplete:"✅ {{name}} 任务完成"},newInstance:{title:"新建实例",edgeNode:"Edge 节点",noEdges:"没有可用的 Edge 节点",workingDir:"工作目录",pathPlaceholder:"/path/to/your/project",create:"创建",creating:"创建中…",truncatedHint:"输入更多字符以缩小范围…",fetchEdgeError:"获取 Edge 列表失败",noEdgeSelected:"未选择 Edge 节点",requestTimeout:"请求超时",networkError:"网络错误",requestFailed:"请求失败 (HTTP {{status}})"},session:{title:"Sessions",new:"新建",filter:"筛选…",noMatch:"无匹配的 Session",noPrevious:"暂无历史 Session",empty:"空 Session",messageCount_one:"{{count}} 条消息",messageCount_other:"{{count}} 条消息",timeJustNow:"刚刚"},entries:{code:"代码",contextCompacted:"上下文已压缩",branchSummary:"分支摘要",thinking:"思考",thinkingStreaming:"思考中...",running:"执行中...",aborted:"已终止",copied:"已复制",copy:"复制",mermaidDiagram:"Mermaid 图表",mermaidExpand:"放大查看",mermaidLoading:"图表生成中…",mermaidError:"图表渲染失败,以下为源码",result:"结果",output:"输出",executionDuration:"执行耗时",waitingDuration:"调用等待时间",timeout:"超时时间",params:"参数"},reEdit:{button:"重新编辑",draftNotEmpty:"输入框已有内容,请先清空"},error:{title:"错误详情",message:"错误信息",type:"错误类型",requestId:"请求 ID",action:{compact:"压缩失败:{{message}}"}}},Wx={common:{cancel:"Cancel",close:"Close",confirm:"Confirm",loading:"Loading…"},modal:{content:"Dialog content"},imagePreview:{title:"Image preview",close:"Close preview",actualSize:"Actual size",fitWindow:"Fit to window"},login:{subtitle:"Enter access token to connect",placeholder:"Access Token",invalidToken:"Invalid token. Please check and try again.",connect:"Connect",verifying:"Verifying…",tokenHint:"Find your token in <1>~/.paimon/hub.json</1>"},sidebar:{newInstance:"New instance",hubConnected:"Hub connected",hubConnecting:"Connecting to Hub",hubDisconnected:"Hub disconnected",toggleMachine:"Expand or collapse machine {{edgeId}}",machineActions:"Machine actions for {{edgeId}}",copyMachineId:"Copy Name",noInstances:"No pi instances connected",settings:"Settings",shutdown:"Shutdown instance",shutdownBusy:"Instance is running, please wait before shutting down",statusStreaming:"Running",statusCompacting:"Compacting",statusIdle:"Idle",statusPending:"Waiting for status"},navigation:{brand:"Paimon",main:"Main navigation",home:"Home",instances:"Instances",backToInstances:"Back to instances",instanceActions:"Actions for {{name}}"},composer:{options:"Input options",more:"More input options",backToOptions:"Back to input options",images:"Images",modelWaiting:"Awaiting model",thinkingLabel:"Thinking",pendingThinking:"Awaiting update",unsupportedThinking:"Unsupported",compact:"Compact",compactBusy:"Compaction is unavailable while a task is running",compactUnavailable:"Compaction will be available after context usage updates",resizeHeight:"Resize input area",resizeHeightHelp:"Drag to resize; double-click or press Home for automatic height; use arrow keys to resize and End for maximum height",heightPixels:"{{height}} pixels",model:"Select model",thinkingLevel:"Thinking level",contextUsage:"Context usage",usedTokens:"Used tokens",contextWindow:"Context window",pendingUsage:"Awaiting update",pendingUsageDescription:"Context usage will update after the next response",previewImage:"Preview attached image {{count}}",removeImage:"Remove attached image {{count}}"},eventStream:{tagline:"Watch · Interact · Control",sendPlaceholder:"Send a message...",scrollToBottom:"Scroll to bottom",stop:"Stop",send:"Send",attachImage:"Attach image",imageProcessFailed:"Image processing failed, please check the format",compactContext:"Compact context",instanceNotFound:"Instance not found"},conversation:{agentName:"Pi",you:"Your message",approximateDuration:"Approx. {{duration}}",durationMilliseconds:"{{value}} ms",durationSeconds:"{{value}} s",durationMinutes:"{{value}} min",durationHours:"{{value}} h",durationDays:"{{value}} d",compactingContext:"Compacting context",attachedImage:"Attached image {{count}}",expandExecution:"Expand tools and thinking",collapseExecution:"Collapse tools and thinking",toolDetails:"View {{name}} tool details",moreToolTypes_one:"{{count}} more tool type",moreToolTypes_other:"{{count}} more tool types",thinkingCount_one:"{{count}} thinking section",thinkingCount_other:"{{count}} thinking sections",thinkingStreamingCount_one:"{{count}} thinking section, thinking in progress",thinkingStreamingCount_other:"{{count}} thinking sections, thinking in progress",toolsPending_one:"{{count}} tool preparing",toolsPending_other:"{{count}} tools preparing",toolsRunning_one:"{{count}} tool running",toolsRunning_other:"{{count}} tools running",toolsCompleted_one:"{{count}} tool completed",toolsCompleted_other:"{{count}} tools completed",toolsFailed_one:"{{count}} tool failed",toolsFailed_other:"{{count}} tools failed",toolsAborted_one:"{{count}} tool aborted",toolsAborted_other:"{{count}} tools aborted",toolsUnknown_one:"{{count}} tool result unavailable",toolsUnknown_other:"{{count}} tool results unavailable",toolPending:"Preparing",toolCompleted:"Completed",toolFailed:"Failed",toolUnknown:"Result unavailable",toolUnavailableDescription:"No tool result or execution record was received.",replyFailed:"Reply failed",replyStart:"Started",replyEnd:"Last updated",loadingEarlier:"Loading earlier messages…",loadingConversation:"Loading conversation",loadFailed:"Failed to load conversation",noMessages:"No messages yet",instanceInfo:"Instance info"},compact:{title:"Compact Context",description:"Compaction summarizes older conversation to free up context space. Optionally provide custom instructions to guide what to focus on.",placeholder:"e.g. Keep the discussion about database design…",start:"Start compaction"},settings:{title:"Settings",appearance:"Appearance",theme:"Theme",themeLight:"Light",themeDark:"Dark",themeSystem:"System",background:"Background",bgMist:"Mist",bgAurora:"Aurora",bgEmber:"Ember",language:"Language",langZhCN:"简体中文",langEn:"English"},notification:{title:"Notification",label:"Task Completion Notification",on:"On",off:"Off",denied:"Notification permission denied. Please allow in browser settings",taskComplete:"✅ {{name}} task completed"},newInstance:{title:"New Instance",edgeNode:"Edge Node",noEdges:"No available Edge nodes",workingDir:"Working Directory",pathPlaceholder:"/path/to/your/project",create:"Create",creating:"Creating…",truncatedHint:"Type more to narrow results…",fetchEdgeError:"Failed to fetch edge list",noEdgeSelected:"No edge selected",requestTimeout:"Request timed out",networkError:"Network error",requestFailed:"Request failed (HTTP {{status}})"},session:{title:"Sessions",new:"New",filter:"Filter…",noMatch:"No matching sessions",noPrevious:"No previous sessions",empty:"Empty session",messageCount_one:"{{count}} message",messageCount_other:"{{count}} messages",timeJustNow:"just now"},entries:{code:"Code",contextCompacted:"Context compacted",branchSummary:"Branch summary",thinking:"Thinking",thinkingStreaming:"Thinking...",running:"Running...",aborted:"Aborted",copied:"Copied",copy:"Copy",mermaidDiagram:"Mermaid diagram",mermaidExpand:"Enlarge",mermaidLoading:"Rendering diagram…",mermaidError:"Unable to render diagram. Source shown below.",result:"Result",output:"Output",executionDuration:"Execution duration",waitingDuration:"Call elapsed time",timeout:"Timeout",params:"Parameters"},reEdit:{button:"Edit",draftNotEmpty:"Input is not empty, please clear first"},error:{title:"Error Details",message:"Error message",type:"Error type",requestId:"Request ID",action:{compact:"Compaction failed: {{message}}"}}},$c="paimon:language";function qx(){const e=localStorage.getItem($c);return e==="zh-CN"||e==="en"?e:"zh-CN"}function Gx(e){localStorage.setItem($c,e),ie.changeLanguage(e)}ie.use(V0).init({resources:{"zh-CN":{translation:Kx},en:{translation:Wx}},lng:qx(),fallbackLng:"zh-CN",interpolation:{escapeValue:!1}});function pn({label:e,children:t,showSeparator:n=!0}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"settings-row select-none",children:[l.jsx("span",{className:"text-[14px] leading-[20px] font-semibold text-[var(--label-primary)]",children:e}),t]}),n&&l.jsx("div",{className:"ml-4 border-b border-[var(--separator)]"})]})}function Yx({value:e,onChange:t,options:n}){const{t:s}=q();return l.jsx(Nn,{label:s("settings.background"),value:e,onChange:t,options:n.map(r=>({value:r.value,label:l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",className:"h-4 w-4 shrink-0 rounded-full",style:{background:`conic-gradient(${r.colors.join(", ")})`}}),l.jsx("span",{children:r.label})]})}))})}function Jx(){const{t:e,i18n:t}=q(),[n,s]=e1(),[r,i]=ac(),[o,a]=t1(),c=[{value:"light",label:e("settings.themeLight")},{value:"dark",label:e("settings.themeDark")},{value:"system",label:e("settings.themeSystem")}],u=[{value:"mist",label:e("settings.bgMist"),colors:["#e8f0fe","#f5e6f0","#e6f0f5","#f0f5e6"]},{value:"aurora",label:e("settings.bgAurora"),colors:["#a8d8ea","#aa96da","#8fd3c4","#c4a8d8"]},{value:"ember",label:e("settings.bgEmber"),colors:["#f8d4b0","#f0b0c0","#f8e0a0","#e8c0d0"]}],d=[{value:"zh-CN",label:e("settings.langZhCN")},{value:"en",label:e("settings.langEn")}],h=[{value:"on",label:e("notification.on")},{value:"off",label:e("notification.off")}];return l.jsx("div",{className:"flex-1 flex items-start justify-center p-4 md:p-6 overflow-y-auto scrollbar-auto",children:l.jsxs("div",{className:"settings-content",children:[l.jsx(kc,{title:e("settings.title")}),l.jsx("h1",{className:"hidden md:block text-[22px] font-semibold text-[var(--label-primary)] mb-6 px-4 select-none",children:e("settings.title")}),l.jsx("div",{className:"text-[14px] leading-[20px] font-semibold text-[var(--label-primary)] mb-2 px-4 select-none",children:e("settings.appearance")}),l.jsxs("section",{className:"glass-panel overflow-hidden",children:[l.jsx(pn,{label:e("settings.theme"),children:l.jsx(Nn,{label:e("settings.theme"),options:c,value:n,onChange:s})}),l.jsx(pn,{label:e("settings.background"),showSeparator:!1,children:l.jsx(Yx,{value:r,onChange:i,options:u})})]}),l.jsx("div",{className:"text-[14px] leading-[20px] font-semibold text-[var(--label-primary)] mb-2 mt-6 px-4 select-none",children:e("settings.language")}),l.jsx("section",{className:"glass-panel overflow-hidden",children:l.jsx(pn,{label:e("settings.language"),showSeparator:!1,children:l.jsx(Nn,{label:e("settings.language"),options:d,value:t.language==="en"?"en":"zh-CN",onChange:Gx})})}),gc&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"text-[14px] leading-[20px] font-semibold text-[var(--label-primary)] mb-2 mt-6 px-4 select-none",children:e("notification.title")}),l.jsx("section",{className:"glass-panel overflow-hidden",children:l.jsx(pn,{label:e("notification.label"),showSeparator:!1,children:l.jsx(Nn,{label:e("notification.label"),options:h,value:o?"on":"off",onChange:async g=>{g==="on"?await Notification.requestPermission()==="granted"?a(!0):ht(e("notification.denied"),"warning"):a(!1)}})})})]})]})})}async function vr(e,t){typeof e=="string"&&e.startsWith("/")&&(e=Ze(e));const n=hr(),s=new Headers(t==null?void 0:t.headers);n&&s.set("Authorization",`Bearer ${n}`);const r=await fetch(e,{...t,headers:s});return r.status===401&&(fc(),window.location.reload()),r}function Xx(e){return se(e)&&typeof e.edgeId=="string"&&typeof e.hostname=="string"&&typeof e.homedir=="string"}function Zx(e){return se(e)&&Array.isArray(e.edges)&&e.edges.every(Xx)}function Qx(e){return se(e)&&typeof e.name=="string"}function ev({id:e,value:t,onChange:n,edgeId:s,disabled:r=!1,autoFocus:i=!1,onSubmit:o}){const{t:a}=q(),[c,u]=f.useState([]),[d,h]=f.useState(!1),[g,m]=f.useState(!1),[p,x]=f.useState(-1),[y,v]=f.useState(!1),k=f.useRef(null),b=f.useRef(null),S=f.useRef(null),w=f.useRef(null);f.useEffect(()=>()=>{var E;(E=S.current)==null||E.abort(),w.current&&clearTimeout(w.current)},[]),f.useEffect(()=>{var E;i&&!window.matchMedia("(pointer: coarse)").matches&&((E=k.current)==null||E.focus())},[i]);const A=f.useCallback(async(E,j)=>{S.current&&S.current.abort();const O=new AbortController;S.current=O,m(!0);try{const R=await(await vr(`/api/edges/${encodeURIComponent(E)}/browse?path=${encodeURIComponent(j)}`,{signal:O.signal})).json();if(O.signal.aborted)return;if(!se(R))throw new Error("Invalid directory browse response");if(R.error)u([]),h(!1),v(!1);else{const N=R.entries??[];if(!Array.isArray(N)||!N.every(Qx))throw new Error("Invalid directory browse entries");const P=typeof R.truncated=="boolean"?R.truncated:!1;u(N),h(P),v(N.length>0||P)}x(-1)}catch{O.signal.aborted||(u([]),v(!1))}finally{O.signal.aborted||m(!1)}},[]);f.useEffect(()=>{if(!s||!t||!t.startsWith("/")){u([]),v(!1);return}return w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{A(s,t)},250),()=>{w.current&&clearTimeout(w.current)}},[t,s,A]);const T=f.useCallback(E=>{var R;const $=(t.endsWith("/")?t:t.substring(0,t.lastIndexOf("/")+1))+E.name+"/";n($),x(-1),(R=k.current)==null||R.focus()},[t,n]),C=f.useCallback(E=>{if(y&&c.length>0){if(E.key==="ArrowDown"){E.preventDefault(),x(j=>j<c.length-1?j+1:0);return}if(E.key==="ArrowUp"){E.preventDefault(),x(j=>j>0?j-1:c.length-1);return}if(E.key==="Tab"){E.preventDefault(),p>=0&&p<c.length?T(c[p]):c.length===1&&T(c[0]);return}if(E.key==="Enter"&&p>=0&&p<c.length){E.preventDefault(),T(c[p]);return}if(E.key==="Escape"){E.preventDefault(),v(!1),x(-1);return}}E.key==="Enter"&&(E.preventDefault(),o==null||o())},[y,c,p,T,o]);return f.useEffect(()=>{if(p<0||!b.current)return;const j=b.current.children[p];j instanceof HTMLElement&&j.scrollIntoView({block:"nearest"})},[p]),f.useEffect(()=>{u([]),v(!1),x(-1)},[s]),l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsxs("div",{className:"relative",children:[l.jsx(si,{id:e,ref:k,type:"text",value:t,onChange:E=>n(E.target.value),onKeyDown:C,onFocus:()=>{c.length>0&&v(!0)},onBlur:()=>{setTimeout(()=>v(!1),150)},placeholder:a("newInstance.pathPlaceholder"),disabled:r,spellCheck:!1,autoComplete:"off",className:"pr-10"}),g&&l.jsx("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2",children:l.jsx(Le,{size:14,className:"animate-spin text-[var(--label-tertiary)]"})})]}),y&&l.jsxs("div",{ref:b,className:"max-h-[200px] overflow-y-auto rounded-surface border border-[var(--separator)] bg-[var(--fill-quaternary)] p-1.5 scrollbar-auto",children:[c.map((E,j)=>l.jsxs(be,{selected:j===p,type:"button",onMouseDown:O=>O.preventDefault(),onClick:()=>T(E),onMouseEnter:()=>x(j),children:[l.jsx(Ta,{size:14,className:"shrink-0 text-[var(--label-tertiary)]"}),l.jsx("span",{className:"text-[var(--label-primary)] truncate",children:E.name})]},E.name)),d&&l.jsx("div",{className:"px-3 py-1.5 text-[12px] text-[var(--label-tertiary)] border-t border-[var(--separator)]",children:a("newInstance.truncatedHint")})]})]})}function tv({onClose:e,onCreated:t}){const{t:n}=q(),s=f.useId(),r=f.useId(),[i,o]=f.useState(""),[a,c]=f.useState([]),[u,d]=f.useState(""),[h,g]=f.useState(!0),[m,p]=f.useState(!1),[x,y]=f.useState(null);f.useEffect(()=>{vr("/api/edges").then(b=>b.json()).then(b=>{if(!Zx(b))throw new Error("Invalid Edge list response");const S=b.edges;if(c(S),S.length>0){d(S[0].edgeId);const w=S[0].homedir;if(w){const A=w.endsWith("/")?w:w+"/";o(A)}}g(!1)}).catch(()=>{g(!1),y(n("newInstance.fetchEdgeError"))})},[]);const v=f.useCallback(b=>{d(b);const S=a.find(w=>w.edgeId===b);if(S!=null&&S.homedir){const w=S.homedir.endsWith("/")?S.homedir:S.homedir+"/";o(w)}},[a]),k=f.useCallback(async()=>{const b=i.trim();if(!(!b||m)){if(!u){y(n("newInstance.noEdgeSelected"));return}p(!0),y(null);try{const S=await vr("/api/instances",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:b,edgeId:u}),signal:AbortSignal.timeout(2e4)}),w=await S.json(),A=se(w)&&typeof w.instanceId=="string"?w.instanceId:null;if(!S.ok||!A){y((se(w)&&typeof w.error=="string"?w.error:"")||n("newInstance.requestFailed",{status:S.status})),p(!1);return}t(A)}catch(S){const w=S instanceof Error&&S.name==="TimeoutError"?n("newInstance.requestTimeout"):(S instanceof Error?S.message:"")||n("newInstance.networkError");y(w),p(!1)}}},[i,m,u,t]);return l.jsx(Pe,{mobileSheet:!1,size:"form",footer:l.jsxs(l.Fragment,{children:[l.jsx(Y,{onClick:e,disabled:m,className:"active:bg-[var(--fill-tertiary)]",children:n("common.cancel")}),l.jsx(Y,{variant:"primary",onClick:k,loading:m,disabled:!i.trim()||!u,children:n(m?"newInstance.creating":"newInstance.create")})]}),title:l.jsxs(l.Fragment,{children:[l.jsx(mf,{size:16}),l.jsx("span",{children:n("newInstance.title")})]}),onClose:e,children:l.jsxs("div",{className:"ui-form-content",children:[l.jsx(ar,{label:n("newInstance.edgeNode"),htmlFor:s,children:h?l.jsx(we,{compact:!0,tone:"loading",children:n("common.loading")}):a.length===0?l.jsx(we,{compact:!0,tone:"error",children:n("newInstance.noEdges")}):a.length===1?l.jsxs("div",{id:s,className:"ui-form-note",children:[a[0].hostname,l.jsxs("span",{className:"text-[var(--label-tertiary)] ml-1.5",children:["(",a[0].edgeId,")"]})]}):l.jsx(Jg,{id:s,value:u,onChange:b=>v(b.target.value),disabled:m,children:a.map(b=>l.jsxs("option",{value:b.edgeId,children:[b.hostname," (",b.edgeId,")"]},b.edgeId))})}),l.jsx(ar,{label:n("newInstance.workingDir"),htmlFor:r,children:l.jsx(ev,{id:r,value:i,onChange:o,edgeId:u,disabled:m||h,autoFocus:!h,onSubmit:k})}),x&&l.jsx(we,{compact:!0,tone:"error",children:x})]})})}function nv(){const{pathname:e}=xe(),t=e.match(/^\/instance\/(.+)$/);return(t==null?void 0:t[1])??null}function sv(){const{t:e}=q(),{authToken:t,authError:n,probing:s,handleLogin:r,handleAuthError:i}=i1(),o=le(w=>w.connect),a=le(w=>w.disconnect),c=le(w=>w.subscribe),u=le(w=>w.send),d=Tt(w=>w.instances),h=Tt(w=>w.instanceListReady),g=Tt(w=>w.handleMessage),m=Yt();Gg();const p=nv();f.useEffect(()=>(t?o(t,i):a(),()=>a()),[t,o,a,i]),p1(),f.useEffect(()=>c(w=>{(w.type==="instance_list"||w.type==="instance_update")&&g(w)}),[c,g]);const x=f.useCallback(w=>{m(`/instance/${w}`)},[m]),y=f.useRef(new Set),v=f.useCallback(w=>{const A=Tt.getState().instances.find(T=>T.id===w);if(A&&dt(A.status)){ht(e("sidebar.shutdownBusy"),"warning");return}y.current.add(w),u({type:"shutdown",payload:{instanceId:w}})},[u,e]),[k,b]=f.useState(!1),S=f.useCallback(w=>{b(!1),m(`/instance/${w}`)},[m]);return f.useEffect(()=>{if(!h||!p)return;d.some(A=>A.id===p)||(y.current.has(p)?y.current.delete(p):ht(e("eventStream.instanceNotFound"),"error"),m("/"))},[h,p,d,m,e]),s?l.jsx("div",{className:"h-[var(--app-viewport-height,100dvh)] w-screen animated-bg flex items-center justify-center",children:l.jsx("div",{className:"glass-panel p-8 flex flex-col items-center gap-4",children:l.jsx(we,{tone:"loading",children:e("common.loading")})})}):t?l.jsxs("div",{className:"h-[var(--app-viewport-height,100dvh)] w-screen animated-bg flex items-stretch p-2 gap-2 md:p-3 md:gap-3 overflow-hidden pb-[max(0.5rem,env(safe-area-inset-bottom))]",children:[l.jsx("div",{className:"hidden md:flex self-stretch",children:l.jsx(Do,{instances:d,selectedId:p,onSelect:x,onShutdown:v,onNewInstance:()=>b(!0)})}),l.jsx(Qu,{children:l.jsxs(jt,{element:l.jsx(y1,{}),children:[l.jsx(jt,{path:"/settings",element:l.jsx(Jx,{})}),l.jsx(jt,{path:"/instance/:id",element:l.jsx(Hx,{})}),l.jsx(jt,{path:"*",element:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-1 md:hidden min-w-0 flex flex-col",children:l.jsx(Do,{instances:d,selectedId:p,onSelect:x,onShutdown:v,onNewInstance:()=>b(!0)})}),l.jsx("div",{className:"hidden md:flex flex-1 min-w-0",children:l.jsx(g1,{})})]})})]})}),l.jsx(Ee,{children:k&&l.jsx(tv,{onClose:()=>b(!1),onCreated:S},"new-instance")}),l.jsx(Sy,{})]}):l.jsx("div",{className:"h-[var(--app-viewport-height,100dvh)] w-screen animated-bg flex items-stretch overflow-hidden",children:l.jsx(r1,{onLogin:r,error:n})})}Uc.createRoot(document.getElementById("root")).render(l.jsx(Cd,{basename:cc||"/",children:l.jsx(sv,{})}));export{qv as $,yv as A,ab as B,fb as C,yb as D,Qv as E,eb as F,tb as G,q1 as H,sb as I,nb as J,rb as K,M1 as L,I1 as M,D1 as N,z1 as O,K1 as P,zv as Q,J1 as R,Q1 as S,ty as T,ry as U,gv as V,wv as W,Ev as X,Av as Y,Ov as Z,Bv as _,Sv as a,Or as a$,Zv as a0,cb as a1,pb as a2,mv as a3,bv as a4,jv as a5,Mv as a6,$v as a7,Vv as a8,Wv as a9,sy as aA,Qi as aB,hv as aC,Gf as aD,tm as aE,Wp as aF,Cm as aG,uv as aH,Hs as aI,Xf as aJ,ze as aK,ge as aL,xm as aM,cv as aN,Ml as aO,fv as aP,ss as aQ,Qr as aR,fe as aS,Ve as aT,av as aU,sm as aV,bl as aW,wl as aX,Sm as aY,bm as aZ,wm as a_,Xv as aa,lb as ab,hb as ac,bt as ad,A1 as ae,He as af,P1 as ag,V1 as ah,H1 as ai,W1 as aj,G1 as ak,X1 as al,ny as am,iy as an,La as ao,Vs as ap,bg as aq,R1 as ar,L1 as as,Ho as at,B1 as au,U1 as av,Uo as aw,Y1 as ax,Z1 as ay,ey as az,Tv as b,no as b0,pv as b1,ae as b2,Jf as b3,_l as b4,dv as b5,jm as b6,he as b7,et as b8,zt as b9,Zt as ba,lv as bb,lt as bc,Zn as bd,Ln as be,H as bf,Yf as bg,pm as bh,Tm as bi,Em as bj,Ki as bk,Se as bl,ee as bm,km as bn,Bt as bo,Fn as bp,_1 as bq,F1 as br,Qm as bs,Lv as c,_v as d,Hv as e,Gv as f,ib as g,ub as h,mb as i,xv as j,Cv as k,Nv as l,Iv as m,Fv as n,Uv as o,Yv as p,ob as q,db as r,gb as s,vv as t,kv as u,Rv as v,Pv as w,Dv as x,Kv as y,Jv as z};